Facilitating the Spread of Knowledge and Innovation in Professional Software Development

Write for InfoQ


Choose your language

InfoQ Homepage News Swift 3 is out

Swift 3 is out

This item in japanese

Lire ce contenu en français


Swift 3.0 has been released, writes Apple engineer Ted Kremenek, bringing a wealth of changes to the language and its standard library, additions to the Linux port, and the first official release of the Swift Package Manager.

Swift 3 is Swift’s first major release since the language was open sourced by Apple at the end of 2015 and implements about 90 proposals that were discussed and approved through the Swift evolution process.

A number of changes in Swift 3.0 aim to clean up the API, as per the Swift API Design guidelines, by getting rid of a few decisions that might be seen as a legacy of Objective-C. This had the main effect of making Swift syntax shorter and more consistent:

  • requiring to name the first parameter of functions and methods (unless explicitly omitted using _) makes it possible to write:
    aString.write(toFile: "filename", atomically: true, encoding: NSUTF8StringEncoding)
    UIFont.preferredFont(forTextStyle: UIFontTextStyleSubheadline) 
    instead of:
    aString.writeToFile("filename", atomically: true, encoding: NSUTF8StringEncoding)
  • omitting needless words allows developers to write
    instead of

The two rules described above will work out an even stronger effect when taken jointly, in that, for example, the following statement:

aString.stringByReplacingOccurrencesOfString("A", withString: "a")


aString.replacingOccurrences(of: "A", with: "a")

Another area where Swift 3 has streamlined things is in dealing with C functions belonging to several Cocoa frameworks. As an example of that, all Core Graphics functions starting with CGContext, CGAffineTansform, CGPDFDocument, etc. may now be called as if they were methods of an object:

if let ctx = UIGraphicsGetCurrentContext() {
CGAffineTransform(translationX: 64, y: 0)

Swift 3 also contains changes to its syntax that are are aimed to clean up the language, such as removing the ++ and -- operators, var from function parameters, and C-style for loops with conditions and incrementers, all of which are deemed to bring more disadvantages than advantages.

The list of changes in Swift 3 is definitely too large to cover briefly. You can find all the details in the official announcement.

Rate this Article


Hello stranger!

You need to Register an InfoQ account or or login to post comments. But there's so much more behind being registered.

Get the most out of the InfoQ experience.

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Community comments

  • Very positive news! Dart tread on the heels and Dart 2.0 will be ready soon.

    by Andrew Mezoni,

    Your message is awaiting moderation. Thank you for participating in the discussion.

    Apple are great.
    But not only Apple loves their own languages and programmers, Google also loves their own languages and programmers and Dart 2.0 will be available very soon (as was announced by Google at Dart Developer Summit 2015 " Dart Today & Tomorrow").

    Swift 3.0 came out, will wait soon Dart 2.0.

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p