PreviewDevice - library with elegant syntax for Preview Device in SwiftUI

Overview

PreviewDevice

Platforms Version SPM Xcode Twitter

Requirements

  • Xcode 13.x
  • iOS 13.0+, macOS 10.15+, Mac Catalyst 13.0+, tvOS 13.0+, watchOS 6.0+

Usage

Example:

import PreviewDevice

struct ContentView_Previews: PreviewProvider {
    
    static var previews: some View {
        ContentView()
            .previewDevice(device: .iphone12, 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: Device, orientation: InterfaceOrientation, colorSchemes: [ColorScheme])

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

Articles

Meet PreviewDevice 0.7.0

License

PreviewDevice is released under the MIT license.

You might also like...
Deck is a library that provides a UI to reproduce stacked cards for SwiftUI.
Deck is a library that provides a UI to reproduce stacked cards for SwiftUI.

Deck Deck is a library that provides a UI to reproduce stacked cards for SwiftUI. RPReplay_Final1624531727.mov Usage struct Card: View { var data

An extension to the standard SwiftUI library.
An extension to the standard SwiftUI library.

SwiftUIX: An extension to the standard SwiftUI library. SwiftUIX attempts to fill the gaps of the still nascent SwiftUI framework, providing an extens

A SwiftUI dynamic property wrapper for fetching media from your photo library. (iOS, tvOS, macOS)

Media Also available as a part of my SwiftUI+ Collection – just add it to Xcode 13+ A package for simplifying the user of the camera and the user's ph

A Swift library for documenting, isolating, and testing SwiftUI, UIKIt & AppKit components.
A Swift library for documenting, isolating, and testing SwiftUI, UIKIt & AppKit components.

A Swift library for documenting, isolating, and testing SwiftUI, UIKit & AppKit components. Minimal Example An example demonstrated with the Slider ui

A Library to extend SwiftUI Controls
A Library to extend SwiftUI Controls

Introduction SwiftUICompatKit is an open source project that enables accessing controls that has not been developed or have limited functionality in S

A simple star rating library for SwiftUI apps on macOS and iOS

DLDRating A simple star rating library for SwiftUI apps on macOS and iOS. Features Installation Usage Styling Credits DLDRating was made by Dionne Lie

🎲 100% SwiftUI 2.0, classic 2048 game [SwiftUI 2.0, iOS 14.0+, iPadOS 14.0+, macOS 11.0+, Swift 5.3].
🎲 100% SwiftUI 2.0, classic 2048 game [SwiftUI 2.0, iOS 14.0+, iPadOS 14.0+, macOS 11.0+, Swift 5.3].

swiftui-2048 If you like the project, please give it a star ⭐ It will show the creator your appreciation and help others to discover the repo. ✍️ Abou

A simple SwiftUI Application to demonstrate creation of UI using SwiftUI.
A simple SwiftUI Application to demonstrate creation of UI using SwiftUI.

WatchShop_UI A simple SwiftUI Application to demonstrate creation of UI using SwiftUI. How to run the project ? Fork the project. Run the project usin

Comments
  • Feature/add support new devices from xcode 13

    Feature/add support new devices from xcode 13

    Add support new devices from xcode 13. Add unit tests for new devices. New devices:

    • iPhone 13 mini, 13, 13Pro, 13Pro Max
    • Apple Watch 7 41 mm, 44 mm
    • iPad 9 Gen, iPad mini 6 gen
    opened by Toni77777 0
Releases(0.9.0)
  • 0.9.0(Dec 11, 2021)

    Preview for Cocoa views:

    • NSViewControllerPreview - preview for NSViewController.
    • NSViewPreview - preview for NSView.

    Preview for UIKit views:

    • UIViewControllerPreview - preview for UIViewController.
    • UIViewPreview - preview for UIView.
    Source code(tar.gz)
    Source code(zip)
  • 0.8.0(Sep 16, 2021)

    Add new devices:

    • iPhone 13 mini, 13, 13Pro, 13Pro Max
    • Apple Watch 7 41 mm, 44 mm
    • iPad 9 Gen, iPad mini 6 gen

    Add new preview with orientation: .previewDevice(device: .iphone12, orientations: [.portrait, .landscapeLeft, .landscapeRight]) Preview on device with orientation and color schemes .previewDevice(device: .iphone12, orientation: .portrait, colorSchemes: [.light, .dark])

    Source code(tar.gz)
    Source code(zip)
  • 0.7.0(Aug 26, 2021)

  • 0.6.0(Aug 26, 2021)

  • 0.5.0(Aug 26, 2021)

    Added:

    • View extensions.
      • previewDevice(device: Device, colorScheme: ColorScheme)
      • previewDevice(device: Device, colorSchemes: [ColorScheme])
    Source code(tar.gz)
    Source code(zip)
  • 0.3.0(Aug 25, 2021)

    Added:

    • View extensions. Available iOS 15.0+ OSX 12.00+ macCatalyst 15.0+ tvOS 15.0+ watchOS 8.0+.
      • previewDevice(device: Device, orientation: InterfaceOrientation)
      • previewDevice(device: Device, orientations: [InterfaceOrientation])
    Source code(tar.gz)
    Source code(zip)
  • 0.2.0(Aug 24, 2021)

Owner
Anton Paliakov
iOS/macOS App Developer
Anton Paliakov
Simulate any device and settings on one simulator or device.

SwiftUI-Simulator Enables the following settings without settings or restarting the simulator or real device. Any device screen Light/Dark mode Locale

Yusuke Hosonuma 70 Dec 19, 2022
A Figma component preview for your SwiftUI views

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

Danis Tazetdinov 50 Dec 23, 2022
Preview with Link's meta information.(SwiftUI)

LinkPreview(SwiftUI) Preview with Link's meta information. Image Gif Get Started import SwiftUI import LinkPreview struct LinkPreview_Test: View {

null 15 Dec 16, 2022
Preview with Link's meta information with SwiftUI

LinkPreview(SwiftUI) Preview with Link's meta information. Image Gif Get Started import SwiftUI import LinkPreview struct LinkPreview_Test: View {

null 15 Dec 16, 2022
QuickLook Preview for SwiftUI on Mac Catalyst

QuickLook Preview for SwiftUI on Mac Catalyst According to the documentation for

Tom Dai 9 Dec 31, 2022
Window preview app for MacOS (on the dock) using AltTab.

DockAltTab The #1 Window manager/Task switcher & Companion for AltTab v1.1 download link https://github.com/steventheworker/DockAltTab/releases/downlo

Steven G. 40 Jan 2, 2023
A SwiftUI app that reads iOS/watchOS/tvOS device model information from Xcode you select.

iVariant A SwiftUI app that reads iOS/watchOS/tvOS device model information from Xcode you select. Preview License iVariant is licensed under MIT. Cop

Lakr Aream 20 Aug 4, 2022
iOS On-Device Game Cheat Creation/Sharing Platform and Software

CheatManager CheatManager is a mobile platform, used for installation/distribution/creation of mobile game cheats/hacks. This platform is completely d

Project Manticore 49 Jan 2, 2023
This is a sample app to create a photo selection classifier using CreateML on an iOS Device.

PhotoSelectionClassifier This is a sample app to create a photo selection classifier using CreateML on an iOS Device. Demo In the demo video below, we

null 15 Nov 18, 2022
ReleaseNotesKit - a brand new, elegant, and extremely simple way to present the recent version’s release notes to your users

ReleaseNotesKit This is ReleaseNotesKit, a brand new, elegant, and extremely simple way to present the recent version’s release notes to your users. R

Swapnanil Dhol 22 Jun 30, 2022