Skip to content

Instantly share code, notes, and snippets.

@iamchiwon
Created December 5, 2022 08:47
Show Gist options
  • Save iamchiwon/3454cb35071673046589f4cb9017ff49 to your computer and use it in GitHub Desktop.
Save iamchiwon/3454cb35071673046589f4cb9017ff49 to your computer and use it in GitHub Desktop.
import UIKit
let screenSize = UIScreen.main.bounds.size
let screenWidth = screenSize.width
let screenHeight = screenSize.height
let statusHeight: CGFloat = {
guard let window = UIApplication.shared.keyWindow else {
return 0
}
return window.safeAreaInsets.top
}()
let menuBarHeight: CGFloat = 44
let tabBarHeight: CGFloat = 49
let bottomMargin: CGFloat = {
guard let window = UIApplication.shared.keyWindow else {
return 0
}
return window.safeAreaInsets.bottom
}()
let thin1px: CGFloat = {
1 / UIScreen.main.nativeScale
}()
let hasNotch: Bool = bottomMargin > 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment