Swift One Year Later - Is Apple's New Mobile Language Ready for the Enterprise
|Brian Westendorf in iOS Wednesday, July 8, 2015|
One year ago at the Apple Worldwide Developer’s Conference, Apple launched the beta of a new language for its Swift iOS platform.
Since Apple started accepting Swift-coded iOS apps into the App Store in September 10, 2014, Swift has made considerable headway with its target developer audience. RedMonk reported in January that its growth has been “meteoric.” Although not one of the top 10 languages, Swift jumped from the 68th ranked language in Q3 of 2014 to number 22 - that’s 46 spots. Year over year, most languages are lucky to shift five spots.
So if you’re teaching yourself to code iOS apps, should you learn Objective-C or jump into Swift? Which should you use to build your app?
Is Swift as fast as its name implies?
Swift is intended to be a faster language than Objective-C, well suited for apps with heavy animation, like gaming apps. Apple has stated that Swift is up to 2.6 times faster than Objective-C when completing a common search algorithm. However, in reality, it may not be much faster. Both languages target the same Cocoa and Cocoa Touch APIs (for OS X and iOS, respectively), both are statically typed languages, and both use the same LLVM compiler.
Apple has released four versions of Swift in rapid succession: The original beta (June 2014), Swift 1.0 (September 2014,coordinated with the release of iOS8), Swift 1.2 beta (February 2015), and Swift 1.2 (April 2015). Swift 2.1 has been tested by developers and found to be substantially faster than earlier versions, but comparative tests will need to be performed when mature Swift apps are developed.
But perhaps it doesn’t matter whether Swift makes the actual application faster. Regardless of whether users notice thati OS apps built with Swift are speedier than apps built with Objective-C, many developers feel that it is easier to code with Swift - and that might just make all the difference.
Is Swift Ready for Prime Time?
Swift may be the right choice for individual developers or small teams building lightweight apps, games and tools, but it is probably not yet time to use it for enterprise applications. Bugs are still being worked out, but the bigger issue is resource constraints. Although Swift ranked number 22 on RedMonk’s list of most popular languages, Objective-C ranked 10. Even with the rapid rise in Swift’s popularity, there’s a shortage of Swift developers currently compared to Objective-C developers, and enterprises need reliability.
The way things stand, if you want to build an iOS app, you have three choices: (1) Swift only, (2) Objective-C only, or (3) a combination of the two.
1. If you have a small team or are building your own app, consider Swift.
If you are an individual or working with a small, committed team, Swift might make good sense as you are unlikely to experience resource issues when you need to update or manage your app. Swift offers many modern and expressive features to reduce code, making it cleaner and less error prone and the open source community has also created easy-to-integrate frameworks, like AFNetworking.
2. If you are an enterprise with heavy resource needs, stick with Objective-C.
Companies with larger teams need more stability, especially when members are rotating in and out. Objective-C is a tried and true language that is widely used for app development. Because there is a greater availability of developers who can support Objective-C-based apps, it is the better choice for most businesses at this time, especially large enterprises.
3. Adventurous? Use a Combination of Objective-C and Swift.
Apple has enabled Swift to be compatible with Objective-C, allowing you to mix and match them in the same code base. There are benefits to embracing new and changing technology early, but you should think about the drawbacks of using a new language side-by-side with a mature one. Mixing two languages in your code base can create confusion for developers, especially in larger teams, and creates the same resource problems as a Swift-only approach.
Apple has strongly endorsed Swift and sees it as the successor of Objective-C for iOS and OS X. In addition, Apple’s recent announcement regarding open-sourcing Swift could allow developers to build OS X and iOS apps on Linux or PCs. But for enterprises, it’s best to wait and see. Adoption is key so it’s not about using the “right” language to build your app; it’s more about the right time. We’ll see what happens in the future.
Read more: https://developer.apple.com/swift/blog/
This content is made possible by a guest author, or sponsor; it is not written by and does not necessarily reflect the views of App Developer Magazine's editorial staff.