How do I use Swift Playgrounds on my iPad?

Swift Playgrounds is a new app for the iPad designed to bring Swift programming to the iPad. 

Aimed principally at children, Swift Playgrounds is designed to make learning to code easier, and more fun. Here, we explain what Swift Playground is and how to use Swift Playgrounds to learn coding and app development.

"Everyone should have the opportunity to learn coding, and we are excited to bring Swift Playgrounds to the next generation of programmers looking for a fun and easy way to explore key coding concepts using real code," said Craig Federighi, Apple's senior vice president of Software Engineering. "More than 100 schools around the world have already committed to adding Swift Playgrounds to their [autumn] curriculum, and we can't wait to see what students create with it."

Released alongside iOS 10, Swift Playgrounds is a standalone app that can be downloaded from the App Store.

Read next: How to install iOS 10 on an iPhone or iPad

In Swift Playgrounds, Apple says: "Technology has a language. It's called code. And we believe coding is an essential skill. Learning to code teaches you how to solve problems and work together in creative ways. And it helps you build apps that bring your ideas to life.

"We think everyone should have the opportunity to create something that can change the world. So we've designed a new approach to coding that lets anyone learn, write, and teach it."

Swift Playgrounds Byte character

See also:

How to use Swift Playgrounds: What is a playground?

How to use Swift Playgrounds on iPad

Developers will already be familiar with the term Playground as this is a feature found inside Xcode (the professional development environment used to create apps) Like Playground in Xcode, Swift Playgrounds is a place where people can experiment with code.

The Swift Playgrounds apps for iPad goes far beyond using an Xcode Playground. As well as being an experimental area for trying out code, it features interactive tutorials where you control a character in a 3D world using code.

In Swift Playgrounds, you'll control a character called "Byte", a giant orange cartoon character with a single eye and yellow trunks (he reminds us of Earl, from the cult 1990s videogame ToeJam & Earl).

You issue commands to Byte, such as moveForward() and turnLeft(). Implementing these commands, along with loop and conditionals, enables you to guide Byte around each level.

Beyond the tutorials, you will also be able to use Swift Playgrounds to build your simple programs. These can interact with iPad technology, such as the built-in camera, microphone, touch display and accelerometer.

We're not sure how advanced the features available in Swift Playgrounds will let you go. But it could be possible to build simple games in Swift Playgrounds.

Interestingly, you can take an app built in Swift Playgrounds and export it to Xcode. So Swift Playgrounds could serve as a digital sketchpad for Swift programmers, as well as a teaching aid.

How to use Swift Playgrounds: How can I learn to use Swift Playgrounds?

How to use Swift Playgrounds

When you first open Swift Playgrounds you'll be taken through an introduction and then to the Playgrounds window. Two tabs are available:

  • Featured
  • My Playgrounds

Tap featured and you will see a number of beginner courses:

  • Learn to code 1: Fundamentals of Swift
  • Learn to code 2: Beyond the Basics
  • Drawing Sounds
  • Blink

The first two are where you'll spend your time to begin with. Tap on Learn to Code 1 and it will open a window pane. Tap Get to download the course (it downloads like a book would in iBooks).

How to use Swift Playgrounds: Entering code in Swift Playgrounds

When the course has finished downloading, tap on Open or My Playgrounds to locate it. You now switch to the main programming interface. On the left is instructions and code, and on the right is a virtual interface displaying the Byte character.

How to use Swift Playgrounds: Playgrounds Byte

Read the instructions and add code to the section on the left, then tap Run My Code. Byte will make his move, and hopefully get the gems and make it through the level. As you continue through the courses, the code and programs become more complex:

How to use Swift Playgrounds: Byte first variable in Swift Playgrounds

It should be simple enough for parents, and teachers, to use Swift Playgrounds, and Apple has created a guide, also called "Swift Playgrounds."

Swift Playgrounds is now available on the iBooks Store. It's designed for teachers to use in middle school and above. Swift Playgrounds sets some lesson plans for teachers, along with additional information and support.

Each chapter has an activity for children to follow, such as hiding an object in the classroom and writing instructions for a student to follow to find the hidden object. These then tie into the Swift tutorials so children can learn how they relate to computer code.

Tim Cook talks about ConnectED

Swift Playgrounds being used in classroom

Apple has also announced another new app called Classroom. With Classroom, a teach can control a classroom full of iPads from a single device. Teachers can open web pages, and apps on all devices in the class, or lock all the devices at the end of a class.

Another idea is that students work on an iPad, and teachers can monitor the work remotely. And teachers can also lock apps, and manage devices.

Work created by students can be displayed directly from an iPad on an Apple TV with the class. 

It's clear that Apple wants to see more iPad use in classrooms, and has joined President Obama's ConnectEd program and pledged $100 million of teaching and learning resources to 114 under-served schools. Apple is donating an iPad to every student, a Mac and iPad to every teacher and an Apple TV to every classroom.

ConnectEd's goal is to connect 99 percent of all students to cutting edge technology. "I wouldn't be where I am today," said Tim Cook, Apple CEO, "without a great public education. 

"Kids today are born in a digital world, but too many kids, when it comes time for the 8 o'clock bell to ring, go back to an analogue world. It's not engaging." See also: How to learn Swift and write apps for iPhone