Skip to content

Instantly share code, notes, and snippets.

@PtitChevreuil
Last active December 21, 2017 12:08
Show Gist options
  • Save PtitChevreuil/0d9a9a7cd9d4cb0b654520e11345d206 to your computer and use it in GitHub Desktop.
Save PtitChevreuil/0d9a9a7cd9d4cb0b654520e11345d206 to your computer and use it in GitHub Desktop.
extension UIView {
var safeTopAnchor: NSLayoutYAxisAnchor {
if #available(iOS 11.0, *) {
return safeAreaLayoutGuide.topAnchor
} else {
return 0
}
}
var safeBottomAnchor: NSLayoutYAxisAnchor {
if #available(iOS 11.0, *) {
return safeAreaLayoutGuide.bottomAnchor
} else {
return 0
}
}
}
@hfossli
Copy link

hfossli commented Dec 21, 2017

👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment