Why Swift?

by Patrick McConnell

Here at Odd Networks we have completely embraced Swift for our Apple platform development. Our iOS and tvOS SDKs are written in Swift. All our client applications to date have been written in Swift.

If you follow the twitters and blogosphere, you may have come across many long time developers hesitating to move to Swift. While there are certainly reasons Swift may not be the right choice for every project, the levels of fear and negativity I see around moving to Swift is disheartening.

Sure, if you have large legacy Objective-C code bases, then porting to Swift is probably a non-starter. I’m sure there are many legitimate reasons not to do a project with Swift.

I’m more concerned with the developers, who point out that Swift is not mature and each new release requires auditing, and updating your code to continue to work. Another complaint is the dev tools are not up to par. Both of these things are true, but how serious an issue are they?

We just ported a handful of apps and our SDKs to the most recent update of Swift, version 2.2. It took one afternoon. Our code is better for it.

Was it worth it? Absolutely.

One new feature for Swift 2.2 is the removal of selectors as String objects. Yes, this results in more verbose selector declarations, but it also has the side effect of improved code safety. Now the compiler can verify a selector actually exists, potentially avoiding a crash down the road.

In our porting to Swift 2.2 we discovered 2 potential crashing bugs based on this very issue. We fixed them in minutes and our code is safer for having ported.

Are the dev tools, Xcode specifically, lagging behind the Objective-C functionality? Yes, a bit but nothing that stops you from getting real work done.

Sure you can’t refactor Swift code yet, but I have faith you will sooner rather than later.

Is the compiler a bit slower when working in Swift? I guess so but it still takes just seconds.

Have you tried to experiment with your Swift code in a playground? Objective-C doesn’t have that feature and its a great way to try things out.

Our Swift projects probably have almost half the lines of code of a similar Objective-C. We get more done, faster.

So we write less code. Do more and do it safer then similar Objective-C code.

Apple has decided that Swift is the future and and so have we. If you’re starting a new project, perhaps an OTT app?, might we suggest giving Swift a try and embracing the future? Don’t believe the naysayers. Swift is good stuff.


p.s.

Like most Apple developers we have a long history with Objective-C and we love it. This post is not meant to knock Objective-C. We just see people generating FUD around Swift and would like to offer an alternate opinion.

Finally, if for whatever reason, you have to continue to work in Objective-C when using our Odd platform we fully support that too. Pick your tool and make something great.


If you have any thoughts or ideas you want to share with us and with everyone else interested in over-the-top broadcasting and development of new kind of video applications, find us on Twitter or Slack, and don’t forget to check out our web-site. Feel free to submit your thoughts to our publication too, Odd Networks.

Show your support

Clapping shows how much you appreciated Odd Networks’s story.