Playbook Documentation

Structure Snapshot​Device

public struct SnapshotDevice  

The device representation for simulating environments of each device such as size, orientation, safe area, trait collection, or dark mode appearance.

Nested Types

SnapshotDevice.Orientation

Represents the orientation of a device.

Initializers

init(name:​size:​safe​Area​Insets:​trait​Collection:​)

public init(
        name: String,
        size: CGSize,
        safeAreaInsets: UIEdgeInsets = .zero,
        traitCollection: UITraitCollection = UITraitCollection()
    )  

Creates a new custom device simulation.

Parameters

name String

A name that to be used as a directory name of snapshots.

size CGSize

A simulated device size.

safe​Area​Insets UIEdge​Insets

A simulated safe area insets.

trait​Collection UITrait​Collection

A simulated trait collection.

Properties

name

public var name: String

The name of this device that to be used as a directory name of snapshots.

size

public var size: CGSize

The simulated size of this device.

safe​Area​Insets

public var safeAreaInsets: UIEdgeInsets

The simulated safe area insets of this device.

trait​Collection

public var traitCollection: UITraitCollection

The simulated trait collection of this device.

Methods

adding​Trait​Collection(_:​)

public func addingTraitCollection(_ traitCollection: UITraitCollection) -> SnapshotDevice  

Adds an arbitrary trait collection to change the appearance.

  • Parameters

    • traitCollection: A trait collection to be added.

Returns

The device that added the given trait collection to the self.

iPhone​SE(_:​style:​)

@available(iOS 12.0, *)
    static func iPhoneSE(_ orientation: Orientation, style: UIUserInterfaceStyle) -> SnapshotDevice  

iPhone SE simulated device.

Parameters

orientation Orientation

A simulated orientation.

style UIUser​Interface​Style

A theme of UI appearance.

Returns

A device simulated the iPhone SE.

iPhone​SE(_:​)

static func iPhoneSE(_ orientation: Orientation) -> SnapshotDevice  

iPhone SE simulated device.

Parameters

orientation Orientation

A simulated orientation.

Returns

A device simulated the iPhone SE.

iPhone8(_:​style:​)

@available(iOS 12.0, *)
    static func iPhone8(_ orientation: Orientation, style: UIUserInterfaceStyle) -> SnapshotDevice  

iPhone 8 simulated device.

Parameters

orientation Orientation

A simulated orientation.

style UIUser​Interface​Style

A theme of UI appearance.

Returns

A device simulated the iPhone 8.

iPhone8(_:​)

static func iPhone8(_ orientation: Orientation) -> SnapshotDevice  

iPhone 8 simulated device.

Parameters

orientation Orientation

A simulated orientation.

Returns

A device simulated the iPhone 8.

iPhone8Plus(_:​style:​)

@available(iOS 12.0, *)
    static func iPhone8Plus(_ orientation: Orientation, style: UIUserInterfaceStyle) -> SnapshotDevice  

iPhone 8 Plus simulated device.

Parameters

orientation Orientation

A simulated orientation.

style UIUser​Interface​Style

A theme of UI appearance.

Returns

A device simulated the iPhone 8 Plus.

iPhone8Plus(_:​)

static func iPhone8Plus(_ orientation: Orientation) -> SnapshotDevice  

iPhone 8 Plus simulated device.

Parameters

orientation Orientation

A simulated orientation.

Returns

A device simulated the iPhone 8 Plus.

iPhone​X(_:​style:​)

@available(iOS 12.0, *)
    static func iPhoneX(_ orientation: Orientation, style: UIUserInterfaceStyle) -> SnapshotDevice  

iPhone X simulated device.

Parameters

orientation Orientation

A simulated orientation.

style UIUser​Interface​Style

A theme of UI appearance.

Returns

A device simulated the iPhone X.

iPhone​X(_:​)

static func iPhoneX(_ orientation: Orientation) -> SnapshotDevice  

iPhone X simulated device.

Parameters

orientation Orientation

A simulated orientation.

Returns

A device simulated the iPhone X.

iPhone​XS(_:​style:​)

@available(iOS 12.0, *)
    static func iPhoneXS(_ orientation: Orientation, style: UIUserInterfaceStyle) -> SnapshotDevice  

iPhone XS simulated device.

Parameters

orientation Orientation

A simulated orientation.

style UIUser​Interface​Style

A theme of UI appearance.

Returns

A device simulated the iPhone XS.

iPhone​XS(_:​)

static func iPhoneXS(_ orientation: Orientation) -> SnapshotDevice  

