Article

Xcode 11.4 Beta 2 Release Notes

Update your apps to use new features, and test your apps against API changes.

Overview

Xcode 11.4 includes SDKs for iOS 13.4, iPadOS 13.4, tvOS 13.4, watchOS 6.2, and macOS Catalina 10.15.4. The Xcode 11.4 release supports on-device debugging for iOS 8 and later, tvOS 9 and later, and watchOS 2 and later. Xcode 11.4 requires a Mac running macOS Catalina 10.15.2 or later.

General

New Features

  • Xcode 11.4 supports building and distributing macOS apps as a universal purchase. To distribute your macOS app as a universal purchase, specify the same bundle identifier as your iOS app in the Xcode template assistant when creating a new project. If you have an existing project, edit its bundle identifier in the Project Editor.

  • Universal purchase is enabled by default for new Mac Catalyst apps created in Xcode 11.4. When you create a new Mac Catalyst app, it will use the same bundle identifier as your iOS app.

  • Automatic signing in Xcode 11.4 supports building Mac Catalyst apps with a custom bundle identifier. You can edit the bundle identifier of your app using the Signing & Capabilities tab in the Project Editor. If you choose to build your Mac Catalyst app with a custom bundle identifier that does not match your iOS app, you will not be able to distribute the app as a universal purchase.

Resolved Issues

  • Creating an Objective-C category file by choosing File > New > File no longer creates a file that includes an import of the AppKit framework. (55977950) (FB7346800)

Build System

New Features

  • Build settings have a new evaluation operator, default, which you can use to specify the default value of a build setting if it evaluates to empty in the context of the evaluation. For example:

    $(SETTING:default=something)
    

    If $(SETTING) is empty, this expression evaluates to ‘something’. The default value may itself be an expression that contains build setting evaluations. (57402718)

  • Building codeless kernel extensions with the new build system now requires you to set the GENERATE_KERNEL_MODULE_INFO_FILE build setting to NO. (57247534)

Known Issues

  • Some projects fail to link when building for testing, with the error message "ld: -sectalign and -bitcode_bundle (Xcode setting ENABLE_BITCODE=YES) cannot be used together". (57857082)

    Workaround: Disable building with bitcode by setting ENABLE_BITCODE=NO, or disable Code Coverage from the scheme’s Test Options view by setting CLANG_INSTRUMENT_FOR_OPTIMIZATION_PROFILING=NO.

Debugging

New Features

  • The view debugger now presents layout guides (UILayoutGuide, NSLayoutGuide) and their referencing constraints. (20387325)

  • View debugging supports showing layers using the Show Layers menu item in the Editor menu. (15775898)

  • The exception reason now surfaces as an editor annotation. You can inspect the Exception object in Variables View and find the backtrace of the original uncaught exception, if any, in the Debug Navigator. (8045587)

  • You can now use the Terminal for standard I/O, instead of Xcode’s Console. Make this choice using the Scheme Editor’s Options tab. (33552211)

Resolved Issues

  • View outlines in the view debugger are now more visible. (44861893) (FB5361403)

  • GPU Debugger is now usable with simulated devices. (59082087)

Devices

Resolved Issues

  • Icons and names for devices running iOS 13.0 reflect the correct OS version in the Devices and Simulators window. (55044395)

Instruments

Resolved Issues

  • Instruments connects to devices via the network, and doesn’t incorrectly report that the device is unavailable because it’s “Waiting for Xcode to download symbols from device.” (59169574)

Interface Builder

New Features

  • Added dynamic system gray colors to inspector color pickers. (55403376) (FB7281404)

  • Removed inspector support for configuring NSTableColumn header cell fonts to match the API. You can configure header cell fonts by subclassing NSTableHeaderCell and overriding the font property in code. (23664679) (FB5630174)

