What's new in Xcode 9?

Xcode is the complete developer toolset used to create apps for Apple TV, Apple Watch, iPad, iPhone, and Mac. The Xcode development environment bundles the Instruments analysis tool, Simulator, and the OS frameworks in the form of tvOS SDKs, watchOS SDKs, iOS SDKs, and macOS SDK.

Supported Configurations

  • Xcode 9 requires a Mac running macOS 10.12.4 or later.
  • Xcode 9 includes SDKs for iOS 11, watchOS 4, macOS 10.13, and tvOS 11.
  • Xcode 9 supports running multiple concurrent versions of the Xcode app and of any associated tools such as Simulator. Xcode 9 can not be run at the same time as earlier versions.

Swift 4

  • Xcode 9 supports both Swift 3.2 and Swift 4.0, as controlled by the "Swift Language Version" build setting.
  • The new Swift 4 compiler now understands Swift 3 code. You can easily move to Xcode 9 right away, choose which parts of your application are ready to move to Swift 4, and migrate the rest of your code later.
  • Swift 4 and Swift 3 targets can be compiled together in the same project.
  • Improved migrator experience that supports migrating only select targets to Swift 4.

Debugging

  • iOS devices and Apple TV can now be debugged over the network (Wirelessly debug). Wireless development also works in other apps, including Instruments, Accessibility Inspector, Quicktime Player, and Console.
    Note - iOS devices need to be plugged-in once to enable network debugging.
  • Added Quick Look support for variables of type CALayer, PDFDocument, NSImageRep, CIRenderTask, CIContext & CIImage.

Main Thread Checker

  • The Main Thread Checker is a standalone tool for Swift and C languages that detects invalid usage of AppKit, UIKit, and other APIs on a background thread. Updating UI on a thread other than the main thread is a common mistake that can result in missed UI updates, visual defects, data corruptions, and crashes.
  • Automatically enabled during debugging, and can be disabled in the Diagnostic tab of the scheme editor.

Build System

  • -runFirstLaunch, a new flag in xcodebuild interactively checks the status of the license agreement and install any packages required for launching Xcode.
  • New Build System
    • Xcode 9 includes a new build system written from scratch in Swift. As per Apple, it's designed for higher reliability, and it catches project configuration problems which the standard build system does not.
    • The new build system is disabled by default, but it can be enabled form File > Project Settings > Workspace Settings, and then choose New Build System (Preview) for the Build System type.
    • Passing the -UseNewBuildSystem=YES flag to xcodebuild will also force it to use the new build system for a command-line build.
    • Improves overall build-system performance. Build system performance does not include the compilers, linkers, and other tools used by the build system.
  • xcodebuild -exportArchive now fully supports automatic signing, including creating and updating signing assets, if you pass the -allowProvisioningUpdates flag.

  • Xcode supports a new build setting, CODESIGNSTYLE, which can be used to override a target’s signing style to Automatic or Manual when using xcodebuild.
  • When automatically signing for distribution, Xcode will now create and use only Xcode managed distribution provisioning profiles. This behavior is functionally analogous to automatic signing for development, and means that Xcode will no longer create or modify any of your manually created distribution provisioning profiles.
  • Xcode Server and xcodebuild now support running tests in parallel on multiple devices and simulators.
  • When running tests, xcodebuild will no longer launch Simulator.

Source Editor

  • You can now increase and decrease the source editor font using ⌘ with + and ⌘ with -.

  • When text is selected, typing a opening delimiter adds a matching closing delimiter at the end of the selection. Auto-matched delimiters include " ", ( ), [ ], { }.
  • Fast scrolling for any sized file.
  • Support for Markdown.
  • Global rename across Swift, C, Objective-C, and C++ files.

Interface Builder

  • Interface Builder now renders navigation bars, tab bars, and toolbars on the canvas in the same way they appear at runtime.
  • To use the new usesAutomaticRowHeights property of NSTableView in Interface Builder, choose "Automatic (Auto Layout)" from the Size inspector and set the Row Height value.
  • Interface Builder now warns when a view’s constraints can cause localization problems, such as truncation and clipping.
  • Asset catalogs now support named colors, which can be referenced in Interface Builder documents.
  • Interface Builder supports setting textContentType on classes conforming to the UITextInputTraits protocol. This improves the ability of AutoFill to populate with appropriate data, including Username and Password on iOS 11.
  • Interface Builder uses UIView.safeAreaLayoutGuide as a replacement for the deprecated "Top and Bottom layout guides" in UIViewController. To use the new safe area, select Safe Area Layout Guides in the File inspector for the view controller, and then add constraints between your content and the new safe area anchors. This prevents your content from being obscured by top and bottom bars, and by the overscan region on tvOS.

Project Navigator

  • Dragging files between groups in the Project Navigator now moves the files in the filesystem, and updates any associated SCM working copies.
  • Creating, renaming, and deleting groups now performs the corresponding changes in the connected directory in the filesystem.

Source Control

  • Xcode 9 includes a brand new Source Control navigator where you can easily see the working copies for your project or workspace. Each working copy lists branches, tags and remotes, and you can quickly see the currently checked out branch and push/pull counts for those branches.
  • Xcode 9 integrates with GitHub. You can easily manage your account from the Xcode preferences window, including support for two-factor authentication, and configure an SSH key to be used when performing Source Control operations against GitHub.
  • GitHub account integration for easy browsing and one-click creation of a project and the associated GitHub repository.

Templates

  • A new standard macro named FILEHEADER has been added that is the content for the standard file header comment.
  • Macros can now be defined in terms of other macros. For example the new FILEHEADER macro is defined in terms of macros like FILENAME and COPYRIGHT. COPYRIGHT, in turn is defined in terms of ORGANIZATIONNAME and YEAR.

Simulator

  • Record videos of simulators.
  • With Xcode 9, you can run multiple simulators at the same time.
  • Simulator now supports face-up and face-down orientations on supported devices.
  • Simulator.app now respects the system screenshot directory instead of always saving screenshots to the desktop.
  • Simulator now supports edge swipe gestures when the device bezel is visible. Begin your gesture just outside the screen region.
  • Simulator now provides a Share Extension. Which can share information with Simulator from Maps, Photos, and Safari.
  • New chrome for iOS and watchOS simulators includes the hardware controls, and allow easy dragging and resizing of the simulated device.


Related Article