Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deal with deprecation of UIViewController top/bottom layout guide in iOS 11 #45

Open
ZevEisenberg opened this issue Jun 5, 2017 · 3 comments

Comments

@ZevEisenberg
Copy link
Collaborator

Not sure what the right approach is. Do we have to use the new edge inset guide on the view?

@ZevEisenberg
Copy link
Collaborator Author

@ZevEisenberg
Copy link
Collaborator Author

Clearly, the new approach is to use the safeAreaLayoutGuide on iOS 11+. We should also have something along these lines for all the hybrid anchors:

var safeCenterAnchors: AnchorPair<NSLayoutXAxisAnchor, NSLayoutYAxisAnchor> {
    if #available(iOS 11.0, *) {
        return AnchorPair(first: safeAreaLayoutGuide.centerXAnchor, second: safeAreaLayoutGuide.centerYAnchor)
    }
    else {
        return centerAnchors
    }
}

In order to do this in my app, I also had to add this to expose the internal initializer:

extension AnchorPair {
    init(first: T, second: U) {
        self.first = first
        self.second = second
    }
}

@ZevEisenberg
Copy link
Collaborator Author

Semi-duplicated by #59

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant