Thursday, May 26, 2022 [Tweets] [Favorites]

Code Injection with Dyld Interposing

Noah Martin:

Swizzling handles Objective-C methods, but cannot be used for C/C++ functions. Non-Obj-C lower level calls can be useful for reverse engineering iOS apps, but sometimes you need to intercept them in an app that you don’t have the source code for.

In this post we’ll be looking at a lesser known technique for injecting code at a function call, one that works with C/C++ functions and with unmodified app binaries.

Peter Steinberger:

As of macOS 10.15.4, text input in Mac Catalyst apps sometimes crashes. I’ve noticed this a lot in Twitter for Mac, however, we also saw crash reports for PDF Viewer for Mac. My hope was Apple would fix this in 10.15.5, but now the release is out and things are still crashing, so let’s fix this ourselves.


Swift @_assemblyVision

Karl (via Ron Avitzur):

There is a super-hidden feature in the compiler which gives you insight in to all kinds of optimisation decisions: such as the cost-benefit calculations for inlining, where exclusivity is enforced, where ARC operations happen, which generic specialisations get generated and which calls get devirtualised.


To use it, add the @_assemblyVision attribute to a function, and build in release mode (or @_semantics("optremark") on a pre-5.6 compiler.


The first is called opt remarks. “opt remarks” shows the decisions the optimizer is making (e.x.: did I specialize this, did I inline this/etc).

The second is something that I invented called “Assembly Vision”. This is the thing that is telling you where the ARC/exclusivity checks/runtime casts. Assembly Vision also enables the other form of normal opt-remarks since that information can be useful when determining where/why ARC is there. The idea is to make it so that instead of having to read the assembly, one can have vision on approximately where these calls are so you don’t have to read the assembly yourself.


The concept came from me trying to automate how I optimize Swift code as a compiler engineer so that other engineers who aren’t compiler people can be just as effective.

This looks incredibly useful.


DOJ Will No Longer Charge Security Researchers

Adi Robertson (in June 2021):

The Computer Fraud and Abuse Act (CFAA), a controversial anti-hacking law which bans “exceeding authorized access” on a computer system, was narrowed by the Supreme Court on Thursday in a 6-3 ruling. The court said the law shouldn’t cover people misusing systems they’re allowed to access — and that claiming otherwise would criminalize a “breathtaking amount” of everyday computer use.

Department of Justice (via Bruce Schneier):

The Department of Justice today announced the revision of its policy regarding charging violations of the Computer Fraud and Abuse Act (CFAA).

The policy for the first time directs that good-faith security research should not be charged. Good faith security research means accessing a computer solely for purposes of good-faith testing, investigation, and/or correction of a security flaw or vulnerability, where such activity is carried out in a manner designed to avoid any harm to individuals or the public, and where the information derived from the activity is used primarily to promote the security or safety of the class of devices, machines, or online services to which the accessed computer belongs, or those who use such devices, machines, or online services.


So they’re saying security research actually is A Crime under CFAA, but they just promise they won’t go after you for committing that Crime, right?

Doesn’t give me a warm and fuzzy feeling…


No, that’s not correct. The policy memo is a straightforward, good-faith instruction to USAs not to prosecute certain categories of potential CFAA cases because (a) SCOTUS’s new Van Buren precedent says they do not fit within the CFAA, or (b) they are near enough to Van Buren that, if called upon to resolve such a case, courts would likely say they do not fit within the CFAA, or (c) even if a court could maybe be convinced not to dismiss the case under Van Buren, such a prosecution wouldn’t serve to vindicate the government’s interest in “promot[ing] privacy and cybersecurity by upholding the legal right of individuals, network owners, operators, and other persons to ensure the confidentiality, integrity, and availability of information stored in their information systems.”

Will Disk Utility Ever Work Properly?

Howard Oakley:

When Apple developed APFS, it decided neither to make it open source, nor to document it sufficiently to help third parties develop their own utilities for its maintenance. In doing so, it made a commitment to its users that Apple itself would provide all the tools necessary to work with its new file system. After all, any file system without sufficient tools to check, repair and maintain it isn’t fit for release, is it?

Disk Utility and its command line check and repair tool fsck_apfs are thus among the most important utilities in the whole of macOS. While there are several excellent alternatives which can perform the same tasks on HFS+ volumes, Apple’s policies on APFS have successfully locked all competition out of this market. Yet, over five years after the new file system’s release on 27 March 2017, Disk Utility is still riddled with bugs, and can’t check or repair disks containing Time Machine backups unless the Mac is booted in Recovery Mode, or without resorting to skulduggery with hidden snapshots.

See also: AskDifferent, Should you trust Disk Utility’s First Aid or fsck?.


Wednesday, May 25, 2022 [Tweets] [Favorites]

AttributedString Attribute Scopes

Natalia Panferova:

UIKit and AppKit attribute scopes have many attributes with matching names but different value types. Attributes with types defined in UIKit such as UIColor, UIFont etc. are available on platforms that can import UIKit and attributes with types defined in AppKit such as NSColor, NSFont etc. are available on macOS. AttributeScopes.UIKitAttributes type contains the full list of UIKit attributes and AttributeScopes.AppKitAttributes contains the full list of AppKit attributes.

Foundation can infer the right type of the attribute to use when we assign the value. The following code will assign as foreground color when UIKit is imported and when AppKit is imported.


Note, that when SwiftUI is imported SwiftUI attributes take priority and the resulting attribute value will be that is defined in the SwiftUI framework.


We can even define our own attributes and attribute scopes. This can be useful if we are building a framework or a package or just want to extend AttributedString functionality in our app.

See also: NSAttributedStringBuilder (via Kaya Thomas).


Silencing a Family Member’s Alarm

Tim Hardwick:

If you live in a family household, there’s a good chance that at some stage you’ve been disturbed by someone else’s alarm going off on their iPhone. If their phone is out of your reach and no one else is bothering to turn off the alarm, the disturbance can quickly become irritating, but if your own iPhone or iPad is nearby, there’s a handy trick you can use to silence that alarm without you having to get up.

That’s great, but how are you supposed to discover this if it’s only available via Siri?

The Rise of Canva

Mark Wilson:

As for Canva, where Perkins is CEO and Obrecht is chief operating officer: It’s now one of the most influential design platforms on the planet, with 75 million monthly active users who create, on average, 150 designs every second. The company, which is valued at $40 billion, expects to exceed $1 billion in revenue in 2022.

While many unicorns pivot again and again to find their market, Canva’s proposition today is remarkably similar to that pitch of more than a decade ago. Its easy-to-use, templated design platform allows people to create business cards, birthday invitations, social media ads, sales presentations, coffee mugs, and yearbooks. It works equally well on a phone, tablet, or laptop. Canva is a word processor for our modern visual culture, adjusting anything you see—text, an image, a background, an animation—with a simple tap.


Canva wants to push exporting options even further, by breaking its users out of the most limited format in design: the PDF. Later this year, Canva will begin allowing users to export projects not just as PDFs, but as single-serve websites with unique URLs. So a wedding invite built in Canva could be instantly published to the web, complete with the ability to accept RSVPs. Canva is reimagining stagnant files as interactive, shareable sites, which Perkins believes will be the predominant way designs are shared well into the future.


Tuesday, May 24, 2022 [Tweets] [Favorites]

OPML-Compatible Apps

Dave Winer:

The list was started by Jesse Grosjean of Hog Bay Software, as part of the development of his Bike outliner for the Mac.

I, Dave Winer, offered to transcribe the list and provide a means for it to grow here on

This page is of course an outline, so you should be able to open it in any of these outliners.

OmniOutliner can also directly open and save OPML files, although opening the same file at the same time as Bike doesn’t work the way it does between Bike and BBEdit. Bike sees changes made by OmniOutliner, but OmniOutliner doesn’t see changes made by Bike. [Update (2022-05-25): I think this is a Bike bug.]

Dave Winer:

Outliners will have compatible apps that render them.

Right now the renderers are specific to the outliner.

It’s as if you could only use one word processor with a printer.

As we get more interop between outliners, based on OPML, it will be possible to write renderers that work with all of them.

You could even mix outlines from different writing tools in a single presentation.


Corey B. Marion, RIP

The Iconfactory (via Sean Heber):

[Without] Corey, there would quite literally be no Iconfactory. Corey, Ged and Talos met in 1994 and we soon began a journey together that spanned 28 years. From day one, Corey did exactly what he loved most - designing, pushing pixels and creating icons.


Corey was instrumental in the growth and success of the company from the very start. He loved participating in judging our annual icon design contest, Pixelpalooza, back in the day. His keen eye for design touched nearly all of our products and made them infinitely better including IconBuilder, xScope, Twitterrific and Triode. He even created Linea Sans, a wonderful font based on his own handwriting that users will be able to enjoy for years to come.


SwiftUI in 2022

Jake Sawyer:

Even if you already know a bit (or a lot) of SwiftUI, Stanford’s course is incredible, amazing, wonderful, AND FREE!

Nick Lockwood:

Half the iOS devs on my TL keep posting stuff like “here’s how I shipped an amazing full-featured cross-platform SwiftUI app in 10 minutes and the other half are like “Button presses have been broken in SwiftUI for 16 months and Apple hasn’t responded to my radar”

Greg Pierce:

My SwiftUI development process starts with a clear definition of the problem and ends in a recursive loop of Google searches trying to figure out why the thing I did to fix A broke B, and the thing I did to fix B, broke C, etc.

Jonathan Badger:

As a newbie to the framework, I enjoy the instant feedback that the canvas preview provides with each code modification and am thoroughly impressed by the elegance and simplicity of SwiftUI’s design. That being said, I have run into odd behaviors and challenging problems that make me want to tear my hair out at times. One such issue, which at first seems trivial, is how to dismiss the keyboard when a user taps an area on the screen that is outside the bounds of a TextField or TextEditor view. Here, I will discuss a few of the common issues surrounding keyboard dismissal and provide two solutions and workarounds that I have found after an embarrassing amount of googling and combing of StackOverflow

Christian Selig:

Has anyone done a nice blog post on integrating SwiftUI as parts of an existing UIKit app and having them communicate nicely? (Many posts are all or nothing) Integrating it for bits and pieces sounds fun, but a bit intimidating. 😬

Scott Anguish:

It’s a nightmare. That’s what we found.

Steve Troughton-Smith:

SwiftUI remains incompetent at basic layout, something Playgrounds users are going to find out the hard way… 😅

Ron Avitzur:

I’m stuck diagnosing an infinite loop in SwiftUI layout for code that worked on macOS 11.

Steve Troughton-Smith:

I’m really excited about using SwiftUI in my apps.

SwiftUI is an unreliable mess that needs to be treated with oven mitts, and I won’t be increasing my reliance on it anytime soon.

That dichotomy is what makes the SwiftUI story so frustrating.

Oskar Groth:

We’re halfway into SwiftUI 3 and this is yet another example where it fails to provide us with a properly working default control.

Ron Avitzur:

Today in C++ → Swift: macOS 12 SwiftUI Focus

.focused($focus, equals: .mathBlock(id)) is not setting the first responder to my NSViewRepresentable NSView.

Should I expect it to?

Anyone have insight into how AppKit first responder interacts with Swift Focus for custom views?

Adam Kaump:

“Hey I got 90% of what I wanted really quick! Neat!” “…oh turns out that last 10% is basically impossible, eh?”

Marco Arment:

I like a lot of it. But it’s not simple, easy, or mature.

Its conceptual elegance and clean presentation-slide code are quickly ruined by common real-world needs.

And you frequently slam HARD into walls that you just can’t overcome.

Steve Troughton-Smith:

I really do feel like every time I use SwiftUI, even in the simplest of places, it’s burying mines in my code that will be set off at some point in the future


Conundrum: do I spend the hours required to try different combinations of SwiftUI modifiers to hopefully find a fix for this layout issue, with potential of it breaking again in the future, or do I spend same hours porting to UIKit knowing I’ll likely never have to touch it again

Simon B. Støvring:

I wouldn’t use SwiftUI for core parts of a complex app yet but it’s safe to say that Runestone wouldn’t have so many settings if it wasn’t for SwiftUI. It’s so simple to build settings screens that look decent with SwiftUI.

Josh Avant:

Today, 2.5 years after release, there’s still validly a more-than-small amount of opinion that SwiftUI is not even Production Ready for mature, complex applications.

If you have to make the choice today, I say choose UIKit.

(Unless your app isn’t intended to be mature, complex)

Helge Heß:

There is very much to like about SwiftUI (and almost all my recent apps use it), but e.g. that it can’t do a very core and basic thing like navigation in its 3rd iteration properly is just embarrassing. 🤷‍♀️

Helge Heß:

The real difference is that one may have been missing API you’d want (not really), while SwiftUI has API all over but the provided stuff isn’t just bad but simply doesn’t work. Often even depending on context - i.e. it is an inconsistent mess from an API perspective.

Sam Deane:

SwiftUI lists can get really slow, due to all the clever diffing that goes on for animation.

There is a workaround, but it seems that it stops working if you put the list inside a NavigationView.

Let’s use value types instead of objects and then allocate a UUID for each one since they no longer have pointer identity.

Paul Haddad:

It’s still terrible, takes at least twice as long to do anything for results that IMO are not as good as UIKit.

Hoà V. DINH:

I’m going to rewrite an app that I wrote with SwiftUI back to regular Swift + UIKit because I’m hitting so many blockers when refining the details.

Marin Todorov:

💯 internet points for @steipete for making a landing page for this SwiftUI crasher that you didn’t cause and can’t fix 👌🏼

Russell Ivanovic:

Let’s play a little game called “Will the SwiftUI preview load?”. It’s ok if you’re not an Apple Developer, you can play along!

Marco Arment:

A day building in SwiftUI:

I would like a search bar in the navigation bar like every app

Oh that requires iOS 15

I would like it to activate when presented

Can’t do that without rebuilding with UIKit hacks

I would like it not to hide itself

Can’t do that, go back to UIKit

For every hour SwiftUI’s niceness has saved me, I’ve probably lost two more hours to the slow and buggy tooling, scouring the web to make up for its non-discoverability and poor documentation, hacking around its brick-wall limitations, or giving up and rewriting things in UIKit.

Phillip Caudell:

Writing SwiftUI is like riding a bicycle downhill on a beautiful sunny day.

Until the bike suddenly explodes, killing you.

It makes building a production app in SwiftUI extremely difficult when the basic system controls don’t work.

There’s so much to love about SwiftUI, but still after several years the basics are still buggy as hell.

Ken Kocienda:

A tool like SwiftUI which can’t easily handle simple and well-understood tasks isn’t likely to scale to more complex and experimental tasks without seemingly endless frustration.

Steve Troughton-Smith:

Abstracting developers from the ‘real’ goings-on is also a means of control on Apple’s part, to shrink us down into a little sandbox we can’t break out of. Can’t compete with system apps if we only have toy APIs

Michael Love:

Seems like an especially self-destructive policy on Apple’s part in this case, because it’s not clear they have much of a vision for what to actually do with AR apps and by abstracting us away they’re going to make it impossible for developers to help come up with one.

Ron Avitzur:

Today in AppKit → SwiftUI:

.keyboardShortcut(.upArrow) does not work with .buttonStyle(PlainButtonStyle())

but .leftArrow and .rightArrow do work

.upArrow works with .buttonStyle(BorderlessButtonStyle()).

Filed under: I do not even want to know the explanation behind this.

Kyle Howells:

I can’t help feeling SwiftUI was a massive mistake for Apple.

I keep seeing blog posts and articles of people trying to write native iOS or macOS apps, using SwiftUI, abandoning it as: too buggy/much work/effort/not worth it. And then switching to Electron & React Native.

If Apple had just spent its effort on updating UIKit, adding more standard UI components modern apps use/need.

Improving Xcode’s tooling, bug fixes. They’d have 1 really nice "reliable" toolset for people to use.

Kyle Howells:

This is my main issue with SwiftUI. It’s a high level black box.

With UIKit I can: drop down to UIControl easily if I want to replace UIButton; make my own table view, drop down to CALayer’s, customise the CALayer a view uses, etc....

Kyle Howells:

And there in lies the problem of why I can never see SwiftUI is a real/full replacement for any UI framework.

Either it needs to allow you full control to build the thing.

Or it needs to be a high level abstraction over top the real thing.

Currently it’s sort of both badly.

Ron Avitzur:

@FocusedValue as seen in macOS menus is not changing reliably when switching windows despite my best attempts. However, setting a global in response to NSWindow.didBecomeKeyNotification seems to work just fine.

Majd Taby:

We WERE going to include a SwiftUI component in our next update, but alas, I just rewrote it in UIKit.

This was a result of three situations:

1. Incomplete APIs in SwiftUI limiting our capabilities

2. Coordinating the SwiftUI layout updates with UIKit ones was difficult and caused animation problems

3. Our data model wasn’t designed for SwiftUI, and thus caused a lot of CPU thrash

Jordan Singer:

Learning SwiftUI unleashed creativity inside of me like no language ever has and brought joy back to building user interfaces.

Here’s a thread of my experiments to show you what’s possible, to learn from, and code to remix👇

Rony Fadel:

SwiftUI forces you to think more deeply about architecture compared to UIKit.

Abstraction hijackings (e.g. getting a reference to and conditional casting a parent or sibling vc) are not possible by virtue of how SwiftUI works.

Ron Avitzur (tweet):

Is it possible to set the isAlternate property on an NSMenuItem in the macOS menubar to implement dynamic menu items in a SwiftUI document-based app which uses CommandMenu to construct the menus?

Steve Troughton-Smith:

The harsh reality of SwiftUI in 2022 is that it doesn’t enable a competent dev to build a better app. It gives you a lesser-than-native, less-reliable, less-compatible, less debuggable app — a two-tier system where 3rd-parties may never be able to compete with Apple’s own

Short of major advancement at WWDC22 wrt to reliability, configurability & back-compat, I’m not sure SwiftUI will ever be the right technology for my apps. Its priorities are clearly elsewhere, and that’s OK. But that isn’t the future of anything, just a lower entry point

Rony Fadel:

SwiftUI + Introspect gets us that much👌 closer, but I agree that we’re not there yet. Right now SwiftUI is a reactive shell on top UIKit with a number of gaping holes (Lists, Navigation, View presentation etc..)

Russell Ivanovic:

As long as you’re ok with ignoring Autolayout errors. I get tonnes of those in my SwiftUI views and it’s like “what would you like me to do with that info…exactly?”

Damien Petrilli:

The Joy of SwiftUI:

Animation in simulator:✅
Animation in Swift Playgrounds on iPad:✅
Animation in the App: freeze and lag.

100% same code.

Khoa Pham:

Just finished refactoring a 115+ screens #SwiftUI app to UIKit navigation. Every screen has its own UIViewController and is self-contained.

Feels so good

As long as SwiftUI is still based on UIKit, using UIKit is a safer bet.

Ron Avitzur:

Looks like it is back to UIKit for the UIPanGestureRecognizer for me.

Simon B. Støvring:

Many seem to either like SwiftUI or believe that it’ll get better down the road and be the future of UI development on iOS and iPadOS.

Is there a possibility that SwiftUI is simply a bad idea for these platforms? That it won’t work?

I’m starting to fear that as we’re adopting SwiftUI in our apps, we’re also compromising too much. Our UIs are getting simpler but more buggy. We’re becoming slobby.

Maybe it’ll all work out in the end. I hope it will. But this is a fear that I currently have.

Steve Troughton-Smith:

To my surprise (not.), yet another SwiftUI regression has begun to screw with my apps, this time affecting tab-focus and text fields. Appears to have cropped up either in the latest SDK or most recent macOS release. Worked fine when I shipped (& for 2 years), now does not.

I think once I bail on SwiftUI that’ll be it for me for quite a while. I’ll check back in in 5, 8 years, like I did with Swift, and maybe it’ll be tolerable then. I have a lot of development in me before then, and I just can’t base any of it around SwiftUI

Unlike early Swift, which was just clumsy to write but could still make a 1:1 version of your ObjC app, early SwiftUI is radioactive and eats holes in everything it touches. I feel like Apple will be paying this one off for a veery long time

Steve Troughton-Smith:

One place I can recommend SwiftUI: as a preview wrapper for UIKit views & view controllers. This element is hugely useful even to developers who don’t use SwiftUI for any of their code

Kyle Hughes:

In March I removed the last traces of SwiftUI from an app, going back to 100% UIKit. I needed block element support in attributed strings.

In March I also released a 100% SwiftUI app.

Perhaps they are both good.

Chris Eidhof:

I was trying to create an NSImage out of a simple SwiftUI View. Turns out to be surprisingly difficult: dataWithPDF is completely broken, cacheDisplay(in:to:) has strange artifacts and good old CGWindowListCreateImage works as expected.

Ron Avitzur:

Today’s API eldritch horror experience trying to implement the macOS Paste menu item so that it is enabled or disabled appropriately depending on what is on the clipboard.

In AppKit, this is very easy.

In SwiftUI, I’m lost in a maze of twisty APIs...

Kuba Suder:

This talk is a bit of a mindfuck… I’m gonna have to watch it more than once. Is it just me, or is it… kinda unintuitive that the lifecycle of state variables in that subview depends on whether you write this as if/else or with ternary operator “?:” ?

Marcin Krzyzanowski:

overpromise under-deliver in one screen. the title itself is almost an oxymoron

Steven Curtis:

Imagine using a version of Xcode with a major memory leak attached to SwiftUI. If it’s Xcode 13 I think that’s fine, they’ll fix in in 13.1. What do you mean, they only fixed it in Xcode 13.2.1?


I want to decouple navigation from views. I don’t want to use UIHostingController as I would like to create a completely native SwiftUI App. I need to have easy access to views using deep-linking where the screens depend on complex state, and can be accessed from multiple parts of the App.

James Thomson:

Since installing 12.4, all the labels for my SwiftUI pickers have vanished. Affects my existing versions too. This is a Mac-idiom Catalyst app.

That’s really not great 🙁

Ron Avitzur:

Replacing a SwiftUI ScrollView/VStack with a List View was straightforward and provides swipe-to-delete, and drag-to-reorder rows. However, it also made scrolling the view impossible. Breakpoint on scrollTo does not fire. I fail to understand this.

Paola Mata:

All these hacks and workarounds for making SwiftUI do basic shit…

See also: The evolution of SwiftUI.


Update (2022-05-25): Steve Streza:

SwiftUI will be great once it’s production ready. Maybe that will be this year. Until that happens though, this post remains a spectacular cautionary tale of what happens when you go down that road.

Martin Pilkington:

There is a very strong argument to make that declarative UI frameworks are always going to be a case of “faster to get to good, difficult to get to great”

Building great software requires fine-grained control over the UI, but that’s kind of the antithesis of declarative UI.

That isn’t to say you can’t have parts of UI be built declaratively, just that you can’t handle every case people will have with a full declarative framework

Aleksandar Vacić:

I expected such issues back in 2019 (the talk I gave at Pragmaconf) but did not see them taking this long to clear up.

The black box design and complete dependence on Apple to fix issues did not turn out good.

Michael Brown:

This absolutely does not reflect my experience of using SwiftUI. In the 8 months that I’ve been using it intensively the time it has saved me is immeasurable compared to the problems encountered. It is unquestionably better than using UIKit (which I have used since 2010).


I have built a production app for a bank in SwiftUI (released in March 2021) but I can relate to all of things described.

Benedikt Terhechte:

Doesn’t even mention how invalid layouts crash SwiftUI apps at runtime!


SwiftUI is such a bummer. While I agree with the feelings that it makes UI development so fun and freeing, when you start running into issues, then the magic is shattered and you’re back to the harsh reality that computers are all broken.

Sam Deane:

I do still like SwiftUI a lot, and am using it in production apps.

I ended up making this to fix the List issues. It is crude but effective and does just enough of what I need.

I do still regularly hit brick walls, but a lot of the time I find them to reflect a strongly opinionated design philosophy, rather than just an accidental omission.

In other words, someone is deliberately preventing you from doing something they don’t think you should do.

R. Mark Volkmann:

I have never used UIKit and am a relatively new user of SwiftUI. So far I love it.

Steve Troughton-Smith:

After @jamesthomson’s tweet, it was with trepidation I upgraded to macOS 12.4 to see how the changes to SwiftUI have broken my own apps. Sure enough, all the labels have been removed from my pickers, in the shipping version of Pastel.

See also: Hacker News.

John Gruber (tweet):

I’d like to see leaps-and-bounds improvements announced this year.

Update (2022-05-26): Luc Vandal:

Overall, my experience with SwiftUI has been mostly positive. Of course there were times I wanted it to die in a but I was able to develop & release an app that is on the App Store & actually selling.

Kevin Hayes:

I’m not blind to its bugs and limitations but it’s definitely a net positive for me. It’s working out well in 1Password 8 for iOS, and my side projects are SwiftUI too.

Francisco Tolmasky:

It requires being an expert in it before you can predict its limitations (which often are bug-related and not necessarily “conceptual”). This would maybe be excusable for a beta release, but SwiftUI is now around 4 years old.

Arguably, its original sin is simply not being open source, and on top of that is trapped behind one of the most opaque bug-reporting mechanisms in the industry. Every minor hack involves tremendous reverse-engineering, which may then have to be replicated throughout the community, instead of being a GitHub issue and PR request like in Electron for example. There are of course upsides to the closed-source model, but in 2022, you have to deliver on those upsides if you want to make a strong case for your framework.

Richard Turton:

If you are working with an existing UIKit codebase and are SwiftUI-curious when it comes to adding or updating new features, this article should help answer your questions. I’m going to cover some of the technical details of how SwiftUI works and how state is managed, some tips on integrating SwiftUI into your existing code, and some common pain points.

The Apple GPU and the Impossible Bug

Alyssa Rosenzweig (Hacker News):

The buffer we’re chasing, the “tiled vertex buffer”, can overflow. To cope, the GPU stops accepting new geometry, renders the existing geometry, and restarts rendering. Since partial renders hurt performance, Metal application developers need to know about them to optimize their applications.


When a partial render is possible, there are two “load” programs. One writes the clear colour or loads the framebuffer, depending on the application setting. We understand this one. The other always loads the framebuffer.

…Always loads the framebuffer, as in, for loading back with a partial render even if there is a clear at the start of the frame?


Doing so, Metal fails in a similar way. That means we’re at the root cause. Looking at our own driver code, we don’t specify any program for this partial render load. Up until now, that’s worked okay. If the parameter buffer is never overflowed, this program is unused. As soon as a partial render is required, however, failing to provide this program means the GPU dereferences a null pointer and faults. That explains our GPU faults at the beginning.


Monday, May 23, 2022 [Tweets] [Favorites]

Combine’s .collect(.byTime) Timer

Jesse Grosjean:

The biggest bug in Bike’s 1.0 release was excessive CPU use while in background.


First, I didn’t realize that each time you use .collect(.byTime) you are setting up a new repeating timer. I had expected a timer was involved, but thought it would only get scheduled when new items were coming into the publisher. Nope, it’s repeating once the pipeline is setup.


I’ve posted a .collect(.byTime) replacement (for my use case) here. It solves the problem by only scheduling on the runloop once per group of incoming results.


How to Open a Window in SwiftUI

Rob N:

I’d like to show a second window with different content in a SwiftUI app on macOS. I can’t find any documentation on this.

Malcolm Hall (tweet, forum):

In your ContentView create a button and open a URL for your app and another View e.g. Viewer to be shown in the window we will open[…]


In your App add another WindowGroup for your viewer and set it to enable handling of external launch events (an internal event in our case).


Now in Project->Info->URL Types type in myappname in the URL Schemes field (and the identifier field too) to register our app with the system.

Tony Arnold:

Is that a workaround? That’s a workaround for missing API, right? 😳

Malcolm Hall:

No, its a declarative state-driven API that handles the reason why you would want a new window. You aren’t going to get an imperative open window in SwiftUI because that’s not how it is designed.

Marcin Krzyzanowski:

I’m not convinced this is designed. It’s more like something that happens, but doesn’t really is well thought for the scenario where the app needs to open multiple windows. URL cannot be the way. It’s missing window state management. Windows are hierarchical. This is not.

It’s great that there is a way to do this without calling into AppKit, but using URLs seems gross.

Khoa Pham:

A common trick is to use an NSViewRepresentable to get underlying view.window and attach this to our SwiftUI view


For a common macOS SwiftUI app with a search bar on the toolbar and a normal settings screen, here’s how I usually do

Setup NSWindow programmatically


Proposed EU DMA: USB-C, Messaging, NFC

European Parliament:

Mobile phones, tablets, digital cameras, headphones and headsets, handheld videogame consoles and portable speakers, rechargeable via a wired cable, would have to be equipped with a USB Type-C port, regardless of the manufacturer. Exemptions would apply only for devices that are too small to have a USB Type-C port, such as smart watches, health trackers, and some sports equipment.

Via Nick Heer:

The straight-line way of reading this is that future iPhones and iPads will have to have a USB-C port instead of a Lightning one.

Casey Newton:

The act applies to what it calls “gatekeepers” — defined as any platform that has a market capitalization of €75 billion, or more than €7.5 billion in European revenue. So: yes to WhatsApp and iMessage; no to Signal and Telegram.


Disdain for the new requirements is not universal; Matrix, a nonprofit organization working to build an open-source standard for encrypted communication, published a blog post Friday explaining some possible technical paths forward.

But it’s clear that, to the extent that there might be a way for services like iMessage and WhatsApp to interoperate and preserve encryption, that way has yet to be invented.

Via Nick Heer:

To be clear, it does not appear that the draft law mandates the creation of no privacy or security risks; the segment posted by Benedict Evans — the full draft text is currently confidential — says platform providers must create a “high level of security and personal data protection”. It is about finding an appropriate level of risk with the caveat that it will never get to zero. But the core of the question seems correct: is there a way to make encrypted messaging services work together while ensuring negligible difference in security and privacy levels?


Remember Adium? That is a great piece of software I have not touched in about ten years as phone-centred messaging clients have replaced desktop-based ones. Something like that could be possible again.

Hartley Charlton:

The latest provisional agreement sets out plans to establish a “High-Level Group” of central European digital regulators to coordinate national regulators across EU member states and requires “gatekeepers” to create an independent “compliance function.” The new group must include compliance officers to monitor their company’s compliance with EU legislation using sufficient authority, resources, and access to management, and be headed by an “independent senior manager with distinct responsibility for the compliance function.” The rule would effectively require companies like Apple to set up an internal department dedicated to meeting pro-competition regulations.

In addition, new rules specifically targeted to address companies like Apple that have “a dual role” with control over both hardware and software look to allow any developer to gain access to any existing hardware feature, such as “near-field communication technology, secure elements and processors, authentication mechanisms, and the software used to control those technologies.” This could have major implications for the level of integration that developers can achieve on Apple platforms, such as allowing contactless payment services to operate on the iPhone and Apple Watch just like Apple Pay.

John Gruber:

This is bananas. All third party developers get control over the secure enclave and the software that controls it?


This is profoundly anti-consumer. Consumers aren’t asking for any of this shit. Actual people love their phones more than their computers — whether Macs or PCs — not despite the fact that their phones are tightly controlled consoles, but because they are tightly controlled consoles. These regulators don’t see it that way, because they’re idiots. They think they can legislate their way to a world where the iPhone (and Android, which is also console-like) remains far safer and more reliable than PCs while mandating that all the protections that have made them far safer and more reliable than PCs be removed. It’s absurd.

I think this is conflating a lot of different things. The main reasons that phones are safer and more reliable are sandboxing (so apps run mostly independently from each other and the system) and the hidden file system (so users can’t mess things up). Those would remain in place. I still think it’s far from clear that adding an API to access NFC would cause harm. The bit about the Secure Enclave strikes me as differing interpretations, like when Microsoft told the court that Internet Explorer couldn’t be removed from Windows because—thinking of the frameworks, not just the app—then it would no longer boot. Obviously, the EU doesn’t want it opened up in a way that would make it useless.

I would imagine though, if this comes to fruition, E.U. citizens are going to wind up buying iPhones that operate very differently from those sold everywhere else in the world, and they will suffer for it.

Steve Troughton-Smith:

Why does Apple see a ‘European’ iPhone variant as an existential threat, but not its stripped-down feature-restricted variant for e.g. China (which it has shipped for a decade)? Because everybody will want one with this unrestricted featureset, of course. Hence the unrelenting PR


Five Things You Still Can’t Do With a MacBook Pro

Tim Hardwick:

Unfortunately, the HDMI port that returned isn’t so top-of-the-line – it’s an HDMI 2.0 port instead of an HDMI 2.1 port.


The SD card slot on the new MacBook Pros supports UHS-II cards, but only up to 250MB/s of data transfer, not the 312MB/s speeds that the standard is theoretically capable of.


Ethernet Port


Lenovo, Samsung, Acer, Dell, and HP all offer laptops with 5G connectivity, yet no Mac in Apple’s notebook lineup currently supports the cellular standard.

My suggestions:

  1. Shrink the trackpad.
  2. Add an external power button so that I can turn on the Mac or enter Recovery while in clamshell mode.
  3. Add more USB ports. I have not had good experiences with hubs/docks, even Apple’s own Studio Display. Being able to directly connect more devices in a pinch, or at least not have to plug one hub into another, would help.
  4. Make a first-party Thunderbolt dock. The current ones are pricey, and people still report them being flakey. Maybe this is inherent to the technology, but maybe if Apple made all the pieces (computer, OS, and dock) it would be better able to ensure that they work together.


Friday, May 20, 2022 [Tweets] [Favorites]

Restoring Contacts From a Time Machine Backup

Miles Wolbe:

Open then “Enter Time Machine” from menu bar icon to restore (H/T). Note that the “Browse Other Backup Disks…” option accessed by Option-clicking the Time Machine menu bar icon really means “Browse Other Backup Disks for the current device”.

This didn’t work for me. It just showed an empty Contacts window, and none of the Time Machine buttons responded, so I had to force quit. Fortunately, he lists 4 other methods. It seems like to really do it right you need to erase all the contacts in iCloud first:

No consideration is given here to iCloud Contacts sync (though thermo2’s 20-step procedure is reproduced below without prejudice). Back up, back up, back up and understand what you are doing.

Disk Utility Can Only Check Backup Disks in Recovery

Howard Oakley:

The most serious problem with Disk Utility remains its manifest inability to run First Aid on some volumes and containers, in particular Time Machine backup stores. This problem persists, although currently it now seems confined to APFS backup volumes.


If you need to run First Aid on an APFS Time Machine backup disk, the only methods available are to use Disk Utility or apfs_fsck in Recovery Mode. This is a serious failure, particularly as the message given to users is to “back up the data on this volume”, which is wholly inappropriate for a backup volume, and gives the false impression that failure is imminent.


Less serious, but more confusing, is a sporadic bug which displays bizarre results after a disk has been erased, or partitioned into two or more containers.

I run into this last issue a lot. Sometimes partitioning fails for no apparent reason. Other times, Disk Utility says it succeeded but displays a completely different partition structure than what it had been asked to create.


New Receipt Validation Sample Code

Apple (via Thomas Zoechling):

The following example code illustrates how to retrieve an identifier in macOS for validating an App Store receipt. Use the data returned to by the copy_mac_address function to validate the App Store receipt.

In the following Swift code, the io_service function uses IOKit to retrieve network interfaces as an optional IOKit object. The copy_mac_address function looks up an appropriate network interface and returns the hardware address from the IOKit object as optional CFData.

Apple’s sample code for this had been broken at least since Catalina. I still think there should just be an API for validating and parsing receipts, instead of encouraging developers to either reinvent the wheel or incorporate open source code of questionable quality.


Weathergraph 1.0.97

I recently started using Weathergraph. I’ve been happy with Snowflake Weather on my iPhone, but less so on my Apple Watch. Weathergraph has a great watch app and complication, and it’s even better with the new icon theme and precipitation probability display that were added in the 1.0.96 update. For some reason—maybe the location-based updates—it does not seem to be subject to the watchOS 8.5 bug that prevents my other complications from updating automatically. And, unlike Apple’s complication, it can show the last cached forecast when there’s no network connection.

The basic design feels like an evolution of Weather Line and Weather Strip, but I think Weathergraph shows the information better. The display is very configurable, so I can choose to show wind speed but not wind direction, humidity but not the dew point, and the UV index but not the atmospheric pressure. Unfortunately, the rain percentage is shown as a light blue area with no scale or label, so it’s not clear what the percentage is except in relative terms. I like how you can choose the zoom level and how it can be different for the phone, the watch app, and the watch complication.

The main drawback is that it only supports a single location, which cannot be set manually, so you can’t use it to plan travel. So right now I’m using Weathergraph in combination with Snowflake.

Weathergraph Pro—which includes Foreca, Dark Sky, and realtime forecasts—is $3.99/month, $19.99/year, or $49.99 for a lifetime license. Below are some screenshots comparing it with other weather apps that I have installed.


weathergraph-iphone-1 weathergraph-iphone-2 weathergraph-watch-complication weathergraph-watch-app-1 weathergraph-watch-app-2


apple-iphone apple-watch-complication apple-watch-app-1 apple-watch-app-2 apple-watch-app-3

Snowflake Weather

snowflake-iphone snowflake-watch-complication snowflake-watch-app-1 snowflake-watch-app-2

Weather Strip


CARROT Weather

carrot-iphone carrot-watch-complication carrot-watch-app


Thursday, May 19, 2022 [Tweets] [Favorites]

Indirect Struct Properties in Swift

Sean Heber:

Surprised that Swift has “indirect” for enum cases but not for structs. Seems like a weird omission.

Here’s a property wrapper that lets you use “indirect” properties in a struct for those times when you really want to because “reasons.”

It uses an enum wrapper, which is more efficient than an object.

Apple Accessibility Feature Preview

Shelly Brisbin:

For the second year running, Apple has offered a preview of updated accessibility features coming to its platforms later this year. The announcements come just ahead of Thursday’s Global Accessibility Awareness Day, which goes by #GAAD online.


Apple is introducing Door Detection, a cutting-edge navigation feature for users who are blind or low vision. Door Detection can help users locate a door upon arriving at a new destination, understand how far they are from it, and describe door attributes — including if it is open or closed, and when it’s closed, whether it can be opened by pushing, turning a knob, or pulling a handle. Door Detection can also read signs and symbols around the door, like the room number at an office, or the presence of an accessible entrance symbol. This new feature combines the power of LiDAR, camera, and on-device machine learning, and will be available on iPhone and iPad models with the LiDAR Scanner.


With Apple Watch Mirroring, users can control Apple Watch using iPhone’s assistive features like Voice Control and Switch Control, and use inputs including voice commands, sound actions, head tracking, or external Made for iPhone switches as alternatives to tapping the Apple Watch display. Apple Watch Mirroring uses hardware and software integration, including advances built on AirPlay, to help ensure users who rely on these mobility features can benefit from unique Apple Watch apps like Blood Oxygen, Heart Rate, Mindfulness, and more.


Live Captions in FaceTime attribute auto-transcribed dialogue to call participants, so group video calls become even more convenient for users with hearing disabilities. When Live Captions are used for calls on Mac, users have the option to type a response and have it spoken aloud in real time to others who are part of the conversation.

Update (2022-05-20): John Siracusa:

This use of accessibility features to rearrange icons on an iPhone is arguably easier than the “normal” way.

Apple Introduces Professional IT Training


As companies expand their use of technology, employees are demanding to use iPhone, iPad, and Mac at work, resulting in an increased need for IT professionals skilled in supporting and managing Apple products.

To help meet this growing demand, Apple today launched updated professional training and certifications for IT support and management. The training has been completely redesigned and moved to an online, self-paced format. Users can demonstrate their competency with two new exams and earn certification from Apple.


Two new Apple Professional Training courses — Apple Device Support, and Apple Deployment and Management — are available today on The courses are sequential, and build on skills and concepts as the user progresses. At the completion of each course, new certification exams are available to demonstrate competence achieved at each level with corresponding digital badges from Apple. Each exam costs $149, and certification can be displayed on resumes, online profiles, and job boards, enabling users to stand out in job searches — and employers to find qualified candidates.

Tom Bridge (tweet):

In addition to the new exams, Apple’s announced a program working with the Mac Admins Foundation to make sure that those who can’t afford to take this exam, or whose employers won’t pay, can still get certified. The Mac Admins Foundation is a brand new 501(c)(3) non-profit whose mission is to support the people who manage Apple products, starting with the Mac Admins Slack, and moving onward to making conferences more approachable for people just starting out in this industry.

Should You Continue Using HFS+?

Howard Oakley:

The most compelling argument for retaining HFS+ is on rotating hard disks, because APFS can result in severe fragmentation, most importantly in the file system metadata, so causing degraded performance; as SSDs don’t suffer those performance penalties, this could be a good reason for continuing to use HFS+ on hard disks, while switching SSDs to APFS.

That argument may hold good for storage which is in active use, such as boot disks and those containing working files, but appears less compelling in more static use, to contain relatively stable archives or backups in which there is limited turnover of files or data. Although objectively assessing the effects of fragmentation is fraught with difficulty, one basic question is whether there is any difference in performance between the file systems to begin with.

I updated my spinning hard drives to APFS when that became necessary in order to make bootable clones. The other main benefit is that APFS snaphots on the destination are a great way to fit multiple backups onto the same drive. Previously, I used multiple partitions, which is much less space-efficient.

The hidden downside is that, for reasons I don’t understand, most of my APFS backup drives take an unpredictable amount of time to mount. With HFS+ it consistently took a few seconds. With APFS, sometimes it takes a few seconds, but other times it takes 5 minutes or even an hour before I can access the drive’s contents. A few of my APFS backups do have multiple partitions. They mount in a random order. If I’m lucky, the one I need mounts first, and in that case the backup is almost always done before the other partitions have even mounted.

Sometimes, the APFS volume never auto-mounts, but it does show up in Disk Utility where—after it takes 10 minutes to launch—I can manually tell it to mount.

Other times, the APFS volume does auto-mount, using the password stored in the keychain, but it shows a password prompt, anyway. Sometimes, despite trying to dismiss this dialog, it stays on-screen the entire time I’m using the drive. I try to drag it mostly off-screen so that it doesn’t block my other windows.

Sometimes, generally after a kernel panic, APFS volumes don’t even show up in Disk Utility after a restart. I have to power cycle the enclosures. (Ironically, most of the kernel panics that I’ve been getting with my M1 Pro MacBook Pro seem to be related to HFS.)


Wednesday, May 18, 2022 [Tweets] [Favorites]

Weak Self: Closure Rules of Thumb

Christian Tietze:

In Swift, you can weak-ify references to self in escaping closures, and then you need to deal with the case that the reference is gone when the block is called.

Last month, Benoit Pasquier and Chris Downie presented different takes on the problem. That discussion was excellent. It prompted me to take some more time to revisit this problem systematically, and I took away a couple of notes for future-me.

The three popular options as Chris listed them are these:

  1. Do not capture strong reference
  2. Override self with strong reference
  3. Bind strongSelf

As always, either way has its pitfalls.


[When overriding self, you] can forget weakifying inner closures and accidentally create a retain cycle again!

I think we still see this discussed because nobody has a great solution. There are some common patterns, but they are verbose and still easy to get wrong.

I tend to upgrade self at the top of the closure. For common cases like notifications and timers, I have the caller handle this and pass the strong reference into the closure if it’s not nil.


Amazon to Support ePub

Jason Snell:

For years, Amazon has used the Mobipocket format (.mobi) rather than the ePub format for Kindle books. Recently it developed its own format, KF8 (and now KFX), and has been using that instead. Everyone else uses ePub. Publishers sell books direct as ePubs, but are forced to include .mobi versions for compatibility reasons.

But this is changing. Amazon announced that later this year, its email and drag-and-drop send tools will accept ePub format files. Amazon will then convert those files to KF8 and deliver them to Kindles, but at least the user won’t have to do the job themselves.

Update (2022-05-19): Tom Nardi (via Hacker News):

Native support for EPUB would make using the Kindle a lot less of a hassle for many folks, but alas, it was not to be. It wasn’t long before the original post was updated to clarify that Amazon had simply added support for EPUB to their Send to Kindle service. Granted this is still an improvement, as it represents a relatively low-effort way to get the open format files on your personal device; but in sending the files through the service they would be converted to Amazon’s KF8/AZW3 format, the result of which may not always be what you expected. At the same time the Send to Kindledocumentation noted that support for AZW and MOBI files would be removed later on this year, as the older formats weren’t compatible with all the features of the latest Kindle models.

If you think this is a lot of unnecessary confusion just to get plain-text files to display on the world’s most popular ereader, you aren’t alone. Users shouldn’t have to wade through an alphabet soup of oddball file formats when there’s already an accepted industry standard in EPUB. But given that it’s the reality when using one of Amazon’s readers, this seems a good a time as any for a brief rundown of the different ebook formats, and a look at how we got into this mess in the first place.

Time Machine Evolution and APFS

Howard Oakley:

You don’t have to prepare an APFS volume, as Time Machine will do that for you, but I prefer to make one ready using Disk Utility.


Time Machine will then prepare its backup volume by making another APFS volume using the case-sensitive option and designating it as a Backup volume.

Howard Oakley:

To distinguish between what are effectively two different systems, I’m going to refer to Time Machine backing up to APFS as TMA, and when backing up to HFS+ as TMH.


From its release, TMH has been dependent on features of the HFS+ file system to create its Finder illusion. Every hour the backup service examined the record of changes made to the file system since the last backup was made, using its FSEvents database. It worked out what had changed and needed to be copied into the backup. During the backup phase itself, it only copied across those files which had been created or changed since the last backup was made.


Apple later introduced what it called Mobile Time Machine, intended for laptops which could be away from their normal backup destination for some time. In around 10,000 lines of code, Mac OS X came to create something like a primitive snapshot, but on HFS+.

When Apple released the first version of APFS on Mac OS X in High Sierra, its new snapshot feature was incorporated into TMH. They were initially used instead of the FSEvents database to determine what should be backed up.


Catalina introduced a more complicated scheme to replace snapshots as the normal means for determining what to back up. This was presumably because computing a snapshot delta proved slow, and the introduction of the Volume Group, with specialist types of APFS volume for which snapshot deltas would be inappropriate or impossible.


TMA interestingly reverses the design of TMH in High Sierra: instead of using snapshots to determine what needs to be backed up before creating a backup using traditional hard links, most of the time TMA determines what’s changed using the traditional method with FSEvents, then creates its backup as a snapshot on the backup volume. The latter is essential, as without directory hard links, there’s no way of using the TMH method to make backups to an APFS volume.

Howard Oakley:

Once again, the changes required to enable Time Machine backups to be made to APFS volumes appear to have required modifications in the file system. Before macOS 11.0, we’ve always thought of snapshots as being straightforward copies of the metadata for a specific volume, something essentially generated by making a copy of those file system metadata. If that was what Time Machine relied on in Big Sur, then it could only back up whole volumes.

Instead, when backing up to an APFS volume, Time Machine now creates snapshots of individual folders when necessary, a feature which hasn’t yet been made available through the command tool tmutil. Not only that, but during the process of making a backup, Time Machine copies snapshots between volumes and seems able to assemble a backup snapshot from its file system metadata and constituent items, including changed blocks within a file.

Howard Oakley

Early versions of Time Machine started making backups when they were run by launchd scheduling (rather than cron), exactly every hour. When Apple introduced its new scheduling system with DAS (Duet Activity Scheduler) and CTS-XPC (Centralized Task Scheduling), Time Machine backups were among the first to take advantage of it. Since then, instead of backups being made at exactly hourly intervals, they’re more flexible in timing, accommodating to environmental conditions such as thermal pressure and power state.

Howard Oakley:

One feature which appears to have been lost in the new Time Machine backups to APFS volumes is the ability to check the integrity of their contents, which now appears confined to backups made to HFS+ volumes.

Howard Oakley:

There’s a clear advantage to this new scheme in that it functions not just with whole files, but with changed blocks within files. Just as a snapshot references the data blocks which make up each file, so a snapshot-based backup can back up individual blocks which have changed, which can be significantly more efficient in the storage space required.

This new scheme not only retains hourly snapshots on the source volume, which are still kept for up to 24 hours, but provides its backups in the form of snapshots on the backup volume, where the file system data are stored in addition to the snapshot itself.

The final piece of magic used by Time Machine backups to APFS volumes is that its snapshots can be made not only for whole volumes, but for individual folders within a volume. If you want to back up just your Home Documents folder, Time Machine will do that, rather than having to back up your complete Data volume.

Howard Oakley:

Creating the backup begins in earnest with a local snapshot, which is termed the stable snapshot. This appears to be a whole-volume snapshot, which is then mounted at a path based on /Volumes/[machine]/[datestamp]/[volume name]. The stable snapshot made in the last backup is located and mounted as the reference snapshot, at a similar path, but with a different datestamp, of course. TMA locates the “volume store”, into which the backed up files and other items will be copied. This should be at a path like /Volumes/[backup volname]/[datestamp].previous/.


TMA states the possible strategies which it could use to work out what is to be backed up[…]


Currently, with Big Sur only backing up Data and unroled general-purpose volumes, those are the four possibilities. The full list of what’s possible in Catalina includes:

  • full first backups
  • deep scans
  • FSEvents
  • snapshot diffing
  • consistency scans
  • cached events.

Howard Oakley:

Now that I’ve worked through the steps involved in an automatic Time Machine backup to APFS local storage (TMA), this article draws that out into a chart, and compares that against the processes used when backing up to HFS+ in Catalina (TMH).

Howard Oakley:

The backup store has a distinctive volume structure, consisting of hidden Spotlight indexes, any mounted backup snapshots listed by their datestamp, a property list containing details of all the backups in that store, and an optional property list giving information about any inheritance of those backups.

Backup snapshots themselves contain the eventdb constructed during their original backup process, a checkpoint file, a property list containing all the exclusions which applied to TMA backups when that backup was made, and the backup itself listed by volume name.


TMA backups provide good access to the user through the Time Machine app and the Finder. However, their ability to manipulate backups is severely limited. As these rely on snapshots, individual files can’t be removed from them, a feature restricted to TMH. Whole backups, complete with their snapshots, can be removed, though. That isn’t supported by the Time Machine app, but can be performed directly in the Finder.

Howard Oakley:

One day we’ll look back and remember fondly when it was possible to clone any Mac volume to an identical copy. Sadly, since the introduction of APFS in High Sierra, that has now stopped working for those volumes formatted using the new file system. Try making a clone of an APFS volume now and you may not even notice what’s missing from the copy: snapshots.

Howard Oakley:

Periodically, backup snapshots are indexed by Spotlight for the volume’s Spotlight-V100 indexes. This may require background mounting and unmounting of those snapshots, and often results in the spinning Time Machine icon being displayed against that volume in the Finder.

Howard Oakley:

Attention now needs to be devoted to addressing the problems identified here with changing source and destination volumes. It isn’t acceptable to have to start completely fresh backups whenever a disk needs to be changed, and Apple needs to document the processes required to inherit source and destination disks, without driving users to experiment with tmutil.

For all its ingenuity and sophisticated engineering, of the three backup utilities which I use, Time Machine is by far the most complex, and the only one which makes changes like these so difficult.

Howard Oakley:

This confirms that TMA is as efficient as possible in both the copying and storage of APFS sparse files and clones. This is far superior to TMH, which would of course have had to copy across almost 15 GB extra data, and required a total of 15 GB space in the backups for these three files. With sparse files and clones being relatively common in APFS volumes, the efficiency of TMA can make a big difference to the time taken to make backups, and use of storage space on the backup volume.

Howard Oakley:

This article is a summary of the current benefits and limitations of TMA as its stands in macOS 11.2.3, at the end of which is a list of those detailed accounts. These should help you make a more informed decision as to whether to use TMA.

Howard Oakley:

One significant exclusion which has been added in Big Sur is the hidden and locked folder on each volume containing its local version database; this is to work around the bug which plagued TMH in Catalina when trying to back up large and complex version databases.

Howard Oakley:

This article looks at configuring and using TMA’s backup storage on a shared disk over a network – in this case, a shared APFS volume on another Mac running Big Sur.

Howard Oakley:

Being more complex and dependent on other systems, making Time Machine backups to shared storage on your network is more prone to fail. As I’ve spent much of the day sorting one such failure out, I thought it might be useful to discuss what went wrong and what went wronger.

Howard Oakley:

A quick check on one of my working folders, just a part of my extended Home folder, found almost 1600 clone files totalling over 10 GB in size. If I were still backing up to HFS+, every one of those files would have to be saved in full into my backup, and in every subsequent backup it would have to be present either in the form of a complete copy (if it had changed), a hard link, or one to a directory above it. Instead, my APFS backup just contains a directory entry for the clone.

Howard Oakley:

With Time Machine it’s so tempting just to let it back up your entire Data volume, and be done with it. This article explains how you can do better than that, and exclude items from that backup which would merely waste space.

Howard Oakley:

In just over a month’s time, Time Machine will turn fourteen, making it one of the longest-lasting and externally almost unchanged features in macOS. As I’ve been trawling back through my archives preparing a talk for MacSysAdmins about Time Machine, I though you might enjoy a stroll down memory lane, and return to autumn 2007 for a few moments.

Howard Oakley:

I have been honoured this year to be invited to present at MacSysAdmin Online 2021, talking about Time Machine.

You can watch my presentation and download my slides from here, where you’ll also find plenty of even better presentations.

Howard Oakley:

It’s that time of year when many of us are planning our upgrades, either to Big Sur or Monterey. One vital consideration is how to migrate our backups: this article looks at what you need to do for existing Time Machine backups, whether stored locally on an external disk, or on your network.

Howard Oakley:

If you’re going to use SMB as recommended by Apple, the most robust way seems to be disable AFP on all NAS which support SMB. It may sometimes help if you’re not connected to the NAS in the Finder, before you start setting that up as your TM backup destination.

Howard Oakley:

Earlier this month, I provided a presentation for the MacSysAdmins virtual conference. Now that’s done and dusted, I’m pleased to provide a copy of my slides in high quality PDF, together with my script, available from here: timemachinemacsysadmins

Howard Oakley:

If you’re intending to back up from Time Machine to network storage such as a NAS or another Mac, the above figures can be used to provide an estimate of how long those backups are likely to take. First, connect to a share on the server, and copy to it a single large file, such as the 10 GB test file used here. Measure the total time for that to transfer, and take two-thirds (0.67) of that transfer rate as the likely overall rate to be delivered by Time Machine. Then use that with your expected average hourly backup to calculate how long that is likely to take.


Time Machine settings you should consider for improving performance include:

  • exclude items containing many small files, such as Xcode;
  • back up very large files such as VMs separately;
  • use default automatic hourly backups, rather than backing up less frequently;
  • back up to APFS, which works at a block rather than file level, and backs up clones and sparse files much more efficiently.


If you should encounter poor performance when making backups, use T2M2’s Check Speed feature to identify which items are causing most slowing.

Howard Oakley:

After four years in which it had offered frustratingly limited support for the new features of APFS, Disk Utility is now complete: this version has excellent support for snapshots, no matter which app created them.

Howard Oakley:

However, we know that snapshots are strictly read-only, and the only user experiences that I can discover confirm my suspicion that all fsck_apfs does when it finds an error in a snapshot is to throw its hands in the air, report an opaque error code, and not even attempt a repair.

For a backup snapshot, that’s fatal. All you can then do is delete the whole snapshot, knocking a hole in your backups which can never be replaced. Disk Utility’s typical response only rubs salt into the wound by telling the user to make a backup of the affected disk. As it’s currently impossible to copy backup snapshots to another disk, a single error on that storage compromises all your backups stored there: every single one of them, and there’s absolutely nothing that macOS offers to help that.

Howard Oakley:

Snapshots are one of the huge advances in APFS, but like other features, they can cause more problems than they’re worth. This article explains how they can go wrong, and what you can do to manage them so they don’t swallow all the free space on your storage.


Third-party backup products which incorporate snapshot features, like Carbon Copy Cloner (CCC), are more flexible and you can set custom snapshot retention policies for individual volumes. These operate independently, so CCC can’t change Time Machine’s policy, neither can Time Machine delete CCC’s snapshots automatically.


In most cases, apps should provide settings in their Preferences which let you store their temporary files on a volume which isn’t backed up, so avoiding them swelling the size of hourly snapshots.


Update (2022-05-20): Howard Oakley:

Time Machine manages its backups actively to ensure that, whenever possible, they remain well within the disk space available to the backup volume. It does this by a process of ‘thinning’ older backups to recover the space that they occupy. If the backup volume is inside a container which completely fills that disk, then Time Machine will normally fill the volume, thus the container, thus the whole disk. Simply adding another non-backup volume to the same container will put the two volumes into competition for the same free disk space, and will eventually result in your use of the non-backup volume being determined by Time Machine’s thinning of its backups.

One way to avoid that competition from occurring is to reserve space on the backup disk for your non-backup storage. There are two ways to do that: you can set a reserve size on a volume in the same container as the backup volume, or you can put your non-backup volume into a separate container. Neither of those is mentioned in Apple’s guide.


However, you can only set reserve and quota sizes when you create the volume. Even diskutil can’t change them once that volume has been created. The only way that I know to make such a change is to create a new volume with the desired sizes set, then move the contents of the original volume across to it.

Tuesday, May 17, 2022 [Tweets] [Favorites]

Bike 1.0

Jesse Grosjean (tweet, Hacker News):

Bike is a macOS (11 and later) native outliner. Bike has good performance on big outlines. Bike uses open file formats and is scriptable too. Use Bike to record and process your ideas.


Outliners are powerful but constraining. Text editors are freeing but weak on structure. Bike is good at both.


Bike uses open file formats. The .bike file format is HTML–you can view it in your web browser. Bike also supports .opml and .txt.

It really is fast. I love the open formats. What’s cool is that it doesn’t just export to OPML and plain text; you can directly edit and save files in those formats, too, and convert between them. I used it to convert some of my big OmniOutliner files to plain text, for easier access on my iPhone and within BBEdit. I can edit a file in both BBEdit and Bike at the same time, and each app recognizes changes from the other. The plain text format just uses tabs and newlines for structure (no leading - or * to mark items), so it works great with lots of tools. Bike supports multiple levels of hoisting/focusing. It’s $29.99 direct and $2.99/month or $19.99/year in the Mac App Store.

See also: How does Bike relate to TaskPaper?.


Opt-Out App Store Subscription Increases

Apple (via Mark Gurman, MacRumors):

Currently, when an auto-renewable subscription price is increased, subscribers must opt in before the price increase is applied. The subscription doesn’t renew at the next billing period for subscribers who didn’t opt in to the new price. This has led to some services being unintentionally interrupted for users and they must take steps to resubscribe within the app, from Settings on iPhone and iPad, or in the App Store on Mac.

With this update, under certain specific conditions and with advance user notice, developers may also offer an auto-renewable subscription price increase, without the user needing to take action and without interrupting the service. The specific conditions for this feature are that the price increase doesn’t occur more than once per year, doesn’t exceed US$5 and 50% of the subscription price, or US$50 and 50% for an annual subscription price, and is permissible by local law. In these situations, Apple always notifies users of an increase in advance, including via email, push notification, and a message within the app.

Mitchell Clark:

Reading that literally, it means that both conditions would have to be true to require an opt-in. But the example scenario seems so ridiculous that it’s hard to believe that’s what Apple intends.


It’s worth noting that you could easily turn Apple’s logic on its head: if users were missing those renewal opt-in notices, wouldn’t they also miss these new price change warnings? But it does sound like they’ll be relatively in your face.


There is an easy fix to this: let users pick whether or not they want the auto-renewing price increases instead of deciding for them. In my mind, that’d just be a toggle in the App Store settings that says something like “Always ask for opt-in if price increases,” and turning it on would make it like this change never happened.


Update (2022-05-19): Benjamin Mayo:

In the short term, those same competition forces mean that Apple will have to pull back on some of the customer-friendly In-App Purchase policies to align with the market, to keep publishers onboard.


The vast majority of subscriptions in the world do not work that way. In-App Purchase was a stark outlier. It stood in contrast to even Apple’s own subscriptions like iCloud or Apple One; they increase their price freely with notification, but without consent.

PasswordWallet 4.8.13 for Mac

Selznick Scientific Software:

  • The Toolbars now look correct in mac OS Big Sur.
  • Ready for Apple Silicon! (M1)
  • Improved Bonjour support for discovering other PasswordWallets on your local network.
  • Fixed an issue with the Entry Editor when in “separate-window mode” and PasswordWallet closes on a timeout.

The iOS version has also been updated to version 4.8.22. My understanding is that the updates were held up for almost 6 months due to an Apple security bug.


Xcode 13.4


Xcode 13.4 includes SDKs for iOS 15.5, iPadOS 15.5, tvOS 15.4, watchOS 8.5, and macOS Monterey 12.3. The Xcode 13.4 release supports on-device debugging for iOS 15.5, iPadOS 15.5, tvOS 15.4, watchOS 8.5, and later. Xcode 13.4 requires a Mac running macOS Monterey 12.3 or later.


The async version of addTeardownBlock method in XCTestCase is now available.

Closures that are guaranteed to run on the main actor are now permitted to reference local variables from their enclosing scopes that are also running on the main actor.


Monday, May 16, 2022 [Tweets] [Favorites]

Apple Platform Security Guide (May 2022)

Apple (PDF):

Unless otherwise noted, this documentation covers the following operating system versions: iOS 15.4, iPadOS 15.4, macOS 12.3, tvOS 15.4, and watchOS 8.5.


Topics added:


In macOS 12.0.1 or later, every new macOS installation also installs a paired version of recoveryOS into the corresponding APFS volume group. This design is familiar to users of Intel-based Mac computers, but on a Mac with Apple silicon, it provides additional security and compatibility guarantees. Because every macOS installation now has a dedicated paired recoveryOS, this helps ensure that only that dedicated paired recoveryOS can perform security-downgrading operations. This helps protect installations of newer versions of macOS from tampering initiated from older versions of macOS, and vice versa.


To boot into a paired recoveryOS for any macOS installation, that installation needs to be selected as the default, which is done using Startup Disk in System Preferences or by starting any recoveryOS and holding Option while selecting a volume.

Howard Oakley:

Don’t be put off by its title: Apple Platform Security Guide is mandatory reading for all advanced Mac Users, and the only way we get to learn about important details of macOS, iCloud, and much else.


Indeed, several of us have experienced problems trying to get a downgraded copy of macOS on an external disk to load third-party kexts. Could this be the result of our not setting that boot volume group as “the default”?


What the Guide says currently is incorrect at the least. If M1 Recovery Mode really does have two different ways of selecting the boot volume group to be used next, their differences need to be explained properly and not left to inference and guesswork. Users, who are hardly likely to pore over the Guide or study bputil’s man page, need clear explanation of how they should start their M1 Macs from an external boot disk, how its local Recovery system is paired to it, and how to use Startup Security Utility effectively.


Update (2022-05-19): Nick Heer:

Max Zinkus tweeted a thread of notable new sections and updates, like this one[…] This is part of a broader question about whether Apple could switch any iMessage discussion to Messages for Business Chat, which has looser security and privacy standards than peer-to-peer iMessage.

iMessage itself retains a misleading description of its security architecture[…]

Studio Display Firmware 15.5

Juli Clover:

According to Apple’s release notes, the firmware refines camera tuning, offering improved noise reduction, contrast, and framing. We tested out the firmware update when it was in beta, and there is a clear difference in camera quality, mostly as it pertains to the way the framing works.

In addition to better framing, colors are not quite as pale, the contrast has been improved, and the overall look is more vibrant. Skin tones are also better than before, and there is less de-noising for more clarity, but ultimately Studio Display owners should not expect dramatic changes.

The first few comments talk about how the camera on the 24-inch iMac—a whole computer that’s thinner and costs less than the Studio Display—is better.

I don’t understand why the update requires macOS 12.4.


Update (2022-05-17): Matt J Fuller:

I ran the macOS update + #AppleStudioDisplay Firmware Update 15.5 today (took 45 min). My office has no windows so lighting did not change. I used PhotoBooth w/full-screen Screen Shots to compare. I see improvements. Before: image is more washed out. After: blacks are improved.

Gus Mueller:

Studio Display got into a loop of “updating please don’t unplug” and a warning symbol with the URL “”. It cycled between the two about 6-8 times before I just powered off the Mac and disconnected the display.

I rebooted the Mac with another display connected, waited a little bit, and reconnected the Studio Display. It tried the update again and it went through successfully this time.

Not being able to trust future display firmware updates, or my display in general, is a bummer.

macOS 12.4

Juli Clover:

Universal Control is no longer in beta. It is now an official feature that Apple has deemed issue-free, and the beta labeling has been removed. Universal Control was introduced in March and it allows you to use a single mouse/trackpad and keyboard across multiple Macs and iPads.

For the Studio Display, macOS Monterey 12.4 adds support for the 15.5 firmware, which is designed to improve the webcam quality.

There’s also an update for the Podcasts app, with Apple adding a setting that limits the number of episodes stored on a Mac and automatically deletes older ones.

See also: Apple’s enterprise and security release notes.

You can download the installer here.


Update (2022-05-16): Wojciech Reguła:

My 6 vulnerabilities patched today in macOS 12.4. Let me tell you something more about them[…]

CVE-2022-26694 (Contacts) led to impersonation of entitlement that allows full control over the TCC. ☠️ Also I got keychain-access-groups for apple and apple account Keychain groups.

Update (2022-05-17): See also: Howard Oakley.

iOS 15.5 and iPadOS 15.5

Juli Clover:

Compared to prior iOS 15 updates, iOS 15.5 and iPadOS 15.5 are smaller in scale. There are updates to the Apple Cash card in the Wallet app and a new setting that lets Podcasts users limit the number of episodes stored on their devices.

There’s a long list of security fixes.


Update (2022-05-17): Joe Cieplinski:

What’s with 15.5 having 15.4’s release notes?

Update (2022-05-19): Juli Clover:

The new updates aren’t as feature rich as the prior updates and focus primarily on under-the-hood changes, but there are still a few minor tweaks, which we’ve outlined below.

Friday, May 13, 2022 [Tweets] [Favorites]

Music Unitasker

Riccardo Mori:

Listening to music with an iPod shuffle is still (and can still be) a fun experience. You can create the digital equivalent of a mixtape, load it on your shuffle, clip the shuffle to your shirt/jeans/jacket, and then you can go out and listen to music without even having to touch the device, unless you need to change volume or skip a track. It’s basically a hands-free device that disappears on you. If Apple made a new iPod shuffle with Bluetooth, the invisibility factor would be even higher, since you wouldn’t even have the earphones’ cable around you to remind you that you are wearing an iPod. It would still be a nice device for commuting, or jogging, or during a workout.

Sure, you might say that these uses are now taken over by the Apple Watch or other smartwatches, but for an Apple Watch you’ll pay a minimum of $199 up to more than $1,000. An iPod shuffle would be a $50 device. If you’re a casual user who just wants to have some music while out and about, jogging, etc., and don’t use a smartwatch, a little wearable device like the iPod shuffle could still be your cup of tea. But maybe wanting from today’s Apple a fun, inexpensive, wearable, colourful device is asking too much. Here, have an AirTag instead.

Tyler Hall:

With all the shit in the world in the last few years, listening to music has become even more of a refuge and safe space for me than it ever was before.

But, for me at least, the incredible technological convergence of every single use-case into a deck of cards-sized pocket super-computer means that when I do want to only listen to music - there are a million beeps, boops, and badges fighting for my attention.

An underappreciated feature of the iPod (because it wasn’t a feature you could market during its heyday) was that it was only an iPod. Not also a mobile phone and internet communicator.

He bought a Sony NW-A105 Walkman running Android.

For all the amazing interactions touch screens have given us, until I clicked to the next track without taking this Walkman out of my pocket, I had forgotten how nice it is to control my music by touch - and not by voice or by first waking my phone from sleep and tapping a button I can’t feel.


iCloud Drive Folder Sharing Risks Data Loss

Adam Engst:

Today’s target is the discovery that when collaborators in an iCloud Drive shared folder delete files or folders, those items are destroyed instantaneously, not put in the Trash or added to iCloud Drive’s Recently Deleted folder. They’re just gone, with no option for recovery. If that’s not bad enough—and it is—Apple has recently tweaked its already weak documentation in a way that further conceals this dangerous implementation.


Sideloading via AltStore

Jared Newman:

AltStore has been downloaded more than 1.5 million times since its launch in 2019, and the service has more than 300,000 monthly active users.


As Apple faces more political pressure to let users install apps from outside the App Store, AltStore is preparing for its biggest updates yet. Users will soon be able to discover new apps to sideload directly through AltStore, so they don’t have to wade through questionable download sites.


The goal, Testut says, is to turn AltStore into a haven for independent apps that clash with Apple’s App Store policies.


To enable sideloading, users must install a companion app called AltServer on a Mac or Windows PC. This program then logs users in with their Apple ID, prepares their account for development, and signs the AltStore app so that it looks like the user created it. AltServer then uses the iTunes sync protocol to send AltStore to the user’s iPhone or iPad.


As for the kind of apps that AltStore plans to curate, Testut points to UTM, an app for running virtualized versions of other operating systems, such as Windows and Linux, on an iPhone or iPad. […] “You would think that allowing high performance apps would be to Apple’s benefit as they keep making more and more powerful iPads, but the state of (allowed) iPad software has been stagnant,” says UTM’s developer, who goes by the pseudonym Osy.

As previously discussed, there are Apple-imposed limits to the number of apps that can be installed, and apps must be refreshed weekly by AltServer in order to keep working.

See also: Matt Birchler.


On App Store Pricing Inflexibility

Jeff Johnson:

If I made StopTheMadness universal and gave the iOS version to previous Mac customers for free, even to the customers who only paid $4.99 three years prior, I’d be passing up a huge amount of money — money I desperately needed at the time just to stay afloat.

The App Store unfortunately doesn’t support paid upgrades. Nonetheless, in my own mind, I treated StopTheMadness on iOS as a kind of paid upgrade: if you already purchased the Mac version, and you wanted the new iOS version, you had to pay extra.


If I charge $9.99 for the universal app, or even more than $9.99 to reflect the added value of cross-platform support, then I scare away potential buyers of the iOS version. On the other hand, if I charge $7.99 for the universal app, I may be losing a lot of revenue. Despite the wild claims of people who are ignorant of the software business, little indie developers like me can’t “make it up in volume” with lower prices, because the hardest part of selling for an indie developer is making potential customers aware of the existence of your app. Lowering your price doesn’t magically make customers appear.

I think the inflexibility of pricing upgrades and different versions of the same app is holding back the products that are available. It seems like the App Store is designed for apps where the software is really a window for selling content or a service. If the app itself is the product, and the goal is to tailor it to each platform and to build deep features over time, the paid-upfront universal model is a bad fit. Subscriptions help in some ways, but they don’t account for the facts that customers don’t want to pay for platforms they aren’t using and that developing for more platforms is more expensive. It takes a lot more than a clicking checkbox.


Thursday, May 12, 2022 [Tweets] [Favorites]

The Apple Services Experience Is Not Good Enough

Benjamin Mayo:

Apple’s services tick the boxes, and they mostly do what they promise. However, nothing comes close to the quality of experience I expect to have from things branded with the Apple logo. When I am using these apps, I am not filled with confidence that striving for greatness was a top priority. Far too often, meeting revenue goals and business objectives seem more important to their creation.

They are built to a passing grade, but nothing more. Basic features found in services from rival companies are either lacking altogether in Apple’s apps, or implemented half-heartedly and performance is sluggish. Browsing in Music and TV is painful, with an over-reliance on the infinite scroll. New content is just tacked on the bottom of already long lists. Meanwhile, the navigation bars are blank when they could include simple shortcut buttons and filters to help users navigate and explore. Moreover, these apps feature too many loading states and too much waiting around. They are akin to janky web apps, rather than richly-compelling responsive experiences.

The services apps are all frustrating to use. In may ways, they feel worse than Web apps. I cannot believe how Apple has let them regress so much. I miss iTunes from 15 years ago. Looking through movies in the TV app the other day: there is no way to see a sorted list of titles. There’s no way to search my list of purchases, nor even to jump-scroll by letter. There is no way to mark a movie on my iPhone so that I can easily find it again on my Apple TV. I guess I could start playing it for a few seconds to make it appear in Up Next? But I don’t want to download it onto my phone, and the sideways scrolling Up Next list is hard to work with and also includes the things that I’m currently watching. Why does it scroll sideways? I guess so that the rest of the screen can be used to promote Apple TV+ content.


Update (2022-05-13): Craig Grannell:

  • Going into Albums view in Photos on iPhone and dragging up to prompt photos to actually upload
  • Regularly force-quitting bird in Activity Monitor to get iCloud docs to sync
  • Restarting Music to get streaming to play

Becky Hansmeyer:

There is downloaded, on-device video content in the TV app on my kids’ iPads that they literally cannot access without an internet connection. I have to tether their iPads to my phone in the car to get their library to appear. Otherwise it just shows an empty state.

Mike Rockwell:

I maintain an old Mac Mini that runs El Capitan and an even older iMac that runs Snow Leopard. iTunes is so much better on those older machines than the current state of the TV app, Apple Music, and Apple Podcasts.

My current pet peeve is the Podcast app’s lack of OPML export or import. What a terrible, user-hostile omission.

Update (2022-05-24): Nick Heer:

Apple’s native apps on these devices simply are not good enough, and that is bananas. The company’s whole thing is that it makes the entire widget, so hardware, software, and services can work seamlessly together. But they do not. They feel brittle, like I am using prototypes where any deviation from a golden path is a risky endeavour.

@MainActor Not Guaranteed

Ole Begemann:

@MainActor is a Swift annotation to coerce a function to always run on the main thread and to enable the compiler to verify this. How does this work? In this article, I’m going to reimplement @MainActor in a slightly simplified form for illustration purposes, mainly to show how little “magic” there is to it. The code of the real implementation in the Swift standard library is available in the Swift repository.


@MainActor already uses the unofficial ability for an actor to provide a custom executor, and we’re going to do the same for our reimplementation. A serial executor that runs its job on the main dispatch queue is implemented as follows.


John McCall’s draft proposal for custom executors is worth reading, particularly the philosophy section.

Rob Jonson (tweet):

For good measure – I mark the task as @MainActor.

My expectation was the following

  1. in doWork(), it would return off the main thread after Background().go()
  2. @MainActor annotation would ensure that calling self.mainDate would happen on the main thread – or there would be a compiler error
  3. @MainActor annotation would ensure that calling self.storedDate would happen on the main thread – or there would be a compiler error

#2 and #3 are false.


Bizarrely – If include a print statement in my task, then everything does run on the main thread!!!

Ole Begemann:

If you’re writing Swift concurrency code, add these compiler flags:

-Xfrontend -warn-concurrency -Xfrontend -enable-actor-data-race-checks

(in Xcode: Other Swift Flags)

Warnings in Swift 5.5 identify unsafe constructs, will become errors in Swift 6.

Rob Jonson:

Moving the exact same code out of the NSViewController and into a separate class (that inherits from nothing) causes the expected compiler warnings to kick in.

It seems that my model is ‘Sendable’ – so now the compiler can do magic.

This feels like an important limitation that should be in BIG BOLD LETTERS in the documentation…

See also: @MainActor ignored by the compiler.

Update (2022-05-13): See also: Frank Illenberger.