Skip to content

Instantly share code, notes, and snippets.

@cafielo
Created October 18, 2018 16:36
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cafielo/682f76ed9b526ed253b38df6f2ac0f2e to your computer and use it in GitHub Desktop.
Save cafielo/682f76ed9b526ed253b38df6f2ac0f2e to your computer and use it in GitHub Desktop.
how to detect notch device in swift
extension UIDevice {
var hasNotch: Bool {
let bottom = UIApplication.shared.keyWindow?.safeAreaInsets.bottom ?? 0
return bottom > 0
}
}
if UIDevice.current.hasNotch {
//... consider notch
} else {
//... don't have to consider notch
}
@grapegirl
Copy link

이게 safeArea 가이드가 적용된 스토리보드에 처리되어있어야 하는건가요?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment