I have a UIViewController subclass I'm using in Mac Catalyst. This view controller is only ever presented as a sheet. When I try to make a live preview for it the preview is displayed a gigantic size (not the sheet's actual size at runtime). I made a separate thread about this: https://developer.apple.com/forums/thread/738641
In order to be able to preview the view controller for Mac Catalyst at the desired size I figured I'd present it on another view controller.
#Preview {
let wrapperVC = WrapperViewController()
return wrapperVC
}
//In WrapperViewController
override func viewDidAppear(_ animated: Bool)
{
super.viewDidAppear(animated)
if (firstViewDidAppear)
{
firstViewDidAppear = false
view.backgroundColor = UIColor.yellow
let realVC = ActualVCIWantToPreview()
realVC.modalPresentationStyle = .formSheet
present(realVC, animated: false);
}
}
But that's not working. However if I change the device from Mac to iPad it does work so it appears modal presentations aren't working for Live Previews on Mac Catalyst (unless I'm doing something wrong but Xcode is reporting no errors it just isn't showing my presented view controller).