Skip to content

Commit 1aa7e28

Browse files
Fix Swift 6 warnings (#1513)
1 parent 681e320 commit 1aa7e28

File tree

6 files changed

+17
-8
lines changed

6 files changed

+17
-8
lines changed

Sources/ProjectSpec/Decoding.swift

+11-2
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,15 @@ extension Dictionary where Key: JSONKey {
1313
let keys = Array(dictionary.keys)
1414
var itemResults: [Result<T, Error>] = Array(repeating: .failure(defaultError), count: keys.count)
1515
itemResults.withUnsafeMutableBufferPointer { buffer in
16+
let bufferWrapper = BufferWrapper(buffer: buffer)
1617
DispatchQueue.concurrentPerform(iterations: dictionary.count) { idx in
1718
do {
1819
let key = keys[idx]
1920
let jsonDictionary: JSONDictionary = try dictionary.json(atKeyPath: .key(key))
2021
let item = try T(name: key, jsonDictionary: jsonDictionary)
21-
buffer[idx] = .success(item)
22+
bufferWrapper.buffer[idx] = .success(item)
2223
} catch {
23-
buffer[idx] = .failure(error)
24+
bufferWrapper.buffer[idx] = .failure(error)
2425
}
2526
}
2627
}
@@ -49,6 +50,14 @@ extension Dictionary where Key: JSONKey {
4950
}
5051
}
5152

53+
private final class BufferWrapper<T>: @unchecked Sendable {
54+
var buffer: UnsafeMutableBufferPointer<T>
55+
56+
init(buffer: UnsafeMutableBufferPointer<T>) {
57+
self.buffer = buffer
58+
}
59+
}
60+
5261
public protocol NamedJSONDictionaryConvertible {
5362

5463
init(name: String, jsonDictionary: JSONDictionary) throws

Sources/ProjectSpec/Scheme.swift

+2-2
Original file line numberDiff line numberDiff line change
@@ -878,7 +878,7 @@ extension Scheme.Build: JSONEncodable {
878878
}
879879
}
880880

881-
extension BuildType: JSONPrimitiveConvertible {
881+
extension BuildType: JSONUtilities.JSONPrimitiveConvertible {
882882

883883
public typealias JSONType = String
884884

@@ -910,7 +910,7 @@ extension BuildType: JSONEncodable {
910910
}
911911
}
912912

913-
extension XCScheme.EnvironmentVariable: JSONObjectConvertible {
913+
extension XCScheme.EnvironmentVariable: JSONUtilities.JSONObjectConvertible {
914914
public static let enabledDefault = true
915915

916916
private static func parseValue(_ value: Any) -> String {

Sources/ProjectSpec/SwiftPackage.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ extension SwiftPackage: JSONEncodable {
101101
}
102102
}
103103

104-
extension SwiftPackage.VersionRequirement: JSONObjectConvertible {
104+
extension SwiftPackage.VersionRequirement: JSONUtilities.JSONObjectConvertible {
105105

106106
public init(jsonDictionary: JSONDictionary) throws {
107107
if jsonDictionary["exactVersion"] != nil {

Sources/ProjectSpec/VersionExtensions.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
import Foundation
99
import Version
1010

11-
extension Version: ExpressibleByStringLiteral {
11+
extension Version: Swift.ExpressibleByStringLiteral {
1212

1313
public static func parse(_ string: String) throws -> Version {
1414
if let version = Version(tolerant: string) {

Sources/XcodeGenCLI/Arguments.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import Foundation
22
import PathKit
33
import SwiftCLI
44

5-
extension Path: ConvertibleFromString {
5+
extension Path: SwiftCLI.ConvertibleFromString {
66

77
public init?(input: String) {
88
self.init(input)

Sources/XcodeGenKit/CarthageVersionLoader.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ struct CarthageVersionFile: Decodable {
7373
}
7474
}
7575

76-
extension Platform: CodingKey {
76+
extension Platform: Swift.CodingKey {
7777

7878
public var stringValue: String {
7979
carthageName

0 commit comments

Comments
 (0)