How to get the notch size for a Device in swift.
Is the notch size constant height for all devices ?
var notchHeightSize: CGFloat = 44 / ScreenSize.ScreenHeight
let hasNotched: Bool? = UIDevice.current.hasNotch
dynamicHeight = hasNotched == true ? dynamicHeight : (dynamicHeight + notchHeightSize)
2
Answers
let window = UIApplication.shared.windows[0]
let topPadding = window.safeAreaInsets.top
let bottomPadding = window.safeAreaInsets.bottom
print(topPadding)
print(bottomPadding)
Below is the generic extension you can use.