The Swift programming language was introduced by Apple in 2014. It was made open source in December of 2015, and its third version entered preview status in June of 2016.
 
Swift is Apple’s preferred programming language for iOS apps, supplanting Objective-C. Zco’s developers have become wizards at using Swift, and I caught up with two of them for a chat about how Swift affects their work.
 
I spoke with Darsan, a technical lead, and Binosh, a senior software engineer.

Swift programming language logo

 

Why Swift?

 
“Swift is easier,” Darsan said simply. “Learning curve is easy. Syntax wise it’s simple.” In fact, both Darsan and Binosh compared Swift to JavaScript and scripting languages in general.
 
Though there’s no bright line between scripting languages and other programming languages, scripting tends to emphasize speedy code writing and automating tasks by calling other programs that may or may not be in the same language. Because scripted languages are often run through a browser or other runtime, code can be tested on the fly more easily – without having to be compiled. When the project is ready, it’s compiled for better performance and easier distribution.
 
Both developers said that programmers with C or C++ experience would find Swift easy to learn – but also that even novices can learn Swift as their first language.
 

Memory Management

 
App memory management is an area Binosh felt Swift was a big change over Objective-C. Both languages can use a system called Automatic Reference Counting (ARC), but while it’s an integral part of Swift, it was only introduced to Objective-C in 2011.
 
ARC keeps track of objects used within an app’s code. When they’re not needed anymore, they’re removed from memory, so an app isn’t taking up more resources than it needs to. Older projects, Binosh said, relied on manual de-allocation of memory by the developer. Making sure the app wouldn’t cause memory leaks or performance degradation would take a lot more development and testing time.
 

Cross Compilation

 
Many legacy applications can even be updated to work with Swift.
 
“Even if we developed our old projects in Objective-C, we can use Swift for the latest updates of that project, because it’s cross compilable,” Darsan said. It’s not always a perfect transfer to the newer language, but the time saved creating new modules in Swift usually outweighs any time spent debugging the cross-compiled code.
 

Extra Features

 
Swift has a few nifty additions that just didn’t exist in Objective-C. Two of Darsan’s favorites are the tuple and higher-order functions.
 
Tuples are simply values that are grouped together for convenience. Apple’s own documentation gives the example (404, “Not Found”) as a tuple describing that message you get when a webpage is broken. It’s easier for a developer to deal values with that are often used together when they’re stored together.
 
Higher-order functions can use other functions as input and output. As basic building blocks of programs, functions in code can be made more useful by allowing them to interact with each other directly, rather than translating their results into values in advance.
 
In its first two years, Swift had made fans of many of Zco’s developers. Email us to learn how it could be right for your iOS project!


Tags: swift, iOS app development, swift app development, swift for iOS, swift mobile app development, iOS application development swift

Categories

Archives

Subscribe