Preview

struct ContentView_Previews: PreviewProvider {
    static var previews: some View {
        Group {
            ContentView()
                .preferredColorScheme(.dark)           // dark mode
                .previewDevice("iPhone 13 Pro Max")    // preview device
                .previewDisplayName(deviceName)        // display name
            ContentView()
        }
    }
}

// available methods
.previewLayout(.sizeThatFits)          // preview layouts
.previewLayout(.fixed(width: 600, height: 600))

.previewInterfaceOrientation(.landscapeRight)    // preview orientation
.environment(\.sizeCategory, .extraExtraExtraLarge)    // accessibility

Last updated