跳转至
Structure

PreviewDevice

The simulator device that runs a preview.

Declaration

struct PreviewDevice : RawRepresentable, ExpressibleByStringLiteral

Overview

Refer to a preview device by its name as shown Xcode's run destination menu, like "iPhone X", or using a model number, like "iPad8,1".

The full list of device names is here:

  • iPhone 4s
  • iPhone 5
  • iPhone 5s
  • iPhone 6 Plus
  • iPhone 6
  • iPhone 6s
  • iPhone 6s Plus
  • iPhone SE (1st generation)
  • iPhone 7
  • iPhone 7 Plus
  • iPhone 8
  • iPhone 8 Plus
  • iPhone X
  • iPhone Xs
  • iPhone Xs Max
  • iPhone Xʀ
  • iPhone 11
  • iPhone 11 Pro
  • iPhone 11 Pro Max
  • iPhone SE (2nd generation)
  • iPhone 12 mini
  • iPhone 12
  • iPhone 12 Pro
  • iPhone 12 Pro Max
  • iPod touch (7th generation)
  • iPad 2
  • iPad Retina
  • iPad Air
  • iPad mini 2
  • iPad mini 3
  • iPad mini 4
  • iPad Air 2
  • iPad Pro (9.7-inch)
  • iPad Pro (12.9-inch) (1st generation)
  • iPad (5th generation)
  • iPad Pro (12.9-inch) (2nd generation)
  • iPad Pro (10.5-inch)
  • iPad (6th generation)
  • iPad (7th generation)
  • iPad Pro (11-inch) (1st generation)
  • iPad Pro (12.9-inch) (3rd generation)
  • iPad Pro (11-inch) (2nd generation)
  • iPad Pro (12.9-inch) (4th generation)
  • iPad mini (5th generation)
  • iPad Air (3rd generation)
  • iPad (8th generation)
  • iPad Air (4th generation)
  • Apple TV
  • Apple TV 4K
  • Apple TV 4K (at 1080p)
  • Apple Watch - 38mm
  • Apple Watch - 42mm
  • Apple Watch Series 2 - 38mm
  • Apple Watch Series 2 - 42mm
  • Apple Watch Series 3 - 38mm
  • Apple Watch Series 3 - 42mm
  • Apple Watch Series 4 - 40mm
  • Apple Watch Series 4 - 44mm
  • Apple Watch Series 5 - 40mm
  • Apple Watch Series 5 - 44mm
  • Apple Watch SE - 40mm
  • Apple Watch SE - 44mm
  • Apple Watch Series 6 - 40mm
  • Apple Watch Series 6 - 44mm

Availability

iOS 13.0+

macOS 10.15+

tvOS 13.0+

watchOS 6.0+

Topics


Initializer

init(rawValue:) Creates a new instance with the specified raw value.

init(stringLiteral:) Creates an instance initialized to the given string value.


Type Alias

ExtendedGraphemeClusterLiteralType A type that represents an extended grapheme cluster literal.

RawValue The raw type that can be used to represent all values of the conforming type.

StringLiteralType A type that represents a string literal.

UnicodeScalarLiteralType A type that represents a Unicode scalar literal.


Instance Property

rawValue The corresponding value of the raw type.