Allow Catalyst UIWindow resizable to smaller than default

How can I allow the window of my catalyst app to be resizable below 670 x 481? (The default min size is 770 x 797.)



By setting either of the following, the window it still limited to 670x481.


window?.canResizeToFitContent = true


window?.windowScene?.sizeRestrictions?.minimumSize = CGSize(width: 100, height: 200)


If I set a sizeRestrictions?.maximumSize the behavior is even stranger -- it will be smaller, but also resizes right off the screen!


I note that the new Twitter catalyst app allows it's main window to resize smaller (400 x 425).


Please help! 🙂

Same problem here... any updates?

As from this stackOverFlow question You need to add this code in App Delegate or Scene Delegate for swiftUI

If you set sizeRestrictions.maximumSize and sizeRestrictions.minimumSize to the same value, the window will not be resizable. To do so, just call this in your application:didFinishLaunchingWithOptions method (if you're using UIKit):

UIApplication.shared.connectedScenes.compactMap { $0 as? UIWindowScene }.forEach { windowScene in
        windowScene.sizeRestrictions?.minimumSize = CGSize(width: 480, height: 640)
        windowScene.sizeRestrictions?.maximumSize = CGSize(width: 480, height: 640)
    }

Note: You need to run this in OSX 10.15 Beta 5 or later, otherwise it will crash

Allow Catalyst UIWindow resizable to smaller than default
 
 
Q