Learn to code in Swift Playgrounds on Mac
If you don’t know how to code, you can start with the playgrounds and tutorial apps in the Learn to Code & Build Apps section. They’re designed to help you learn the basics of coding and prepare you to create apps of your own.
Note: If you have macOS 12.4 or later, you can create and use app projects in Swift Playgrounds. If you have macOS 11.7–12.3, you can create and use playgrounds, but you can’t create and use apps.
In the Swift Playgrounds app on your Mac, go to the More Playgrounds screen.
If you’re on the My Playgrounds screen, click See All near the bottom right.
If you’re working in a playground or an app project, choose Window > My Playgrounds, then click See All near the bottom right.
Click an app or playground in the Learn to Code & Build Apps section to view a description.
These tutorial playgrounds are especially helpful for learning to code:
Get Started with Code: Learn the basics of coding through fun, interactive lessons. Help a character navigate a beautiful 3D world by writing code in Swift, the programming language used by millions of developers around the world to create apps. Learn coding concepts, like variables, loops, conditionals, and functions.
Learn to Code 1 and Learn to Code 2: Practice writing Swift code through a series of lessons, each of which focuses on a different coding concept and builds on what you’ve learned. Some of these lessons are also in Get Started with Code, and they reinforce what you learned there.
Click to return to the More Playgrounds screen, then click Get to download the app to your Mac.
Double-click the app or playground to open it.
The playgrounds Get Started with Code, Learn to Code 1, and Learn to Code 2 are made up of chapters, each of which teaches a coding concept, starting with an introduction.
To see the chapters and pages when you’re in these playgrounds, click to open the left sidebar. (Clicking it again closes the sidebar.)
To learn about a coding concept, click the Introduction in the chapter about that concept. Click at the bottom of the window to page through the introduction. When you’re ready to try adding your own code, click Start Coding at the end of the introduction.