Previews in Xcode Xcodeでプレビューする

Generate dynamic, interactive previews of your custom views. あなたのあつらえのビューの動的な、相互作用するプレビューを生成します。

Overview 概要

When you create a custom View with SwiftUI, Xcode can display a preview of the view’s content that stays up to date as you make changes to the view’s code. You define a structure that conforms to the PreviewProvider protocol to tell Xcode what to display. Xcode shows the preview in a canvas beside your code.

A screenshot of Xcode showing code that draws a circular image and the

You can use view modifiers to configure the preview, including a set of preview-specific modifiers, like previewDevice(_:) and previewInterfaceOrientation(_:). Xcode also reflects changes that you make in the canvas back into your code. For tips on working with the canvas, see the Creating and Combining Views tutorial.

Topics 話題

Preview Creation プレビュー作成

Preview Customization プレビューカスタマイゼーション

Preview Contexts

See Also 参照

Tool Support