Guides and Sample Code


Playground Book Format Reference

On This Page

PlaygroundLiveViewable Protocol

A type that can be displayed as the live view for a playground.


This protocol enables you to display any type of object in a live view. For example, a playground that presents a simplified user interface programming environment can make its view-like type conform to PlaygroundLiveViewable and appear in the live view.

By default, UIView and UIViewController conform to this protocol on iOS. Implement this protocol only for custom objects that do not inherit from UIView or UIViewController.

Instance Properties


The view controller or view used to render and manage the live view.


  1. var playgroundLiveViewRepresentation: PlaygroundLiveViewRepresentation { get }

Return value

A view controller or view that renders and manages the live view. View controllers are preferred.


The value returned by playgroundLiveViewRepresentation can be different each time the method is called.