Generated from iOS SDK 27.1. Availability is shown on each declaration; permissions and entitlements still apply.
Functions and constants
static · iOS 17.0+fixedLayout
TypeScriptstatic fixedLayout(width: number, height: number): Promise<PreviewTrait<Preview_ViewTraits>>
Swift declaration@MainActor static func fixedLayout(width: CGFloat, height: CGFloat) -> PreviewTrait<T>
Center the preview in a fixed size container with the given dimensions.
This is the same as ``PreviewLayout/fixed(width:height:)``.
get · iOS 17.0+defaultLayout
TypeScriptstatic get defaultLayout(): Promise<PreviewTrait<Preview_ViewTraits>>
Swift declaration@MainActor static var defaultLayout: PreviewTrait<Preview.ViewTraits> { get }
Center the preview in a container the size of the device on which the
preview is running.
This is the same as the ``PreviewLayout/device`` layout, and is the
default if you don't specify a layout trait.
get · iOS 17.0+landscapeLeft
TypeScriptstatic get landscapeLeft(): Promise<PreviewTrait<Preview_ViewTraits>>
Swift declaration@MainActor static var landscapeLeft: PreviewTrait<Preview.ViewTraits> { get }
The device is in landscape mode, with the top of the device on the left.
This is the same as
<doc://com.apple.documentation/documentation/SwiftUI/InterfaceOrientation/landscapeLeft>.
get · iOS 17.0+landscapeRight
TypeScriptstatic get landscapeRight(): Promise<PreviewTrait<Preview_ViewTraits>>
Swift declaration@MainActor static var landscapeRight: PreviewTrait<Preview.ViewTraits> { get }
The device is in landscape mode, with the top of the device on the right.
This is the same as
<doc://com.apple.documentation/documentation/SwiftUI/InterfaceOrientation/landscapeRight>.
get · iOS 26.0+assistiveAccess
TypeScriptstatic get assistiveAccess(): Promise<PreviewTrait<Preview_ViewTraits>>
Swift declaration@MainActor static var assistiveAccess: PreviewTrait<Preview.ViewTraits> { get }
Apply the visual style used in Assistive Access on iOS and iPadOS.
On other platforms, this is a no-op.
get · iOS 17.0+portraitUpsideDown
TypeScriptstatic get portraitUpsideDown(): Promise<PreviewTrait<Preview_ViewTraits>>
Swift declaration@MainActor static var portraitUpsideDown: PreviewTrait<Preview.ViewTraits> { get }
The device is in portrait mode, but is upside down.
This is the same as
<doc://com.apple.documentation/documentation/SwiftUI/InterfaceOrientation/portraitUpsideDown>.
get · iOS 17.0+sizeThatFitsLayout
TypeScriptstatic get sizeThatFitsLayout(): Promise<PreviewTrait<Preview_ViewTraits>>
Swift declaration@MainActor static var sizeThatFitsLayout: PreviewTrait<Preview.ViewTraits> { get }
Fit the container to the size of the preview when offered the size of
the device that the preview is running on.
This is the same as ``PreviewLayout/sizeThatFits``.
get · iOS 17.0+portrait
TypeScriptstatic get portrait(): Promise<PreviewTrait<Preview_ViewTraits>>
Swift declaration@MainActor static var portrait: PreviewTrait<Preview.ViewTraits> { get }
The device is in portrait mode, with the top of the device on top.
This is the same as
<doc://com.apple.documentation/documentation/SwiftUI/InterfaceOrientation/portrait>
and is the default orientation if you don't specify one.
static · iOS 18.0+buildBlock
TypeScriptstatic buildBlock(content: unknown): unknown
Swift declarationstatic func buildBlock(_ content: Content) -> Content
static · iOS 17.0+buildBlock
TypeScriptstatic buildBlock(arg0: unknown): unknown
Swift declarationstatic func buildBlock(_: Content) -> Content