Swift Playgrounds Homepage

Swift Playgrounds Makes Learning to Code Fun

Apple introduced Swift Playgrounds, an app designed to teach the Swift programming language, at WWDC 2016. We’ve had a chance to experiment with it since then, and can say without reservation that their first foray into teaching kids how to code deserves top marks. They have enabled learning to code to be fun and addictive, even for those who aren’t the “coding type.”

The app feels like a puzzle-solving game, reeling you into the challenge while introducing coding concepts and building skills step-by-step. After completing a challenge and receiving encouraging praise from the app, we found we were motivated and eager to move on to the next one. One tester expected to finish two or three challenges to get a feel for the app, but ended up finishing over fifteen lessons because she was so engaged with it. The pace, lesson structure, and challenges all prove to be well-designed from an instructional standpoint. This app will likely teach many future programmers how to code.

Swift Playgrounds: Learn to Code 1

Swift Playgrounds contains two learning paths. Learn to Code 1: Fundamentals of Swift is the only path available now, while Learn to Code 2: Beyond the Basics will be available soon. More are expected both from Apple and third parties in the future. Learn to Code 1 is divided into twelve chapters, each with six to ten lessons. (The number of lessons alone is impressive!)

Each chapter starts with a few screens to introduce the topic and relate it to something in the real world. For example, the app compares coding a “while” loop to hammering a nail. “While you’re hammering a nail, you can’t just hit it a certain number of times and expect it to go all the way in. Instead, you continue hitting the nail while the nail is still sticking out.” “For” loops are introduced as “repeating yourself” like when you’re planting seeds in a garden…make a hole, place the seed, move 5 inches forward. These brief explanations before getting into the semantics of the code help to get your mind in the right place before diving in.

After the introduction, you jump into the “playground” part. You’re presented with an area to write code on the left of the screen and a character named Byte on the right. Your code instructs Byte to move around his world, collect gems, and toggle switches on and off. Byte’s world is nicely designed with engaging colors and allows you to swipe to spin it around or pinch to zoom in for different views.

Some code is pre-populated and you easily add to it by typing or tapping commands in the tray below. Adding code in this way instead of straight typing is efficient. As Apple states, “With QuickType for code, the Shortcut Bar intelligently displays commands as you go, so you can write a line of code with a tap or two. And for those moments when typing is the best option, there’s an innovative keyboard designed just for coding. Touch a key to access multiple characters, then drag to choose the one you want.”

Swift Playgrounds Screen Shot

Each lesson provides either a goal or a challenge to complete that involves moving Byte around and collecting gems in an efficient way. The app encourages you when you get it right and motivates you to keep moving on to the next level, like every good puzzle game should. Hints are provided for each topic, and the general Help menu is actually helpful. If you do get stuck, you are able to move on to the next lesson if you want, without completing a challenge.

Swift Playgrounds: A Few Challenges

Those who are not visual-spatial learners might find Learn to Code 1 in Swift Playgrounds a bit more challenging. To solve a puzzle, you need to determine where Byte was, where he needs to go, and how to get there. This task involves moving his habitat around and counting squares to determine his location. This isn’t as easy to visualize for some, but needed to figure out his space. Apple offers a few other challenges in Swift Playgrounds outside of Byte’s world, that are not visual-spatial: Drawing Sounds and Blink. They require a more advanced grasp of the coding concepts, but we imagine tackling these challenges will enable those with limited visual-spatial competence to focus more on the code.

Another challenge that we came across was getting “lost” in the code. As Byte performed the actions on the right of the screen, we wished the line of code on the left would highlight as he performed it. For “while” loops and “for” loops especially, we sometimes lost track of where Byte was in the code. An indicator would be helpful.

Overall Impression of Swift Playgrounds

Apple designed the Swift language to be easy to use and as an improvement to Objective-C, its primary programming language before Swift. We believe it to be a definite improvement over Objective-C, and our developers use it almost exclusively to develop for iOS, macOS, tvOS, and watchOS apps for our clients. Swift Playgrounds was designed to be an engaging way to teach the Swift language, and we think Apple succeeded there too.

The number of lessons available, the way each builds on the last, the appealing interface, and deserved praise when you complete a goal successfully make it an engaging and fun way to learn. Further, the code you develop in your playground can be exported and shared for use in real apps, outside of the Playgrounds environment. Compared to the dry programming books we’ve read in the past, Swift Playgrounds is a far superior method of instruction.

Swift Playgrounds is a free iPad app, currently available only when running the public beta of iOS 10, but will be available publicly when iOS 10 launches in the fall.

If you like hearing about new products like this, consider subscribing to our InspiringApps newsletter. Once a month we’ll send you the latest on mobile trends, technologies, and innovations.

Share on FacebookTweet about this on TwitterShare on LinkedIn



Interested in industry news and trends?

Sign up for our monthly email to get the highlights on technologies and innovations impacting mobile strategy.