Objective-C or Swift for iOS Software Development

Objective-C or Swift for iOS Software Development

Most software developers I encounter are aware that Apple is gradually changing the programming language used for iOS software development. Objective-C is the outgoing language and Swift is the incoming language.  But which one is the correct choice for new projects?

Apple are helping to smooth this transition by allowing developers to mix and match. You can add Swift classes to your existing Objective-C projects without any problems.

For existing iOS developers the dilemma is: “Should I begin to use Swift in production code?”. And new iOS developers are asking, “Which language should I learn”.

So far my feeling has been to stick with Objective-C. I’ve been in the software industry long enough to be cautious of anything too new. I prefer to let other people iron out the teething problems, before jumping in.

I’m aware that my somewhat cautious approach has been informed by the fact that I’ve mostly worked for or trained companies in Financial Services sector, and they generally prefer established and proven technologies. So does that make me wrong?  Does that make me too cautious?  And what is ‘conventional wisdom’ saying?

In the last iOS course I delivered, one of the course delegates recounted, “a contractor came into our company and wrote some classes in Swift. Now, every time we do a build, the Swift parts break”.

This is probably a slight exaggeration. What I’m sure he meant was, “every time Xcode gets an update, the Swift parts break”.

Last year (June – June) Swift went from version 1.0 to 1.1 to 1.2. Then Swift 2.0 was released for iOS9.  Therein lies the problem. That’s 4 updates to the LANGUAGE in little over a year. Every time an update comes out they have had to refactor classes so that they work according to the latest Swift spec.

With so much discussion iOS blogs and forums about Swift, I’d begun to wonder if I was becoming something of a luddite by not embracing Swift for production code in Coding Fury. However, a few weeks ago on John Gruber’s “The Talk Show” Episode 124, he and Guy English were discussing Swift, this is what they said.

https://daringfireball.net/thetalkshow/2015/06/20/ep-124. Fast forward to 1:35:35.

Gruber: “Almost no-one is using it [Swift] yet as their main language, it’s not reasonable… it’s the side affect of Apple using it as early as they did to get feedback…”.

English: “I agree, I think if Apple had been a different Company, what they’re now calling Swift 1.0 would have been Swift 0.x, and Swift 2 would have been Swift 1.0… When Swift first came out, there was some banana stuff there, you could mutate arrays in ways that would make make no sense…”.

They do go on to say how Swift 2.0 is much improved, having been based on a year’s worth of developer feedback.

So will I be moving to Swift 2.0?

In the shorter term we’ll stick with Objective-C. I’m not keen on the idea of rewriting portions of code for clients because the language keeps changing.  And I’m quite sure clients would less than keen to pay for updates that just maintain the status quo.

Swift is definitely the way things are going, it has some really nice features like “playgrounds” and promises to dramatically reduce the amount of code we have to write while improving developer productivity.  At some point it the future there’s no doubt I’ll be making the switch, but for now it appears that the majority of the iOS community agrees with me and is sticking with Objective-C.

 

If you are interested in becoming an iOS Developer, you’ll find details of our iOS training courses in Belfast and Dublin at http://codingfury.com/training/