Apple needs to support locking a SwiftUI View into a particular orientation like .portrait or .landscape. The work arounds to support this feature are complicated and keep getting deprecated by Apple.
You need this feature to support the Camera at least which is another sore topic since it's poorly supported in SwiftUI presently.
All that is needed is an orientation var like UIDevice.current.orientation, but excluding .faceUp and .faceDown so it only returns .portrait or .landscape orientations. If the device goes into .faceUp it should just return the previous orientation.
Then a View extension like detectOrientation(_ orientation: Binding) to detect the current views orientation so this can be used like :
if orientation.isLandscape {
//SwiftUI landscape elements
} else {
//SwiftUI portrait elements
}
Then another method .lockOrientation(_ orientation:UIDeviceOrienation)
Now a SwiftUI can get the current orientation with :
.detectionOriention($orientation)
And lock a SwiftUI view :
.lockOrientation(.portrait)
The SwiftUI SubViews within the Primary View would then just consume the orientation var to layout properly in Landscape or Portrait.
Selecting any option will automatically load the page