Skip to content

Commit a5aabe3

Browse files
authored
Sendable (#18)
* Marking as Sendable and @unchecked Sendable, as appropriate * Update Package.swift, require Swift 5.7 * No more need for Package.resolved * Clean-up, require Swift 5.7
1 parent 297f447 commit a5aabe3

5 files changed

Lines changed: 32 additions & 82 deletions

File tree

.github/workflows/swift.yml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,18 +10,21 @@ jobs:
1010
macos:
1111
runs-on: macos-latest
1212
steps:
13-
- uses: actions/checkout@v2
13+
- uses: actions/checkout@v4
1414
- name: Build
1515
run: swift build
1616
- name: Test
1717
run: swift test
1818

1919
linux:
2020
runs-on: ubuntu-latest
21+
strategy:
22+
matrix:
23+
swift: ["5.10", "5.9", "5.8", "5.7"]
2124
container:
22-
image: swift:5.4
25+
image: swift:${{ matrix.swift }}
2326
steps:
24-
- uses: actions/checkout@v2
27+
- uses: actions/checkout@v4
2528
- name: Build
2629
run: swift build
2730
- name: Test

.gitlab-ci.yml

Lines changed: 0 additions & 21 deletions
This file was deleted.

Package.resolved

Lines changed: 0 additions & 16 deletions
This file was deleted.

Package.swift

Lines changed: 14 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,19 @@
1-
// swift-tools-version:5.2
2-
// The swift-tools-version declares the minimum version of Swift required to build this package.
1+
// swift-tools-version:5.7
32

43
import PackageDescription
54

65
let package = Package(
7-
name: "GeoJSONKit",
8-
products: [
9-
// Products define the executables and libraries produced by a package, and make them visible to other packages.
10-
.library(
11-
name: "GeoJSONKit",
12-
targets: ["GeoJSONKit"]),
13-
],
14-
dependencies: [
15-
// Dependencies declare other packages that this package depends on.
16-
// .package(url: /* package url */, from: "1.0.0"),
17-
],
18-
targets: [
19-
// Targets are the basic building blocks of a package. A target can define a module or a test suite.
20-
// Targets can depend on other targets in this package, and on products in packages which this package depends on.
21-
.target(
22-
name: "GeoJSONKit",
23-
dependencies: []),
24-
.testTarget(
25-
name: "GeoJSONKitTests",
26-
dependencies: ["GeoJSONKit"]),
27-
]
6+
name: "GeoJSONKit",
7+
products: [
8+
.library(
9+
name: "GeoJSONKit",
10+
targets: ["GeoJSONKit"]),
11+
],
12+
targets: [
13+
.target(
14+
name: "GeoJSONKit"),
15+
.testTarget(
16+
name: "GeoJSONKitTests",
17+
dependencies: ["GeoJSONKit"]),
18+
]
2819
)
29-
30-
#if swift(>=5.6)
31-
// Add the documentation compiler plugin if possible
32-
package.dependencies.append(
33-
.package(url: "https://github.com/apple/swift-docc-plugin", from: "1.0.0")
34-
)
35-
#endif

Sources/GeoJSONKit/GeoJSON.swift

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99
import Foundation
1010

1111
/// Representation of a [GeoJSON](https://geojson.org) document
12-
public struct GeoJSON: Hashable {
13-
12+
public struct GeoJSON: Hashable, @unchecked Sendable {
13+
1414
/// A latitude or longitude in degrees. Should use `WGS84`.
1515
public typealias Degrees = Double
1616

@@ -31,7 +31,7 @@ public struct GeoJSON: Hashable {
3131
/// A GeoJSON object may represent a region of space (a Geometry), a
3232
/// spatially bounded entity (a Feature), or a list of Features (a
3333
/// FeatureCollection).
34-
public enum GeoJSONObject: Hashable {
34+
public enum GeoJSONObject: Hashable, Sendable {
3535
/// A region of space
3636
case geometry(GeometryObject)
3737

@@ -45,7 +45,7 @@ public struct GeoJSON: Hashable {
4545
/// GeoJSON supports the following geometry types:
4646
/// Point, LineString, Polygon, MultiPoint, MultiLineString,
4747
/// MultiPolygon, and GeometryCollection.
48-
public enum GeometryObject: Hashable {
48+
public enum GeometryObject: Hashable, Sendable {
4949
/// A single region of space
5050
case single(Geometry)
5151

@@ -133,7 +133,7 @@ public struct GeoJSON: Hashable {
133133
}
134134

135135
/// The type of a GeoJSON, representing the value of the top-level "type" field in the JSON
136-
public enum GeoJSONType: String, Codable, CaseIterable {
136+
public enum GeoJSONType: String, Codable, CaseIterable, Sendable {
137137
case feature = "Feature"
138138
case featureCollection = "FeatureCollection"
139139
case point = "Point"
@@ -146,7 +146,7 @@ public struct GeoJSON: Hashable {
146146
}
147147

148148
/// A GeoJSON Position, with latitude, longitude and optional altitude
149-
public struct Position: Hashable {
149+
public struct Position: Hashable, Sendable {
150150
public var latitude: Degrees
151151
public var longitude: Degrees
152152
public var altitude: Distance?
@@ -183,7 +183,7 @@ public struct GeoJSON: Hashable {
183183
}
184184
}
185185

186-
public struct LineString: Hashable {
186+
public struct LineString: Hashable, Sendable {
187187
public var positions: [Position]
188188

189189
// We precompute this as it's static, but slow to re-compute
@@ -202,8 +202,8 @@ public struct GeoJSON: Hashable {
202202
}
203203
}
204204

205-
public struct Polygon: Hashable {
206-
public struct LinearRing: Hashable {
205+
public struct Polygon: Hashable, Sendable {
206+
public struct LinearRing: Hashable, Sendable {
207207
public var positions: [Position]
208208

209209
// We precompute this as it's static, but slow to re-compute
@@ -273,7 +273,7 @@ public struct GeoJSON: Hashable {
273273
}
274274
}
275275

276-
public enum Geometry: Hashable {
276+
public enum Geometry: Hashable, Sendable {
277277
// identified by coordinates + geometries
278278

279279
case point(Position)
@@ -317,7 +317,7 @@ public struct GeoJSON: Hashable {
317317
}
318318

319319
/// Features in GeoJSON contain a Geometry object and additional properties.
320-
public struct Feature: Hashable {
320+
public struct Feature: Hashable, @unchecked Sendable {
321321
public var geometry: GeometryObject
322322

323323
/// Optional properties, as a dictionary.
@@ -355,7 +355,7 @@ public struct GeoJSON: Hashable {
355355
}
356356
}
357357

358-
public struct BoundingBox: Hashable {
358+
public struct BoundingBox: Hashable, Sendable {
359359
public let southWesterlyLatitude: Degrees
360360
public let southWesterlyLongitude: Degrees
361361
public let northEasterlyLatitude: Degrees

0 commit comments

Comments
 (0)