Skip to content

Commit 7bc4ec9

Browse files
authored
Make PolymorphicCodable conform to Sendable (#388)
This allows making types that use `PolymorphicCodable` and `PolymorphicCodableArray` property wrappers `Sendable`.
1 parent cba2779 commit 7bc4ec9

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

Sources/TSCUtility/PolymorphicCodable.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@ public struct PolymorphicCodable<T: PolymorphicCodableProtocol>: Codable {
4242
}
4343
}
4444

45+
extension PolymorphicCodable: Sendable where T: Sendable {}
46+
4547
@propertyWrapper
4648
public struct PolymorphicCodableArray<T: PolymorphicCodableProtocol>: Codable {
4749
public let value: [PolymorphicCodable<T>]
@@ -54,3 +56,5 @@ public struct PolymorphicCodableArray<T: PolymorphicCodableProtocol>: Codable {
5456
return value.map{ $0.value }
5557
}
5658
}
59+
60+
extension PolymorphicCodableArray: Sendable where T: Sendable {}

0 commit comments

Comments
 (0)