Commit e6a97f9733
e6a97f9733bfdddc9ea46e24a252a16bb7f32b7c
parent: 3319bd391d
Unsigned
cmc <hello@cleberg.net> · 2026-10-29 01:44 UTC
Make DomainDebugLog nonisolated (!68)
`setAlternateIconName`'s completion handler is a nonisolated escaping closure
that UIKit can call off the main thread, and it logged the failure through
`DomainDebugLog.error`, which the project-wide `SWIFT_DEFAULT_ACTOR_ISOLATION =
MainActor` isolates. That was the one warning the Release archive produced:
```
DomainDig/Theme.swift:171:28: warning: call to main actor-isolated static
method 'error' in a synchronous nonisolated context [#ActorIsolatedCall]
```
Release only. The Debug build of the same commit does not report it, which is
how it survived since `!49` — and why it took running `Scripts/release-ios.sh`
to find it.
## Fixed at the source, not the call site
Nothing in `DomainDebugLog` needs the main actor: `enabled` is a compile-time
constant and `Logger` is `Sendable` and thread-safe. It is main-actor-isolated
only because the project default makes it so.
Wrapping the call site in a `Task { @MainActor in … }` instead would hop actors
to write one line, defer the message past the failure it describes, and leave
the next nonisolated caller to rediscover the same thing.
## Verified
Re-ran the Release archive: **zero warnings in the whole build**, where there
was one. The export still produces a 6.3 MB `.ipa` at 5.5.2 (55) with both
extensions embedded.
386 tests green. `./Scripts/audit-a11y.sh` passes on both tiers with no
enforced failures.
Layout: unified · split
DomainDig/DomainDebugLog.swift
+8 −1
| @@ -1,7 +1,14 @@ |
| 1 | import Foundation |
1 | import Foundation |
| 2 | import os |
2 | import os |
| 3 | |
3 | |
| 4 | enum DomainDebugLog { |
4 | /// Nonisolated because nothing here needs the main actor: `enabled` is a |
| |
5 | /// compile-time constant and `Logger` is `Sendable` and thread-safe. Without |
| |
6 | /// this the project-wide `SWIFT_DEFAULT_ACTOR_ISOLATION = MainActor` makes it |
| |
7 | /// main-actor-isolated, so a nonisolated caller — a UIKit completion handler, |
| |
8 | /// say — cannot log the failure it was handed without hopping actors to write |
| |
9 | /// one line. `AppIconController` had exactly that, as a Release-only warning |
| |
10 | /// the Debug build did not show. |
| |
11 | nonisolated enum DomainDebugLog { |
| 5 | #if DEBUG |
12 | #if DEBUG |
| 6 | static let enabled = true |
13 | static let enabled = true |
| 7 | #else |
14 | #else |