Subscribe / Unsubscribe Enewsletters | Login | Register

Pencil Banner

How to write apps with Swift 3

Lucy Hattersley | July 13, 2016
All you need to know about writing apps with Apple's Swift 3 developer language: the importance of Swift going open-source, new features in Swift 3, and why you should you learn to program in Swift

Apple introduced Swift 3, the latest version of its programming language at its WWDC 2016 event. Swift 3 is the first update since Apple announced Swift would be going open-source, and is packed with new features based upon community direction.

Swift 3 is used to write or create apps for Mac OS X and iOS devices. Apple designed Swift explicitly to get the fastest and most efficient performance from devices, and Swift 3 expands upon its already impressive feature set.

How to write apps with Swift 3: What's new in Swift 3.0 - community-driven and wider in scope

Swift 3 WWDC 2016

"Swift was released as an open-source project just six months ago," says Ted Kremenek, Senior Manager, Languages and Runtimes at Apple. "A big part of doing that was not just to shove out a bunch of sources to GitHub, but to create a fully open community that drives the evolution of swift going forward. Swift 3 is the first major update to swift that is intended to a product of that community."

Another big aspect for Swift is that it's no longer just about iOS and OS X development. Since Swift went open-source, a version has appeared for Linux computers. This has opened up Swift to server developers, as well as app coders.

"Today's software ecosystems are really diverse," says Kremenek. Whether they're working on servers, or working on apps. We want Swift to be for everybody. This is the first major update since Swift was ported to Linux."

How to write apps with Swift 3: Getting the core fundamentals right with new Swift 3 API language

Swift 3 API changes

What may surprise developers who've been using Swift 2 (or before) is how much the language is changing in Swift 3. "A big thing about Swift 3 is that we really want to get those core fundamentals into shape and build on top of them going forward," says Kremenek. "We really want to awesomize Swift for awesomeness."

Chris Lattner, Sr. Director, Developer Tools Department at Apple, agrees. "We want to make the core experience of Swift great.

"This is a hard problem. This isn't just a matter of if we use commas or colons. It's also about compatibility. So we're doing everything we can to get Swift into that shape so we can live with it forever."

So there are bunch of new features in Swift:

  • Accessing APIs in Swift 3. The biggest change is to the API language. Accessing Apple APIs is an essential part of building software in Swift (and most modern languages). Apple has radically changed the API language to emphasize clarity. You can read more about the new syntax at
  • Playground support. There is now Playground support for downloadable snapshots in Xcode 8. This means you can download the latest snapshot of Swift in Xcode and start experimenting right away. You don't even need to restart Xcode. This should make it a lot easier for developers to keep on top of the new language as it evolves.
  • Parameter labelling. There are some quite heavy changes to parameter labelling in Swift 3. In Swift 2 it was consistent with Objective-C, but because the API language has changed so much, it makes sense to make parameters consistent with Swift.
  • Generics are another area that's seen a change of syntax. The signature is now up front, and constraints are secondary to that.
  • Warnings. If you have unused results in a function, you now get a warning. You can override this warning if the behaviour is intentional.


1  2  3  4  5  6  Next Page 

Sign up for CIO Asia eNewsletters.