Skip to content

Commit

Permalink
Updates for Xcode 16
Browse files Browse the repository at this point in the history
  • Loading branch information
mmllr committed Aug 7, 2024
1 parent d7efedd commit e8d73b9
Show file tree
Hide file tree
Showing 9 changed files with 190 additions and 173 deletions.
114 changes: 56 additions & 58 deletions Package.resolved
Original file line number Diff line number Diff line change
@@ -1,61 +1,59 @@
{
"object": {
"pins": [
{
"package": "swift-algorithms",
"repositoryURL": "https://github.com/apple/swift-algorithms",
"state": {
"branch": null,
"revision": "f6919dfc309e7f1b56224378b11e28bab5bccc42",
"version": "1.2.0"
}
},
{
"package": "swift-custom-dump",
"repositoryURL": "https://github.com/pointfreeco/swift-custom-dump",
"state": {
"branch": null,
"revision": "6ea3b1b6a4957806d72030a32360d4bcb155a0d2",
"version": "1.2.0"
}
},
{
"package": "SwiftDocCPlugin",
"repositoryURL": "https://github.com/apple/swift-docc-plugin",
"state": {
"branch": null,
"revision": "26ac5758409154cc448d7ab82389c520fa8a8247",
"version": "1.3.0"
}
},
{
"package": "SymbolKit",
"repositoryURL": "https://github.com/apple/swift-docc-symbolkit",
"state": {
"branch": null,
"revision": "b45d1f2ed151d057b54504d653e0da5552844e34",
"version": "1.0.0"
}
},
{
"package": "swift-numerics",
"repositoryURL": "https://github.com/apple/swift-numerics.git",
"state": {
"branch": null,
"revision": "0a5bc04095a675662cf24757cc0640aa2204253b",
"version": "1.0.2"
}
},
{
"package": "xctest-dynamic-overlay",
"repositoryURL": "https://github.com/pointfreeco/xctest-dynamic-overlay",
"state": {
"branch": null,
"revision": "b58e6627149808b40634c4552fcf2f44d0b3ca87",
"version": "1.1.0"
}
"pins" : [
{
"identity" : "swift-algorithms",
"kind" : "remoteSourceControl",
"location" : "https://github.com/apple/swift-algorithms",
"state" : {
"revision" : "f6919dfc309e7f1b56224378b11e28bab5bccc42",
"version" : "1.2.0"
}
]
},
"version": 1
},
{
"identity" : "swift-custom-dump",
"kind" : "remoteSourceControl",
"location" : "https://github.com/pointfreeco/swift-custom-dump",
"state" : {
"revision" : "82645ec760917961cfa08c9c0c7104a57a0fa4b1",
"version" : "1.3.3"
}
},
{
"identity" : "swift-docc-plugin",
"kind" : "remoteSourceControl",
"location" : "https://github.com/apple/swift-docc-plugin",
"state" : {
"revision" : "26ac5758409154cc448d7ab82389c520fa8a8247",
"version" : "1.3.0"
}
},
{
"identity" : "swift-docc-symbolkit",
"kind" : "remoteSourceControl",
"location" : "https://github.com/apple/swift-docc-symbolkit",
"state" : {
"revision" : "b45d1f2ed151d057b54504d653e0da5552844e34",
"version" : "1.0.0"
}
},
{
"identity" : "swift-numerics",
"kind" : "remoteSourceControl",
"location" : "https://github.com/apple/swift-numerics.git",
"state" : {
"revision" : "0a5bc04095a675662cf24757cc0640aa2204253b",
"version" : "1.0.2"
}
},
{
"identity" : "xctest-dynamic-overlay",
"kind" : "remoteSourceControl",
"location" : "https://github.com/pointfreeco/xctest-dynamic-overlay",
"state" : {
"revision" : "357ca1e5dd31f613a1d43320870ebc219386a495",
"version" : "1.2.2"
}
}
],
"version" : 2
}
16 changes: 12 additions & 4 deletions Package.swift
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
// swift-tools-version:5.2
// swift-tools-version:5.9

import PackageDescription

let settings: [SwiftSetting] = [
.enableExperimentalFeature("StrictConcurrency")
]

let package = Package(
name: "GPXKit",
platforms: [
Expand All @@ -16,21 +20,25 @@ let package = Package(
targets: ["GPXKit"]),
],
dependencies: [
.package(url: "https://github.com/pointfreeco/swift-custom-dump", from: "1.2.0"),
.package(url: "https://github.com/pointfreeco/swift-custom-dump", from: "1.3.3"),
.package(url: "https://github.com/apple/swift-algorithms", from: "1.2.0")
],
targets: [
.target(
name: "GPXKit",
dependencies: [
.product(name: "Algorithms", package: "swift-algorithms"),
]),
],
swiftSettings: settings
),
.testTarget(
name: "GPXKitTests",
dependencies: [
"GPXKit",
.product(name: "CustomDump", package: "swift-custom-dump")
]),
],
swiftSettings: settings
),
]
)