Resolved Issues

  • Fixed an issue where the inspector section for NSNumberFormatter Symbols had a light background in dark mode. (57393302) (FB7459536)

  • Fixed an issue where several NSResponder actions were missing from the Connections Inspector. (56546759) (FB7403346)

  • Fixed a crash that could occur when moving duplicate NSComboBox items in the Inspector. (55796760)

  • Fixed an issue where the Interface Style Simulated Metrics setting wouldn’t apply to objects being dragged. (55207867)

  • Fixed an issue where named Global Tint colors weren’t properly unarchived during Interface Builder document loading, resulting in incorrect Global Tint colors on subsequent document saves. (55158004) (FB7232333)

  • Fixed an issue where unrecognized system colors wouldn’t have their fallback colors preserved after loading and saving Interface Builder documents. (54623340)

  • Fixed a bug that prevented entering a 0 constant in the constraint popup editors. (54076090)

  • Fixed an issue where XIB template files didn’t have dynamic background colors. (53907727) (FB6918296)

  • Fixed a crash that occurred if an NSLevelIndicator Minimum inspector value was higher than its Maximum. (53302326) (FB6740368)

  • Fixed an issue where Interface Builder documents that contain UINavigationBar titles configured with named colors could be archived with duplicate-named color resources. (52162293) (FB6253352)

  • Fixed an issue where Apple TV UITableViewCell safe area frames displayed incorrectly in XIB files. (51679086)

  • Fixed an issue where Xcode could crash after configuring text to be non-attributed. (46228389) (FB5673720)

  • Fixed a crash that could occur when opening a storyboard with popover presentation segues. (58421606, 59070586)

  • Fixed an issue where creating a Swift outlet with drag-to-source could result in a class-not-found error. (57883610) (FB7491401)

  • UIDatePicker compact style is available. (58963416)

Metal

New Features

  • The Metal Frame Debugger now supports iOS and tvOS simulators. (54273848)

Known Issues

Organizer

New Features

  • The Crashes Organizer now shows crash logs for universal purchase macOS apps. (57607495)

Previews

New Features

  • You can now copy, cut, paste, duplicate, and delete views directly within the Xcode Previews canvas. (56134191)

  • Selecting a SwiftUI preview in code now highlights the corresponding preview in the canvas, and vice versa. (56412209)

  • Xcode Previews now supports previewing iPad applications brought to the Mac. (41416222)

Known Issues

  • Using ForEach to set Preview properties may result in preview failure. (58985849)

    Workaround: Use Group.

Resolved Issues

  • Fixed an issue where some Xcode Previews would spin forever when first updating. (55560302)

  • Xcode Previews now correctly builds previews in frameworks that depend on other frameworks in the project. (56956786)

  • Fixed a crash in Xcode Previews that could occur when using the inspectors. (55933725)

  • Fixed an issue causing Preview layout to extend beyond the safe area for iOS. (58963049)

  • Previews are supported on devices running tvOS 13.4 beta 2 or watchOS 6.2 beta 2. (59014002)

  • Fixed a bug in Xcode Previews where applying a preferredColorScheme(_:) modifier would not apply the appropriate background in the preview. (58464203)

  • Fixed scrolling in the Xcode Preview inspector when using a mouse with a scroll wheel. (58843545)

Server

Known Issues

  • An Xcode Server bot loses authentication when a user clicks the “Replace Repositories” button under the Repositories tab. (59066142)

    Workaround: Either don’t click “Replace Repositories”, or reauthenticate after doing so.

  • Users can no longer select which branch to use for integrations under the Repositories tab of an Xcode Server bot. (59068222)

Simulator

New Features

  • Dragging and dropping an SSL certificate (CER or PEM file) will now install the certificate into the simulated device’s trusted root store. (56225826)

  • simctl supports a keychain subcommand. This command can add certificates to the trusted root store or the keychain. It can also reset the keychain, deleting all saved items. For example, to install “my-selfsigned.cer” to the trusted root store:

    $ xcrun simctl keychain <device> add-root-cert my-selfsigned.cer
    

    Adding a certificate to the trusted root store causes TLS/SSL connections to trust the certificate (56213319)

  • simctl now supports modifying privacy permissions. You can modify privacy permissions to create known states for testing purposes. For example, to allow an example app to access the photo library without any prompts:

    xcrun simctl privacy <device> grant photos com.example.app
    

    To reset all permissions to defaults, as if the app had never been installed before:

    xcrun simctl privacy <device> reset all com.example.app
    

    Always test your application after resetting permissions to ensure you have the correct usage description keys in your Info.plist and you are properly requesting and handling different authorization states. See xcrun simctl help privacy for more information. (55155981)

  • Simulator supports toggling appearance for iOS simulators (13.0 and later). From within the app select Debug > Toggle Appearance. From the command line use the simctl ui subcommand, e.g. to set dark appearance (54556446) (FB7093020):

    $ xcrun simctl ui <device> appearance dark
    

  • Simulator now has a menu item and keyboard shortcut to bring up the app switcher in iOS Simulators. (54252732) (FB7014782)

  • simctl status_bar now allows changing the operator (carrier) name. (54162823) (FB6985308)

  • Simulator now has a menu item to trigger screenshots in iOS simulators. This saves a screenshot to the simulated device’s camera roll. The existing screenshot feature has been renamed “Save Screen” for clarity and continues to save the device’s framebuffer to your Mac’s desktop by default. Hold Option when saving the screen to change the default location. (52852628)

  • tvOS simulators no longer capture the TouchBar as if it were a Siri Remote paired with your Mac. (48547948)

  • Simulator supports simulating remote push notifications, including background content fetch notifications. In Simulator, drag and drop an APNs file onto the target simulator. The file must be a JSON file with a valid Apple Push Notification Service payload, including the “aps” key. It must also contain a top-level “Simulator Target Bundle” with a string value that matches the target application‘s bundle identifier.

    simctl also supports sending simulated push notifications. If the file contains “Simulator Target Bundle” the bundle identifier is not required, otherwise you must provide it as an argument (8164566):

    $ xcrun simctl push <device> com.example.my-app ExamplePush.apns
    

  • Simulator has a new UI that streamlines working with simulated devices. Simulated device windows have a standard title bar, with buttons for common tasks. App-level settings are now available in the Preferences window. (57715023, 57380865, 58013098)

