From 38925e3cfacf3fb89a81a35b1cd44fd5a5b7e0fa Mon Sep 17 00:00:00 2001 From: Sindre Sorhus Date: Tue, 20 Feb 2024 19:32:27 +0700 Subject: [PATCH] Improve compatibility with strict concurrency Fixes #167 --- Sources/Defaults/Defaults.swift | 2 +- Sources/Defaults/Observation.swift | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/Sources/Defaults/Defaults.swift b/Sources/Defaults/Defaults.swift index d6c3036..2385cc9 100644 --- a/Sources/Defaults/Defaults.swift +++ b/Sources/Defaults/Defaults.swift @@ -43,7 +43,7 @@ extension Defaults { /** Type-erased key. */ - public class _AnyKey { + public class _AnyKey: @unchecked Sendable { public typealias Key = Defaults.Key public let name: String diff --git a/Sources/Defaults/Observation.swift b/Sources/Defaults/Observation.swift index 06d2d74..fff41e8 100644 --- a/Sources/Defaults/Observation.swift +++ b/Sources/Defaults/Observation.swift @@ -27,7 +27,7 @@ public protocol _DefaultsObservation: AnyObject { extension Defaults { public typealias Observation = _DefaultsObservation - public enum ObservationOption { + public enum ObservationOption: Sendable { /** Whether a notification should be sent to the observer immediately, before the observer registration method even returns. */ @@ -365,3 +365,4 @@ extension Defaults.ObservationOptions { } extension Defaults.KeyChange: Equatable where Value: Equatable {} +extension Defaults.KeyChange: Sendable where Value: Sendable {}