Instance Property

needsIndefiniteExecution

A Boolean value that indicates whether indefinite execution is enabled.

Declaration

var needsIndefiniteExecution: Bool { get set }

Discussion

By default, all top-level code is executed, and then execution is terminated. When working with asynchronous code, enable indefinite execution to allow execution to continue after the end of the playground’s top-level code is reached. This, in turn, gives threads and callbacks time to execute.

Editing the playground automatically stops execution, even when indefinite execution is enabled.

Set needsIndefiniteExecution to true to continue execution after the end of top-level code. set it to false to stop execution at that point.

The default value is false. It is set to true when liveView is set to a non-nil value.