Apple's kid-friendly Swift Playgrounds taught me to code

A little, at least.

In 2014, Apple introduced a new programming language called Swift. Though that might not seem like much to everyday users like you and me, this announcement was actually a pretty big deal for the developer community. One of the reasons for that is that it's a lot simpler than Objective C, the lingo that Apple had been using for over 20 years. So simple, in fact, that Apple believes that Swift could be anyone's first programming language. That's why at this year's WWDC, the company introduced Swift Playgrounds, an iPad app designed to teach kids how to code. After a few days playing around with it, I can safely say that it also managed to teach me -- a clueless grownup -- a few Swift programming basics as well.

It's available for developer preview now and will be in public beta in July, with a much wider release when iOS 10 launches this fall. An iPad-only app, it's compatible only with the following models: iPad mini 2, 3 and 4; iPad Air and Air 2; and both the 9.7-inch and 12.9-inch iPad Pro.

When you first launch the app, you'll see a Featured tab with a gallery of highlighted lessons. Each set of lessons is called a "Playground," and if you've already started playing with one, you'll see it listed in the My Playgrounds tab. The app ships with two basic modules, which are 'Learn to Code 1" and "Learn to Code 2." As I'm a beginner when it comes to programming languages -- last I learned was MS Basic when I was 12 -- I decided to start with the first one.

In this particular Playground, you'll learn basic Swift commands by guiding a character called Byte around to solve puzzles. The screen is split in two; one side shows the actual code, while the other is a live view of Byte and a 3D world. You can spin the world by swiping it around or pinch to zoom to get a closer look. As for the code, you don't even have to type anything in; you can cherry pick what commands you like from a QuickType keyboard at the bottom of the screen. You can also bring up an on-screen keyboard at any time to enter in custom text.

The first few lessons are pretty easy, at least to my adult brain. To get started, all you do is compile a few simple commands like moveForward(), turnLeft() and collectGem() to get Byte moving the way you want. Once you're happy with your list of commands, you can simply tap "Run My Code" to see if it works. Later on, I learned how to repeat commands in loops as well as how to ascribe several commands into a single function. I have to admit that even though Playgrounds is meant for the average 12-year-old, as the lessons got progressively harder, I was definitely challenged. I did consult a few hints at times when I was stuck.

That's part of the cool thing about Swift Playgrounds; there is no one right solution. The code can be as complex or as simple as you want it to be. As long as you get the objective done -- be it collecting gems or toggling switches -- the app will celebrate your success. There's no shame in giving up and looking up the answer either; you won't get penalized if you do. Still, if you're smart enough to enter in the most optimal code, you'll be given even further praise -- sort of an extra pat on the back, if you will. Plus, optimizing code is a good lesson to learn in general; better code leads to better apps.

The other thing that I found fascinating is that the experience is pretty open-ended. You don't have to follow the curriculum exactly; you can jump around from lesson to lesson if you feel like it. That way you can skip ahead if you feel like being challenged. I should also mention that the fact that this is all done via an iPad makes the coding process feel more intuitive. The ability to tap and drag around bits of code makes an otherwise tedious process a lot faster.

Along with lessons and challenges, the app ships with a couple of templates for building Playgrounds of your very own. Indeed, the company is encouraging educators and developers to create their own lessons and challenges for the app so that the app can be used in the classroom. Apple is also planning to release additional lessons and challenges on a regular basis.

An important takeaway is that the language you're learning on Swift Playgrounds is actual, real code, and not some pretend pseudocode common in a lot of educational apps. "It's the exact same language as Swift," said Cheryl Thomas, Apple's Vice President of Software Engineering Operations. "This is very unique; you can learn to code in something that is the same as the one you can use to make very powerful apps."

Because Playgrounds lets you code in actual Swift, even seasoned programmers can use it to draw up a prototype of an app. It can even call on real iOS APIs. From there, you can transfer that code via iCloud to Xcode, Apple's more advanced developer tool, to finish up the process. What's more, because the latter uses much of the same language and syntax as Swift, a Playgrounds graduate could theoretically pick it up simply by reading the documentation.

"When we first created Swift Playgrounds, we wanted to really inspire the next generation to want to learn to code," said Thomas. "It reflects an Apple engineer's viewpoint and perspective on the best practices on how to do so." The team recruited several educators to help them figure out how kids will respond to the app and the best way to motivate them. "We feel like the app appeals to a broad base of learners. It appeals to boys, girls and is very accessible. It can be used by folks with different levels of sight."

In just a few lessons, I felt like I had a decent grasp of the basics of Swift. While I don't think I'm ready to code my own app just yet, I'm pretty confident that if I really committed to it, I eventually could. More importantly, it was fun solving the puzzles, even for an adult like me. I can only imagine how much fun kids would have.

Apple also brought kids in to get their feedback and, according to Thomas, it was fantastic. "Folks at all different ages seem to like the product a lot." Thomas and her colleagues also realized that kids love to share what they're building. So if you want, you can send screenshots right from the app and even record a video or broadcast what you're doing live.

"It assumes zero knowledge," said Wiley Hodges, a product marketing director for Tools and Technologies at Apple. "You can come to it a complete beginner and it'll introduce you to all the core concepts."

"We're pretty excited about the idea that we can give people better access to this ability to learn and experiment with code," he continued. "There's a value beyond just the idea of learning to code. You're not necessarily going to be a programmer [...] Learning to code can teach kids problem-solving, persistence... it'll serve them well regardless of what they go on to do."