SwiftUI iPad Landscape Only

@Apple How do you set an iPad swiftUI app to Landscape only seeing that the Xcode supportedInterfaceOrientations flag is ignored by swiftUI.

The following doesn't work via the UIApplicationDelegateAdapter when the 2 methods are implemented.

func application(_ application: UIApplication, supportedInterfaceOrientationsFor window: UIWindow?) -> UIInterfaceOrientationMask {
            .landscape
        }

      func supportedInterfaceOrientations(for window: UIWindow?) -> UIInterfaceOrientationMask {
            .landscape
        }
Answered by Claude31 in 711024022
Accepted Answer

Downside these methods are not fired:

func application(_ application: UIApplication, supportedInterfaceOrientationsFor window: UIWindow?) -> UIInterfaceOrientationMask {

            self.orientationLock

        }

        

        func supportedInterfaceOrientations(for window: UIWindow?) -> UIInterfaceOrientationMask {

            self.orientationLock

        }
SwiftUI iPad Landscape Only
 
 
Q