Created
February 23, 2018 13:01
-
-
Save KonstantinBerkow/e6d015533945448aaa44081abcf529e2 to your computer and use it in GitHub Desktop.
Main anchors template
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
let leadingAnchor: NSLayoutXAxisAnchor | |
let topAnchor: NSLayoutYAxisAnchor | |
let trailingAnchor: NSLayoutXAxisAnchor | |
let bottomAnchor: NSLayoutYAxisAnchor | |
let centerXAnchor: NSLayoutXAxisAnchor | |
let centerYAnchor: NSLayoutYAxisAnchor | |
if #available(iOS 11, *) { | |
let guide = rootView.safeAreaLayoutGuide | |
leadingAnchor = guide.leadingAnchor | |
topAnchor = guide.topAnchor | |
trailingAnchor = guide.trailingAnchor | |
bottomAnchor = guide.bottomAnchor | |
centerXAnchor = guide.centerXAnchor | |
centerYAnchor = guide.centerYAnchor | |
} else { | |
leadingAnchor = rootView.leadingAnchor | |
topAnchor = rootView.topAnchor | |
trailingAnchor = rootView.trailingAnchor | |
bottomAnchor = rootView.bottomAnchor | |
centerXAnchor = rootView.centerXAnchor | |
centerYAnchor = rootView.centerYAnchor | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment