---
title: needsIndefiniteExecution
framework: playgroundsupport
role: symbol
role_heading: Instance Property
path: playgroundsupport/playgroundpage/1964501-needsindefiniteexecution
---

# needsIndefiniteExecution

A Boolean value that indicates whether indefinite execution is enabled.

## Declaration

```swift
final var needsIndefiniteExecution: Bool { get set }
```

```swift
var needsIndefiniteExecution: Bool { get set }
```

## Discussion

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. With a traditional live view, editing the playground automatically stops execution, even when indefinite execution is enabled. When using the always-on live view, execution continues whether or not 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's set to true when liveView is set to a non-nil value.

## See Also

### Configuring Execution

- [executionMode](playgroundsupport/playgroundpage/3029561-executionmode.md)
- [PlaygroundPage.ExecutionMode](playgroundsupport/playgroundpage/executionmode.md)
- [finishExecution()](playgroundsupport/playgroundpage/1964505-finishexecution.md)