Known Issues

  • Third-party “endpoint security” software may cause slow simulators, system freezes, or prevent debug processes from running in simulators reliably. This sometimes manifests as debugserver disconnections, or sends simulator applications a SIGKILL signal. (55853555)

    Workaround: Uninstall the third-party software.

Resolved Issues

  • CoreSimulator now cleans up temporary files generated by Interface Builder during the build process. (53568836)

  • When multiple GPUs are installed in the new Mac Pro, Simulator assigns each booted simulator to one of the available GPUs. (50608554)

  • Fixed an issue that could cause certain kinds of IOSurfaces in simulators to corrupt memory or be created with the wrong memory protection. (52899754)

Source Control

New Features

  • Improved stability of core source control functionality, and reduced memory footprint related issues. (54765574)

  • Split functionality of “Fetch and Refresh Status” menu item into two separate menu items to separate fetching and refreshing status. (54326241)

Known Issues

  • Adding a new account for GitHub may not function correctly in Xcode 11.4 beta 2. (59205637)

    Workaround: Add new accounts for GitHub with other versions of Xcode.

Source Editor

Resolved Issues

  • A rename refactor of a Swift or Objective-C object correctly renames the file that contains the object. (32408445)

Swift Packages

New Features

  • Remote Swift packages with tools version 5.2 and above no longer resolve package dependencies that are only used in their test targets, improving performance and reducing the chance of dependency version conflicts. (56925017)

  • Swift Package Manager uses a new strategy to resolve package dependencies that significantly improves the quality of error messages and performance in complex package graphs. (45371461)

Resolved Issues

  • iOS, tvOS, or watchOS apps with a Swift Package that builds a dynamic library can be submitted to the App Store. (55564324) (FB7303066)

  • You can now use Swift-only XCTest APIs (such as XCTUnwrap(_:_:file:line:)) when building a package using command-line SwiftPM. (51959291)

  • You can import libxml2, libxslt, and libexslt modules in both Swift package targets and regular Xcode targets, without any additional search paths. (52043828)

Swift

New Features

  • You can call values of types that declare func callAsFunction methods like functions. The call syntax is shorthand for applying func callAsFunction methods.

    struct Adder {
        var base: Int
    
        func callAsFunction(_ x: Int) -> Int {
          return x + base
        }
    }
    
    var adder = Adder(base: 3)
    adder(10) // returns 13, same as adder.callAsFunction(10)
    

    You must include func callAsFunction argument labels at call sites. You can add multiple func callAsFunction methods on a single type, and you can mark them as mutating. func callAsFunction works with throws and rethrows, and with trailing closures. (59014791)

  • Subscripts can now declare default arguments. (59012048)

    struct Subscriptable {
        subscript(x: Int, y: Int = 0) {
          ...
        }
    }
    
    let s = Subscriptable()
    print(s[0])
    

  • A class-constrained protocol extension, where the extended protocol does not impose a class constraint, now infers the constraint implicitly. (59011997)

    protocol Foo {}
    class Bar: Foo {
        var someProperty: Int = 0
    }
    
    // Even though 'Foo' does not impose a class constraint, it is automatically
    // inferred due to the Self: Bar constraint.
    extension Foo where Self: Bar {
        var anotherProperty: Int {
            get { return someProperty }
            // As a result, the setter is now implicitly nonmutating, just like it would
            // be if 'Foo' had a class constraint.
            set { someProperty = newValue }
        }
    }
    

  • Convenience initializer inheritance for subclasses defined outside of the module defining the base class now comes with additional restrictions. When these subclasses have a base class with non-public designated initializers, they no longer automatically inherit convenience initializers from their superclasses. To restore this automatic inheritance behavior, the base class must ensure that all of its designated initializers are public or open. (51249311)

  • Xcode and the corresponding Command Line Tools package include the SourceKit-LSP language server for Swift and C-based languages. The language server is in early development, and this is a great time to experiment with it. SourceKit-LSP can be used with third-party tools that support the Language Server Protocol (LSP), and it supports Swift Packages built from the command-line. For information about using SourceKit-LSP see Getting Started with SourceKit-LSP. (48004600)

  • The Swift compiler uses a new strategy to produce diagnostics that drastically improves the quality and precision of error messages. Details about this new strategy can be found on the post New Diagnostic Architecture Overview on the Swift blog. (36854046)

  • A method override can no longer have a generic signature with requirements not imposed by the base method. For example, the below code produces an error. (23626260) (FB5382462)

    protocol P {}
          
    class Base {
        func foo<T>(arg: T) {}
    }
          
    class Derived: Base {
        // generates an error because of the added requirement
        override func foo<T: P>(arg: T) {}
    }
    

Resolved Issues

  • The compiler now correctly strips argument labels from function references used with the as operator in a function call. As a result, you can now use the as operator to disambiguate a call to a function with argument labels.

    func foo(x: Int) {}
    func foo(x: UInt) {}
          
    (foo as (Int) -> Void)(5)  // Calls foo(x: Int)
    (foo as (UInt) -> Void)(5) // Calls foo(x: UInt)
    

    Previously, this was only possible for functions without argument labels. This change also means that you can no longer use a generic type alias to preserve the argument labels of a function reference through the as operator. The following is now rejected:

    typealias Magic<T> = T
    func foo(x: Int) {}
    (foo as Magic)(x: 5) // error: Extraneous argument label 'x:' in call
    

    You must instead call the function value without argument labels. (59011892)

    (foo as Magic)(5)
    

  • The compiler now supports local functions whose default arguments capture values from outer scopes. (SR-2189) (20796451)

    func outer(x: Int) -> (Int, Int) {
        func inner(y: Int = x) -> Int {
            return y
        }
        
        return (inner(), inner(y: 0))
    }
    

Testing

New Features

  • To enable test timeout behavior from xcodebuild, or to override the corresponding setting in the test plan, pass the -test-timeouts-enabled option. To configure the default execution time allowance for an individual test when timeouts are enabled, pass the -default-test-execution-time-allowance option. To enforce an absolute cap on the amount of time a test can run (if it requests additional time via the executionTimeAllowance API), pass the -maximum-test-execution-time-allowance option. Refer to the xcodebuild man page (man xcodebuild) for more information. (58413928)

  • You can enable test timeouts through the “Test Timeouts” option in the test plan. You can override this value from the command-line through the -test-timeouts-enabled option to xcodebuild. (58125818)

  • The XCTAssertEqualWithAccuracy and XCTAssertNotEqualWithAccuracy APIs now support all FloatingPoint types. (57523034)

  • When building a scheme which has been converted to use test plans and whose active test plan has code coverage enabled, Xcode now includes code coverage instrumentation when building for the ‘Run’ action, in addition to the ‘Test’ action. This matches the behavior of building schemes which don’t use test plans and have code coverage enabled, and avoids unnecessary rebuilds when alternating between running and testing actions. (57367856)

  • Resetting the authorization status of a protected resource (e.g. Contacts, Bluetooth or Location) is now supported in UI testing contexts. XCUIApplication gains a new method, resetAuthorizationStatusForResource:, that accepts an XCUIProtectedResource. This allows test authors to easily set the the authorization status of apps to their initial state, providing a convenient way to test first-launch / first-access flows of their resources. (56628656)

  • Xcode’s New File templates for XCTest in Swift now include the throws keyword for all test methods. Errors thrown by test methods are recorded as test failures. (56619497)

  • If you enable parallel testing for a test target in the active scheme/test plan, and you pass the -parallelize-tests-among-destinations flag to xcodebuild along with multiple destination specifiers, Xcode distributes test classes within that target among the destinations to speed up test execution. (56585597)

  • UI testing and recording on macOS support the Fn key modifier. (56178883)

  • When you run xcodebuild build-for-testing for a scheme that uses test plans, its generated .xctestrun file now includes metadata about each test plan, including the name of the test plan and whether it’s the scheme’s default plan. (53997527)

  • Xcode now has better support for test support frameworks and libraries by introducing an “Enable Testing Search Paths” build setting. This build setting is on by default for test bundle targets, as well as for targets which explicitly include XCTest.framework in their “Link Binary With Libraries” list. Source files in such targets can now import XCTest without setting any custom search paths. (51117167)

  • XCTest has improved error handling and logging for the case where a custom XCTestObservation implementation throws an exception. (44291078)

  • xcodebuild now validates the deployment target and architecture of built products when running xcodebuild test-without-building with the -xctestrun flag. Targets that aren’t compatible with the requested run destination are skipped. (43107996)

  • XCTest now includes throwing variants of the setUp and tearDown instance methods, allowing tests to throw errors in Swift during set up or tear down. Override the setUpWithError: or tearDownWithError: methods instead of setUp or tearDown, respectively. If an error is thrown by setUpWithError:, the test method is not executed, and if the error was due to calling an XCTSkip* API, the test is marked as skipped instead of failed. (42069831)

  • Xcode now validates the deployment target of test bundle targets, and skips running any tests that are incompatible with the selected run destination. Some targets may require a change to their minimum deployment target build setting to continue to run on older run destinations. (39775813)

  • Errors thrown by Swift test methods now record the source location where the error was thrown. Xcode highlights these lines in the source editor and allows jumping to those locations from the Issue Navigator. (26370684)

  • Xcode now opens files in the source editor after they are created by clicking the ‘+’ button in the Test Navigator. (17088680)

  • XCTest now supports dynamically skipping tests based on runtime conditions, such as only executing some tests when running on certain device types or when a remote server is accessible. When a test is skipped, Xcode displays it differently in the Test Navigator and Test Report, and highlights the line of code where the skip occurred along with an optional user description. Information about skipped tests is also included in the .xcresult for programmatic access.

    To skip a test, call one of the new XCTSkip* functions from within a test method or setUp. For example:

    func test_canAuthenticate() throws {
        XCTSkipIf(AuthManager.canAccessServer == false, "Can't access server")
    
        // Perform test…
    }
    
    

    The XCTSkipUnless(_:_:file:line:) API is similar to XCTSkipIf(_:_:file:line:) but skips if the provided expression is false instead of true, and the XCTSkip API can be used to skip unconditionally. (13696693)

  • XCTest now allows individual tests to time out if they exceed a configurable duration of time. If timeouts are enabled, either via a test plan option or via an xcodebuild command-line option, a test will be given a default allowance within which it must complete. Tests that exceed this length of time will fail, and a spindump of the test process will be attached to the test in the test report. If the test needs additional time to run, it can request so via the executionTimeAllowance property on XCTestCase. For more information, refer to the documentation in XCTestCase.h. (12584283)

Resolved Issues

  • XCTest now correctly handles large wait timeout values passed to XCTWaiter “wait” APIs, such as DBL_MAX. (56503613)

  • Source editor test diamonds for tests in Swift packages now appear automatically upon opening the package in Xcode. (51105554)

  • Previously, when running UI tests, the target under test was (re)installed before each test started. Starting in Xcode 11.4, the target under test is installed once per test session and device, speeding up UI tests considerably. (24776269)

  • Fixed an issue that caused skipped tests to sometimes display in the Test Log using a green success icon instead of a gray skipped icon. (58604973)

  • Fixed an issue that caused source editor annotations for skipped tests to sometimes show on the wrong line if new lines were inserted earlier in the file. (58848468)

See Also

Xcode 11

Xcode 11.3.1 Release Notes

Update your apps to use new features, and test your apps against API changes

Xcode 11.3 Release Notes

Update your apps to use new features, and test your apps against API changes

Xcode 11.2.1 Release Notes

Update your apps to use new features, and test your apps against API changes.

Xcode 11.2 Release Notes

Update your apps to use new features, and test your apps against API changes.

Xcode 11.1 Release Notes

Update your apps to use new features, and test your apps against API changes.

Xcode 11 Release Notes

Update your apps to use new features, and test your apps against API changes.