Created
August 27, 2018 09:41
-
-
Save iamchiwon/efcce3ff6ff37d36296e10d89721d97e to your computer and use it in GitHub Desktop.
iPhoneX margins
This file contains 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
let screenSize = UIScreen.main.bounds.size | |
let screenWidth = screenSize.width | |
let screenHeight = screenSize.height | |
let statusHeight: CGFloat = { | |
guard #available(iOS 11.0, *), let window = UIApplication.shared.keyWindow else { | |
return 0 | |
} | |
return window.safeAreaInsets.top | |
}() | |
let bottomMargin: CGFloat = { | |
guard #available(iOS 11.0, *), let window = UIApplication.shared.keyWindow else { | |
return 0 | |
} | |
return window.safeAreaInsets.bottom | |
}() | |
let thin1px: CGFloat = { | |
1 / UIScreen.main.nativeScale | |
}() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment