-
Notifications
You must be signed in to change notification settings - Fork 528
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
Universal way of defining SafeArea constraints #300
Comments
Precisely !? |
iPhone X in landscape mode has different guides for left, right, leading and trailing. Do you mean as making the old API available again and using it as a proxy to safe area's top and bottom automatically? I mean, I think it's good but it'd need quite a bit of refactoring as the logic is different. |
Yes, that's exactly what I meant. It would save us a lot of boilerplate code when defining |
I did something like this: extension ViewProxy {
var safeArea: SupportsPositioningLayoutProxy {
if #available(iOS 11.0, *) {
return safeAreaLayoutGuide
} else {
return self
}
}
} It's not the best solution or the most elegant one, but it's better than spreading Just an idea 😅 😇 |
just opened a PR 👉 #301 |
Right now we must use the
#available(iOS x, *)
preprocessor to switch between pre-iOS 11.0car_topLayoutGuide
/car_bottomLayoutGuide
and post-iOS 11.0safeAreaLayoutGuide
.Isn't there any cleaner way of defining those types of constraints?
The text was updated successfully, but these errors were encountered: