How to change the height of ShareViewController view (for mac Catalyst iOS app)

Used Catalyst to port iOS app to MacOS, but Share Extension view is too small on MacOS Safari. The height needs to be changed, but self.preferredContentSize = NSSize(width: 200, height: 500) or CGSize(width: 200, height: 500) seems to not be called in viewDidLoad()

Any input helps, thanks.


ShareViewController.swift
Code Block
override func viewDidLoad() {
super.viewDidLoad()
#if targetEnvironment(macCatalyst)
self.preferredConstenSize = NSSize(width: 200, height: 500)
#else
#endif
}





Answered by tmo in 621912022
Thanks for your input, Frameworks Engineer and J0hn.
I replaced the default view on main interface.storyboard with a regular view (set as entry point) and associated a new ViewController.swift to it. So you can customize the size of Share Extension view and the view is working on Mac Catalyst too now. It does add a URL, page title, and assigned Core Data entity info from Safari to my app's Core Data (using iCloud sync), but only from iOS device. It doesn't add info from Mac. This seems to be another problem that I have to deal with. I'll post it to the forum as a separate issue.

Is there a presentingViewController? What if you set the preferredContentSize of that?
Safari sets the size of Mac Catalyst share extensions; this size cannot be overridden by the extension.
Accepted Answer
Thanks for your input, Frameworks Engineer and J0hn.
I replaced the default view on main interface.storyboard with a regular view (set as entry point) and associated a new ViewController.swift to it. So you can customize the size of Share Extension view and the view is working on Mac Catalyst too now. It does add a URL, page title, and assigned Core Data entity info from Safari to my app's Core Data (using iCloud sync), but only from iOS device. It doesn't add info from Mac. This seems to be another problem that I have to deal with. I'll post it to the forum as a separate issue.

How to change the height of ShareViewController view (for mac Catalyst iOS app)
 
 
Q