Learn Swift Now

I was listening to episode 104 of ATP.fm and Marco Arment mentioned that he would not be diving into Swift until WWDC of this year.

DON’T TAKE THAT ADVICE. Learn Swift now.

Xcode 6.3 BETA came out this week along with big changes in Swift 1.2. The argument Marco made is that since Swift is moving and that this leads to unstability and time wasted learning the language.

Yes, the language is progressing very quickly. However, the time it took to download and install Xcode was longer than it took for “Edit -> Convert -> To Swift 1.2” to run.

The converter could not figure out how to cast between NSDictionary and NSMutableDictionary in a 3rd party library that I was using, but that was easy enough to do manually. On the plus side, the compiler caught a member variable in a struct that wasn’t initialized.

Granted the source code for Impact is only about 10,000 lines. The converter still did a good job.

Time Spent Learning

Learning the changes between Swift 1.1 and 1.2s took about an hour.

It took about 30 minutes to read this NSHipter article and think through the changes in the language. It took about 30 minutes to read this Airspeed Swift article on the changes to the Swift Standard Library.

You can spend chunks of 30 minutes learning the language now or learn in one big bang a year down the road. I would argue that learning in chunks now is the better strategy.

Influence The Language

The main reason to learn the language now is that you have the opportunity to influence language design. Radars are being read and fixed. Chris Lattner is active in the developer forums.

Deliberate Practice

The 10,000 Hour Rule is bullshit. However, it takes deliberate practice to get good at a skill.

It will take practice learning “native” Swift. There is a transition from object-oriented programming to more functional constructs with immutable data. Old habits take a while to break.

Progression

I recently presented on Refactoring Swift code. This is one of my opening slides:

When a programmer starts programming in Swift, their first instinct is to force unwrap all optionals. Eventually, they end up writing safer code. Eventually, they start using functional constructs to achieve the same effect. This progression takes time to learn. It’s best to learn that sooner rather than later.