Archive for February 14, 2024

Wednesday, February 14, 2024

Swift Collections 1.1

Karoy Lorentey (Mastodon):

This feature release adds a number of new data structure implementations, along with minor changes to existing constructs.


  • Heap implements a min-max heap, backed by a native array.
  • BitSet and BitArray are two alternate representations of a bitmap type, backed by dynamically allocated storage.
  • TreeSet and TreeDictionary are hashed collections implementing Compressed Hash-Array Mapped Prefix Trees (CHAMP). They provide similar API as Set/Dictionary in the Standard Library, but as persistent data structures, supporting incremental mutations of shared instances and efficient structural diffing.

Michael Steindorfer has written a paper and thesis about CHAMP.


Update (2024-02-21): Majid Jabrayilov:

Dictionary and Set types that Swift language provides us store values in a single flat hash table that you copy on every write or mutation. The Swift Collection package introduces TreeDictionary and TreeSet types implementing Compressed Hash-Array Mapped Prefix Trees. In other words, TreeDictionary and TreeSet types hold values in the tree-based structure, allowing the efficient updating of only the needed branches.


The TreeDictionary is still a struct, but the implementation uses the UnsafeMutablePointer type to access memory and mutate it directly without copying on write. Another benefit of the TreeDictionary and TreeSet types is the optimized way to compare because of their tree-based nature. Usually, they handle this operation in a constant time.

Mail and Preview Working Together

Wade Tregaskis:

…after I’d filled out a form PDF that was emailed to me. It had exactly the option I wanted first and foremost, to send the completed PDF back to the sender.

Sure, manually digging up the completed PDF from disk and dragging it into a Mail Compose [Reply] window isn’t hard, but it just feels so thoughtful when the system saves me the effort. Knowing that someone, somewhere, actually thought through how Mail & Preview might be used, and thought enough of their users to go to the trouble of implementing this.

This does not happen when editing an image file. Is it only for PDF forms?

Unlike with kMDItemWhereFroms, there does not seem to be a public API, e.g. so that a third-party mail client could make the same information available to Preview or a third-party document editor could access the information from Mail.

The metadata seems to be stored in the extended attribute, which seems to be encrypted. I guess this is to prevent accidentally sharing it with other Macs because on the same Mac it’s accessible using mdls. Finder also displays an envelope badge on files with this attribute and displays some of the e-mail information.

Update (2024-04-08): Simon:

So far so good I guess. But did you know that when you select such a file in column view it now displays that email icon and a link (to Mail, and in my case non-functional) INSTEAD of the file size in the location where the file size used to be? So in order to see the size of a file that came as an email attachment I’m now having to open a Get Info window.

The iMessage Halo Effect

John Siracusa:

The iMessage service is not so good that it makes the iPhone more attractive to customers. It’s the iPhone that makes iMessage attractive. The iPhone gives iMessage its cachet, not the other way around.


Today, it still feels like the iPhone is carrying iMessage. Anecdotally, both my teenage children have iPhones, but their group chats with their friends take place in WhatsApp.


Apple has little to lose by expanding iMessage to other platforms, and there still may be something to be gained (even if it’s just making mixed Android/iPhone conversations in Messages a bit more smooth).


Fraudulent Kimi App

Wes Davis:

There’s a vision testing app called Kimi sitting at number eight in the Apple iOS App Store’s trending list of free entertainment apps right now (and number 46 overall for free apps!). But it’s not an app for testing your eyesight, at least not unless you consider watching pirated movies on your smartphone a form of vision testing, which, I suppose you could?


You open it, and there are just movies and TV shows right there for you to watch. There’s no splash screen and no trick to unlock the real app. It wasn’t hidden at all under a thin veneer of legitimacy.

Juli Clover:

The App Store description mentioned comparing two pictures as an eyesight test, watching scenery, and playing games, but none of those features were present in the app.


Apple pulled the app this morning after The Verge wrote about it, and it is no longer available.

This is the second time in the last week that Apple’s App Store has made headlines for questionable app approval.

Even if Apple were doing a good job of reviewing, there’s little they can do about apps that change their functionality outside of the review environment. Apple knows this but is still pretending that it’s even possible to do what they claim to do. High-profile apps like this get caught eventually, but there’s probably a large number of them that are unpopular and so stay under the radar.


Update (2024-02-16): Jeff Johnson:

Incidentally, this problem applies to Mac app notarization too. A developer can easily notarize a harmless app that software updates itself into malware.