From b1b7dcd10ac58bb3294db6a7100154eec55095c8 Mon Sep 17 00:00:00 2001 From: Arkadiusz Fal Date: Tue, 1 Sep 2026 23:53:01 +0200 Subject: [PATCH] Keep notification tokens out of observation The two observer tokens carried an isolation annotation the compiler reported as having no effect, while rejecting the plain `nonisolated` it suggested in its place. Both follow from `@Observable`: the macro rewrites stored properties into computed accessors, where `unsafe` means nothing and `nonisolated` is not allowed at all. They are notification tokens, written on the main actor and read once in deinit. Nothing renders them, so nothing should be tracking them. Marking them ignored lets the annotation apply to a real stored property again and settles the warning by removing the reason it appeared. --- .../Services/Credentials/CredentialIdentityScope.swift | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/Yattee/Services/Credentials/CredentialIdentityScope.swift b/Yattee/Services/Credentials/CredentialIdentityScope.swift index 325dd755..aca9f34c 100644 --- a/Yattee/Services/Credentials/CredentialIdentityScope.swift +++ b/Yattee/Services/Credentials/CredentialIdentityScope.swift @@ -67,8 +67,14 @@ final class CredentialIdentityScope { private let retryDelay: @Sendable (Int) async -> Void /// Written only on the main actor; read in `deinit`, which runs after the /// last reference is gone and so cannot race with it. - private nonisolated(unsafe) var identityChangeObserver: NSObjectProtocol? - private nonisolated(unsafe) var cloudKitAccountObserver: NSObjectProtocol? + /// + /// Kept out of observation deliberately. These are notification tokens, not + /// state anything renders, and `@Observable` would rewrite them into + /// computed accessors — which is what made the compiler report the + /// isolation annotation as having no effect while also refusing the plain + /// `nonisolated` it suggested. + @ObservationIgnored private nonisolated(unsafe) var identityChangeObserver: NSObjectProtocol? + @ObservationIgnored private nonisolated(unsafe) var cloudKitAccountObserver: NSObjectProtocol? private static let cacheKey = "credentialIdentityScopeCache"