Swift Development for iOS – The Good, the Bad, and the Latest

October 2018 officially landed Swift as one of the top 10 programming languages in the TIOBE Index, a marked achievement within two years of its launch. As Apple launched this programming language in 2014, calling it the “Objective-C without C”, Swift development was quick to gain traction.

As per Apple’s announcement at the WWDC 2014, the whole aim of Swift programming language was to make the development task easier for developers to create iOS apps. The very nature of this language did enable them to code faster than they ever could with Objective-C. The idea was to combine the best of C and Objective-C, but eradicating the compatibility issues that had existed.

It took four years for the Apple developers team to create and launch Swift. But to the surprise of the world, none from the outside even had the whiff of it until Apple launched it. And once the world had discovered iOS development with Swift, it was glad it did.

Big brands like LinkedIn, Twitter, Fitbit, Coursera, Lyft, etc., have already been using Swift. Nevertheless, what this language has in front of it is the tough competition that other bigger players that have been rocking the market. Let’s what all good and not-so-good it has to offer, and what’s the latest with Swift.

Let’s start with getting to know Swift development better.

What is Swift?

Wikipedia explains Swift as

“general-purpose, multi-paradigm, compiled programming language developed by Apple Inc. for iOS, macOS, watchOS, tvOS, Linux and z/OS.”

Swift is now an open source programming language. The aim to create a sound programming language by opening the technology to all. And so, within 3 years of it launch, Swift could boast of a large community and a spectrum of third-party tools.

Unlike Objective-C, it is friendly to novice programmers. It is expressive and enjoyable at the same time. It is compatible with devices with operating systems iOS7, OSX10.9, and higher.

The core value that Swift offers is safety, but it also aims at making the code look more natural.

The Swift Rise of Swift Development for iOS

The Creation and the Launch

creation-of-swiftImage source

It was Chris Lattner, Apple’s Senior Director of the Developer Tools Department at the time, who has started developing the Swift programming language way back in 2010, as well, an alternative to Objective-C. After four years of hard work and secrecy, Apple revealed this language to the world at the 2014 Worldwide Developers Conference.

For the fear of causing massive disruption in a probable scenario wherein all iOS developers will have to move to an altogether new language, Apple kept investing in Objective-C. And it kept doing so till it was ready to launch an iOS mobile development language that was safer than Objective-C.

Much later, in January 2017, Lattner even spoke about it in the Accidental Tech Podcast,

“Initially, it was really just me messing around and nobody knew about it because it wasn’t anything to know about. But eventually, it got a little bit more serious […] We got a couple people working on it part-time and I convinced my manager that it was interesting enough that we could have a couple of people work on it.”

Come 2014, developers had the beta version to play with. Within just one month of its release, Tim Cook announced that 11 million downloads had already been made.

The Response

swift-most-loved-languageStatistics from: StackOverflow

While the initial reactions were of a mixed sort, the language was still on its way to evolution, introducing improvements release by release. And then, 2015 witnessed it as the “most loved” languages for iOS app development (2015 StackOverflow Developer Survey).

Spurred by this growth, Apple made Swift open source the very same year. The result – by 2017, Swift became the fastest growing language in the history of the TIOBE Index, entering the top 10 list in March 2017. Even after the release of Swift 4.0 in September 2017, and Swift 4.2 in September 2018, it stayed at #10 till 2018.

2019 has, however, seen it slip down by 4 ranks, owing to reasons which we’ll discuss later in the blog.

The Good in Swift

When we talk of all the good that lies in app development with Swift is majorly in comparison with Objective-C. Let’s go ahead and see what all it has to offer to us.

Faster Development Process

As simple, clean, yet expressive language as Swift is, its simplified grammar and syntax make it ever so easy to read and write. Its virtue of being concise reduces the development time since a lesser volume of code can perform the same task as Objective-C used to perform with a longer code.

All thanks to ARC – Automatic Reference Counting – Swifts’ memory usage is well-managed thus saving the coder the effort spent in doing so manually.

Improved Safety

Safety was always a core idea behind the introduction of Swift to iOS developers. It is certainly less error-prone, owing to its error handling capabilities and enhanced typing system. There are lesser code crashes as compared to Objective-C.

Swift developers are able to see the code errors instantly and fix them right away because of the short feedback loop. Bug fixing, thus, takes a short time and prevents the deployment of low-quality code.

swift-offers-improved-safety

Better Performance

Swift is not a misnomer for this language for iOS application development. Its very focus is speed and better performance. In fact, the initial release of Swift claimed up to 40% spike in performance as compared to what Objective-C was delivering back then. And it has been largely true to the performance promises it has made,

Lesser Memory Footprint with Dynamic Libraries

Swift allows you the lightness of memory through dynamic libraries. The absence of static libraries ensures that the memory is never clogged up. Since dynamic libraries have a copy in only one file, decreased footprints benefits you when you use a score of third-party code to build a Swift application.

Cross-Device Support

cross-device-support

This language is not just meant for iOS application development for iPhones and iPads. It is meant to support the full span of Apple devices ( Mac, Apple Watch, and Apple TV). Besides, it supports Linux as well.

There was a time when we heard the rumors that, impressed with Swift, even Google may go for Swift for app development while sacrificing Java. However, now we all know that Kotlin is the future of android app development.

Full stack Capabilities

Swift for server-end, consolidates the best of backend technologies that developers are likely to need. This is what the power of the cloud can bring to the table. Using Swift, just like Java, for backend as well as the frontend of applications gives you the power to share and reuse the code extensively. The result – shorter still development time and lesser still efforts on the coders’ part.