iPhone XS simulated device.

Parameters

orientation Orientation

A simulated orientation.

Returns

A device simulated the iPhone XS.

iPhone​XR(_:​style:​)

@available(iOS 12.0, *)
    static func iPhoneXR(_ orientation: Orientation, style: UIUserInterfaceStyle) -> SnapshotDevice  

iPhone XR simulated device.

Parameters

orientation Orientation

A simulated orientation.

style UIUser​Interface​Style

A theme of UI appearance.

Returns

A device simulated the iPhone XR.

iPhone​XR(_:​)

static func iPhoneXR(_ orientation: Orientation) -> SnapshotDevice  

iPhone XR simulated device.

Parameters

orientation Orientation

A simulated orientation.

Returns

A device simulated the iPhone XR.

iPhone​XSMax(_:​style:​)

@available(iOS 12.0, *)
    static func iPhoneXSMax(_ orientation: Orientation, style: UIUserInterfaceStyle) -> SnapshotDevice  

iPhone XS Max simulated device.

Parameters

orientation Orientation

A simulated orientation.

style UIUser​Interface​Style

A theme of UI appearance.

Returns

A device simulated the iPhone XS Max.

iPhone​XSMax(_:​)

static func iPhoneXSMax(_ orientation: Orientation) -> SnapshotDevice  

iPhone XS Max simulated device.

Parameters

orientation Orientation

A simulated orientation.

Returns

A device simulated the iPhone XS Max.

iPhone11(_:​style:​)

@available(iOS 12.0, *)
    static func iPhone11(_ orientation: Orientation, style: UIUserInterfaceStyle) -> SnapshotDevice  

iPhone 11 simulated device.

Parameters

orientation Orientation

A simulated orientation.

style UIUser​Interface​Style

A theme of UI appearance.

Returns

A device simulated the iPhone 11.

iPhone11(_:​)

static func iPhone11(_ orientation: Orientation) -> SnapshotDevice  

iPhone 11 simulated device.

Parameters

orientation Orientation

A simulated orientation.

Returns

A device simulated the iPhone 11.

iPhone11Pro(_:​style:​)

@available(iOS 12.0, *)
    static func iPhone11Pro(_ orientation: Orientation, style: UIUserInterfaceStyle) -> SnapshotDevice  

iPhone 11 Pro simulated device.

Parameters

orientation Orientation

A simulated orientation.

style UIUser​Interface​Style

A theme of UI appearance.

Returns

A device simulated the iPhone 11 Pro.

iPhone11Pro(_:​)

static func iPhone11Pro(_ orientation: Orientation) -> SnapshotDevice  

iPhone 11 Pro simulated device.

Parameters

orientation Orientation

A simulated orientation.

Returns

A device simulated the iPhone 11 Pro.

iPhone11Pro​Max(_:​style:​)

@available(iOS 12.0, *)
    static func iPhone11ProMax(_ orientation: Orientation, style: UIUserInterfaceStyle) -> SnapshotDevice  

iPhone 11 Pro Max simulated device.

Parameters

orientation Orientation

A simulated orientation.

style UIUser​Interface​Style

A theme of UI appearance.

Returns

A device simulated the iPhone 11 Pro Max.

iPhone11Pro​Max(_:​)

static func iPhone11ProMax(_ orientation: Orientation) -> SnapshotDevice  

iPhone 11 Pro Max simulated device.

Parameters

orientation Orientation

A simulated orientation.

Returns

A device simulated the iPhone 11 Pro Max.

iPhone12Mini(_:​style:​)

@available(iOS 12.0, *)
    static func iPhone12Mini(_ orientation: Orientation, style: UIUserInterfaceStyle) -> SnapshotDevice  

iPhone 12 mini simulated device.

Parameters

orientation Orientation

A simulated orientation.

style UIUser​Interface​Style

A theme of UI appearance.

Returns

A device simulated the iPhone 12 mini.

iPhone12Mini(_:​)

static func iPhone12Mini(_ orientation: Orientation) -> SnapshotDevice  

iPhone 12 mini simulated device.

Parameters

orientation Orientation

A simulated orientation.

Returns

A device simulated the iPhone 12 mini.

iPhone12(_:​style:​)

@available(iOS 12.0, *)
    static func iPhone12(_ orientation: Orientation, style: UIUserInterfaceStyle) -> SnapshotDevice  

iPhone 12 simulated device.

Parameters

orientation Orientation

A simulated orientation.

style UIUser​Interface​Style

A theme of UI appearance.

