I don't know why, but for my MacCatalyst
target, I have to make my view controller Y orgin 36 and the subtract the view height by 36 points, or the view is clipped.
The following works in my main UIViewController
, but feels super hacky. I'd feel better if I understood the issue and addressed it properly.
override func viewWillLayoutSubviews() {
super.viewWillLayoutSubviews()
#if targetEnvironment(macCatalyst)
if view.frame.origin.y < 1 {
let f = UIApplication.shared.sceneBounds
let newFrame = CGRect(x: 0.0, y: 36, width: f.size.width, height: f.size.height - 36)
self.view.frame = newFrame
}
#endif
}
My guess is it starts the view under the title bar, but I have these set in the view controller:
self.extendedLayoutIncludesOpaqueBars = false
self.edgesForExtendedLayout = []