Large Open-Source Community Support

swift-enjoys-a-large-open-source-community

Since Swift turned open-source on December 3rd, 2015, a large and rather vibrant developer community has formed around the language. And that is what makes it easier still to learn and adapt to because there is the support that new developers need.

So, there is a massive contribution from developers for fixing bugs, enhancing the language itself, and even add more useful features.

Compatibility with Objective-C

As the present scenario is, we see a co-existence of Objective-C and Swift for iOS development. Actually, there are two possibilities; not only can you add features with Swift to a code that has already been written in Objective-C, but also vice versa. Both can be used interchangeably in one and the same project. Their compatibility makes their amalgam risk-free.

Learnability with Playgrounds

swift-development-offers-learnability-with-playgrounds

New, as this language is, Swift helps its users learn it with an application called Playgrounds. Even if one doesn’t have an in-depth knowledge of Swift, one can easily learn the language with Playgrounds.

Newer Swift developers use this application to assist them in writing as well as testing their code, without actually having to create the whole app. This not only helps shorten the learning curve but also the development cycle.

The Bad in Swift

As the order of nature goes, nothing is perfect. Swift too has some challenges in its way; that the community around it is constantly working to resolve.

Still a Young Language

There is no denying the fact that the language has been progressing full-throttle, but neither can we ignore that fact that it is still a young language, especially in relation to Objective-C. This is why issues do crop up from time to time, which, of course, need resolution.

Moreover, Swift still has a very limited number of “native” libraries and tools: Many of the available resources and tools dedicated to earlier Swift versions are useless with the newer releases.

Very Few Native Libraries and Tools

swift-offers-few-native-libraries

It’s been four years since the launch, and Swift can still not boast of a large number of native libraries. While its memory management may help developers with dynamic libraries, native libraries are important.

The same problem lies with the native tools, which makes it highly dependent on third-party tools, whereby compatibility issues arise. The trouble is also that the available native resources that belong to earlier versions of Swift are rendered useless as newer releases arrive.

Nascent Talent Pool

The community is growing fast. Yes, it is. However, if we look at other communities of developers, this one seems like it still has a talent pool that is at its nascent stage.

However, the demand for Swift developers only seems to be increasing as a result of its popularity. Hence, the talent gap.

No Support for Older Versions of Operating Systems

swift-doesn't-support-older-versions-of-ios

Swift is meant for iOS app development only for iOS7, OSX10.9, and higher versions. So, using it for other older projects that run on older OS versions is not possible.

Nevertheless, with only around 5% of devices using iOS6 and older operating system versions are presently in use. So, this problem may as well become a no-problem soon.

Poor Compatibility with IDEs and Third-Party Tools

As we mentioned before, by large there is an incompatibility with third-party tools because of frequent updates causing the older tool compatibility to go defunct. This makes it very difficult to find the right tools.

Xcode, Apple’s official IDE isn’t that great when it comes to native tools and support. Apart from this, developers also face issues with compilers, syntax, highlighting, autocomplete and even refactoring tools.

The Latest in Swift – Swift 4.2

swift-4.2

On October 30, 2018, Swift 4.2 was officially launched as the stable version. It is a major release for the language and has introduced some major changes to Swift. Let’s see what’s new in Swift.

Generic Changes

Swift 4.2 has implemented generics, thus offering better support for them. The result is the reduced amount of bipolerate requirement, making the code more usable.

Updates in Standard Library

Now the standard library has a host of new features, like improvements in the Hashable protocol and a brand new unified set of randomization protocols as well as functions.

Binary Compatibility Improvements

Swift is now closest to a stabilized ABI it has ever been. It has now enabled binary compatibility for any future releases of the language.

Batch Mode Compilation Support

There is now support for batch mode compilation. This has resulted in faster build times. There are also changes in calling convention for retain/release cycle. So, there is decreased code size and better runtime performance.

Updates in Package Manager

Swift 4.2 targets are compiled through the batch mode of Swift compiler. The new watch option in the generate-xcodeproj lets you watch the file system and if required, generate the Xcode project automatically. It has also made improvements to the scheme generation logic as well.

Is Swift 5.0 around the Corner?

swift-5.0-is-around-the-corner

While earlier, a release was speculated in late 2018, it is now in early/mid-2019 that we’ll have rendezvous with Swift 5.

According to Dice

“While ABI stability means the language will support older versions, that’s not fully ironed out. The team says version 4.2 “should” compile with version 5, but notes the 4.2 release will be the last to support Swift 3.”

Conclusion

The growth that Swift has seen in the past four years since its launch, is promising and encouraging indeed. Its features like ease of readability and writing, cleaner, more expressive form and syntax, and a shorter development cycle, etc., make it a great contender against Objective-C.

Its advantages, by large, overshadow its disadvantages. The disadvantages, however, we think, are just a matter of time. Things have improved since Swift 4.2. And now we await Swift 5 to see what’s new.

hire-expert-for-swift-development-for-ios

Amandeep Singh

About the Author

Amandeep Singh is a self-directed and motivated technical developer with 8 years of experience in iOS technologies. Excellent at developing and maintaining iOS applications, he is an avid learner of technologies, given his strong development background. Outside of work, Amandeep likes surfing the net and listening to music.

Comments

 
 


SUBSCRIBE TO OUR NEWSLETTER

Stay updated on the most effective technologies and trends that will shape up tomorrow's digital experiences.