Playground: What’s new in Swift 4

I made an Xcode playground that lets you try out many of the new features coming in Swift 4. You can download it on GitHub.

The cool thing is that you can run the playground right now in Xcode 8.3; you don’t have to wait for the first official Swift 4.0 beta, which will probably come as part of Xcode 9 at WWDC. All you need to do is install the latest Swift snapshot from swift.org (don’t worry, it’s easy).

Toolchain installation

  1. Go to the snapshots download page on swift.org and download the latest snapshot for Xcode.1
  2. Run the installer to install the snapshot.
  3. In Xcode, go to Xcode > Toolchains > Manage Toolchains… and select the snapshot. It might be a good idea to quit and relaunch Xcode after switching snapshots. I had occasional problems with syntax highlighting and error reporting, and a relaunch fixed them.

    Toolchain selection in Xcode 8.3
    Toolchain selection in Xcode.

I plan to keep the playground up to date over the summer as Swift 4.0 matures and more features get implemented.

  1. You can choose between two branches: Trunk Development (the master branch) and Swift 4.0 Development. I recommend the latter because that’s the branch the final Swift 4.0 release will be made from. ↩︎