Playbook Documentation Beta

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, *)
    public 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(_:​)

public 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, *)
    public 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(_:​)

public 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, *)
    public 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(_:​)

public 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, *)
    public 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(_:​)

public 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, *)
    public 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(_:​)

public 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, *)
    public 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(_:​)

public 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, *)
    public 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(_:​)

public 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, *)
    public 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(_:​)

public 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, *)
    public 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(_:​)

public 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, *)
    public 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(_:​)

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

iPad​Mini5th(_:​style:​)

@available(iOS 12.0, *)
    public 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(_:​)

public 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, *)
    public 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(_:​)

public 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, *)
    public 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(_:​)

public 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, *)
    public 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(_:​)

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