At WWDC 2016, Apple announced Xcode 8, the latest version of its IDE for iOS, macOS, tvOS, and watchOS. Now available in beta, Xcode 8 brings Swift 3, improved address and thread sanitizer, a new editor extension architecture, and more.
Swift 3 is the first major release of Swift that takes place after Apple open sourced it in December 2015. As InfoQ readily reported, Swift 3 is neither source, nor binary-compatible with previous versions of the language. To make the task of porting code written for Swift 2.x to version 3, Xcode 8 includes a Swift migration tool. As usual when using Xcode migration tool, you should ensure that your scheme includes all the targets that you want to convert and that your code compiles without errors with Xcode 7.3. Even if those preconditions are met, though, the migration can still fail. Swift’s blog lists a few workarounds that you may apply if that happens.
Xcode 8 also introduces new runtime sanitizers and a stricter static analyzer:
- The new thread sanitizer aims to help find and understand data races and other concurrency bugs in Swift and Objective-C.
- The address sanitizer now supports Swift code and can help catch problems related to the use of
UnsafeMutablePointer
, which is used in Swift to interact with C calls. - The static analyzer now supports an “aggressive” level of checking for nullability violations. This will check for violations in all calls, including both project and system headers, and is enabled by default for all new projects.
The new features introduced with Xcode runtime sanitizers and static analyzer can only be used with Swift 3.
On the UI front, Xcode now supports editor extensions, which aim to make it possible to customize Xcode’s editor. Xcode 8 also includes a new project template that can be used to create editor extensions. To prevent editor extensions from affecting Xcode stability, Xcode editor extensions run in a separate process.
Apple claims that Xcode 8 is radically faster than previous versions. In particular, Interface Builder has been reengineered, Apple says, for speed and control, and is now able to provide a live preview of how an app will appear on any Apple device.
You can read a detailed list of all changes in Xcode 8 in Xcode 8 release notes. Xcode 8 is a 5.5 GB download available from Apple Developer Connection download page. Both the release notes and Xcode 8 installer can only be accessed by registered developers, although no paid membership is required.