Skip to content

Commit 41fd42a

Browse files
authored
Merge pull request #1 from rcarver/concurrent
enable strict concurrency and fix warnings
2 parents 493c770 + da7d964 commit 41fd42a

File tree

5 files changed

+13
-8
lines changed

5 files changed

+13
-8
lines changed

Package.swift

+4-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,10 @@ let package = Package(
1212
],
1313
targets: [
1414
.target(
15-
name: "GraphQLPagination"
15+
name: "GraphQLPagination",
16+
swiftSettings: [
17+
.enableExperimentalFeature("StrictConcurrency"),
18+
]
1619
),
1720
.testTarget(
1821
name: "GraphQLPaginationTests",

Sources/GraphQLPagination/Cursor.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import Foundation
22

3-
public struct Cursor: RawRepresentable, Hashable {
3+
public struct Cursor: RawRepresentable, Hashable, Sendable {
44
public var rawValue: String
55
public init(rawValue: String) {
66
self.rawValue = rawValue

Sources/GraphQLPagination/EdgeBuilder.swift

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import Foundation
22

33
/// Describes how to create the cursor for a set of edges.
4-
public enum CursorType {
4+
public enum CursorType: Hashable, Sendable {
55
/// The edge cursor is based on the node's `cursor` property.
66
case identifier
77
/// The edge cursor is based on the index of the node.
@@ -37,6 +37,7 @@ public struct EdgesConstruction<Edge> {
3737
}
3838

3939
extension EdgesConstruction: Equatable where Edge: Equatable {}
40+
extension EdgesConstruction: Sendable where Edge: Sendable {}
4041

4142
/// A type that can transform a set of nodes into edges with pagination logic.
4243
public struct EdgeBuilder<Node: GraphCursorable, Edge> {
@@ -96,6 +97,7 @@ struct Bounded<T> {
9697
}
9798

9899
extension Bounded: Equatable where T: Equatable {}
100+
extension Bounded: Sendable where T: Sendable {}
99101

100102
fileprivate extension Bounded {
101103
init(range: Range<Int>, count: Int, nodes: [T], cursors: [Cursor]) {

Sources/GraphQLPagination/Offset.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import Foundation
22

33
/// Traditional offset pagination, describing the offset of
44
/// the first record, and the number of records to return.
5-
public struct OffsetPagination: Equatable {
5+
public struct OffsetPagination: Equatable, Sendable {
66
public var offset: Int
77
public var count: Int?
88
public init(offset: Int = 0, count: Int? = nil) {

Sources/GraphQLPagination/Pagination.swift

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import Foundation
22

33
/// Pagination.
4-
public enum GraphPagination {
4+
public enum GraphPagination: Equatable, Sendable {
55
case forward(GraphForwardPagination)
66
case backward(GraphBackwardPagination)
77
}
@@ -50,7 +50,7 @@ extension GraphPaginatable {
5050
}
5151

5252
/// A concrete forward pagination input.
53-
public struct GraphForwardPagination: GraphForwardPaginatable {
53+
public struct GraphForwardPagination: Equatable, Sendable, GraphForwardPaginatable {
5454
public var first: Int?
5555
public var after: Cursor?
5656
public init(first: Int? = nil, after: Cursor? = nil) {
@@ -60,7 +60,7 @@ public struct GraphForwardPagination: GraphForwardPaginatable {
6060
}
6161

6262
/// A concrete backward pagination input.
63-
public struct GraphBackwardPagination: GraphBackwardPaginatable {
63+
public struct GraphBackwardPagination: Equatable, Sendable, GraphBackwardPaginatable {
6464
public var last: Int?
6565
public var before: Cursor?
6666
public init(last: Int? = nil, before: Cursor? = nil) {
@@ -70,7 +70,7 @@ public struct GraphBackwardPagination: GraphBackwardPaginatable {
7070
}
7171

7272
/// Describes the state of pagination for output.
73-
public struct GraphPageInfo: Equatable, Codable {
73+
public struct GraphPageInfo: Equatable, Codable, Sendable {
7474
public let hasPreviousPage: Bool
7575
public let hasNextPage: Bool
7676
public let startCursor: Cursor?

0 commit comments

Comments
 (0)