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.
size
public var size: CGSize
The simulated size of this device.
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, *)
public 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(_:)
public 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, *)
public 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(_:)
public 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, *)
public 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(_:)
public 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, *)
public 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(_:)
public 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, *)
public 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(_:)
public 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, *)
public 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(_:)
public 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, *)
public 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(_:)
public 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, *)
public 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(_:)
public 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, *)
public 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(_:)
public 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, *)
public 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(_:)
public 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
.
iPadMini5th(_:style:)
@available(iOS 12.0, *)
public 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(_:)
public 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, *)
public 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(_:)
public 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, *)
public 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(_:)
public 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, *)
public 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(_:)
public 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
.