From e2ec84902c6bf8317ca50ffc06cd944b84a1b52f Mon Sep 17 00:00:00 2001 From: Ramon Torres Date: Fri, 30 Aug 2024 17:56:23 -0400 Subject: [PATCH 1/3] Bump Xcode version and test on visionOS --- .github/workflows/build.yml | 23 +++++++++---------- .github/workflows/lint.yml | 6 ++--- LICENSE | 2 +- Package.swift | 5 ++-- Sources/SmoothGradient/CubicBezierCurve.swift | 11 +++++---- Sources/SmoothGradient/Curve.swift | 2 +- Sources/SmoothGradient/Gradient+Smooth.swift | 4 +++- .../SmoothGradient/GradientInterpolator.swift | 4 ++-- .../SmoothGradient/SmoothLinearGradient.swift | 2 +- .../CubicBezierCurveTests.swift | 2 +- .../GradientSmoothTests.swift | 2 +- .../SmoothLinearGradientTests.swift | 2 +- 12 files changed, 34 insertions(+), 31 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index f3ad529..1ab6dea 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -2,14 +2,14 @@ name: Build on: push: branches: - - 'main' + - "main" paths: - - '.github/workflows/build.yml' - - '**.swift' + - ".github/workflows/build.yml" + - "**.swift" pull_request: paths: - - '.github/workflows/build.yml' - - '**.swift' + - ".github/workflows/build.yml" + - "**.swift" concurrency: group: build-${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true @@ -22,20 +22,19 @@ jobs: destination: - name: macOS value: "platform=macOS,arch=x86_64" - - - name: iOS + - name: iOS value: "platform=iOS Simulator,name=iPhone 14,OS=latest" - - - name: tvOS + - name: tvOS value: "platform=tvOS Simulator,name=Apple TV,OS=latest" - - - name: watchOS + - name: watchOS value: "platform=watchOS Simulator,name=Apple Watch Series 8 (41mm),OS=latest" + - name: visionOS + value: "generic/platform=visionOS" steps: - uses: actions/checkout@v3 - uses: maxim-lobanov/setup-xcode@v1 with: - xcode-version: '14.3.1' + xcode-version: "15.0" - name: Build run: |- set -o pipefail && NSUnbufferedIO=YES xcodebuild clean build \ diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 0066f2e..6f44010 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -2,9 +2,9 @@ name: Lint on: pull_request: paths: - - '.github/workflows/lint.yml' - - '.swiftlint.yml' - - '**/*.swift' + - ".github/workflows/lint.yml" + - ".swiftlint.yml" + - "**/*.swift" jobs: lint: runs-on: ubuntu-latest diff --git a/LICENSE b/LICENSE index ba5c1af..08825e3 100644 --- a/LICENSE +++ b/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2023 Ramon Torres +Copyright (c) 2023-2024 Ramon Torres Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/Package.swift b/Package.swift index 7b2d7ed..914e6f7 100644 --- a/Package.swift +++ b/Package.swift @@ -1,4 +1,4 @@ -// swift-tools-version:5.6 +// swift-tools-version:5.9 import PackageDescription @@ -9,7 +9,8 @@ let package = Package( .macOS(.v11), .macCatalyst(.v14), .tvOS(.v14), - .watchOS(.v7) + .watchOS(.v7), + .visionOS(.v1) ], products: [ .library( diff --git a/Sources/SmoothGradient/CubicBezierCurve.swift b/Sources/SmoothGradient/CubicBezierCurve.swift index 07f4df6..dea94c8 100644 --- a/Sources/SmoothGradient/CubicBezierCurve.swift +++ b/Sources/SmoothGradient/CubicBezierCurve.swift @@ -2,7 +2,7 @@ // CubicBezierCurve.swift // SmoothGradient // -// Copyright (c) 2023 Ramon Torres +// Copyright (c) 2023-2024 Ramon Torres // // This file is part of SmoothGradient which is released under the MIT license. // See the LICENSE file in the root directory of this source tree for full details. @@ -18,6 +18,7 @@ import SwiftUI @available(macOS, introduced: 11.0, deprecated: 14.0, message: "use UnitCurve instead") @available(tvOS, introduced: 14.0, deprecated: 17.0, message: "use UnitCurve instead") @available(watchOS, introduced: 7.0, deprecated: 10.0, message: "use UnitCurve instead") +@available(visionOS, deprecated: 1.0, message: "use UnitCurve instead") public struct CubicBezierCurve: Curve { let p1: UnitPoint let p2: UnitPoint @@ -63,9 +64,7 @@ public struct CubicBezierCurve: Curve { guard p1 != p2 else { return x } return sampleCurveY(getT(x: x)) } -} -extension CubicBezierCurve { private func getT(x: Double) -> Double { assert(x >= 0 && x <= 1, "x must be between 0 and 1") @@ -100,7 +99,8 @@ extension CubicBezierCurve { // MARK: - Preview -@available(iOS 15.0, macOS 12.0, tvOS 15.0, watchOS 8.0, *) +#if compiler(>=5.9) +@available(iOS 17.0, macOS 14.0, tvOS 17.0, watchOS 10.0, *) struct CubicBezierCurve_Previews: PreviewProvider { static var previews: some View { Canvas(opaque: true) { context, size in @@ -147,10 +147,11 @@ struct CubicBezierCurve_Previews: PreviewProvider { color: CGColor(red: 0, green: 1, blue: 0, alpha: 1), dashed: true ) { progress in - CubicBezierCurve.easeInOut.value(at: progress) + UnitCurve.easeInOut.value(at: progress) } } } .frame(width: 400, height: 400) } } +#endif diff --git a/Sources/SmoothGradient/Curve.swift b/Sources/SmoothGradient/Curve.swift index b1240ff..1f413bc 100644 --- a/Sources/SmoothGradient/Curve.swift +++ b/Sources/SmoothGradient/Curve.swift @@ -2,7 +2,7 @@ // Curve.swift // SmoothGradient // -// Copyright (c) 2023 Ramon Torres +// Copyright (c) 2023-2024 Ramon Torres // // This file is part of SmoothGradient which is released under the MIT license. // See the LICENSE file in the root directory of this source tree for full details. diff --git a/Sources/SmoothGradient/Gradient+Smooth.swift b/Sources/SmoothGradient/Gradient+Smooth.swift index ac4d9eb..06ed5d5 100644 --- a/Sources/SmoothGradient/Gradient+Smooth.swift +++ b/Sources/SmoothGradient/Gradient+Smooth.swift @@ -2,7 +2,7 @@ // Gradient+Smooth.swift // SmoothGradient // -// Copyright (c) 2023 Ramon Torres +// Copyright (c) 2023-2024 Ramon Torres // // This file is part of SmoothGradient which is released under the MIT license. // See the LICENSE file in the root directory of this source tree for full details. @@ -77,6 +77,7 @@ extension Gradient { @available(macOS, introduced: 11.0, deprecated: 14.0, renamed: "smooth(from:to:curve:steps:)") @available(tvOS, introduced: 14.0, deprecated: 17.0, renamed: "smooth(from:to:curve:steps:)") @available(watchOS, introduced: 7.0, deprecated: 10.0, renamed: "smooth(from:to:curve:steps:)") + @available(visionOS, deprecated: 1.0, renamed: "smooth(from:to:curve:steps:)") @_disfavoredOverload public static func smooth( from: Color, @@ -104,6 +105,7 @@ extension Gradient { @available(macOS, introduced: 11.0, deprecated: 14.0, renamed: "smooth(from:to:curve:steps:)") @available(tvOS, introduced: 14.0, deprecated: 17.0, renamed: "smooth(from:to:curve:steps:)") @available(watchOS, introduced: 7.0, deprecated: 10.0, renamed: "smooth(from:to:curve:steps:)") + @available(visionOS, deprecated: 1.0, renamed: "smooth(from:to:curve:steps:)") @_disfavoredOverload public static func smooth( from: Stop, diff --git a/Sources/SmoothGradient/GradientInterpolator.swift b/Sources/SmoothGradient/GradientInterpolator.swift index 217cee4..8ac9843 100644 --- a/Sources/SmoothGradient/GradientInterpolator.swift +++ b/Sources/SmoothGradient/GradientInterpolator.swift @@ -2,7 +2,7 @@ // GradientInterpolator.swift // SmoothGradient // -// Copyright (c) 2023 Ramon Torres +// Copyright (c) 2023-2024 Ramon Torres // // This file is part of SmoothGradient which is released under the MIT license. // See the LICENSE file in the root directory of this source tree for full details. @@ -71,7 +71,7 @@ extension GradientInterpolator { // the block and return the transformed color. return block() #else - // iOS, iPadOS, Mac Catalyst, and tvOS + // iOS, iPadOS, Mac Catalyst, tvOS, and visionOS. return PlatformColor { _ in block() } #endif #else diff --git a/Sources/SmoothGradient/SmoothLinearGradient.swift b/Sources/SmoothGradient/SmoothLinearGradient.swift index 22f4a49..bc1f6f8 100644 --- a/Sources/SmoothGradient/SmoothLinearGradient.swift +++ b/Sources/SmoothGradient/SmoothLinearGradient.swift @@ -2,7 +2,7 @@ // SmoothLinearGradient.swift // SmoothGradientTests // -// Copyright (c) 2023 Ramon Torres +// Copyright (c) 2023-2024 Ramon Torres // // This file is part of SmoothGradient which is released under the MIT license. // See the LICENSE file in the root directory of this source tree for full details. diff --git a/Tests/SmoothGradientTests/CubicBezierCurveTests.swift b/Tests/SmoothGradientTests/CubicBezierCurveTests.swift index 52f3a6d..c4b4a46 100644 --- a/Tests/SmoothGradientTests/CubicBezierCurveTests.swift +++ b/Tests/SmoothGradientTests/CubicBezierCurveTests.swift @@ -2,7 +2,7 @@ // CubicBezierCurveTests.swift // SmoothGradientTests // -// Copyright (c) 2023 Ramon Torres +// Copyright (c) 2023-2024 Ramon Torres // // This file is part of SmoothGradient which is released under the MIT license. // See the LICENSE file in the root directory of this source tree for full details. diff --git a/Tests/SmoothGradientTests/GradientSmoothTests.swift b/Tests/SmoothGradientTests/GradientSmoothTests.swift index d4a1cad..134a0b7 100644 --- a/Tests/SmoothGradientTests/GradientSmoothTests.swift +++ b/Tests/SmoothGradientTests/GradientSmoothTests.swift @@ -2,7 +2,7 @@ // GradientSmoothTests.swift // SmoothGradientTests // -// Copyright (c) 2023 Ramon Torres +// Copyright (c) 2023-2024 Ramon Torres // // This file is part of SmoothGradient which is released under the MIT license. // See the LICENSE file in the root directory of this source tree for full details. diff --git a/Tests/SmoothGradientTests/SmoothLinearGradientTests.swift b/Tests/SmoothGradientTests/SmoothLinearGradientTests.swift index 1fbca3a..89f7585 100644 --- a/Tests/SmoothGradientTests/SmoothLinearGradientTests.swift +++ b/Tests/SmoothGradientTests/SmoothLinearGradientTests.swift @@ -2,7 +2,7 @@ // SmoothLinearGradientTests.swift // SmoothGradientTests // -// Copyright (c) 2023 Ramon Torres +// Copyright (c) 2023-2024 Ramon Torres // // This file is part of SmoothGradient which is released under the MIT license. // See the LICENSE file in the root directory of this source tree for full details. From 10310c075422b89950b542808cb426907cd74dc1 Mon Sep 17 00:00:00 2001 From: Ramon Torres Date: Fri, 30 Aug 2024 18:01:30 -0400 Subject: [PATCH 2/3] Bump macOS version --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 1ab6dea..3e4925c 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -15,7 +15,7 @@ concurrency: cancel-in-progress: true jobs: build: - runs-on: macos-13 + runs-on: macos-14 name: Build ${{ matrix.destination.name }} strategy: matrix: From e16cdfdf5e17a42b56300dae2ef8bc675c42751c Mon Sep 17 00:00:00 2001 From: Ramon Torres Date: Sat, 31 Aug 2024 17:25:42 -0400 Subject: [PATCH 3/3] Remove visionOS test --- .github/workflows/build.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 3e4925c..d221e50 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -28,8 +28,6 @@ jobs: value: "platform=tvOS Simulator,name=Apple TV,OS=latest" - name: watchOS value: "platform=watchOS Simulator,name=Apple Watch Series 8 (41mm),OS=latest" - - name: visionOS - value: "generic/platform=visionOS" steps: - uses: actions/checkout@v3 - uses: maxim-lobanov/setup-xcode@v1