Fast reading

The article is a bit long, so if you are busy you can quickly scan the simple list below

Xcode 11.4 Beta brings a lot of great features!

  • Swift 5.2, SwiftUI added more prominent error messages.

  • Swift 5.2, with a batch of grammar sugar. The direction is to reduce the amount of code.

  • Simulator supports remote push notifications

  • UI debugger with layers

  • In-app purchases for the Apple Watch

  • The macOS App will be available bundled with iOS

  • Simulator supports dragging SSL certificates
  • The Simulator screensaver is stored in the Simulator’s camera photo

The macOS App will be available bundled with iOS

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

  • By default, new Mac Catalyst applications created in Xcode 11.4 enable universal purchases. When a new Mac Catalyst application is created, it uses the same bundle identifier as the iOS application.

  • Automatic signing in Xcode 11.4 enables you to build Mac Catalyst applications using custom package identifiers. You can edit the bundle identifier for your application using the Signatures and Features TAB in the project editor. If you choose to build a Mac Catalyst application with a custom bundle identifier that does not match the iOS application, you will not be able to distribute the application as a universal purchase.

Problem solved

Create objective-C category files by choosing File > New > File. Files containing the AppKit framework imports will no longer be created. (55977950) (FB7346800)


Swift Packages

  • Remote Swift packages with tools version 5.2 and higher no longer resolve package dependencies that are only used in their test targets, improving performance and reducing the possibility of dependency version conflicts. (56925017).
  • Swift Package manager dramatically improves the quality of error messages and performance in complex package diagrams by using a new strategy to address package dependencies. (45371461

Swift

  • You can call a value that declares a type of func callAsFunction method such as a function. The calling syntax is shorthand for applying the func callAsFunction method.
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)
Copy the code

You can add multiple func callAsFunction methods on a single type, and you can mark them as variants. The func callAsFunction can be used to raise and reraise as well as trailing closures. (59014791).

  • Subscripts can now declare default parameters.
struct Subscriptable { subscript(x: Int, y: Int = 0) { ... }}let s = Subscriptable()
print(s[0])
Copy the code
  • Protocol extensions of a class constraint, where the extension protocol does not impose a class constraint, now implicitly infer that constraint. (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 }
    }
}
Copy the code
  • Convenient initializer inheritance for subclasses defined outside the module that defines the base class now has additional restrictions. When these subclasses have a base class with a non-publicly specified initializer, they no longer automatically inherit the convenient initializer from their superclass. To restore this automatic inheritance behavior, the base class must ensure that all of its specified initializers are public or open. (51249311).

  • Method overrides can no longer have generic signatures that have no requirements imposed by the base method. For example, the following code produces an error. (2362 26260) (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) {}
}
Copy the code

Build system new properties

The build Settings have a new evaluation operator, the default value, that can be used to specify the default value for the build Settings if the evaluation result is nil in the context of the evaluation. Such as:

$(SETTING:default=something)
Copy the code

If $(SETTING) is empty, this expression evaluates to “something”. The default value itself can be an expression containing an evaluation of the build Settings. (57402718).

Now, to build a codeless kernel extension using the new build system, you need to set the build setting of GENERATE_KERNEL_MODULE_INFO_FILE to NO. (57247534).


Debbugging new attribute

  • The view debugger now provides the layout guide (UI LeyOutGuide, NSLayoutGuide) and its reference constraints. (20387325).

  • View debugging Displays layers using the Display Layers menu item in the Editor menu. (15775898).

  • The cause of the exception now emerges as an editor comment. You can examine the Exception object in the Variables View and find the traceback of the original uncaught Exception (if any) in the Debug Navigator. (8045587).

  • Improved visibility of view contours in view debugger. (44861893) (FB5361403)


equipment

Known issues

The ICONS and names of devices running iOS 13.0 May not reflect the correct OS version in the Devices and Emulators window. (55044395).

Solution: Restart macOS.


Simulator

  • Now, dragging and dropping the SSL certificate (CER or PEM file) installs the certificate into the trusted root store of the emulated device. (56225826).

  • The emulator supports the switching look of the iOS emulator (version 13.0 and later). In the application, choose Debug > Switch Appearance. Use the simctl UI subcommand on the command line, for example, set the dark look (54556446) (FB7093020)

$ xcrun simctl ui <device> appearance dark
Copy the code
  • Simulator now has menu items and keyboard shortcuts to call up the application switcher in iOS Simulators. (54252732).

  • The emulator now has a menu item that triggers the guest screen capture feature in the iOS emulator. This saves the screen capture to the analog device’s camera roll. For clarity, the existing screen capture feature has been renamed “Save Screen” and continues to save the device’s frame buffer to the Mac desktop by default. Hold down options while saving the screen to change the default location. (52852628).

  • The Simulator has a new UI that simplifies collaboration with emulation devices. The analog device window has a standard title bar with buttons for performing normal tasks. Application-level Settings are now available in the Preferences window. (57715023, 57380865, 58013098)


Instruments

Known problems When performing performance analysis on an application on a networked device, Instruments may report that the device is unavailable, indicating that it is “waiting for Xcode to download symbols from the device.” (59169574).

Workaround: Profile the application using a wired connection on the device or on an analog device.


Interface Builder

Added dynamic system gray to Inspector Color Pickers. (55403376) (FB7281404)

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

Known problems

Xcode may hang on some storyboards due to iOS pop-ups. (59070586).

Workaround: Re-open Xcode with Shift.

When open the use pop-up presentation of particular nib (the UIKit TestVectorLabelController. The storyboard), Xcode could crash. (58421606).

Workaround: Re-open Xcode with Shift.

Download address

developer.apple.com/download/

More SwiftUI tutorials and code focus columns

QQ:3365059189 SwiftUI Technical exchange QQ group :518696470

  • Please pay attention to my column icloudend SwiftUI tutorial and the source www.jianshu.com/c/7b3e3b671…