Enterprise Mobile App Development : Dallas Fort Worth Metroplex
The world of iOS and OS X development is currently dominated by Objective-C, a language developed in the 1980s originally used as the programming language for the NeXTSTEP operating system. It had been the tool of choice for iOS and OS X development until the announcement of Swift at Apple’s Worldwide Developer’s Conference (WWDC) in 2014.
Swift is a programming language developed by Apple to be used for iOS and OS X development. It encompasses modern language paradigms in order to provide more power to iOS and OS X developers. The syntax and features of Swift reflect the popularity of modern languages such as Ruby, Python and Haskell. Yes, it even has familiar functional programming features such as maps and filters.
The biggest difference between Objective-C and Swift is the syntax itself. Swift models the syntax of modern scripting languages. Here is a small example of a Swift program that showcases the new syntax as well as the ability to switch using a String.
var vehicle = "Monster Truck"
switch vehicle {
case "Minivan":
let comment = "I guess it could be worse!"
case "Motorcycle":
let comment = "Don't forget your helmet."
case "Monster Truck":
let comment = "I don't think that is street legal."
default:
let comment = "I don't have any opinions about \(vehicle)"
}
Both functions and closures in Swift provide useful utilities to the developer such as variable number of arguments and nesting while functions themselves can return multiple values using tuples. Returning multiple values is possible using Objective-C by returning some type of collection, but Swift’s implementation makes it much easier and quicker to implement.
Unlike Objective-C, Swift treats functions as first-class objects. This means that functions can be returned and passed to and from other functions.
The features of Swift are not new to programming languages, but they are, however, new to iOS and OS X development. Many of these features provide a cleaner and more readable solution while keeping code clutter to a minimum. The goal is to ultimately provide a more efficient tool when creating applications. Less time should be spent on cumbersome implementation details and Swift aims to boost productivity by simplifying the most mundane of tasks.
Developers started diving into Swift after the release of the beta version during WWDC 2014. The new features and syntax are well-received and bring a lot to the development table. We here at Ayoka are excited to start developing new applications using Swift. If you have a developer account with Apple, you can start using Swift right away by downloading the beta version of Xcode. Download it via the Apple developer website. For more information, check out Apple’s documentation.