From c3e04db78bd6bd33bc38aa8812f845b7b15137c0 Mon Sep 17 00:00:00 2001 From: Richard Piazza Date: Tue, 24 Nov 2026 10:18:12 -0600 Subject: [PATCH 1/2] Swift 6.2 Toolchain --- .github/workflows/pull_request.yml | 83 +++++++++++++++++++++++++ .github/workflows/swift.yml | 32 ---------- .swiftformat | 6 +- Package.resolved | 16 ++--- Package.swift | 8 +-- Sources/GraphPoint/Arc.swift | 18 +++--- Sources/GraphPoint/CartesianFrame.swift | 32 +++++----- Sources/GraphPoint/CartesianPlane.swift | 20 +++--- Sources/GraphPoint/CartesianPoint.swift | 32 +++++----- 9 files changed, 147 insertions(+), 100 deletions(-) create mode 100644 .github/workflows/pull_request.yml delete mode 100644 .github/workflows/swift.yml diff --git a/.github/workflows/pull_request.yml b/.github/workflows/pull_request.yml new file mode 100644 index 0000000..b8d0f40 --- /dev/null +++ b/.github/workflows/pull_request.yml @@ -0,0 +1,83 @@ +name: Pull Request + +on: + pull_request: + branches: [ main ] + workflow_dispatch: + +env: + SCHEME: "GraphPoint" + +jobs: + Lint: + runs-on: macos-latest + steps: + - name: Checkout + uses: actions/checkout@v6 + - name: Lint + run: swiftformat --lint . --reporter github-actions-log + + Swift: + strategy: + fail-fast: false + matrix: + os: [ + macos-latest, + ubuntu-latest, + ] + runs-on: ${{ matrix.os }} + steps: + - name: Checkout + uses: actions/checkout@v6 + - name: Cache + uses: actions/cache@v5 + with: + path: | + .build + ~/Library/Developer/Xcode/DerivedData/ModuleCache.noindex + ~/Library/Caches/org.swift.swiftpm + ~/Library/org.swift.swiftpm + key: ${{ runner.os }}-spm-${{ hashFiles('**/Package.swift', '**/Package.resolved') }} + restore-keys: | + ${{ runner.os }}-spm- + - name: Package Resolution + run: swift package resolve + - name: Build + run: swift build + - name: Test + run: swift test + + Xcode: + strategy: + fail-fast: false + matrix: + platform: [ + "macOS", + "iOS", + "tvOS", + "watchOS", + "visionOS", + "macOS,variant=Mac Catalyst", + ] + runs-on: macos-latest + steps: + - name: Checkout + uses: actions/checkout@v6 + - name: Cache + uses: actions/cache@v5 + with: + path: | + .build + ~/Library/Developer/Xcode/DerivedData/ModuleCache.noindex + ~/Library/Caches/org.swift.swiftpm + ~/Library/org.swift.swiftpm + key: ${{ runner.os }}-spm-${{ hashFiles('**/Package.swift', '**/Package.resolved') }} + restore-keys: | + ${{ runner.os }}-spm- + - name: Package Resolution + run: set -o pipefail && xcodebuild -resolvePackageDependencies | xcbeautify + - name: Build + shell: bash + env: + DESTINATION: "generic/platform=${{ matrix.platform }}" + run: xcodebuild build -scheme "$SCHEME" -destination "$DESTINATION" | xcbeautify diff --git a/.github/workflows/swift.yml b/.github/workflows/swift.yml deleted file mode 100644 index cc76f64..0000000 --- a/.github/workflows/swift.yml +++ /dev/null @@ -1,32 +0,0 @@ -name: Swift - -on: - push: - branches: [ main ] - pull_request: - branches: [ main ] - workflow_dispatch: - -jobs: - SwiftActions: - strategy: - matrix: - os: [macos-latest, ubuntu-latest] - - runs-on: ${{ matrix.os }} - - steps: - - name: Checkout Source - uses: actions/checkout@v4 - - - name: Lint - if: ${{ runner.os == 'macOS' }} - shell: bash - run: swiftformat --lint . --reporter github-actions-log - - - name: Swift Build - uses: SwiftActions/SwiftBuild@main - - - name: Swift Test - uses: SwiftActions/SwiftTest@main - \ No newline at end of file diff --git a/.swiftformat b/.swiftformat index 66a20d4..3784879 100644 --- a/.swiftformat +++ b/.swiftformat @@ -1,6 +1,6 @@ # Compiler --languagemode 5 ---swiftversion 5.9 +--swiftversion 6.2 # Options --exclude derivedData @@ -10,6 +10,10 @@ # Rules --disable blankLinesAtStartOfScope --disable hoistPatternLet +--disable nestedIf --disable redundantType +--disable repeatedGuard +--disable swiftTestingTestCaseNames --disable unusedArguments --disable wrapArguments +--disable wrapPropertyBodies diff --git a/Package.resolved b/Package.resolved index 13225b0..4e4ee91 100644 --- a/Package.resolved +++ b/Package.resolved @@ -1,23 +1,15 @@ { + "originHash" : "b02417293efdb1ccdc339bc11eeaf03b8a73e4221428855ea1a01a47da514e2e", "pins" : [ { "identity" : "swift2d", "kind" : "remoteSourceControl", "location" : "https://github.com/richardpiazza/Swift2D", "state" : { - "revision" : "b18c58dbcc4aa8091df51be0512ee5b0d16559e5", - "version" : "2.2.0" - } - }, - { - "identity" : "swiftformat", - "kind" : "remoteSourceControl", - "location" : "https://github.com/nicklockwood/SwiftFormat", - "state" : { - "revision" : "d35227722eb590b34a3ccaf8b40759e8910bc870", - "version" : "0.56.1" + "branch" : "feature/swift-6.2", + "revision" : "be56759b2d4e24596ab79591e5208bc888b41db6" } } ], - "version" : 2 + "version" : 3 } diff --git a/Package.swift b/Package.swift index 6685c03..475f885 100644 --- a/Package.swift +++ b/Package.swift @@ -1,4 +1,4 @@ -// swift-tools-version:5.9 +// swift-tools-version:6.2 // The swift-tools-version declares the minimum version of Swift required to build this package. import PackageDescription @@ -11,6 +11,7 @@ let package = Package( .iOS(.v16), .tvOS(.v16), .watchOS(.v9), + .visionOS(.v1), // .v2 ~ iOS 18 ], products: [ .library( @@ -18,8 +19,7 @@ let package = Package( targets: ["GraphPoint"]), ], dependencies: [ - .package(url: "https://github.com/richardpiazza/Swift2D", .upToNextMajor(from: "2.2.0")), - .package(url: "https://github.com/nicklockwood/SwiftFormat", from: "0.55.0"), + .package(url: "https://github.com/richardpiazza/Swift2D", branch: "feature/swift-6.2"), ], targets: [ .target( @@ -29,5 +29,5 @@ let package = Package( name: "GraphPointTests", dependencies: ["GraphPoint"]), ], - swiftLanguageVersions: [.v5] + swiftLanguageModes: [.v5], ) diff --git a/Sources/GraphPoint/Arc.swift b/Sources/GraphPoint/Arc.swift index 9d97db9..b8048dd 100644 --- a/Sources/GraphPoint/Arc.swift +++ b/Sources/GraphPoint/Arc.swift @@ -9,7 +9,7 @@ public struct Arc: Hashable, Codable, Sendable { radius: Radius = 0.0, startingDegree: Degree = 0.0, endingDegree: Degree = 0.0, - clockwise: Bool = true + clockwise: Bool = true, ) { self.radius = radius self.startingDegree = startingDegree @@ -43,20 +43,20 @@ public extension Arc { if startingDegree < 90 { pivot = pivot - .with(x: endingPoint.x) - .with(y: startingPoint.y) + .x(endingPoint.x) + .y(startingPoint.y) } else if startingDegree < 180 { pivot = pivot - .with(x: startingPoint.x) - .with(y: endingPoint.y) + .x(startingPoint.x) + .y(endingPoint.y) } else if startingDegree < 270 { pivot = pivot - .with(x: endingPoint.x) - .with(y: startingPoint.y) + .x(endingPoint.x) + .y(startingPoint.y) } else { pivot = pivot - .with(x: startingPoint.x) - .with(y: endingPoint.y) + .x(startingPoint.x) + .y(endingPoint.y) } return pivot diff --git a/Sources/GraphPoint/CartesianFrame.swift b/Sources/GraphPoint/CartesianFrame.swift index 9c0ba35..82b2573 100644 --- a/Sources/GraphPoint/CartesianFrame.swift +++ b/Sources/GraphPoint/CartesianFrame.swift @@ -58,19 +58,19 @@ public extension CartesianFrame { for point in points { if point.x < minXMaxY.x || minXMaxY.x == 0 { - minXMaxY = minXMaxY.with(x: point.x) + minXMaxY = minXMaxY.x(point.x) } if point.y > minXMaxY.y || minXMaxY.y == 0 { - minXMaxY = minXMaxY.with(y: point.y) + minXMaxY = minXMaxY.y(point.y) } if point.x > maxXMinY.x || maxXMinY.x == 0 { - maxXMinY = maxXMinY.with(x: point.x) + maxXMinY = maxXMinY.x(point.x) } if point.y < maxXMinY.y || maxXMinY.y == 0 { - maxXMinY = maxXMinY.with(y: point.y) + maxXMinY = maxXMinY.y(point.y) } } @@ -78,8 +78,8 @@ public extension CartesianFrame { origin: minXMaxY, size: Size( width: abs(maxXMinY.x - minXMaxY.x), - height: abs(maxXMinY.y - minXMaxY.y) - ) + height: abs(maxXMinY.y - minXMaxY.y), + ), ) } @@ -132,33 +132,33 @@ public extension CartesianFrame { let maxAxis = frame.origin.x + frame.width if maxAxis < arc.radius { let width = frame.size.width + (arc.radius - maxAxis) - let size = frame.size.with(width: width) - frame = frame.with(size: size) + let size = frame.size.width(width) + frame = frame.size(size) } case (.II, .I), (.I, .II): let maxAxis = frame.origin.y if maxAxis < arc.radius { let y = frame.origin.y + (arc.radius - maxAxis) - let origin = frame.origin.with(y: y) + let origin = frame.origin.y(y) let height = frame.size.height + (arc.radius - maxAxis) - let size = frame.size.with(height: height) - frame = frame.with(origin: origin).with(size: size) + let size = frame.size.height(height) + frame = frame.origin(origin).size(size) } case (.III, .II), (.II, .III): let maxAxis = abs(frame.origin.x) if maxAxis < arc.radius { let x = frame.origin.x - (arc.radius - maxAxis) - let origin = frame.origin.with(x: x) + let origin = frame.origin.x(x) let width = frame.size.width + (arc.radius - maxAxis) - let size = frame.size.with(width: width) - frame = frame.with(origin: origin).with(size: size) + let size = frame.size.width(width) + frame = frame.origin(origin).size(size) } case (.IV, .III), (.III, .IV): let maxAxis = abs(frame.origin.y) + frame.size.height if maxAxis < arc.radius { let height = frame.size.height + (arc.radius - maxAxis) - let size = frame.size.with(height: height) - frame = frame.with(size: size) + let size = frame.size.height(height) + frame = frame.size(size) } default: throw GraphPointError.unhandledQuadrantTransition(startQuadrant, endQuadrant) diff --git a/Sources/GraphPoint/CartesianPlane.swift b/Sources/GraphPoint/CartesianPlane.swift index 3d40a6c..0abb5af 100644 --- a/Sources/GraphPoint/CartesianPlane.swift +++ b/Sources/GraphPoint/CartesianPlane.swift @@ -10,13 +10,13 @@ public typealias CartesianPlane = Rect public extension CartesianPlane { init(axis: Int) { self.init( - size: Size(width: axis * 2, height: axis * 2) + size: Size(width: axis * 2, height: axis * 2), ) } init(radius: Radius) { self.init( - size: Size(width: radius * 2, height: radius * 2) + size: Size(width: radius * 2, height: radius * 2), ) } } @@ -64,15 +64,15 @@ public extension CartesianPlane { var cartesianPoint: CartesianPoint = .zero if point.x < origin.x { - cartesianPoint = cartesianPoint.with(x: -(origin.x - point.x)) + cartesianPoint = cartesianPoint.x(-(origin.x - point.x)) } else if point.x > origin.x { - cartesianPoint = cartesianPoint.with(x: point.x - origin.x) + cartesianPoint = cartesianPoint.x(point.x - origin.x) } if point.y > origin.y { - cartesianPoint = cartesianPoint.with(y: -(point.y - origin.y)) + cartesianPoint = cartesianPoint.y(-(point.y - origin.y)) } else if point.y < origin.y { - cartesianPoint = cartesianPoint.with(y: origin.y - point.y) + cartesianPoint = cartesianPoint.y(origin.y - point.y) } return cartesianPoint @@ -83,15 +83,15 @@ public extension CartesianPlane { var point: Point = .zero if cartesianPoint.x >= 0.0 { - point = point.with(x: cartesianOrigin.x + cartesianPoint.x) + point = point.x(cartesianOrigin.x + cartesianPoint.x) } else { - point = point.with(x: cartesianOrigin.x - abs(cartesianPoint.x)) + point = point.x(cartesianOrigin.x - abs(cartesianPoint.x)) } if cartesianPoint.y <= 0.0 { - point = point.with(y: cartesianOrigin.y + abs(cartesianPoint.y)) + point = point.y(cartesianOrigin.y + abs(cartesianPoint.y)) } else { - point = point.with(y: cartesianOrigin.y - cartesianPoint.y) + point = point.y(cartesianOrigin.y - cartesianPoint.y) } return point diff --git a/Sources/GraphPoint/CartesianPoint.swift b/Sources/GraphPoint/CartesianPoint.swift index 62e991c..5b56a67 100644 --- a/Sources/GraphPoint/CartesianPoint.swift +++ b/Sources/GraphPoint/CartesianPoint.swift @@ -61,56 +61,56 @@ public extension CartesianPoint { run = 180.0 - rightAngle - rise point = CartesianPoint( x: (radius / sinRight) * sin(run.radians), - y: (radius / sinRight) * sin(rise.radians) + y: (radius / sinRight) * sin(rise.radians), ) } else if degree > 270 { run = degree - 270.0 rise = 180.0 - rightAngle - run point = CartesianPoint( x: (radius / sinRight) * sin(run.radians), - y: (radius / sinRight) * sin(rise.radians) + y: (radius / sinRight) * sin(rise.radians), ) } else if degree > 225 { run = 270.0 - degree rise = 180.0 - rightAngle - run point = CartesianPoint( x: -1.0 * (radius / sinRight) * sin(run.radians), - y: (radius / sinRight) * sin(rise.radians) + y: (radius / sinRight) * sin(rise.radians), ) } else if degree > 180 { rise = degree - 180.0 run = 180.0 - rightAngle - rise point = CartesianPoint( x: -1.0 * (radius / sinRight) * sin(run.radians), - y: (radius / sinRight) * sin(rise.radians) + y: (radius / sinRight) * sin(rise.radians), ) } else if degree > 135 { rise = 180.0 - degree run = 180.0 - rightAngle - rise point = CartesianPoint( x: -1.0 * (radius / sinRight) * sin(run.radians), - y: -1.0 * (radius / sinRight) * sin(rise.radians) + y: -1.0 * (radius / sinRight) * sin(rise.radians), ) } else if degree > 90 { run = degree - 90.0 rise = 180.0 - rightAngle - run point = CartesianPoint( x: -1.0 * (radius / sinRight) * sin(run.radians), - y: -1.0 * (radius / sinRight) * sin(rise.radians) + y: -1.0 * (radius / sinRight) * sin(rise.radians), ) } else if degree > 45 { run = 90.0 - degree rise = 180.0 - rightAngle - run point = CartesianPoint( x: (radius / sinRight) * sin(run.radians), - y: -1.0 * (radius / sinRight) * sin(rise.radians) + y: -1.0 * (radius / sinRight) * sin(rise.radians), ) } else if degree >= 0 { rise = degree run = 180.0 - rightAngle - rise point = CartesianPoint( x: (radius / sinRight) * sin(run.radians), - y: -1.0 * (radius / sinRight) * sin(rise.radians) + y: -1.0 * (radius / sinRight) * sin(rise.radians), ) } case false: @@ -151,42 +151,42 @@ public extension CartesianPoint { if degree >= 315 { point = CartesianPoint( x: sqrt(pow(radius, 2) - pow(modifier.y, 2)), - y: modifier.y + y: modifier.y, ) } else if degree >= 270 { point = CartesianPoint( x: modifier.x, - y: sqrt(pow(radius, 2) - pow(modifier.x, 2)) + y: sqrt(pow(radius, 2) - pow(modifier.x, 2)), ) } else if degree >= 225 { point = CartesianPoint( x: modifier.x, - y: sqrt(pow(radius, 2) - pow(modifier.x, 2)) + y: sqrt(pow(radius, 2) - pow(modifier.x, 2)), ) } else if degree >= 180 { point = CartesianPoint( x: -sqrt(pow(radius, 2) - pow(modifier.y, 2)), - y: modifier.y + y: modifier.y, ) } else if degree >= 135 { point = CartesianPoint( x: -sqrt(pow(radius, 2) - pow(modifier.y, 2)), - y: modifier.y + y: modifier.y, ) } else if degree >= 90 { point = CartesianPoint( x: modifier.x, - y: -sqrt(pow(radius, 2) - pow(modifier.x, 2)) + y: -sqrt(pow(radius, 2) - pow(modifier.x, 2)), ) } else if degree >= 45 { point = CartesianPoint( x: modifier.x, - y: -sqrt(pow(radius, 2) - pow(modifier.x, 2)) + y: -sqrt(pow(radius, 2) - pow(modifier.x, 2)), ) } else if degree >= 0 { point = CartesianPoint( x: sqrt(pow(radius, 2) - pow(modifier.y, 2)), - y: modifier.y + y: modifier.y, ) } case false: From 2141b724735c175a62a74e0c138b85c569410b0b Mon Sep 17 00:00:00 2001 From: Richard Piazza Date: Tue, 24 Nov 2026 13:10:17 -0600 Subject: [PATCH 2/2] Pinned 'Swift2D' to 2.3.0 --- .github/workflows/pull_request.yml | 3 ++- Package.resolved | 6 +++--- Package.swift | 2 +- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/.github/workflows/pull_request.yml b/.github/workflows/pull_request.yml index b8d0f40..8457345 100644 --- a/.github/workflows/pull_request.yml +++ b/.github/workflows/pull_request.yml @@ -75,7 +75,8 @@ jobs: restore-keys: | ${{ runner.os }}-spm- - name: Package Resolution - run: set -o pipefail && xcodebuild -resolvePackageDependencies | xcbeautify + shell: bash + run: xcodebuild -resolvePackageDependencies | xcbeautify - name: Build shell: bash env: diff --git a/Package.resolved b/Package.resolved index 4e4ee91..c167b1b 100644 --- a/Package.resolved +++ b/Package.resolved @@ -1,13 +1,13 @@ { - "originHash" : "b02417293efdb1ccdc339bc11eeaf03b8a73e4221428855ea1a01a47da514e2e", + "originHash" : "c6fcf9cff99427ad7b09eeaf2298278434070baae2cc6f65c3f5a9dfa1b06384", "pins" : [ { "identity" : "swift2d", "kind" : "remoteSourceControl", "location" : "https://github.com/richardpiazza/Swift2D", "state" : { - "branch" : "feature/swift-6.2", - "revision" : "be56759b2d4e24596ab79591e5208bc888b41db6" + "revision" : "79f6a0907c5032d291d79b14d53d844256d2c366", + "version" : "2.3.0" } } ], diff --git a/Package.swift b/Package.swift index 475f885..a7ba51c 100644 --- a/Package.swift +++ b/Package.swift @@ -19,7 +19,7 @@ let package = Package( targets: ["GraphPoint"]), ], dependencies: [ - .package(url: "https://github.com/richardpiazza/Swift2D", branch: "feature/swift-6.2"), + .package(url: "https://github.com/richardpiazza/Swift2D", from: "2.3.0"), ], targets: [ .target(