.previewLayout(PreviewLayout.fixed(width:_,height:_)) not working in Xcode 14

Since updating to Xcode 14 the SwiftUI canvas is behaving differently.

I’m have files that are a fixed size and I am trying to preview them by adding

.previewLayout(PreviewLayout.fixed(width: width,height: height))

to the preview view.

Previously the behaviour was that I would see the canvas the expected width of view. Now I’m seeing the preview in a device.

Is there a way I can get this to work as expected again?

>Solution :

From Xcode 14 preview loads default in Live mode but you can change this to selectable, by clicking the second button from the bottom toolbar.

enter image description here

Leave a Reply