Returns

A device simulated the iPhone 12.

iPhone12(_:​)

static func iPhone12(_ orientation: Orientation) -> SnapshotDevice  

iPhone 12 simulated device.

Parameters

orientation Orientation

A simulated orientation.

Returns

A device simulated the iPhone 12.

iPhone12Pro(_:​style:​)

@available(iOS 12.0, *)
    static func iPhone12Pro(_ orientation: Orientation, style: UIUserInterfaceStyle) -> SnapshotDevice  

iPhone 12 Pro simulated device.

Parameters

orientation Orientation

A simulated orientation.

style UIUser​Interface​Style

A theme of UI appearance.

Returns

A device simulated the iPhone 12 Pro.

iPhone12Pro(_:​)

static func iPhone12Pro(_ orientation: Orientation) -> SnapshotDevice  

iPhone 12 Pro simulated device.

Parameters

orientation Orientation

A simulated orientation.

Returns

A device simulated the iPhone 12 Pro.

iPhone12Pro​Max(_:​style:​)

@available(iOS 12.0, *)
    static func iPhone12ProMax(_ orientation: Orientation, style: UIUserInterfaceStyle) -> SnapshotDevice  

iPhone 12 Pro Max simulated device.

Parameters

orientation Orientation

A simulated orientation.

style UIUser​Interface​Style

A theme of UI appearance.

Returns

A device simulated the iPhone 12 Pro Max.

iPhone12Pro​Max(_:​)

static func iPhone12ProMax(_ orientation: Orientation) -> SnapshotDevice  

iPhone 12 Pro Max simulated device.

Parameters

orientation Orientation

A simulated orientation.

Returns

A device simulated the iPhone 12 Pro Max.

iPad​Mini5th(_:​style:​)

@available(iOS 12.0, *)
    static func iPadMini5th(_ orientation: Orientation, style: UIUserInterfaceStyle) -> SnapshotDevice  

iPad Mini 5th generation simulated device.

Parameters

orientation Orientation

A simulated orientation.

style UIUser​Interface​Style

A theme of UI appearance.

Returns

A device simulated the iPad Mini 5th generation.

iPad​Mini5th(_:​)

static func iPadMini5th(_ orientation: Orientation) -> SnapshotDevice  

iPad Mini 5th generation simulated device.

Parameters

orientation Orientation

A simulated orientation.

Returns

A device simulated the iPad Mini 5th generation.

iPad​Pro10_5(_:​style:​)

@available(iOS 12.0, *)
    static func iPadPro10_5(_ orientation: Orientation, style: UIUserInterfaceStyle) -> SnapshotDevice  

iPad Pro 10.5 inch simulated device.

Parameters

orientation Orientation

A simulated orientation.

style UIUser​Interface​Style

A theme of UI appearance.

Returns

A device simulated the iPad Pro 10.5 inch.

iPad​Pro10_5(_:​)

static func iPadPro10_5(_ orientation: Orientation) -> SnapshotDevice  

iPad Pro 10.5 inch simulated device.

Parameters

orientation Orientation

A simulated orientation.

Returns

A device simulated the iPad Pro 10.5 inch.

iPad​Pro11(_:​style:​)

@available(iOS 12.0, *)
    static func iPadPro11(_ orientation: Orientation, style: UIUserInterfaceStyle) -> SnapshotDevice  

iPad Pro 11 simulated device.

Parameters

orientation Orientation

A simulated orientation.

style UIUser​Interface​Style

A theme of UI appearance.

Returns

A device simulated the iPad Pro 11.

iPad​Pro11(_:​)

static func iPadPro11(_ orientation: Orientation) -> SnapshotDevice  

iPad Pro 11 simulated device.

Parameters

orientation Orientation

A simulated orientation.

Returns

A device simulated the iPad Pro 11.

iPad​Pro12_9(_:​style:​)

@available(iOS 12.0, *)
    static func iPadPro12_9(_ orientation: Orientation, style: UIUserInterfaceStyle) -> SnapshotDevice  

iPad Pro 12.9 inch simulated device.

Parameters

orientation Orientation

A simulated orientation.

style UIUser​Interface​Style

A theme of UI appearance.

Returns

A device simulated the iPad Pro 12.9 inch.

iPad​Pro12_9(_:​)

static func iPadPro12_9(_ orientation: Orientation) -> SnapshotDevice  

iPad Pro 12.9 inch simulated device.

Parameters

orientation Orientation

A simulated orientation.

Returns

A device simulated the iPad Pro 12.9 inch.