Setting default orientation of a view in SwiftUI

Viewed 202

How can we set the default orientation of a specific view in SwiftUI and lock it in case the view only usable in landscape mode for example ?

Couldn't find anything related to swiftUI so far except from preview orientation.

1 Answers

Same as before, through the UISupportedInterfaceOrientations key in Info.plist.

When you start a new project, the key should already be there containing Portrait, Landscape Left and Right by default values (everything except Portrait Upside-down). Just delete the Portrait value and leave the Landscape modes.

Related