Created
December 5, 2022 08:47
-
-
Save iamchiwon/3454cb35071673046589f4cb9017ff49 to your computer and use it in GitHub Desktop.
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
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