Hi Brian, in iOS13, the function "UIApplication.shared.statusBarFrame.height" is depracted.
'statusBarFrame' was deprecated in iOS 13.0: Use the statusBarManager property of the window scene instead.
i fixed it by use view.window?.windowScene?.statusBarManager?.statusBarFrame.height - but this only works in viewWillLayoutSubviews, so i have to move the anchor setting to this place. My question is now, is this really the best solution for this case?
The "view.safeAreaLayoutGuide.topAnchor" method was not flipping in my simulator, maybe it be fixed by apple, but i still want to use your solution, because it feels more "robust".
override func viewWillLayoutSubviews() {
super.viewWillLayoutSubviews()
let statusBarHeight = view.window?.windowScene?.statusBarManager?.statusBarFrame.height ?? 0
let paddinTop = statusBarHeight + 8
barStackView.anchor(top: view.topAnchor, leading: view.leadingAnchor, bottom: nil, trailing: view.trailingAnchor, padding: .init(top: paddinTop, left: 8, bottom: 0, right: 8), size: .init(width: 0, height: 4))
}