Xcode 15.0 (15A240d) - Preview Provider Orientation

Hello! 👋

In previous versions of Xcode I was used to make something like this:

struct MyView_Previews: PreviewProvider {
    static var previews: some View {
        MyView()
           .previewInterfaceOrientation(.landscapeLeft)
    }
}

So I don't have to change the Device Settings in the Canvas.

Now, with Xcode 15, I couldn't manage to do the same.

#Preview {
  MyView()
    .previewInterfaceOrientation(.landscapeLeft)
}

Hi,

Try using the traits argument to the Preview macro:

#Preview(traits: .landscapeLeft) {
    MyView()
}
Xcode 15.0 (15A240d) - Preview Provider Orientation
 
 
Q