Despite the growing popularity for single page web applications, the demand for native applications is still high. Native applications allow developers to more easily create code that interfaces with the hardware of a user’s mobile phone. This allows them to access the camera, location and even accelerometer of a user’s device without the use of a third party app such as a web browser. However, in order to create Apps, one must know the programming languages necessary to develop them. In the case of developing iPhone and iPad apps, that language is Swift.
Before Swift, iOS development was focused around Objective-C, a version of C like C++ that allowed for Object-Oriented Programming. Objective-C was created for NeXT, a company Apple bought in the 1990s which used it in the development of their operating systems. When Apple purchased NeXT, their future operating systems, including MacOS and iOS were developed in Objective-C. While Objective-C was very performant due to it being compiled, it slowly became outdated like its predecessor language C. In 2014, Apple introduced the Swift programming language, describing it as “Objective-C without the C”.
Swift came with various features that enabled easier development of iOS Apps. It followed a more simple syntax, resembling Python or Ruby code, and it was even typesafe, ensuring the developer wouldn’t have null pointers in their code through the use of Optionals. Optionals allow Swift code to be much safer and lower the likelihood of a software crash. Swift also mitigated the need for semicolons, much like more modern languages seen today, and uses type inference and treats functions as first class objects much like a functional programming language. The compiler for Swift is also greatly optimized, reducing the amount of memory an application uses. This, in turn, helps users when installing Apps, as their sizes will be greatly decreased have they been written in Swift. These features allowed Swift to be more modern than Objective-C and allow developers to create more performant Apps.
Swift uses many of the same variable types and control expressions as Objective-C. This allows developers to use old Objective-C libraries in their Swift code easily. Additionally Swift runs on the same compiler as Objective-C, LLVM, allowing projects to be written in both Objective-C and Swift simultaneously. The LLVM allows Swift to be much more performant than Objective-C, boasting speedups of at least 2.6x, with a much more friendly and modern syntax.
Programming Languages and Resources for App Developers