Thoughts on Swift

swift logoIt’s post-WWDC and the internet is abuzz with talk of Swift – Apple’s new programming language and intended Objective-C replacement.

My initial reaction was one of $*##! More changes at the expense of developers. Apple push forward and we pick up the tab.

It’s challenging developing for iOS. Every year, the ground shifts beneath your feet. New devices to support, new standards, new API changes, new resolutions, etc. Even full blown UI revamps. Often there is no immediate impact but the damage is implied. Users come to expect all Apps to have the shiny new features, and Apple actively encourage this.

You change your App to include the features or it quickly finds itself at the bottom of the pile.

The reality of course is slightly different.

Apple are pushing the platform forward in new ways. They’re trying different things and with quite some speed. It is, by and large, great for users and it’s required to keep the platform relevant (and therefore to keep the user base numbers high). It benefits developers in the long run and it’s up to us to change with them.

As a developer, you have to stay relevant. Experience is important of course but translating this experience to modern languages and techniques is invaluable. Holding on too tightly to old concepts, and for too long, just makes it more and more difficult to ever make the change. Now is the time to act.

I’m currently reading the First Law trilogy (by Joe Abercrombie) and as Logen “The Bloody-Nine” Ninefingers aptly puts it – “Once you’ve got a task to do, it’s better to do it than live with the fear of it.”

So, Swift; is it any good?

There are certainly some nice points in the book that Apple released. Everyone is talking about the unicode character support but to be honest its some of the other stuff that’s pretty nice. Here are a few things I noticed when skimming the book. (This is when compared to Objective-C. Other languages already have some of these features.)

1) No need for a header file

Honestly I think that’s one of the most jarring things when trying to learn Objective-C. And now, its no longer required. Everything in one file, hurray!

2) Easy string manipulation

Honestly string concatenation in Objective-C is incredibly unwieldy. Now, it’s just like many other languages.

3) Type inference

To be honest, I sort of prefer defining the variable type since it aids readability. Still, its nice that you can determine a variable’s type when the first value is assigned. And you can always explicitly set the type if you wish. Best of both worlds really.

4) Range

So this is pretty handy. 1…10 contains values 1 through 10. 1..10 contains values 1 through 9. Note 3 periods vs 2. Shove that in your loop and smoke it!

I’m sure there are many more. That was just a brief flick through the rather lengthy book.

So, this is a chance to get in on the ground floor. I plan on giving it a go shortly. More on that new project soon :)

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.