Skip to content

Commit

Permalink
Add some Sendable conformances (sindresorhus#182)
Browse files Browse the repository at this point in the history
  • Loading branch information
kitwtnb authored Jul 23, 2024
1 parent 5c6d5bf commit b8c1e7c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions Sources/Defaults/Defaults+Bridge.swift
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ extension Defaults {
}

extension Defaults {
public struct URLBridge: CodableBridge {
public struct URLBridge: CodableBridge, Sendable {
public typealias Value = URL
}
}
Expand Down Expand Up @@ -296,7 +296,7 @@ extension Defaults {
}

extension Defaults {
public struct UUIDBridge: Bridge {
public struct UUIDBridge: Bridge, Sendable {
public typealias Value = UUID
public typealias Serializable = String

Expand Down Expand Up @@ -373,7 +373,7 @@ extension Defaults {
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.
*/
public struct ColorBridge: Bridge {
public struct ColorBridge: Bridge, Sendable {
public typealias Value = Color
public typealias Serializable = Any

Expand Down Expand Up @@ -428,7 +428,7 @@ extension Defaults {
}

extension Defaults {
public struct AnyBridge: Defaults.Bridge {
public struct AnyBridge: Defaults.Bridge, Sendable {
public typealias Value = Defaults.AnySerializable
public typealias Serializable = Any

Expand Down
2 changes: 1 addition & 1 deletion Sources/Defaults/Defaults.swift
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ extension Defaults {
- Important: The `UserDefaults` name must be ASCII, not start with `@`, and cannot contain a dot (`.`).
*/
public final class Key<Value: Serializable>: _AnyKey {
public final class Key<Value: Serializable>: _AnyKey, @unchecked Sendable {
/**
It will be executed in these situations:
Expand Down

0 comments on commit b8c1e7c

Please sign in to comment.