Enumeration
SnapshotSupport
public enum SnapshotSupport
A namespace for the methods supporting to generate snapshot from scenarios.
Relationships
Nested Types
SnapshotSupport.ImageFormat
The image format of the exported file.
Methods
data(for:on:format:scale:keyWindow:viewPreprocessor: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
Name | Type | Description |
---|---|---|
scenario | Scenario |
A scenario to be snapshot. |
device | SnapshotDevice |
A snapshot environment simulating device. |
format | ImageFormat |
An image file format of exported data. |
scale | CGFloat |
A rendering scale of the snapshot image. |
keyWindow | UIWindow? |
The key window of the application. |
handler | @escaping (Data) -> Void |
A closure that to handle generated data. |
viewPreprocessor | ((UIView) -> UIView)? |
A closure to preprocess scenario UIView before generating snapshot. |
image(for:on:scale:keyWindow:viewPreprocessor: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
Name | Type | Description |
---|---|---|
scenario | Scenario |
A scenario to be snapshot. |
device | SnapshotDevice |
A snapshot environment simulating device. |
scale | CGFloat |
A rendering scale of the snapshot image. |
keyWindow | UIWindow? |
The key window of the application. |
handler | @escaping (UIImage) -> Void |
A closure that to handle generated |
viewPreprocessor | ((UIView) -> UIView)? |
A closure to preprocess scenario UIView before generating snapshot. |