I was expecting isolated deinit to be available in Swift 6.1, but it's still marked as an "experimental" feature (not even an upcoming one, so we can't even try it in the production compiler).
What's this waiting on, and when can we expect it generally?
Since it will be released in Swift 6.2, is there a way to use the isolated deinit - eg: .enableUpcomingFeature("IsolatedDeinit") - in my Swift 6.1 package?
EDIT:
When I tried to add an isolated deinit to my actor, I saw an error:
'isolated' deinit requires frontend flag -enable-experimental-feature IsolatedDeinit to enable the usage of this language feature
Then I added .enableExperimentalFeature("IsolatedDeinit") to my package, and it couldn't be built due to an error:
experimental feature 'IsolatedDeinit' cannot be enabled in production compiler
I have a similar question, trying out isolated deinit in XCode 26 beta 3 yields "Isolated deinit is only available in iOS 18.4.0 or newer", which I am surprised by. (I need to ship for at least iOS 15).
Sounds like it has a newer runtime requirement and the needed features shipped in the Swift 6.1 update in iOS 18.4, even if the compiler support was only finalized for Swift 6.2. Apple doesn't backport new runtimes to old OSes, so your only real option is to create separate types for the new capability, or not use it at all.
Hm. I vaguely remember, that in Objective-C UIKit classes have had the issue that the last strong reference could be released on a non-main thread, which caused issues. And, as far as I remember, this has been changed same day in the past, so that for UIKit classes, the last reference would be deallocated on the main thread.
I'm wondering, if it might be useful, to make a general exception for @MainActor annotated classes, that they will always call its deinitialiser on the main thread. Non-isolated deinits are quite a nasty thing and can go horribly wrong.