Structure
SnapshotDevice
public struct SnapshotDevice
The device representation for simulating environments of each device such as size, orientation, safe area, trait collection, or dark mode appearance.
Relationships
Nested Types
SnapshotDevice.Orientation
Represents the orientation of a device.
Initializers
init(name:size:safeAreaInsets:traitCollection:)
public init(
name: String,
size: CGSize,
safeAreaInsets: UIEdgeInsets = .zero,
traitCollection: UITraitCollection = UITraitCollection()
)
Creates a new custom device simulation.
Parameters
Name | Type | Description |
---|---|---|
name | String |
A name that to be used as a directory name of snapshots. |
size | CGSize |
A simulated device size. |
safeAreaInsets | UIEdgeInsets |
A simulated safe area insets. |
traitCollection | UITraitCollection |
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.
safeAreaInsets
public var safeAreaInsets: UIEdgeInsets
The simulated safe area insets of this device.
traitCollection
public var traitCollection: UITraitCollection
The simulated trait collection of this device.
Methods
addingTraitCollection(_:)
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
.
iPhoneSE(_:style:)
@available(iOS 12.0, *)
static func iPhoneSE(_ orientation: Orientation, style: UIUserInterfaceStyle) -> SnapshotDevice
iPhone SE
simulated device.
Parameters
Name | Type | Description |
---|---|---|
orientation | Orientation |
A simulated orientation. |
style | UIUserInterfaceStyle |
A theme of UI appearance. |
Returns
A device simulated the iPhone SE
.
iPhoneSE(_:)
static func iPhoneSE(_ orientation: Orientation) -> SnapshotDevice
iPhone SE
simulated device.
Parameters
Name | Type | Description |
---|---|---|
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
Name | Type | Description |
---|---|---|
orientation | Orientation |
A simulated orientation. |
style | UIUserInterfaceStyle |
A theme of UI appearance. |
Returns
A device simulated the iPhone 8
.
iPhone8(_:)
static func iPhone8(_ orientation: Orientation) -> SnapshotDevice
iPhone 8
simulated device.
Parameters
Name | Type | Description |
---|---|---|
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
Name | Type | Description |
---|---|---|
orientation | Orientation |
A simulated orientation. |
style | UIUserInterfaceStyle |
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
Name | Type | Description |
---|---|---|
orientation | Orientation |
A simulated orientation. |
Returns
A device simulated the iPhone 8 Plus
.
iPhoneX(_:style:)
@available(iOS 12.0, *)
static func iPhoneX(_ orientation: Orientation, style: UIUserInterfaceStyle) -> SnapshotDevice
iPhone X
simulated device.
Parameters
Name | Type | Description |
---|---|---|
orientation | Orientation |
A simulated orientation. |
style | UIUserInterfaceStyle |
A theme of UI appearance. |
Returns
A device simulated the iPhone X
.
iPhoneX(_:)
static func iPhoneX(_ orientation: Orientation) -> SnapshotDevice
iPhone X
simulated device.
Parameters
Name | Type | Description |
---|---|---|
orientation | Orientation |
A simulated orientation. |
Returns
A device simulated the iPhone X
.
iPhoneXS(_:style:)
@available(iOS 12.0, *)
static func iPhoneXS(_ orientation: Orientation, style: UIUserInterfaceStyle) -> SnapshotDevice
iPhone XS
simulated device.
Parameters
Name | Type | Description |
---|---|---|
orientation | Orientation |
A simulated orientation. |
style | UIUserInterfaceStyle |
A theme of UI appearance. |
Returns
A device simulated the iPhone XS
.
iPhoneXS(_:)
static func iPhoneXS(_ orientation: Orientation) -> SnapshotDevice
iPhone XS
simulated device.
Parameters
Name | Type | Description |
---|---|---|
orientation | Orientation |
A simulated orientation. |
Returns
A device simulated the iPhone XS
.
iPhoneXR(_:style:)
@available(iOS 12.0, *)
static func iPhoneXR(_ orientation: Orientation, style: UIUserInterfaceStyle) -> SnapshotDevice
iPhone XR
simulated device.
Parameters
Name | Type | Description |
---|---|---|
orientation | Orientation |
A simulated orientation. |
style | UIUserInterfaceStyle |
A theme of UI appearance. |
Returns
A device simulated the iPhone XR
.
iPhoneXR(_:)
static func iPhoneXR(_ orientation: Orientation) -> SnapshotDevice
iPhone XR
simulated device.
Parameters
Name | Type | Description |
---|---|---|
orientation | Orientation |
A simulated orientation. |
Returns
A device simulated the iPhone XR
.
iPhoneXSMax(_:style:)
@available(iOS 12.0, *)
static func iPhoneXSMax(_ orientation: Orientation, style: UIUserInterfaceStyle) -> SnapshotDevice
iPhone XS Max
simulated device.
Parameters
Name | Type | Description |
---|---|---|
orientation | Orientation |
A simulated orientation. |
style | UIUserInterfaceStyle |
A theme of UI appearance. |
Returns
A device simulated the iPhone XS Max
.
iPhoneXSMax(_:)
static func iPhoneXSMax(_ orientation: Orientation) -> SnapshotDevice
iPhone XS Max
simulated device.
Parameters
Name | Type | Description |
---|---|---|
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
Name | Type | Description |
---|---|---|
orientation | Orientation |
A simulated orientation. |
style | UIUserInterfaceStyle |
A theme of UI appearance. |
Returns
A device simulated the iPhone 11
.
iPhone11(_:)
static func iPhone11(_ orientation: Orientation) -> SnapshotDevice
iPhone 11
simulated device.
Parameters
Name | Type | Description |
---|---|---|
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
Name | Type | Description |
---|---|---|
orientation | Orientation |
A simulated orientation. |
style | UIUserInterfaceStyle |
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
Name | Type | Description |
---|---|---|
orientation | Orientation |
A simulated orientation. |
Returns
A device simulated the iPhone 11 Pro
.
iPhone11ProMax(_:style:)
@available(iOS 12.0, *)
static func iPhone11ProMax(_ orientation: Orientation, style: UIUserInterfaceStyle) -> SnapshotDevice
iPhone 11 Pro Max
simulated device.
Parameters
Name | Type | Description |
---|---|---|
orientation | Orientation |
A simulated orientation. |
style | UIUserInterfaceStyle |
A theme of UI appearance. |
Returns
A device simulated the iPhone 11 Pro Max
.
iPhone11ProMax(_:)
static func iPhone11ProMax(_ orientation: Orientation) -> SnapshotDevice
iPhone 11 Pro Max
simulated device.
Parameters
Name | Type | Description |
---|---|---|
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
Name | Type | Description |
---|---|---|
orientation | Orientation |
A simulated orientation. |
style | UIUserInterfaceStyle |
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
Name | Type | Description |
---|---|---|
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
Name | Type | Description |
---|---|---|
orientation | Orientation |
A simulated orientation. |
style | UIUserInterfaceStyle |
A theme of UI appearance. |
Returns
A device simulated the iPhone 12
.
iPhone12(_:)
static func iPhone12(_ orientation: Orientation) -> SnapshotDevice
iPhone 12
simulated device.
Parameters
Name | Type | Description |
---|---|---|
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
Name | Type | Description |
---|---|---|
orientation | Orientation |
A simulated orientation. |
style | UIUserInterfaceStyle |
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
Name | Type | Description |
---|---|---|
orientation | Orientation |
A simulated orientation. |
Returns
A device simulated the iPhone 12 Pro
.
iPhone12ProMax(_:style:)
@available(iOS 12.0, *)
static func iPhone12ProMax(_ orientation: Orientation, style: UIUserInterfaceStyle) -> SnapshotDevice
iPhone 12 Pro Max
simulated device.
Parameters
Name | Type | Description |
---|---|---|
orientation | Orientation |
A simulated orientation. |
style | UIUserInterfaceStyle |
A theme of UI appearance. |
Returns
A device simulated the iPhone 12 Pro Max
.
iPhone12ProMax(_:)
static func iPhone12ProMax(_ orientation: Orientation) -> SnapshotDevice
iPhone 12 Pro Max
simulated device.
Parameters
Name | Type | Description |
---|---|---|
orientation | Orientation |
A simulated orientation. |
Returns
A device simulated the iPhone 12 Pro Max
.
iPadMini5th(_:style:)
@available(iOS 12.0, *)
static func iPadMini5th(_ orientation: Orientation, style: UIUserInterfaceStyle) -> SnapshotDevice
iPad Mini 5th generation
simulated device.
Parameters
Name | Type | Description |
---|---|---|
orientation | Orientation |
A simulated orientation. |
style | UIUserInterfaceStyle |
A theme of UI appearance. |
Returns
A device simulated the iPad Mini 5th generation
.
iPadMini5th(_:)
static func iPadMini5th(_ orientation: Orientation) -> SnapshotDevice
iPad Mini 5th generation
simulated device.
Parameters
Name | Type | Description |
---|---|---|
orientation | Orientation |
A simulated orientation. |
Returns
A device simulated the iPad Mini 5th generation
.
iPadPro10_5(_:style:)
@available(iOS 12.0, *)
static func iPadPro10_5(_ orientation: Orientation, style: UIUserInterfaceStyle) -> SnapshotDevice
iPad Pro 10.5 inch
simulated device.
Parameters
Name | Type | Description |
---|---|---|
orientation | Orientation |
A simulated orientation. |
style | UIUserInterfaceStyle |
A theme of UI appearance. |
Returns
A device simulated the iPad Pro 10.5 inch
.
iPadPro10_5(_:)
static func iPadPro10_5(_ orientation: Orientation) -> SnapshotDevice
iPad Pro 10.5 inch
simulated device.
Parameters
Name | Type | Description |
---|---|---|
orientation | Orientation |
A simulated orientation. |
Returns
A device simulated the iPad Pro 10.5 inch
.
iPadPro11(_:style:)
@available(iOS 12.0, *)
static func iPadPro11(_ orientation: Orientation, style: UIUserInterfaceStyle) -> SnapshotDevice
iPad Pro 11
simulated device.
Parameters
Name | Type | Description |
---|---|---|
orientation | Orientation |
A simulated orientation. |
style | UIUserInterfaceStyle |
A theme of UI appearance. |
Returns
A device simulated the iPad Pro 11
.
iPadPro11(_:)
static func iPadPro11(_ orientation: Orientation) -> SnapshotDevice
iPad Pro 11
simulated device.
Parameters
Name | Type | Description |
---|---|---|
orientation | Orientation |
A simulated orientation. |
Returns
A device simulated the iPad Pro 11
.
iPadPro12_9(_:style:)
@available(iOS 12.0, *)
static func iPadPro12_9(_ orientation: Orientation, style: UIUserInterfaceStyle) -> SnapshotDevice
iPad Pro 12.9 inch
simulated device.
Parameters
Name | Type | Description |
---|---|---|
orientation | Orientation |
A simulated orientation. |
style | UIUserInterfaceStyle |
A theme of UI appearance. |
Returns
A device simulated the iPad Pro 12.9 inch
.
iPadPro12_9(_:)
static func iPadPro12_9(_ orientation: Orientation) -> SnapshotDevice
iPad Pro 12.9 inch
simulated device.
Parameters
Name | Type | Description |
---|---|---|
orientation | Orientation |
A simulated orientation. |
Returns
A device simulated the iPad Pro 12.9 inch
.