Expand Down
6 changes: 3 additions & 3 deletions Sources/GPXKit/ISO8601DateFormatter.swift
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import Foundation

extension ISO8601DateFormatter {
static var importing: ISO8601DateFormatter = {
nonisolated(unsafe) static var importing: ISO8601DateFormatter = {
let formatter = ISO8601DateFormatter()
formatter.formatOptions = .withInternetDateTime
return formatter
}()

static var importingFractionalSeconds: ISO8601DateFormatter = {
nonisolated(unsafe) static var importingFractionalSeconds: ISO8601DateFormatter = {
let formatter = ISO8601DateFormatter()
if #available(macOS 10.13, iOS 12, tvOS 11.0, *) {
formatter.formatOptions = [.withInternetDateTime, .withFractionalSeconds]
Expand All @@ -17,7 +17,7 @@ extension ISO8601DateFormatter {
return formatter
}()

static var exporting: ISO8601DateFormatter = {
nonisolated(unsafe) static var exporting: ISO8601DateFormatter = {
let formatter = ISO8601DateFormatter()
formatter.formatOptions = .withInternetDateTime
return formatter
Expand Down
18 changes: 9 additions & 9 deletions Tests/GPXKitTests/CollectionExtensionsTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,19 @@ final class ArrayExtensionsTests: XCTestCase {
func testRemovingNearbyCoordinatesInEmptyCollection() {
let coords: [Coordinate] = []

XCTAssertNoDifference([], coords.removeIf(closerThan: 1))
expectNoDifference([], coords.removeIf(closerThan: 1))
}

func testRemovingNearbyCoordinatesWithOneElement() {
let coords: [Coordinate] = [.leipzig]

XCTAssertNoDifference([.leipzig], coords.removeIf(closerThan: 1))
expectNoDifference([.leipzig], coords.removeIf(closerThan: 1))
}

func testRemovingNearbyCoordinatesWithTwoElement() {
let coords: [Coordinate] = [.leipzig, .dehner]

XCTAssertNoDifference([.leipzig, .dehner], coords.removeIf(closerThan: 1))
expectNoDifference([.leipzig, .dehner], coords.removeIf(closerThan: 1))
}

func testRemovingDuplicateCoordinates() {
Expand All @@ -34,7 +34,7 @@ final class ArrayExtensionsTests: XCTestCase {
]

let result = coords.removeIf(closerThan: 50)
XCTAssertNoDifference([coords[0], coords[1], coords[3], .postPlatz], result)
expectNoDifference([coords[0], coords[1], coords[3], .postPlatz], result)
}

func testSmoothingElevation() {
Expand Down Expand Up @@ -83,7 +83,7 @@ final class ArrayExtensionsTests: XCTestCase {
]

let actual = try XCTUnwrap(grades.flatten(maxDelta: 0.01))
XCTAssertNoDifference(expected, actual)
expectNoDifference(expected, actual)
}

func testFlatteningGradeSegmentsWithVeryLargeGradeDifferencesDoesNotResultInNotANumber() throws {
Expand All @@ -92,7 +92,7 @@ final class ArrayExtensionsTests: XCTestCase {
let graph = TrackGraph(coords: .init(track.trackPoints.map(\.coordinate).prefix(50)))
let actual = try XCTUnwrap(graph.gradeSegments.flatten(maxDelta: 0.01))

XCTAssertNoDifference(0, actual.filter { $0.grade.isNaN }.count)
expectNoDifference(0, actual.filter { $0.grade.isNaN }.count)
}

func testSmoothingElevationOnSmallCollections() {
Expand All @@ -103,12 +103,12 @@ final class ArrayExtensionsTests: XCTestCase {
elevation: Double.random(in: 500 ... 550)
)

XCTAssertNoDifference([], [Coordinate]().smoothedElevation(sampleCount: Int.random(in: 2...200)))
XCTAssertNoDifference([start], [start].smoothedElevation(sampleCount: Int.random(in: 5...200)))
expectNoDifference([], [Coordinate]().smoothedElevation(sampleCount: Int.random(in: 2...200)))
expectNoDifference([start], [start].smoothedElevation(sampleCount: Int.random(in: 5...200)))

let coords: [Coordinate] = [start, end]
let avg = coords.map(\.elevation).reduce(0, +) / Double(coords.count)

XCTAssertNoDifference([.init(latitude: start.latitude, longitude: start.longitude, elevation: avg), .init(latitude: end.latitude, longitude: end.longitude, elevation: avg)], coords.smoothedElevation(sampleCount: 50))
expectNoDifference([.init(latitude: start.latitude, longitude: start.longitude, elevation: avg), .init(latitude: end.latitude, longitude: end.longitude, elevation: avg)], coords.smoothedElevation(sampleCount: 50))
}
}
Loading

0 comments on commit e8d73b9

Please sign in to comment.