diff --git a/Sources/ProjectSpec/Decoding.swift b/Sources/ProjectSpec/Decoding.swift index 24d158d9..e193a7f1 100644 --- a/Sources/ProjectSpec/Decoding.swift +++ b/Sources/ProjectSpec/Decoding.swift @@ -13,14 +13,15 @@ extension Dictionary where Key: JSONKey { let keys = Array(dictionary.keys) var itemResults: [Result] = Array(repeating: .failure(defaultError), count: keys.count) itemResults.withUnsafeMutableBufferPointer { buffer in + let bufferWrapper = BufferWrapper(buffer: buffer) DispatchQueue.concurrentPerform(iterations: dictionary.count) { idx in do { let key = keys[idx] let jsonDictionary: JSONDictionary = try dictionary.json(atKeyPath: .key(key)) let item = try T(name: key, jsonDictionary: jsonDictionary) - buffer[idx] = .success(item) + bufferWrapper.buffer[idx] = .success(item) } catch { - buffer[idx] = .failure(error) + bufferWrapper.buffer[idx] = .failure(error) } } } @@ -49,6 +50,14 @@ extension Dictionary where Key: JSONKey { } } +private final class BufferWrapper: @unchecked Sendable { + var buffer: UnsafeMutableBufferPointer + + init(buffer: UnsafeMutableBufferPointer) { + self.buffer = buffer + } +} + public protocol NamedJSONDictionaryConvertible { init(name: String, jsonDictionary: JSONDictionary) throws diff --git a/Sources/ProjectSpec/Scheme.swift b/Sources/ProjectSpec/Scheme.swift index a476b71a..204d05c3 100644 --- a/Sources/ProjectSpec/Scheme.swift +++ b/Sources/ProjectSpec/Scheme.swift @@ -878,7 +878,7 @@ extension Scheme.Build: JSONEncodable { } } -extension BuildType: JSONPrimitiveConvertible { +extension BuildType: JSONUtilities.JSONPrimitiveConvertible { public typealias JSONType = String @@ -910,7 +910,7 @@ extension BuildType: JSONEncodable { } } -extension XCScheme.EnvironmentVariable: JSONObjectConvertible { +extension XCScheme.EnvironmentVariable: JSONUtilities.JSONObjectConvertible { public static let enabledDefault = true private static func parseValue(_ value: Any) -> String { diff --git a/Sources/ProjectSpec/SwiftPackage.swift b/Sources/ProjectSpec/SwiftPackage.swift index 216a6061..55e273b9 100644 --- a/Sources/ProjectSpec/SwiftPackage.swift +++ b/Sources/ProjectSpec/SwiftPackage.swift @@ -101,7 +101,7 @@ extension SwiftPackage: JSONEncodable { } } -extension SwiftPackage.VersionRequirement: JSONObjectConvertible { +extension SwiftPackage.VersionRequirement: JSONUtilities.JSONObjectConvertible { public init(jsonDictionary: JSONDictionary) throws { if jsonDictionary["exactVersion"] != nil { diff --git a/Sources/ProjectSpec/VersionExtensions.swift b/Sources/ProjectSpec/VersionExtensions.swift index 0b67ce60..3ab52d65 100644 --- a/Sources/ProjectSpec/VersionExtensions.swift +++ b/Sources/ProjectSpec/VersionExtensions.swift @@ -8,7 +8,7 @@ import Foundation import Version -extension Version: ExpressibleByStringLiteral { +extension Version: Swift.ExpressibleByStringLiteral { public static func parse(_ string: String) throws -> Version { if let version = Version(tolerant: string) { diff --git a/Sources/XcodeGenCLI/Arguments.swift b/Sources/XcodeGenCLI/Arguments.swift index fef7c798..88f6c34f 100644 --- a/Sources/XcodeGenCLI/Arguments.swift +++ b/Sources/XcodeGenCLI/Arguments.swift @@ -2,7 +2,7 @@ import Foundation import PathKit import SwiftCLI -extension Path: ConvertibleFromString { +extension Path: SwiftCLI.ConvertibleFromString { public init?(input: String) { self.init(input) diff --git a/Sources/XcodeGenKit/CarthageVersionLoader.swift b/Sources/XcodeGenKit/CarthageVersionLoader.swift index 4a15a634..20eb2607 100644 --- a/Sources/XcodeGenKit/CarthageVersionLoader.swift +++ b/Sources/XcodeGenKit/CarthageVersionLoader.swift @@ -73,7 +73,7 @@ struct CarthageVersionFile: Decodable { } } -extension Platform: CodingKey { +extension Platform: Swift.CodingKey { public var stringValue: String { carthageName