How do I rotate the SwiftUI Preview to show my view in landscape?
rotate swiftui preview
Add a Comment
How do I rotate the SwiftUI Preview to show my view in landscape?
I spoke to one of the engineers at WWDC about this. It is currently not possible. Your best bet is something like this:
#if DEBUG
struct ContentView_Previews : PreviewProvider {
static var previews: some View {
return ContentView().previewLayout(.fixed(width: 2688, height: 1242))
}
}
#endif
Code Block swift .previewLayout(.fixed(width: 2732, height: 2048))
Code Block `
// iPhone X - Px res: 1125 x 2436 - Scale factor: 3.0 #if DEBUG struct ContentView_Previews : PreviewProvider { static var previews: some View { return ContentView().previewLayout(.fixed(width: 2436 / 3.0, height: 1125 / 3.0)) } } #endif
`