Mac catalyst allows to resize window, is there any way to provide minimum window size for Mac catalyst app?
In the target settings, click General to view the general settings of the target. In the Deployment Info section, add Mac as a supported device and enable Mac support. Select the Mac checkbox. Xcode displays an “Enable Mac support?” confirmation after you select the Mac checkbox.
With Mac Catalyst, you can make a Mac version of your iPad app. Click the Mac checkbox in your iPad app's project settings to configure the project to build both Mac and iPad versions of your app. The two apps share the same project and source code, making it easy to change your code in one place.
Just add the following chunk of code to your application:didFinishLaunchingWithOptions
method (for UIKit projects) or to scene(_:willConnectTo:options:)
(for SwiftUI projects):
UIApplication.shared.connectedScenes.compactMap { $0 as? UIWindowScene }.forEach { windowScene in windowScene.sizeRestrictions?.minimumSize = CGSize(width: 480, height: 640) }
PS: you can also set the maximumSize
property there
PS2: If you set both minimumSize
and maximumSize
to the same value, the window size will remain static and won't be resizable.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With