Teaching Code with
Swift Playgrounds
Learning to code helps students build confidence and problem‑solving skills. It starts with Swift Playgrounds, the app that takes learners from their first line of code to building their first app.
Learn how to use Swift Playgrounds.
Download the Swift Playgrounds app on either iPad or Mac to get started.
Get Swift PlaygroundsPro tips:
- Turn on iCloud Drive to continue working on your app playgrounds from multiple devices.
- If you’re using iPad to view the Learning Center or Keynote and Swift Playgrounds at the same time, tap the Multitasking button Multitasking button at the top of the screen to use Slide Over or Split View.
Learn more about multitasking
iPad screen with More Playgrounds open showing multiple app playgrounds in the Learn to Code & Build Apps section, App Gallery section and Extend Your App section Learn to Code & Build Apps section includes tutorials that teach app-building basics App Gallery section includes example app playgrounds with built-in guides that explain how code works and how to edit code to personalise samples Extend Your App section includes playgrounds that help you learn different app features, like responding to gestures, to prepare you to create apps of your own - elapsed 00:00 44:44remaining 00:00 -44:44LiveLive StreamingThe video could not be played.
iPad screen with My App playground open, code editor with CircleView selected, lines of code in the code editor panel on the left, and a large green circle with a black tick in the preview panel on the right To close your project and return to the My Playgrounds page, tap the Back button To run your app full-screen, tap the Play button. To stop or rerun your app, tap the Swift logo in the toolbar To select the view you want to see, tap the name of the view above the App Preview panel Write and edit code in the code editor panel on the left Preview your work in the App Preview panel on the right. App Preview automatically updates when you edit code Swift Playgrounds teaches Swift and SwiftUI, the programming technologies created by Apple and used by professionals to build many of today’s most popular apps.
You can add SwiftUI controls, views, modifiers, symbols and colours from the library by tapping the icons in the toolbar above the coding area.
Views
Modifiers
Symbols
Colours
Note: If your screen space is limited — for example, if you’re working in multiple windows in Split View — the icons may be replaced by a plus sign Plus sign.
iPad screen with My App playground open, sidebar open on the left and the App Settings menu open To open or close the left sidebar, where you can find files and assets, tap the Sidebar button To add a new file or asset, tap the Add Asset button in the sidebar. Adding a new asset, such as an image, will create a new folder named Assets To edit the name, accent colour, app icon and capabilities of your app, tap App Settings in the sidebar to open the menu iPad screen with the About Me playground open, code editor with ContentView selected, lines of code in the code editor panel on the left and Guide open in the panel on the right To show or hide the guide, tap the Guide button To show or hide the app preview, tap the Preview button The guide appears in the panel on the right after tapping the Guide button iPad screen with the About Me playground open, code editor with HomeView selected, Customise Home tab instructions open over code editor panel on the left, and Guide open in the panel on the right showing walkthroughs and experiments for the Home tab and Story tab Ticks next to walkthroughs and experiments in the guide help you keep track of what you’ve completed Blue character in the guide indicates tasks and suggestions to edit code Expert character in the guide indicates code walkthrough There are several options for sharing your app playgrounds with other people. Tap the app name in the toolbar, then tap the Share button to bring up the share sheet.
iPad screen with the My App playground open and the Share menu open over the code editor panel To share via AirDrop, tap the AirDrop icon in the Share menu To share via Mail or other communication apps, tap the Mail icon in the Share menu To share via the Schoolwork app, tap the Schoolwork icon in the Share menu On a Mac, you can install your app playgrounds in the Applications folder. See Help in Swift Playgrounds for detailed directions.
If you’re ready for a more advanced app development tool, you can open your app playgrounds in Xcode and continue editing.
Get Xcode for Mac