Apple this week introduced Swift, a new high-level programming language meant to usher in a new future for iOS development. While there are a number of great facets to Swift, one of its more frequently cited benefits is that the syntax is much more approachable and readable than Objective-C. What's more, Swift promises to let developers create powerful apps with less code, making for a more efficient development process.
To illustrate this, there have been no shortage of code snippets posted online which match up Swift code against Objective-C code. For instance, developer Jordan Clifton earlier this week posted a few examples which make the point rather emphatically.
NSArray *myArray = [[NSArray alloc] init];
let myArray = String();
Creating an array with items also looks quite different:
NSArray *myArray = [[NSArray alloc] initWithObjects:@"one", @"two", @"three", nil];
var myArray = ["one", "two", "three"];
The unveiling of Swift and its myriad of features brings to mind a blurb about programming Steve Jobs once made during a Q&A session at WWDC 1997.
The way you get programmer productivity is not by increasing the line of code per programmer per day. That doesn't work. The way you get programmer productivity is by eliminating lines of code you have to write. The line of code that is the fastest to write, that never breaks, that never needs maintenance is the line that you never have to write. The goal here is to eliminate 80% of the code that you have to write for your app. That's the goal.
Video of the unscripted Q&A, which is well worth watching in its entirety, is viewable below. The pertinent portion of the video begins at 40 minutes and 50 seconds.