Skip to content

Commit 12ee56f

Browse files
authored
Add Sendable Conformances (#90)
* Add 5.9 manifest * Bump minimum Swift version to 5.7 * Add Sendable annotations to most types
1 parent cf2f6ad commit 12ee56f

File tree

7 files changed

+42
-9
lines changed

7 files changed

+42
-9
lines changed

Package.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// swift-tools-version:5.4
1+
// swift-tools-version:5.7
22
import PackageDescription
33

44
let package = Package(

[email protected]

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
// swift-tools-version:5.9
2+
import PackageDescription
3+
4+
let package = Package(
5+
name: "multipart-kit",
6+
platforms: [
7+
.macOS(.v10_15),
8+
.iOS(.v13),
9+
.tvOS(.v13),
10+
.watchOS(.v6),
11+
],
12+
products: [
13+
.library(name: "MultipartKit", targets: ["MultipartKit"]),
14+
],
15+
dependencies: [
16+
.package(url: "https://github.com/apple/swift-nio.git", from: "2.61.1"),
17+
.package(url: "https://github.com/apple/swift-collections.git", from: "1.0.5")
18+
],
19+
targets: [
20+
.target(
21+
name: "MultipartKit",
22+
dependencies: [
23+
.product(name: "NIO", package: "swift-nio"),
24+
.product(name: "NIOHTTP1", package: "swift-nio"),
25+
.product(name: "Collections", package: "swift-collections")
26+
],
27+
swiftSettings: [.enableExperimentalFeature("StrictConcurrency")]),
28+
.testTarget(
29+
name: "MultipartKitTests",
30+
dependencies: ["MultipartKit"],
31+
swiftSettings: [.enableExperimentalFeature("StrictConcurrency")]),
32+
]
33+
)

Sources/MultipartKit/FormDataDecoder/FormDataDecoder.swift

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import NIOHTTP1
66
/// See [RFC#2388](https://tools.ietf.org/html/rfc2388) for more information about `multipart/form-data` encoding.
77
///
88
/// Seealso `MultipartParser` for more information about the `multipart` encoding.
9-
public struct FormDataDecoder {
9+
public struct FormDataDecoder: Sendable {
1010

1111
/// Maximum nesting depth to allow when decoding the input.
1212
/// - 1 corresponds to a single value
@@ -15,7 +15,7 @@ public struct FormDataDecoder {
1515
let nestingDepth: Int
1616

1717
/// Any contextual information set by the user for decoding.
18-
public var userInfo: [CodingUserInfoKey: Any] = [:]
18+
public var userInfo: [CodingUserInfoKey: Sendable] = [:]
1919

2020
/// Creates a new `FormDataDecoder`.
2121
/// - Parameter nestingDepth: maximum allowed nesting depth of the decoded structure. Defaults to 8.

Sources/MultipartKit/FormDataEncoder/FormDataEncoder.swift

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@ import NIOCore
55
/// See [RFC#2388](https://tools.ietf.org/html/rfc2388) for more information about `multipart/form-data` encoding.
66
///
77
/// Seealso `MultipartParser` for more information about the `multipart` encoding.
8-
public struct FormDataEncoder {
8+
public struct FormDataEncoder: Sendable {
99

1010
/// Any contextual information set by the user for encoding.
11-
public var userInfo: [CodingUserInfoKey: Any] = [:]
11+
public var userInfo: [CodingUserInfoKey: Sendable] = [:]
1212

1313
/// Creates a new `FormDataEncoder`.
1414
public init() { }

Sources/MultipartKit/MultipartFormData.swift

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import Collections
1+
@preconcurrency import Collections
22

3-
enum MultipartFormData: Equatable {
3+
enum MultipartFormData: Equatable, Sendable {
44
typealias Keyed = OrderedDictionary<String, MultipartFormData>
55

66
case single(MultipartPart)

Sources/MultipartKit/MultipartPart.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import NIOHTTP1
33
import Foundation
44

55
/// A single part of a `multipart`-encoded message.
6-
public struct MultipartPart: Equatable {
6+
public struct MultipartPart: Equatable, Sendable {
77
/// The part's headers.
88
public var headers: HTTPHeaders
99

Sources/MultipartKit/MultipartSerializer.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import NIOCore
33
/// Serializes `MultipartForm`s to `Data`.
44
///
55
/// See `MultipartParser` for more information about the multipart encoding.
6-
public final class MultipartSerializer {
6+
public final class MultipartSerializer: Sendable {
77

88
/// Creates a new `MultipartSerializer`.
99
public init() { }

0 commit comments

Comments
 (0)