Wednesday, February 5, 2020

Xcode 11.4 Beta

Apple:

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.

[…]

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 Navigator.

[…]

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

[…]

You can call values of types that declare func callAsFunction methods like functions.

[…]

Subscripts can now declare default arguments.

[…]

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.

[…]

Errors thrown by Swift test methods now record the source location where the error was thrown.

[…]

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.

Looks like some great improvements (including many for the simulator). Too bad it requires Catalina.

Previously:

Update (2020-02-06): Paul Hudson (Hacker News):

The first beta of Swift 5.2 just landed with Xcode 11.4 beta, and it includes a handful of language changes alongside reductions in code size and memory usage, plus a new diagnostic architecture architecture that will help you diagnose errors faster.

Update (2020-02-07): Peter Steinberger:

We benchmarked Xcode 11.3.1 and Xcode 11.4b1 after seeing the reported Swift compiler performance improvements. For ObjC/C++ heavy code Clang became around 10% slower, not faster.

Peter Steinberger:

Xcode 11.4b1 is great overall. Similar stability, much nicer Simulator, everything still compiles, way faster UI tests, amazing view inspector upgrades. Gonna use this as main IDE now. Great work, Xcode team!

Update (2020-02-14): Shai Mishali:

Xcode 11.4b1 mentioned it offers Swift compiler improvements, and yet:

On a ~7 years-old project with mixed Objective-C/Swift (60%/40%)

3 clean (nuked Derived Data, etc.) build-time averages:

Xcode 11.3: ~185 seconds
Xcode 11.4b1: ~230 seconds

About 22% slower

Donny Wals:

I’m pretty sure that the ability to test push notifications in the simulator is my favorite new feature in Xcode 11.4

Update (2020-02-17): Donny Wals:

Swift isn’t the only language to allow its users to call instances of certain types as functions. A language that I have used a lot that allows this kind of behavior is Python. The ability to invoke instances as functions is very interesting in certain applications where you want to represent a stateful calculator, parser or computing object. This is very common in complex math operations and machine learning where certain objects might hold on to some state and only implement a single method.

[…]

In many cases, a simple closure wouldn’t do. The object that ends up handling the route would need to have a database connection, a concept of caching, authenticating and possibly a lot of other functionality. Capturing all of that in a closure just doesn’t seem like a great idea. Instead, you’d want some kind of complex object to handle this route. And that’s exactly the kind of freedom we get with callAsFunction.

Comments RSS · Twitter

Leave a Comment