Playbook Documentation Beta

Enumeration Snapshot​Support

public enum SnapshotSupport

A namespace for the methods supporting to generate snapshot from scenarios.

Methods

data(for:​on:​format:​scale:​key​Window:​handler:​)

public static func data(for scenario: Scenario, on device: SnapshotDevice, format: ImageFormat, scale: CGFloat = UIScreen.main.scale, keyWindow: UIWindow? = nil, handler: @escaping (Data) -> Void)

Generates an image file data that snapshots the given scenario.

Parameters

scenario Scenario

A scenario to be snapshot.

device Snapshot​Device

A snapshot environment simulating device.

format Image​Format

An image file format of exported data.

scale CGFloat

A rendering scale of the snapshot image.

key​Window UIWindow?

The key window of the application.

handler @escaping (Data) -> Void

A closure that to handle generated data.

image(for:​on:​scale:​key​Window:​handler:​)

public static func image(for scenario: Scenario, on device: SnapshotDevice, scale: CGFloat = UIScreen.main.scale, keyWindow: UIWindow? = nil, handler: @escaping (UIImage) -> Void)

Generates an UIImage that snapshots the given scenario.

Parameters

scenario Scenario

A scenario to be snapshot.

device Snapshot​Device

A snapshot environment simulating device.

scale CGFloat

A rendering scale of the snapshot image.

key​Window UIWindow?

The key window of the application.

handler @escaping (UIImage) -> Void

A closure that to handle generated UIImage.