What’s New in Swift 3.1?

Great news: Xcode 8.3 and Swift 3.1 is now out of beta! This article highlights the most significant changes in Swift 3.1. By Cosmin Pupăză.

Leave a rating/review
Save for later
Share
You are currently viewing page 3 of 3 of this article. Click here to view the first page.

Other Bits

The swift package reset command resets a package back to a clean state, with no dependencies checked out or build artifacts present.

As well, the swift test --parallel command executes tests in parallel.

Miscellaneous Bits and Pieces

There’s a few other tidbits in Swift 3.1 that don’t quite fit anywhere else:

Multiple-Return Functions

C functions which return twice such as vfork and setjmp don’t work anymore. They change the program’s control flow in interesting ways. So the Swift community has decided that using them should be banned and now results in a compile-time error.

Disable Auto-Linking

The Swift Package Manager disables the auto-linking feature of module maps for C language targets:

// Swift 3.0
module MyCLib {
    header “foo.h"
    link “MyCLib"
    export *
}

// Swift 3.1
module MyCLib {
    header “foo.h”
    export *
}

Where to Go From Here?

Swift 3.1 polishes up some Swift 3.0 features in preparation for more serious changes that will be bundled in Swift 4.0 later on this year. These include huge improvements to generics, regular expressions, a more ergonomic string design and more.

If you're feeling adventurous, then head over and look at the Swift standard library diffs or look at the official Swift CHANGELOG where you can read more information about all of the changes. Or you can use this to keep an eye out for what's coming in Swift 4.0!

And if you're really curious about what changes are coming in Swift 4 and beyond, then head over to the Swift Evolution proposals where you can see what things are being proposed right now. If you're really keen then why not give feedback on one of the current proposals under review or even pitch a proposal yourself ;].

What do you like or dislike about Swift 3.1 so far? Let us know in the forum discussion below!

Cosmin Pupăză

Contributors

Cosmin Pupăză

Author

Chris Belanger

Editor

Matt Galloway

Final Pass Editor

Ray Fix

Team Lead

Over 300 content creators. Join our team.