mamaral / Neon

A powerful Swift programmatic UI layout framework.
MIT License
4.58k stars 389 forks source link

Support for safeArea Layout with iOS 11/iPhone X ? #64

Open yodasl opened 6 years ago

yodasl commented 6 years ago

With the release of iPhone X, apps that use Neon are working without runtime issues, but since the iPhone X has some interesting physical attribute it will be great if Neon could add support for the safeArea layout that is now available. Neon should support the safe area at the top for avoiding any issue with the "notch" of the iPhone X, and since the bottom area with the iPhone X has the visible UI element for dragging up it will be good to have some updated API that could account for it.

wdcurry commented 5 years ago

gentle nudge..

kuwaitbinary commented 4 years ago

This code helped me with the issue

if #available(iOS 11.0, *) {
    let window = UIApplication.shared.keyWindow
    let topPadding = window?.safeAreaInsets.top
    let bottomPadding = window?.safeAreaInsets.bottom
}