"This is cool."
With those three words from my 11-year-old son, I knew Apple had a hit on its hands with Swift Playgrounds, its iPad app for learning the company's Swift programming language. We didn't exactly have to pry him away, but he had reached that just-one-more-level-before-dinner type of self-motivation that warms an educator's heart.
The app is free. So when Apple releases Swift Playgrounds on Tuesday in the App Store, I recommend giving it a try. It's geared for middle school kids, but adults can learn too -- it sucked me in. You'll need Apple's new iOS 10 software, also arriving Tuesday. And just so you know, some older iPads like the first-generation iPad Mini can't run it.
With Swift Playgrounds, Apple wanted to build a cool tool that gives people coding skills the company thinks are increasingly necessary in the 21st century, when technology bleeds into every corner of our work and personal lives. Of course, Apple would be happy to see tomorrow's coders equipped to create iPhone, iPad and Mac software with Apple's own programming tools. But Swift Playgrounds is good enough that you needn't be an Apple fanboy to benefit from it.
Why Swift Playgrounds works
Here's why it's good. First, it strips away the complexities of modern programming so you can get started quickly. Second, it gives you concrete programming tasks to accomplish, such as guiding an animated cartoon character through various puzzles involving gems, toggle switches and teleportation pads.
Next, it builds expertise with bite-sized lessons that gradually introduce new concepts while reinforcing what you already learned, and the lessons don't just peter out after the basics. Finally, it offers real code that lets you learn by tinkering. For example, what happens if I change the value of image.center.y from 11 to 15?
You may or may not agree with Apple that programming is a skill for everyone. After all, this is the company that tries to make phones and computers you don't have to be a computer science jock to operate.
But if you're at all interested in coding, Swift Playgrounds is the real deal. And Swift is not some academic's concept language. It's used by big-name apps from Strava, NBA, Slack, Sports Illustrated and Disney. Swift Playgrounds starts out cartoonish, but if you keep going far enough, you can move straight into Apple's Xcode developer tool. Apple thinks Swift itself is a lucid enough programming language to span the gamut.
Making Byte march
When programming, you type your code on the left side of the screen. Swift Playgrounds suggests contextually appropriate commands so you're not fishing through an entire glossary of options. If you construct a function called twoStepsForwardTurnAround(), that function will appear as a suggested option, too.
Your commands control a goofy character called Byte on the right side of the screen. Byte, or one of two other characters you can pick by tapping on them, wanders around the surface of an island floating in the sky. You can drag the scene around and pinch to zoom to get a better view of the environment.
Swift Playgrounds comes with an introductory module and one that's more advanced. There are also separate modules called challenges for those who want to look beyond Byte puzzles and basic shapes. Apple will periodically add new challenges to keep students coming back. The whole package works either for self-starters with about 25 hours of instruction or as part of a school curriculum with about 45 hours.
More than 100 schools will offer Swift Playgrounds classes, Apple said. The company itself is getting in on the action this fall as well, with "Get Started with Coding" workshops in some Apple Stores in English-speaking countries.
Like a kid again
I'm no programming expert, but I've dabbled since the earliest days of personal computers, when BASIC ruled the roost and kids wrote rudimentary text programs like 10 PRINT "HELLO"; 20 GOTO 10. That wasn't particularly useful, but it was very accessible even to a novice.
Programming long since raced out of my league, but Swift Playgrounds returned me to those carefree days of youth. Apple has built most of the framework so you can just start noodling.
In Swift Playgrounds, the famous first program people learn is one easily comprehensible line: show("Hello World"). That makes learning much more accessible. There's no including the iostream header file like in the C++ language and no baffling "public static void" like in Java.
But that's just getting back to something like BASIC on my old TRS-80. What really opened my eyes is how easy Swift Playgrounds makes it to fool around with modern technology. There's a circle you can drag around the screen with your finger and a rainbow of colored rectangles that play a scale of musical notes, a version of Conway's Game of Life that uses emoji.
Coding still gets complex
Swift Playgrounds can't disguise the fact that programming gets pretty complex, though. Apple tries to make object-oriented programming concepts clear by analogy with houses and blueprints. A property is a feature like "bedrooms = 2," while a method is behavior like "turnLightsOn()," one tutorial says. That's relatively clear. But since we're dealing with a real-world language here, you'll have to plow through a thicket of types, instances, methods, functions, variables and other tech terminology.
Still, Apple does a good job making it as accessible as possible. Introductory pages lay some groundwork, then each incrementally more complicated lesson comes with instructions and a hint. At first you can solve the puzzles in your head, but as you progress, you learn that it's good to get started with part of the answer, then refine, debug and expand -- just like in real programming.
A table of contents lets you navigate through the sequence at your own pace, and multiple users can keep their own lessons separate. You're learning Swift as you go, but the lessons are broadly applicable to any programming language.
Apple has long sought a place in computer science education. Programming in the Logo language in the 1980s using an the Apple II computer is one notable chapter in the history of computing. Swift Playgrounds is a worthy sequel, at once more mature, more sophisticated, more interactive and more relevant to modern computing.
reading•Apple's Swift Playgrounds app will lure your kid into coding
Dec 17•Any phone but iPhone X, according to this Sprint salesman
Dec 15•How I shot a rock concert on the iPhone X
Dec 15•The iMac Pro isn't for everyone (Apple Byte Extra Crunchy, Ep. 114)
Dec 15•The iMac Pro is here!