Wednesday, September 19, 2018

Swift 4.2 Released

Ted Kremenek:

Swift 4.2 is now officially released! Swift 4.2 builds on the strengths of Swift 4, delivering faster compile times, improving the debugging experience, updating the standard library, and converging on binary compatibility.

[…]

The standard library in Swift 4.2 includes a number of new features, including improvements to the Hashable protocol as well as a new unified set of randomization functions and protocols.

See more at:

JaviAir:

A year later, and Swift 4.2 shipped with a ship-stopper KVO bug still unresolved. Don’t use the Swift KVO syntax in an iOS app unless you want random crashes.

Previously: Swift 4.2.

Update (2018-09-20): John Sundell:

Instead of manually defining our font dictionary, like we do above, let’s take a look at how Swift 4.2’s CaseIterable can help us avoid bugs and make our code more consistent when defining enum-keyed dictionaries.

Soroush Khanlou:

Ideally, you’d be able to initialize the Hasher with a seed, instead of mixing it in. Swift’s Hasher uses a different seed for each launch of the application (unless you set an environment variable which they added for consistent hashing between launch, mostly for testing purposes), meaning you can’t write these values to disk. If we controlled the seed of the Hasher, then we could write these values to disk as well. As this Bloom filter currently stands, it should only be used for in-memory caches.

Renaud Lienhart:

I think this is new in the Swift 4.2 toolchain: it is now possible to declare a nested type in an extension, in a different file than the one with the parent type’s declaration. This will clean up things nicely

Update (2018-09-24): See also: Swift 4.2 Release Notes for Xcode 10.

Bruno Rocha:

You can reverse engineer the resulting binary, but it would be painfully hard to understand what the [CaseIterable] assembly means. Another option is to fork the Swift compiler and attach lldb to it, but you would need to know what to breakpoint in the first place - which I have no idea.

Luckily, the Swift compiler in your Xcode’s toolchain offers several arguments that allow you to extract human-readable files that represent “processed” versions of Swift source files, and one of these options allow you to retrieve the Abstract Syntax Tree (AST) of a file.

1 Comment RSS · Twitter


[…] Michael Tsai’s Swift 4.2 Released […]

Leave a Comment