In this article, I will show you how to get height of safe area programmaticall in Swift.
let safeArea = UIApplication.shared.windows.first { $0.isKeyWindow }?.safeAreaInsetsorUIApplication.shared.keyWindow?.safeAreaInsets.topprint("top:", safeArea?.top, "bootom:", safeArea?.bottom)
Result:
// iPhone SE
top: Optional(0.0) bootom: Optional(0.0)// iPhone 13
top: Optional(50.0) bootom: Optional(34.0)