Created
October 18, 2018 16:36
-
-
Save cafielo/682f76ed9b526ed253b38df6f2ac0f2e to your computer and use it in GitHub Desktop.
how to detect notch device in swift
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
이게 safeArea 가이드가 적용된 스토리보드에 처리되어있어야 하는건가요?