Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Did previewInterfaceOrientation() stop working in Xcode 15?

I was looking for how to change the orientation of the preview in Xcode 15 and found this SO question, however this is not working for me (I'm using 15.0.1 - 15A507). Has this changed in Xcode 15? Is there another method to change the preview orientation to landscape?

My preview code looks like:

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

and this is not producing any change to the preview orientation in Xcode 15.

like image 357
velo35 Avatar asked Oct 15 '25 19:10

velo35


1 Answers

It was changed to traits, try this:

#Preview(traits: .landscapeLeft) { //<- here
    ContentView()
        //.previewInterfaceOrientation(.landscapeLeft) //<- no longer work
}
like image 167
sonle Avatar answered Oct 18 '25 15:10

sonle



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!