Learning to code isn’t supposed to be this fun. Apple’s new Swift Playgrounds app for iPads running iOS 10 is aimed at teaching the Swift programming language to middle-school-age children and adults, no coding experience necessary. But it feels like a puzzle game—one that just happens to be solved with commands and functions and For loops, instead of with a slingshot full of birds.
And I’m totally hooked. In fact, Swift Playgrounds is my favorite thing to come out of this year’s WWDC by far, and I think it’s going to be one of the highlights of iOS 10 when it’s released this fall.
You can try out the free Swift Playgrounds app today by putting the iOS 10 public beta on a compatible iPad (fourth-generation or later). The app is automatically added to your home screen when you join the beta, but when iOS 10 launches this fall, Swift Playgrounds will be a free download from the App Store.
When you fire it up, you’ll see a Featured section with lesson packs named Learn to Code 1: Fundamentals of Swift, and then Learn to Code 2: Beyond the Basics. Below that are the Challenges, starting with Drawing Sounds and Blink. More lesson packs and challenges will be added over time, and the lessons are RSS-based, so Apple can add new content without having to update the app itself.
Learn to Code 1 and two Challenges are available now, with Learn to Code 2 and more playgrounds coming later.
Downloading a lesson pack or challenge adds it to the My Playgrounds tab, which looks like the shelf in iBooks. You can create new playgrounds too, or download them from other sources. For example, Apple made a Sphero playground to demo at WWDC, showing how Swift Playgrounds can use all of the iPad’s hardware and software features, in this case connecting via Bluetooth and issuing commands to a Sphero robotic ball. Sphero could actually make its own playground and distribute it on its own site, explained Wiley Hodges, Apple's director of tools and technologies product marketing.
From this shelf, you can also duplicate a playground or reset it. Say your child is halfway through a lesson her little sister wants to try, too. You can duplicate the playground to make a copy, then reset the copy to its original state. (Swift Playgrounds will also work with the classroom-management features Apple added for teachers in iOS 9.3.)
Learning to code
Since I had no Swift experience, I plunged right in to Learn to Code 1, which assumes no prior knowledge. A friendly cut-scene introduces each new topic and explains it in a way anyone can understand. The first group of lessons, for example, covers basic commands, so the cut-scene makes the analogy that these are like following a recipe or set of instructions. Later, when introducing For loops, the analogy is breaking down a task like planting a flower garden into small steps you’ll repeat over and over.
Sign up for MIS Asia eNewsletters.