3 Tips for Effectively Learning Swift
As I sat in the SFO airport waiting for my flight home to Seattle from WWDC, I started to come up for air after what was the biggest series of changes for iOS/Mac developers since I started learning Cocoa.
The vibe at Apple’s Worldwide Developers Conference this year was a healthy mixture of feeling needed and loved on by Apple, while feeling overwhelmed by Swift and the addition of all of the new features and APIs to the Apple platforms. Many of the devs I chatted with were excited about Swift and learning how to start transposing their existing Cocoa knowledge to a new language. But since most iOS developers work day-to-day on a couple of large apps that won’t be migrating to Swift anytime soon, learning the new language is more of a long-term roadmap, rather than an immediate call to action.
For me, for Brad, and for the rest of the Code Fellows teachers/students/alumni, Swift has much more immediate implications, since Swift is clearly the path forward for Apple. This means it should be the language of choice for anyone learning or teaching Cocoa.
I’m thankful to be in a position where learning Swift can be my job for the next month or two, rather than having to try to squeeze in the time to learn a new language in addition to a full-time day job. Regardless of your available bandwidth for learning, here are three suggestions for getting the most out of your time devoted to learning Swift.
1. Code Slow
If you’re a master of the Dvorak keyboard or too tightly coupled to your shortcuts, snippets, and muscle memory, try slowing things down. Think through the goal you’re trying to achieve, rather than the code you would typically write in Objective-C. Getting in the habit of writing computed properties for any of your model classes would be a great practical exercise.
2. Code Early
This one may vary a bit from person to person, but early in the day (typically right after morning coffee) seems to be when my mind is the sharpest, so if you’re planning on setting aside 1-2 hours a day to learn Swift, pick the hour or two when you’re the most focused and have the fewest number of distractions. Most long-time iOS devs can write something like a delegate protocol or implement a tableview datasource with their eyes closed, but you’ll need all the mental focus available to effectively learn a new language.
3. Code Smart
Apple didn’t spend four years and lots of resources building Swift so that you could write code exactly the same way as you would in Objective-C. As you learn Swift, pay close attention to the language features that will eventually save you time and lots of lines of code. It might feel a lot faster to bridge Swift objects to Objective-C objects and then do your work with Objective-C, but you’re here to learn Swift, not to crank out code as fast as possible.
Design patterns, best practices, third-party libraries, and lots of changes and fixes from Apple will come eventually, so in the meantime, enjoy the rare experience to learn together, teach each other, and form the patterns and practices that will help the rest of our community.
It’s going to be a great year to be an iOS dev, and if you’re just getting started or want to jumpstart your Swift training, be sure to check out our upcoming development accelerators for Swift.
Join the conversation on Reddit.