SwiftUI - Struct ContentView_Previews: ContentView() .previewLayout Not Displaying

I’m working on the tutorial “Your First iOS and SwiftUI App From Scratch”
Whenever I add a new ContentView() with .previewLayout to the struct ContentView it doesn’t display. My original ContentView() in portrait mode or layout is the only view
displaying. How do I fix this? I’m running Xcode Version 14.0.1
Here’s my code:
struct ContentView_Previews: PreviewProvider {
static var previews: some View {
.previewLayout(.fixed(width: 568, height: 320))

After I posted this, I discovered that it appears that the way multiple ContentView()s are
displayed is by clicking on one of the “Content View” tabs at the top of the previews.
So, you no longer view the “previews” by scrolling and instead preview them by toggling and clicking on on one of the “Content View” tabs
.previewLayout doesn’t work but .previewInterfaceOrientation(.landscapeRight) does
and displays when I click on the second “Content View” tab.
Looks like this is the solution.
Thanks, Gary

This topic was automatically closed after 166 days. New replies are no longer allowed.