diff --git a/Package.swift b/Package.swift index cbc6ccc..c86538b 100644 --- a/Package.swift +++ b/Package.swift @@ -1,4 +1,4 @@ -// swift-tools-version:5.4 +// swift-tools-version:5.7 import PackageDescription let package = Package( diff --git a/Package@swift-5.9.swift b/Package@swift-5.9.swift new file mode 100644 index 0000000..1e85788 --- /dev/null +++ b/Package@swift-5.9.swift @@ -0,0 +1,33 @@ +// swift-tools-version:5.9 +import PackageDescription + +let package = Package( + name: "multipart-kit", + platforms: [ + .macOS(.v10_15), + .iOS(.v13), + .tvOS(.v13), + .watchOS(.v6), + ], + products: [ + .library(name: "MultipartKit", targets: ["MultipartKit"]), + ], + dependencies: [ + .package(url: "https://github.com/apple/swift-nio.git", from: "2.61.1"), + .package(url: "https://github.com/apple/swift-collections.git", from: "1.0.5") + ], + targets: [ + .target( + name: "MultipartKit", + dependencies: [ + .product(name: "NIO", package: "swift-nio"), + .product(name: "NIOHTTP1", package: "swift-nio"), + .product(name: "Collections", package: "swift-collections") + ], + swiftSettings: [.enableExperimentalFeature("StrictConcurrency")]), + .testTarget( + name: "MultipartKitTests", + dependencies: ["MultipartKit"], + swiftSettings: [.enableExperimentalFeature("StrictConcurrency")]), + ] +) diff --git a/Sources/MultipartKit/FormDataDecoder/FormDataDecoder.swift b/Sources/MultipartKit/FormDataDecoder/FormDataDecoder.swift index f728bb6..7e6f2c8 100644 --- a/Sources/MultipartKit/FormDataDecoder/FormDataDecoder.swift +++ b/Sources/MultipartKit/FormDataDecoder/FormDataDecoder.swift @@ -6,7 +6,7 @@ import NIOHTTP1 /// See [RFC#2388](https://tools.ietf.org/html/rfc2388) for more information about `multipart/form-data` encoding. /// /// Seealso `MultipartParser` for more information about the `multipart` encoding. -public struct FormDataDecoder { +public struct FormDataDecoder: Sendable { /// Maximum nesting depth to allow when decoding the input. /// - 1 corresponds to a single value @@ -15,7 +15,7 @@ public struct FormDataDecoder { let nestingDepth: Int /// Any contextual information set by the user for decoding. - public var userInfo: [CodingUserInfoKey: Any] = [:] + public var userInfo: [CodingUserInfoKey: Sendable] = [:] /// Creates a new `FormDataDecoder`. /// - Parameter nestingDepth: maximum allowed nesting depth of the decoded structure. Defaults to 8. diff --git a/Sources/MultipartKit/FormDataEncoder/FormDataEncoder.swift b/Sources/MultipartKit/FormDataEncoder/FormDataEncoder.swift index 399c889..f48066d 100644 --- a/Sources/MultipartKit/FormDataEncoder/FormDataEncoder.swift +++ b/Sources/MultipartKit/FormDataEncoder/FormDataEncoder.swift @@ -5,10 +5,10 @@ import NIOCore /// See [RFC#2388](https://tools.ietf.org/html/rfc2388) for more information about `multipart/form-data` encoding. /// /// Seealso `MultipartParser` for more information about the `multipart` encoding. -public struct FormDataEncoder { +public struct FormDataEncoder: Sendable { /// Any contextual information set by the user for encoding. - public var userInfo: [CodingUserInfoKey: Any] = [:] + public var userInfo: [CodingUserInfoKey: Sendable] = [:] /// Creates a new `FormDataEncoder`. public init() { } diff --git a/Sources/MultipartKit/MultipartFormData.swift b/Sources/MultipartKit/MultipartFormData.swift index 428412c..da084b2 100644 --- a/Sources/MultipartKit/MultipartFormData.swift +++ b/Sources/MultipartKit/MultipartFormData.swift @@ -1,6 +1,6 @@ -import Collections +@preconcurrency import Collections -enum MultipartFormData: Equatable { +enum MultipartFormData: Equatable, Sendable { typealias Keyed = OrderedDictionary case single(MultipartPart) diff --git a/Sources/MultipartKit/MultipartPart.swift b/Sources/MultipartKit/MultipartPart.swift index e252bc7..2281fc1 100644 --- a/Sources/MultipartKit/MultipartPart.swift +++ b/Sources/MultipartKit/MultipartPart.swift @@ -3,7 +3,7 @@ import NIOHTTP1 import Foundation /// A single part of a `multipart`-encoded message. -public struct MultipartPart: Equatable { +public struct MultipartPart: Equatable, Sendable { /// The part's headers. public var headers: HTTPHeaders diff --git a/Sources/MultipartKit/MultipartSerializer.swift b/Sources/MultipartKit/MultipartSerializer.swift index 4523785..a005dc0 100644 --- a/Sources/MultipartKit/MultipartSerializer.swift +++ b/Sources/MultipartKit/MultipartSerializer.swift @@ -3,7 +3,7 @@ import NIOCore /// Serializes `MultipartForm`s to `Data`. /// /// See `MultipartParser` for more information about the multipart encoding. -public final class MultipartSerializer { +public final class MultipartSerializer: Sendable { /// Creates a new `MultipartSerializer`. public init() { }