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...
FigmaPreviewSwiftUI

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

SafePreviewDevice

Motivation At WWDC 2019, Apple announced SwiftUI a new library for building UI in a simple and fast way. Xcode’s ...

PreviewView

Make use of SwiftUI previews for rapidly prototyping your UIViewControllers and UIViews! The SwiftUI preview canvas is tied to a specific version of ...

SwiftUIWheelPicker

Horizontal wheel picker for SwiftUI Requirements iOS 13.0+ Installation CocoaPods

PermissionsSwiftUI: A SwiftUI package to handle permissions

PermissionsSwiftUI displays and handles permissions in SwiftUI. It is largely inspired by SPPermissions. The UI is highly customizable and resembles an Apple style. ...