Enter code in an app playground in Swift Playgrounds on iPad
You can enter or edit code in an app playground by tapping in the coding area and typing. As you type, suggestions for completing your code appear. To accept a suggestion, tap it.
You can also add Swift files, Swift packages, and more in your app playgrounds. To see these items in an app playground, tap at the top left. See Add Swift files, images, and more to an app playground.
You can add SwiftUI controls, views, symbols, colors, and more from the built-in libraries by tapping the icons in the toolbar above the coding area.
Note: If your screen space is limited (for example, if you’re working in multiple windows in Split View), the icons shown below may be replaced by .
Tap to add a view or a control from the Views Library.
Tap to add a control, an effect, a layout, text, an image, a list, and more from the Modifiers Library.
Tap to add a symbol from the Symbols Library.
Tap to add colors from the Colors Library.
Customize the toolbar
You can customize the toolbar at the top of the Swift Playgrounds screen by adding or removing buttons.
In an open app playground in the Swift Playgrounds app on your iPad, tap at the top right.
Choose Customize Toolbar, then drag a button from the Customize window to the toolbar.
Tap Done.
Enter code
In an app playground you create, or in a sample app playground from the App Gallery, you can enter code.
In the Swift Playgrounds app on your iPad, open an app playground you created, or open a sample app playground from the App Gallery on the More Playgrounds screen.
Tap in the app playground’s coding area and start typing.
Note: If you don’t want to change existing code, you can add a Swift file and enter code in it.
If code completion suggestions appear as you type, you can accept them by tapping them.
To turn off the line numbers to the left of your code, tap , then choose Hide Line Numbers.
(Line numbers appear in the coding area by default.)
See the Swift Playgrounds developer documentation to learn about writing code for app playgrounds, using sample code, and creating and sharing learning experiences in Swift Playgrounds.
Search across your project files
While you’re entering code, you can search for text across all the files in your app playground to find places where you might want to make changes.
In the app playground you’re working in, open the left sidebar (if it’s not already open) by tapping at the top left.
In the Find field at the top of the sidebar, enter the text you want to find, then tap Return (or Search) on the onscreen keyboard.