Last active
November 2, 2017 10:12
-
-
Save PtitChevreuil/fcf4ee9bb0f11e6be9fa981a7b634877 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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