Should UISceneSizeRestriction be available on iPhone in iOS 27?

I'm trying to require a minimum size in my UIKit-based iOS app. I added code to set that using the UIWindowScene.sizeRestrictions property to my app's scene delegate as recommended in Apple's documentation:

func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) {
        guard let currentScene = (scene as? UIWindowScene) else { return }
        
        currentScene.sizeRestrictions?.minimumSize.height = 400
        currentScene.sizeRestrictions?.minimumSize.width = 320
        
        print("*** Size restrictions: \(String(describing: currentScene.sizeRestrictions))")
 ...
}

When I run that in the simulator for an iOS 27 iPhone, the size restrictions property prints out as being nil. That's surprising to me, since the documentation states that "The system provides this object only when it supports variable-sized windows.", and iPhone windows are resizable in iOS 27.

If this is working as expected, is there another way to restrict the size of an iPhone window in iOS 27?

Hello @dsbirch,

Is Resize Mode enabled in Device Hub? For more information see Configuring the environment of a simulated device

You should be able to resize the simulator, even when on the home screen. Your app does not determine if the simulator can resize or not, so let's start there.

Let me know if this message is resolved by enabling Resize Mode.

If the issue persists, I'd like to take a look at the project you are using. Upload this through Feedback Assistant and reply with the feedback number once complete. I will offer any suggestions, as well as confirm that report is routed to the relevant engineering team.

Thank you,

 Travis

I should have mentioned that I was testing this with Device Hub in Resize Mode.

Judging by your response, I'm not sure I asked my question clearly enough.

I can resize the simulator for the iPhone in Resize Mode. I want to be able to enforce a minimum size for my app's window when it's being resized.

It just occurred to me that the code where I'm testing for the windowScene's sizeRestrictions might be nil because Device Hub is not in Resize Mode when the app is launched. If that's the case, is there a way to test for setting sizing limits?

I get a valid sizeRestrictions object when running on an iPad simulator. For testing purposes, will that give me the same end result as running on an iPhone in.a real-world resizable scenario?

Should UISceneSizeRestriction be available on iPhone in iOS 27?
 
 
Q