Instance Method インスタンスメソッド

previewLayout(_:)

Overrides the size of the container for the preview. プレビューに対するコンテナの大きさをオーバーライドします。

Declaration 宣言

func previewLayout(_ value: PreviewLayout) -> some View

Return Value 戻り値

A preview that uses the given layout.

Parameters パラメータ

value

A layout to use for preview.

Discussion 議論

By default, previews use the PreviewLayout.device layout, which places the view inside a visual representation of the chosen device. You can instead tell a preview to use a different layout by choosing one of the PreviewLayout values, like PreviewLayout.sizeThatFits:


struct CircleImage_Previews: PreviewProvider {
    static var previews: some View {
        CircleImage()
            .previewLayout(.sizeThatFits)
    }
}

See Also 参照

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