Protocol

PlaygroundLiveViewSafeAreaContainer

A protocol that ensures that views fit without obstruction within the Swift Playgrounds user interface.

Declaration

protocol PlaygroundLiveViewSafeAreaContainer : AnyObject

Overview

This protocol provides liveViewSafeAreaGuide, a layout guide set to the safe area. The safe area is the part of the live view that isn't covered by any Swift Playgrounds user interface elements like the Run button. You use this property to constrain the bounds of your content view inside the bounds of the safe area, which depend on how you set the LiveViewEdgeToEdge key for the current page. When this key is set to NO, the safe area is exactly the same as the live view area. When the key is set to YES, the safe area can be smaller than the live view area.

Side-by-side screenshots showing how the safe area can be larger or smaller depending on how you set the LiveViewEdgeToEdge key.

Topics

Accessing the Layout Guide

var liveViewSafeAreaGuide: UILayoutGuide

A layout guide you use to position content so that it's unobstructed by the Swift Playgrounds user interface.

Required. Default implementations provided.

See Also

Live Views

protocol PlaygroundLiveViewable

A protocol that displays an instance as a live view in a playground.

enum PlaygroundLiveViewRepresentation

The supported types for displaying for live views in playgrounds.

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