mirror of
https://github.com/yattee/yattee.git
synced 2026-10-23 21:22:53 +00:00
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.
This commit is contained in:
@@ -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"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user