Skip to content

Instantly share code, notes, and snippets.

@PtitChevreuil
Last active November 2, 2017 10:12
Show Gist options
  • Save PtitChevreuil/fcf4ee9bb0f11e6be9fa981a7b634877 to your computer and use it in GitHub Desktop.
Save PtitChevreuil/fcf4ee9bb0f11e6be9fa981a7b634877 to your computer and use it in GitHub Desktop.
extension UIViewController {
var safeTopAnchor: NSLayoutYAxisAnchor {
if #available(iOS 11.0, *) {
return view.safeAreaLayoutGuide.topAnchor
} else {
return topLayoutGuide.bottomAnchor
}
}
var safeBottomAnchor: NSLayoutYAxisAnchor {
if #available(iOS 11.0, *) {
return view.safeAreaLayoutGuide.bottomAnchor
} else {
return bottomLayoutGuide.topAnchor
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment