Xcode 11.4 Beta Release

Overview

 
Apple recently released Xcode 11.4 Beta version. You can update your apps with new features, and test your app against API changes.
 

New Features

  • Xcode 11.4 supports building and distributing macOS apps as universal purchases. 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 gave an existing project, edit its bundle identifier in the Project Editor. 
  • Universal purchase is enabled by default for new Max 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 the iOS app, you will not be able to distribute the app as a universal purchase. 

Resolved Issue

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

Build System

 
In the build system the following features are new: 
  • 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 nil in the context of the evaluation. For example:
    1. $(SETTING:default=something)    
    2. //If $(SETTING) is empty, then this expression evaluates to 'something'. The default value may itself be an expression containing build settings evaluations.  
  •  Building codeless kernel extensions with the new build system now requires that you set the GENERATE_KERNEL_MODULE_INFO_FILE build setting to NO.

Debugging

 
In the Debugging section the following features are new: 
  • The view debugger now presents a layout guide (UILayoutGuid, NSLayoutGuide) and their referencing constraints.
  • View debugging supports showing layers using the Show Layers menu item in the Editor menu.
  • 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 Navigation.

Resolved Issues 

  • Improved visibility of view outlines in the view debugger. 

Interface Builder - New features

  • Added dynamic system gray colors to inspector color pickers. 
  • 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. 

Resolved Issue

  • Fixed an issue where the inspector section for NumberFormatter Symbols had a light background in dark mode.
  • Fixed an issue where several NSResponder actions were missing from the Connections Inspector.
  • Fixed a crash that could occur when moving duplicate NSComboBox items in the Inspector.
  • Fixed an issue where the unrecognized system colors wouldn't have their fallback colors preserved after loading and saving Interface Builder documents.
  • Fixed a bug that prevented entering a 0 constant in the constraint popup editors.
  • Fixed an issue where XIB template files didn't have a dynamic background color.
  • Fixed a crash that would occur if an NSLevelIndicator Minimum inspector value was higher than its Maximum.
  • Fixed an issue where Interface Builder documents containing UINavigationBar titles configured with named colors could be archived with duplicate named color resources.
  • Fixed an issue where Apple TV UITableViewCell safe area frames displayed incorrectly in XIB files.
  • Fixed an issue where Xcode could crash after configuring text to be non-attributed.

Preview  - New Features 

  • You can now copy, cut, paste, duplicate, and delete views directly within the Xcode Previews canvas.
  • Selecting a SwiftUI preview in code now highlights the corresponding preview in the canvas and vice versa.

Resolved Issues

  • Xcode Previews now supports previewing iPad applications brought to the Mac.
  • Entering live mode in the canvas for Xcode Previews now happens immediately.
  • Fixed an issue where some Xcode Previews would spin forever when first updating.
  • Xcode Previews now correctly builds previews in the frameworks that depend on other frameworks in the project.
  • Fixed a crash in Xcode Previews that could occur when using the inspector.

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 or the keychain.
  • 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. 
  • simctl now supports modifying 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 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 snd handling different authorization states.
  • The simulator supports the 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.

    $ xrun simctl UI <device> appearance dark 
  •  Simulator now has a menu item and keyboard shortcut to bring up the app switcher in iOS Simulators.
  • simctl status_bar now allows changing the operator (carrier) name.
  • Simulator now has a menu item to trigger the guest screenshot feature in iOS simulators. This saved a screenshot of the simulated device's camera roll. The existing screenshot feature has been "Save Screen" for clarity and continues to save the device's framebuffer to your Max's desktop by default.
  • tvOS simulators no longer capture the TouchBar as if it were a Siri Remote paired with your Mac. 
  • The 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 matching the target application's bundle identifier. 
  • simctl also supports sending simulated push notifications. If the file contains "Simulator Target Bundle" the bundle.

    $ xcrun simctl push <device> com.example.my-app ExamplePush.apns
  • simctl also supports sending simulated push notifications. If the file contains "Simulator Target" the bundle identifier is not required, otherwise, you must provide it as an argument.

  • The 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. 

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 method.
    1. struct Adder {    
    2.     var base: Int    
    3.     func callAsFunction(_ x: Int) -> Int {    
    4.       return x + base    
    5.     }    
    6. }      
    7. var adder = Adder(base: 3)    
    8. 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 trainling closure.
  • Subscripts can now declare default arguments. 
    1. struct Subscriptable {    
    2.     subscript(x: Int, y: Int = 0) {    
    3.       ...    
    4.     }    
    5. }    
    6. let s = Subscriptable()    
    7. print(s[0])   
  • A class-constrained protocol extention, where the extented protocol does not impose a class constraint, now infers the coonstraint implicitly.
    1. protocol Foo {}    
    2. class Bar: Foo {    
    3.     var someProperty: Int = 0    
    4. }    
    5. // Even though 'Foo' does not impose a class constraint, it is automatically    
    6. // inferred due to the Self: Bar constraint.    
    7. extension Foo where Self: Bar {    
    8.     var anotherProperty: Int {    
    9.         get { return someProperty }    
    10.         // As a result, the setter is now implicitly nonmutating, just like it would    
    11.         // be if 'Foo' had a class constraint.    
    12.         set { someProperty = newValue }    
    13.     }    
    14. }    
If you enjoyed to reading my article, please share it with others. Thank you in advance.