Alongside iOS 10, Apple
officially introduced Swift Playgrounds, an app designed to teach anyone the principles of coding using Swift. With so many platforms and apps competing for your attention, is Playgrounds your best option for learning to code? Swift Playgrounds has an obvious target demographic: kids. The app is cartoonish, asking you to navigate a few characters around mazes as a proxy for learning coding. It relies on pre-fabricated code snippets and a clever custom keyboard to help alleviate the tedium of writing code (and keep the young ones interested). Although Swift Playgrounds focuses heavily on the Swift programming language, Apple says the app isn’t meant to sway your affection towards iOS or macOS development; the aim is to teach you core coding principles. What it's really teaching you is how to think like a machine so you can write effective code once you graduate beyond Playgrounds. If a puzzle calls for your character to walk three paces, turn and walk three more, that has to be broken out step-by-step. Instead of asking a character to go to a position as you would in a video game, Swift Playgrounds teaches you that each action is its own process. It gets much more detailed from there (you’ll learn things like methods, which help you bundle together often-used actions such as ‘take three steps forward’). Swift Playgrounds is an approachable trek through Apple’s own Swift documentation, which is tedious and boring and would probably dissuade an eager learner from trying to code. But Playgrounds isn’t the only game in town; there is stiff competition on the learning front.
The Apps
There are other iOS apps that can teach you Swift, if that’s your focus. Those apps can be used on both iPad and iPhone (Swift Playgrounds is limited to iPad), enabling you to learn anywhere you go.
Swifty is one of the more popular options, and walks you through each of the tools you’ll be using in basic coding such as boolean values and variables. It then moves into optionals and subclassing. It’s a fairly static app, relying on the written word to teach you how to code.
Code! is another app that relies on text to teach you Swift, but takes things a step further with a wider menu of lessons and tips. Like Swifty, Code! asks that you fill in some blanks on static lines of code. The concept is helping you understand the overall scope of how programming works. And if you get stuck, Code! has video tutorials that ease you past your stumbling block. The problem with apps like these (and there are many) is you’re not seeing code work. With Swift Playgrounds, you hash out some code and see it running in a visual environment immediately, much like you would in Xcode when you hit ‘build.’ But the upside of these apps is portability. Catching a few lessons while on the train home from work or during a lunch break is easier with Swifty, Code! and similar apps. Swift Playgrounds is in a position to do much more than these apps can. With visualization and instant feedback, Apple achieved something with its app nobody else can approach right now. Even though you can import Playgrounds from Xcode into Swift Playgrounds (which invariably means enterprising educators from every corner of the globe will create their own lesson plans) the handy visualization is not yet available to all, and it’s really special when you’re first learning how to code.
Swift Courses
If you’re looking for a more traditional method of learning Swift, but don’t want to go back to university, there are some very good programs available to you.
Udemy offers courses created by knowledgeable people, but they may not be accredited educators.
Coursera has coding classes from top universities, but it’s not a full course-load. With either, your mileage will definitely vary.
Udacity takes the idea of formal education and wraps it in digestible online classes. Taught by its own staff, Udacity gives a bit more polish to the less-traditional online education platform, going so far as to offer a ‘Nanodegree’ to those who complete its various programs.
Treehouse takes it a step further. More formal than Udacity, Treehouse courses are also taught by its own staffers, and have a more formal process for students to navigate. Unlike some other courses, you don’t dive straight into making an app. Instead, you start with Xcode Playgrounds, then make your way to Xcode proper. Treehouse even offers a proctored final exam, and a very active Slack channel for each of the 12 projects you make throughout the course. If you need one-on-one help, Treehouse staffers are available for dedicated tutorials. It feels more like a proper education than an online course. Treehouse focuses on teaching fundamentals that provide a stronger foundation for long-term success as a developer. This prevents you from rocketing through the course; and while it's obviously a move to solidify monetization of the platform, Treehouse says it’s also about making sure students absorb what they’re learning rather than rushing to finish a degree and find a job. Like Udacity’s Nanodegree program, Treehouse offers aptly named Techdegrees to those who successfully finish a course. Treehouse CEO Ryan Carson tells Dice that its Swift curriculum is the second most popular mobile language (Android leads the way), and fourth most popular course overall (behind JavaScript, HTML and CSS). Just under 14 percent of Treehouse students are learning Swift, and while Android has more sign-ups, Swift has more people completing its courses.
Is There a Right Way to Learn Swift?
Like the proverbial rabbit’s hole, it depends on how deep you want to go. If you’re interested in a casual understanding of the language, apps like Swifty and Code! are a great source. When you’ve finished making your way through the bite-sized lessons, you’ll have a better understanding of what the language can do, and how to make it perform tasks that are building blocks for apps. While Swift Playgrounds is a bit cartoonish and off-beat, it’s much more robust than other iOS apps dedicated to learning Swift. The core lesson plan teaches you in real-time how code works, and its sharp visualizations of your code actually working is the best way (mobile or desktop) to learn where you’re going wrong (which is a lot of what developing apps is about anyway). It’s also extensible. Apple will be creating more lesson plans for Swift Playgrounds over time, no doubt driven by its new education initiative for schools. If nothing more, Swift Playgrounds is a solid environment for learning and experimentation. And although Apple’s official position is that Swift Playgrounds isn’t dedicated to teaching Swift, every programming language produces its own gravity. Playgrounds can’t escape Swift’s, no matter how hard Apple tries to talk its way out of the vortex. You’ll get a solid foundational understanding of computer science principles with Swift Playgrounds, but it’s still very much about Swift. As good as it is, Swift Playgrounds won’t leave you ready to dive into Xcode to create an app. If that’s your goal, using the app as a springboard to a Treehouse course is probably your best bet. You’ll go from a mobile Playgrounds environment to the desktop, which feels immediately familiar—and by the time you’re creating real apps in Xcode, it’ll feel like a natural progression.