Putting Swift vs. Objective-C to the test.
When trying to understand the basics of programming, Swift is a much easier language to learn and work with than Objective-C. Objective-C is over 30 years old, and was written with different considerations because of how computer interactions were being handled. These things, which are important, can make the basics extremely hard to grasp. A majority of students coming out of school are learning Swift because they can more quickly hit the ground running.
Apple not only created Swift, but also created interactive coding environments that help beginners learn rapidly - Xcode Playgrounds and an iPad app, Swift Playgrounds. This allows students “to learn and explore Swift, prototype parts of your app, and create learning environments for others.”
“Swift is a robust and intuitive programming language created by Apple for building apps for iOS, Mac, Apple TV, and Apple Watch. It’s designed to give developers more freedom than ever. Swift is easy to use and open source, so anyone with an idea can create something incredible.” — Apple
Objective-C still works, though.
Yes, it does, and it will continue to do so. It is also possible to mix and match Objective-C and Swift as long as they are in different files and configured correctly. However, this mix and match backward compatibility is not intended to be part of any long term strategy. The end goal is to allow a gradual migration over to Swift so that the desired services and experiences can be delivered and maintained to users.
Swift 5 is coming.
The current version of Swift is 4, and Swift 5 is slated to be released in 2019. A lot of great tools and libraries that we use to develop iOS apps are built on Swift. It takes more resources to push Objective-C code in a legacy application and to develop new features. Given that Swift was first released nearly 5 years ago, rewriting an application in Swift pays off because many engineers are shifting to using Swift and don't use Objective-C as much. There are a large number of engineers who have never used Objective-C since it is viewed as a legacy language. As more and more Objective-C engineers gain seniority the cost for these engineers increases. Therefore the maintenance of a legacy application in Objective-C will cost more in the long run coupled with the ever shrinking demand for Objective-C engineers - new applications are typically written in Swift.
Image credit to SB designer Raleigh Felton.
Yes, do it in Swift.
Migrating to Swift will require less code, be more efficient, and have fewer bugs. It will be easier to maintain or extend and be able to leverage all of the new resources and libraries that are being developed in the Swift language. Apple is committed to Swift and has offered a clear roadmap of regular improvements to the language, which reassures engineers looking to get into this development space that the language is here to stay.
“We try to continually push ourselves to do more and more, not just on the hardware side but also in terms of developers’ tools so they can take advantage of the hardware that’s there, in the best way. That’s the heart of what the coding software Swift is about. We’ve created the language and our hope was that you can get a lot more people coding, and then secondly have people push more to take advantage of the latest hardware.” — Tim Cook
Is your App Store app outdated? Smashing Boxes can help! Let us know if we can help migrate your app to the new Swift platform.Todd Crown is a principal engineer at Smashing Boxes and when not building iOS apps is extremely passionate about blockchain and IoT technologies.