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
        }

Accepted Reply

Did you try one of the solutions described here ?

https://stackoverflow.com/questions/59633415/swiftui-force-portrait-on-all-except-one-view

Replies

Did you try one of the solutions described here ?

https://stackoverflow.com/questions/59633415/swiftui-force-portrait-on-all-except-one-view

Downside these methods are not fired:

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

            self.orientationLock

        }

        

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

            self.orientationLock

        }