Run code in an app in Swift Playgrounds on iPad
In a SwiftUI app created in Swift Playgrounds, you don’t have to run the code to see what it does—the result of the code appears automatically in the App Preview on the right. If you make changes to the code, the App Preview is automatically updated to reflect your code changes.
Run an app full screen
You can run (or rerun) an app by tapping above the coding area. This runs the app in its own window, full screen.
To stop an app that’s running full screen, tap the red Swift button at the top right, then tap Stop.
You can also expand the app result to the full screen by tapping to expand the App Preview window.
Tap to return the App Preview to its previous size and location.
To return to the project window, tap at the top of the screen, then tap the thumbnail of the project window at the bottom of the screen.
If your code won’t run
Sometimes typos and other hard-to-spot bugs get introduced into code. These errors can cause your app or your App Preview to crash. If this happens, a panel appears, indicating the reason for the crash. You can click the Show Location button in the panel to see where your code crashed. Clicking the Show Backtrace button shows the hierarchy of function and method calls that resulted in the crash.
If you see in the toolbar, it indicates there are issues in your code that aren’t preventing the app from building.
If appears in the toolbar, you can tap it to see inline error messages next to your code.
You can tap either of these icons to see a list of the issues in your code.