PreviewDevice
  • August 1, 2025

Requirements


 

  • Dev environment: Xcode 13+, macOS 12+
  • iOS 13.0+, macOS 10.15+, Mac Catalyst 13.0+, tvOS 13.0+, watchOS 6.0+

Usage


import PreviewDevice

struct ContentView_Previews: PreviewProvider {

static var previews: some View {
ContentView()
.previewDevice(device: .iphone13, colorSchemes: ColorScheme.allCases)
}
}

Result

Preview on device

.previewDevice(device: .iphone12)

Preview on devices

.previewDevices(device: [.iphone8, .iphone11Pro .iphone12, .iphone12ProMax])

Preview on device with color scheme (light, dark)

.previewDevice(device: .iphone12, colorScheme: .light)

Preview on device with ColorSchemes

 

.previewDevice(device: .iphone12, colorScheme: [.light, .dark])

Preview on device with orientation (InterfaceOrientation)

.previewDevice(device: .iphone12, orientation: .portrait)

Preview on device with orientations

.previewDevice(device: .iphone12, orientations: [.portrait, .landscapeLeft, .landscapeRight])

Preview on device with orientation and color schemes

.previewDevice(device: .iphone12, orientation: .portrait, colorSchemes: [.light, .dark])

Installation


CocoaPods

Specify next line in Podfile:

pod PreviewDevice

Swift Package Manager

Open Xcode, File -> Swift Packages -> Add Packages.. and paste library git url:

https://github.com/Toni77777/PreviewDevice.git

GitHub


View Github

YOU MIGHT ALSO LIKE...
StarRating

 

ZeplinPreviewSwiftUI

A Zeplin component preview for your SwiftUI views. You can use Zeplin components instead of real views within your app ...

CarBode

Free and Opensource Barcode scanner & Barcode generator for swiftUI

🎭 Gala

Gala is a Swift Package Manager project for macOS, iOS, tvOS, and watchOS to help you create SwiftUI preview variants. ...

FigmaPreviewSwiftUI

A Figma component preview for your SwiftUI views. You can use Figma components instead of real views within your app ...