Monthly Archives: June 2014

Apple’s Swift New World

As a developer who makes his living off of creating software for Apple devices, any announcement that Apple makes can dramatically affect my future. At WWDC 2014, Apple’s annual developer conference, my universe was rocked harder than I can remember.

This year’s announcements empowered developers by giving us more access to important hardware, like Touch ID, and the ability to communicate with other apps. Just these two enhancements alone will allow me to create solutions for my customers that I could never have imagined way back in May.

Add to these the thousands of new ways I can improve my apps by targeting the forthcoming iOS 8 and Yosemite releases and it was a banner WWDC for those of use that write apps. The real winners will be the people consuming the new and improved apps I and other developers will be writing. Apple deserves a huge round of applause for their multi-year development efforts that went into this event.

A Swift Future

But that wasn’t the end of the story, Apple also announced a new programming language called Swift.

I was expecting Apple to replace Objective-C, the current blessed language for all App Store app development, but I thought that change was still three years or more in the future. Shocked is too tame a word for my response to hearing this… I needed help to pry my jaw off the floor.

Now I’ve been writing software since the early 80’s and have used dozens of different languages on hundreds of combinations of hardware and operating systems over the years and I can tell you that great software is about the person writing it more than the platform or language used. That said, Swift is a game changer for several reasons with the top three being:

  1. Swift is a safe, modern language. This means it removes software failures caused by accessing memory that can lead to security problems and crashes.
  2. Swift complains early about coding mistakes. Having a compiler tell me that something is amiss is far better than a customer shouting at me my app has screwed up. The faster I can spot mistakes, the faster I can correct them.
  3. Swift has playgrounds. Much like when I started with computers1 that booted up to an interpretive language console, playgrounds allow me to sit down, type some code, and get immediate feedback. I can test new concepts quickly and noodle on possible solutions without building an app. Playgrounds are also an amazing educational tool and will be an enormous asset for teaching new developers how to write code.

Overall, Swift will allow me to create stable apps more quickly for my customers. I win, they win, and frankly, Apple wins. It’s good all around.

The Great Debate

With every new tool, framework, or language comes much debate amongst developers (we love to argue about the silliest things) and Swift is no different. I don’t think it’s such a hard decision about sticking with Objective-C and when to start using Swift:

  • If you are working on existing apps written in Objective-C with short release cycles, don’t mess with success—keep writing in Objective-C.
  • If you are adding new functionality to an existing app and will be releasing it on a more relaxed schedule, I’d write new views and logic in Swift to get myself ramped up with the new language—but for the love of Pete, don’t go nuts and rewrite all the code.
  • If you are creating a new app, write it in Swift. It’s the future. Seriously, don’t kid yourself thinking that Apple is on the fence about which language will survive long term. Swift has the lock on that prize.

Another part of the debate is about which language is harder to learn. Frankly, programming is hard and languages are just something to adjust to for that task. I’ve forgotten more programming languages than most new developers will ever learn, so I’m happy to learn another if I can get my apps shipping faster.

Swift can get complex, as will any powerful coding language, but overall I believe it beats Objective-C in approachability. At my core, I’ve been a C programmer and have used some variation of C more than any other language. I’ve grown accustomed to include files, declaration duplication, semicolons, and pointers. These are not things that developers should have to deal with today and Swift eliminates much of what seems pointless to a new developer who has not been marinating in a K & R2 doctrine for decades. Read the Swift manual and experiment with playgrounds. You’ll start to see why this language has such potential to free us from working around C syntax restrictions.

Is Swift perfect? Nope.

Can you write bad code in Swift? Yep.

It’s just a programming language, so let’s not get all religious about it. Remember that Swift is a 1.0 release of a brand new tool that we can look forward to evolving with for years to come. It’s a chance to reboot our brains and come up with even more creative solutions without much of the baggage that we’ve been dragging around for years.

This old dog is learning some new tricks and I am fired up about the future of app development. I hope everyone focuses on the positives and we can all grow together. Now you’ll have to excuse me; I have Swift code to write.

Peace.

  1. Yes, we had fire and the wheel back then.
  2. “The C Programming Language by Kernighan and Richie”