Archive for July 24, 2017

Monday, July 24, 2017

Matching and Bridging NSErrors in Swift

Joshua Emmons:

You can find all the gory details in SE-0112, but the long and the short of it is, depending on the domain of a given NSError, Swift automatically bridges it to a struct describing that domain. In the case of NSURLErrorDomain, for example, Swift will bridge to a URLError[…]

You can also use the CustomNSError protocol to bridge in the other direction.

See also: CocoaError.

NSNotificationCenter Thread Safety

Jeff Johnson:

As far as I can tell, NSNotificationCenter now keeps a strong reference to the observer while posting a notification. As a consequence, the observer can no longer deallocate while processing the notification. This behavior occurs both with Automatic Reference Counting (ARC) and with Manual Retain-Release (MRR). Hooray!

It’s still true that removeObserver: does not block for notifications in progress.

APFS Support Is Undone in 10.12.6

Howard Oakley:

Sierra 10.12.6 addresses the previous problems with Apple’s new file system, APFS, by making it normalising, thus compatible with HFS+ file and folder naming.

Unfortunately, the update also breaks the tools provided in 10.12.4 and 10.12.5 for working with APFS, and Disk Utility is similarly incapable of even distinguishing between case-sensitive and case-insensitive variants of APFS. While 10.12.6 does read from and write to APFS volumes, it can do little more than that.