Skip to content

Instantly share code, notes, and snippets.

@AttiaMo
Created October 8, 2018 07:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save AttiaMo/9ec7d88c0cf7841dcf096924bff33f38 to your computer and use it in GitHub Desktop.
Save AttiaMo/9ec7d88c0cf7841dcf096924bff33f38 to your computer and use it in GitHub Desktop.
class var hasTopNotch: Bool {
if #available(iOS 11.0, tvOS 11.0, *) {
// with notch: 44.0 on iPhone X, XS, XS Max, XR.
// without notch: 20.0 on iPhone 8 on iOS 12+.
return UIApplication.shared.delegate?.window??.safeAreaInsets.top ?? 0 > 20
}
return false
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment