Learning to code with Swift Playgrounds as an adult

Apple’s Everyone Can Code initiative is laudable but has a big gap to fill.

swift playgrounds 01

Today's Best Tech Deals

Picked by Macworld's Editors

Top Deals On Great Products

Picked by Techconnect's Editors

Apple thinks it is critically important that everyone learn how to code. It may not help you in your job directly, but it teaches useful skills and creates a basic knowledge of the fundamental workings of the products and tools we all use every day. It’s not just something kids should do at school, but an important part of an ongoing education for adults.

So, the company created an initiative called Everyone Can Code that aims to make it easy for anyone, from kids to adults, to learn the basics of writing code. Naturally, it’s centered around Apple’s Swift programming language rather than, say, C++ or JavaScript. And it all starts with Swift Playgrounds, a cute iPad app that teaches the fundamentals of coding in a way so simple even young kids can grasp it.

I am not a young kid. I’m 43, and I have been glued to computers since my first Apple II. I decided to run through the Swift Playgrounds activities to see if it can teach an old dog new tricks.

Starting from scratch(-ish)

I’m not a total stranger to programming, but it would be a big understatement to say, “it’s been awhile.” I grew up writing simple BASIC programs on an Apple II in middle school, but it’s been more than 20 years since I wrote even a few lines of code. (That was C++ class back in college.) I went into this exercise with no clue what it’s like to use real modern development environments or what a modern language like Swift is like.

I’m not exactly a total newbie, but I feel most comfortable starting from the very beginning. Time to load up Swift Playgrounds on the ‘ol iPad…

And wow, it’s cute! And easy! So, so easy. This is clearly made for young children to grok. I have no problem guiding around Byte, my little animated character, to understand the basic concepts of what a program is, but I can’t help but be turned off by how utterly simplistic Swift Playgrounds is. If I was eight, this would have been a delight. At 43, it’s a little like curling up to read a good novel and it turns out to be Goodnight Moon.

swift playgrounds 02 IDG

Swift Playgrounds starts off mind-numbingly basic, but stick with it!

While the juvenile appearance never fades, the mind-numbing simplicity doesn’t last long at all. Most adults will quickly power through the first few lessons. By the time you’ve moved on from Nested Functions to For Loops and then Conditional Code you’ll be solving some real logic puzzles. (And if those terms confused you, take heart: The whole point of Swift Playgrounds is to introduce you to them.) The challenges are not terribly difficult—the app accepts any solution that works and you can endlessly tweak yours to fix problems—but you have to actually exercise your noggin.

Simply put, after about an hour, even grown adults should be fully engaged by Swift Playgrounds’ playful coding puzzles. That’s a big win. Parents and children can go through these activities together, and they can both really get something out of it.

Where it all breaks down

It turns out that, after a rather boring first few lessons, Swift Playgrounds becomes thoughtful and engaging enough to capture the attention of adults. Your average middle-aged person who doesn’t know the first thing about programming can spend an hour with the app every night, and in just a couple weeks they will probably finish all the lessons in Learn to Code 1 and Learn to Code 2.

That’s enough to learn a lot. Getting that far, a person would really understand what it means to code. They’ll understand how complex tasks are broken down into really simple tasks that are repeated and looped as needed, and how programs say “if this, do that, otherwise do this other thing.” Making use of these tasks to solve little logic puzzles, guiding Byte around his little 3D world, is charming and really makes the concepts stick.

Eventually you’ll go beyond just trying to guide Byte along a path, and start modifying and creating his little 3D world. If you go through Learn to Code 3, you’ll learn stuff that looks like real app development: coordinates and placing graphics and touch events!

swift playgrounds 03 IDG

Go far enough in Swift Playgrounds and you’ll learn sophisticated concepts like arrays.

But then what? Swift Playgrounds teaches concepts and uses real Swift structure, but it’s not real code. It doesn’t make an app, it just guides Byte around and solves puzzles. Swift doesn’t have a real command called collectGem() after all.

Swift Playgrounds can satisfy your curiosity about what coding is and how it works, but it doesn’t really let you write apps. Not even a super-simple basic one. The code you write can’t leave the app; it can’t even leave that particular puzzle page! If you want to actually make an app, Apple has a whole other curriculum.

Bridging the gap

So you want to take your newfound knowledge of loops, if-else statements, and functions and write an app. Just bust out your iPad and…open the Apple Store app to purchase a Mac.

That’s right, Apple’s actual real-code-writing program, Xcode, is only available for Mac. It’s free, you just download it from the Mac App Store. Then you’ll want to go to the iBooks store and grab Intro to App Development with Swift. When you start reading that eBook, it’ll prompt you to download some project files you’ll use as you progress through the book.

This is traditional programming instruction, and it sucks. Reading along in a book, loading up sample code and making a few changes, taking little quizzes to make sure you understand the concepts…this is what learn-to-program-at-home courses have looked like for ages. Apple does a great job making the book and the project files clear and interactive, but it’s a boring, businesslike slog compared to Swift Playgrounds.

intro to app dev IDG

If you want to write real apps, you have to hop on a Mac and go through a traditional, boring, course.

If Apple wants to really inspire people—both kids and adults—to write code instead of just learning what code is, it needs to bridge the gap between the colorful puzzle-solving of Swift Playgrounds and Xcode’s developer-centric environment. Give us a transition phase that jettisons Byte in favor of a virtual iPhone screen. Walk us through the creation of a very simple app: something like a tip calculator, where the user inputs a dollar amount and presses one of two buttons (15 or 20 percent) to calculate the tip. That’s not exactly going to become your first App Store submission, but it’s the kind of thing a Swift Playgrounds graduate could understand, and it performs a real-world task instead of navigating a cartoon character through a self-contained puzzle.

Did I mention you need to buy a Mac? It makes no sense that Swift Playgrounds is exclusively available for iPad, and Xcode is available exclusively for Mac. What a huge barrier to learning it is to lock it behind yet another expensive purchase. This, from the company that just ran a prominent TV commercial where a precocious bright young girl uses her iPad for everything and asks, “What’s a computer?”

what’s a computer? IDG

You know, Apple. A computer is a thing you use to write apps.

If you’re an adult who wants to learn to code, don’t let the kid-friendly nature of Swift Playgrounds dissuade you. It quickly becomes sophisticated enough to make it a worthwhile and satisfying way to learn about core programming concepts.

But if you want to actually write usable code, you’re going to have to do some real work. You need to use a Mac and Xcode to use the Swift knowledge you’ve learned, or else try to translate the concepts to a more portable language like JavaScript. Either way, you’ll be stuck with the ol’ “book and sample code” lessons that have plagued programming education forever, making you feel like you’re back in high school. 

Note: When you purchase something after clicking links in our articles, we may earn a small commission. Read our affiliate link policy for more details.
Shop Tech Products at Amazon