Swift Has Top Notch

[Solved] Swift Has Top Notch | Swift - Code Explorer | yomemimo.com
Question : swift has Top Notch

Answered by : clumsy-cod-grl1ycp3etqn

extension UIDevice { /// Returns `true` if the device has a notch var hasNotch: Bool { guard #available(iOS 11.0, *), let window = UIApplication.shared.windows.filter({$0.isKeyWindow}).first else { return false } if UIDevice.current.orientation.isPortrait { return window.safeAreaInsets.top >= 44 } else { return window.safeAreaInsets.left > 0 || window.safeAreaInsets.right > 0 } }
}

Source : https://stackoverflow.com/questions/52402477/ios-detect-if-the-device-is-iphone-x-family-frameless | Last Update : Tue, 29 Sep 20

Answers related to swift has Top Notch

Code Explorer Popular Question For Swift