LEARN SOMETHING NEW

Learn to code with Swift Playground

Anyone can make real apps – and have real fun.

As accessible as it is powerful, Swift Playground makes learning to code fun – no matter your age or experience. The app’s gamelike lessons will quickly have you leveling up in Swift, the programming language behind almost 1 million apps for iOS, iPadOS, macOS, tvOS, and watchOS. And you can even submit apps to the App Store right from within Swift Playground!

Here’s what you need to know about this versatile and intuitive learning tool.

Learn by playing

Launch the app and choose a playground – we recommend Get Started With Code. (If you don’t see it on the intro screen, click Learn to Code and download Get Started With Code from the gallery.) After you view the introduction, Swift Playground’s split window shows a videogame world inhabited by a cute one-eyed creature named Byte; on the left is the code area, where you enter Swift code to control Byte. Your task is to get Byte to travel across the colorful terrain and collect gems, enter portals, flip switches, and more. How? By putting the right commands in the right order, which is really what coding is all about.

Each lesson has a goal – which translates to a quest for Byte – that you’ll accomplish with the right bits of code.

For example, type moveForward(), then click Run My Code and watch Byte move forward. Congratulations, you’ve written your first program! (You can also enter Swift code by clicking specific commands – no typing required.)

Progress to Code Machine, Blu’s Adventure and other playgrounds as your skills improve. You’ll learn how to break a complex problem into small steps (a process called decomposition), dive into conditional statements and logical operators and explore other key topics. Before long, you’ll see how the apps you use every day employ the same simple commands you’ve learned.

Level up your skills

Ready to learn even more? Try Get Started With Apps to learn the basics of app development. Then head over to the App Gallery, where you can go deeper on topics like animating shapes, building an image gallery, and even creating panda memes!

You can create apps with Swift Playground – and submit them to the App Store!

Other topics include understanding and recognising gestures, building your own camera and creating an app of personal facts to introduce yourself.

Ready to go it alone? From the Playground screen, click “Create New App” to get a blank canvas on which to start from scratch.

Find the right command

Not sure which code or command to use? Smart Code Completion can help by suggesting commands and options relevant to the frameworks you’re using. Just select a bit of code to see the list.

Code anywhere

Sync your Swift Playground data with iCloud Drive to jump in whenever inspiration strikes – on Mac or iPad. You can also import Swift Playground projects into Xcode, the Mac app for professional app and game makers, to take advantage of Xcode’s advanced editing experience.

When you’re ready to take your ideas further, you can open your app playground in Xcode and use the same advanced editing tools used by the pros.

Share with a friend… or the world

When you’re ready to share your first (or next) app or game, you can send your code to a friend’s iPad or Mac using Mail, Messages or AirDrop; they can view – and edit – it in Swift Playground.

Want a broader audience? Use the App Store Connect website to create a product page, invite users to provide feedback using TestFlight and gain insights on how users are engaging with your app. When you’re ready, submit your creation to App Store Connect directly from Swift Playground.