Hello, following Apple docs and guidance from WWDC I'm trying to set a minimum size for my scene, for example I want it to minimally be 3/4 the width and height of the device.
I've removed the UIRequiresFullScreen Info.plist property. The app does run in windowed mode and does have a resizing handle.
I've implemented this UISceneDelegate:
var window: UIWindow?
var cameraWindow: UIWindow?
func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) {
window = UIWindow(windowScene: scene as! UIWindowScene)
// setup root view controller
let rootViewController: MainViewController = MainViewController(nibName: "Main", bundle: nil)
let navController: NavigationController = NavigationController(rootViewController: rootViewController)
navController.modalPresentationStyle = .fullScreen
// set reasonable minimum sizes for WindowScene
if let windowScene: UIWindowScene = scene as? UIWindowScene {
if #available(iOS 16.0, *) {
let windowSize: CGSize = windowScene.coordinateSpace.bounds.size
windowScene.sizeRestrictions?.minimumSize.width = windowSize.width * 0.75
windowScene.sizeRestrictions?.minimumSize.height = windowSize.height * 0.75
}
}
window?.rootViewController = navController
window?.makeKeyAndVisible()
}
}
And proven via debugger that this code is being executed. I have the following observations:
After setting these minimumSize properties I see the width and height both contain 0 afterwards, as if the property settings are discarding the value. I've even used hard-coded values instead of reading the coordinateSpace.bounds, to no avail.
The scene is allowing resizing well below these minimums, about 1/3 the width and 1/2 the height.
Anyone else observed this and have suggestions?