Swift was introduced during Apple’s WWDC in June 2014 as the “one more thing” and has since taken the iOS developer community with storm if we believe The RedMonk Programming Language Rankings.
I started to learn Objective-C with iOS3 and found myself commercially developing for iOS from late iOS4. That makes about 4+ major iOS releases that I have been developing full-time with Objective-C and I have to say that I really loved it (even it has various odds that makes it look alien for developers working on other platforms).
When Swift was announced during last WWDC 2014 and consequently rolled out as beta over the following months, there was nothing stopping me in going full in, to learn this new language that was officially sanctioned as the future standard for iOS and Mac development.
Today, about 6+ months and 4 released Swift apps (+3 currently in development) later, I am getting regularly asked from various mobile agencies, startups and friends who advice startups: “What’s your experience with Swift? Is it ready for prime time? Shall we start using it for production projects?”
My answer to that kind of questions tends to be “Let me share my experience, so that you can answer your questions yourself based on where you are in your app development”. That’s not what everyone likes to hear, but I believe that’s the only way as there isn’t one answer that fits everyone.
Around the time Swift got announced and released as beta, I was to start one of my latest projects, Context the “team communication and collaboration app that we have always dreamed of”, and even Swift was not ready for production at that time, I decided to write this new project entirely in Swift.
Here the main reasons why I decided for Swift (at that time not ready for production) over Objective-C (well established and me having years of experience with):
- New project, no existing code that would have needed to be migrated from Objective-C to Swift.
- I wanted to learn Swift from the very beginning in order to grow with the language.
- I wanted to avoid having a newly written Objective-C app to migrate to Swift just a year or two later.
Just a few weeks into developing Context in Swift, I found myself in a love-hate relationship going back and starting over a few times from scratch as it took some time to write actual Swift style code without the “Objective-C” way of doing it. Even today, I believe that the Swift code we write is still to much influenced by the existing Objective-C frameworks which will be a long term process to clean up and I assume it will start for real with WWDC 2015 when Apple will announce/release its first native Swift frameworks (at least that’s what I wish for).
Swift has been in flux since it’s official release (beta) and it still is today with it’s latest release of Swift 1.2 (beta) which caused me multiple times to make substantial changes to my Swift code. You might now think “that’s one more reason to not jump into Swift for production projects”, but that has been exactly the process that helped me to learn and understand Swift and I am very grateful for that experience (even it felt quite annoying at some times when building would result in 100+ build errors after updating Xcode).
The best way for me to learn anything is to do it for real, I am really bad in just learning via tutorials or reading books. I need to actually build a real thing and therefore my approach with going full in on a real project worked best for me.
At the point where Swift 1.0 was officially released, I felt so comfortable with this new modern language that I decided to write every single new project with it. That was an easy decision for my own projects (particularly for Context as well as the new major release of Hill88 3.0, and surprisingly my clients were in on that decision for their projects as well.
What do I love most about writing in Swift:
- Swift has caused me to rethink how I design my apps
- Swift code is safer and reduces the bug rate significantly (according my production app stats)
- Swift requires me to write less code (which is good in many ways)
- Swift code is easier to read and most importantly to maintain
I hope that so far you have been able to answer the question
“What’s your experience with Swift? as well as “Is it ready for prime time?”, but what about “Shall we start using it for production projects?”
The answer to that question depends mostly on where you are in your app/business. If you are just starting a new project it would be a definite yes to go with Swift, however if your app is in production you might prioritize your efforts towards the implementation of all the new features that your users expect from iOS8 and the new iPhone 6/6+ before you look into Swift. You also might want to spend your efforts towards Apple Watch, Share Extensions, or any other new technology that your users might benefit from when using your app. In that situation I would at least wait until WWDC 2015 before I would migrate to Swift as the migration from Objective-C to Swift won’t add any immediate benefit to your users.
Just in case you have read my blog post Announcing Hill88 3 you might think that I am not very consistent in what I say here. Hill88 for Asana is currently in production and I decided to re-write it from scratch in Swift. Why that? … that’s a subject for another blog post.