Skip to content

Commit b8c1e7c

Browse files
authored
Add some Sendable conformances (#182)
1 parent 5c6d5bf commit b8c1e7c

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

Sources/Defaults/Defaults+Bridge.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ extension Defaults {
5353
}
5454

5555
extension Defaults {
56-
public struct URLBridge: CodableBridge {
56+
public struct URLBridge: CodableBridge, Sendable {
5757
public typealias Value = URL
5858
}
5959
}
@@ -296,7 +296,7 @@ extension Defaults {
296296
}
297297

298298
extension Defaults {
299-
public struct UUIDBridge: Bridge {
299+
public struct UUIDBridge: Bridge, Sendable {
300300
public typealias Value = UUID
301301
public typealias Serializable = String
302302

@@ -373,7 +373,7 @@ extension Defaults {
373373

374374
It is unsafe to convert `SwiftUI.Color` to `UIColor` and use `UIColor.bridge` to serialize it, because `UIColor` does not hold a color space, but `Swift.Color` does (which means color space might get lost in the conversion). The bridge will always try to preserve the color space whenever `Color#cgColor` exists. Only when `Color#cgColor` is `nil`, will it use `UIColor.bridge` to do the serialization and deserialization.
375375
*/
376-
public struct ColorBridge: Bridge {
376+
public struct ColorBridge: Bridge, Sendable {
377377
public typealias Value = Color
378378
public typealias Serializable = Any
379379

@@ -428,7 +428,7 @@ extension Defaults {
428428
}
429429

430430
extension Defaults {
431-
public struct AnyBridge: Defaults.Bridge {
431+
public struct AnyBridge: Defaults.Bridge, Sendable {
432432
public typealias Value = Defaults.AnySerializable
433433
public typealias Serializable = Any
434434

Sources/Defaults/Defaults.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ extension Defaults {
8989

9090
- Important: The `UserDefaults` name must be ASCII, not start with `@`, and cannot contain a dot (`.`).
9191
*/
92-
public final class Key<Value: Serializable>: _AnyKey {
92+
public final class Key<Value: Serializable>: _AnyKey, @unchecked Sendable {
9393
/**
9494
It will be executed in these situations:
9595

0 commit comments

Comments
 (0)