Playbook Documentation

Enumeration Snapshot​Support

public enum SnapshotSupport  

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

Nested Types

SnapshotSupport.ImageFormat

The image format of the exported file.

Methods

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

public static func data(
        for scenario: Scenario,
        on device: SnapshotDevice,
        format: ImageFormat,
        scale: CGFloat = UIScreen.main.scale,
        keyWindow: UIWindow? = nil,
        viewPreprocessor: ((UIView) -> UIView)? = 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.

view​Preprocessor ((UIView) -> UIView)?

A closure to preprocess scenario UIView before generating snapshot.

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

public static func image(
        for scenario: Scenario,
        on device: SnapshotDevice,
        scale: CGFloat = UIScreen.main.scale,
        keyWindow: UIWindow? = nil,
        viewPreprocessor: ((UIView) -> UIView)? = 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.

view​Preprocessor ((UIView) -> UIView)?

A closure to preprocess scenario UIView before generating snapshot.