Protocol

PreviewProvider

A type that produces view previews in Xcode.

Declaration

protocol PreviewProvider

Overview

Xcode statically discovers types that conform to the PreviewProvider protocol in your app, and generates previews for each provider it discovers.

Topics

Setting the Type

associatedtype Previews

The type to preview.

Required.

Generating Previews

static var platform: PreviewPlatform?

The platform on which to run the provider.

Required. Default implementation provided.

static var previews: Self.Previews

Generates a collection of previews.

Required.

Beta Software

This documentation contains preliminary information about an API or technology in development. This information is subject to change, and software implemented according to this documentation should be tested with final operating system software.

Learn more about using Apple's beta software