diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 1327194..f3ad529 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -14,22 +14,14 @@ concurrency: group: build-${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true jobs: - build-macos: - name: Build macOS - runs-on: macos-13 - steps: - - uses: actions/checkout@v3 - - uses: maxim-lobanov/setup-xcode@v1 - with: - xcode-version: '14.3.1' - - name: Run tests - run: swift test -v - build-other-platforms: + build: runs-on: macos-13 name: Build ${{ matrix.destination.name }} strategy: matrix: destination: + - name: macOS + value: "platform=macOS,arch=x86_64" - name: iOS value: "platform=iOS Simulator,name=iPhone 14,OS=latest" @@ -50,10 +42,12 @@ jobs: -scheme SmoothGradient \ -destination '${{ matrix.destination.value }}' \ | xcpretty - # - name: Run tests - # run: |- - # set -o pipefail && NSUnbufferedIO=YES xcodebuild test \ - # -scheme SmoothGradient \ - # -destination '${{ matrix.destination.value }}' \ - # -sdk iphonesimulator \ - # | xcpretty + - name: Run tests + # only run tests for iOS + if: ${{ matrix.destination.name == 'iOS' }} + run: |- + set -o pipefail && NSUnbufferedIO=YES xcodebuild test \ + -scheme SmoothGradient \ + -destination '${{ matrix.destination.value }}' \ + -sdk iphonesimulator \ + | xcpretty diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..337f5c1 --- /dev/null +++ b/Makefile @@ -0,0 +1,13 @@ +.PHONY: build test lint format + +build: + swift build + +test: + swift test + +lint: + swiftlint + +format: + swiftlint --fix diff --git a/Package.swift b/Package.swift index 26b3b7f..7b2d7ed 100644 --- a/Package.swift +++ b/Package.swift @@ -5,9 +5,9 @@ import PackageDescription let package = Package( name: "SmoothGradient", platforms: [ - .iOS(.v15), + .iOS(.v14), .macOS(.v11), - .macCatalyst(.v13), + .macCatalyst(.v14), .tvOS(.v14), .watchOS(.v7) ], @@ -32,6 +32,9 @@ let package = Package( dependencies: [ "SmoothGradient", .product(name: "SnapshotTesting", package: "swift-snapshot-testing") + ], + exclude: [ + "__Snapshots__" ] ) ] diff --git a/Sources/SmoothGradient/CubicBezierCurve.swift b/Sources/SmoothGradient/CubicBezierCurve.swift index b543ee9..788d5e1 100644 --- a/Sources/SmoothGradient/CubicBezierCurve.swift +++ b/Sources/SmoothGradient/CubicBezierCurve.swift @@ -14,6 +14,10 @@ import SwiftUI /// /// A Cubic Bezier is defined by four points: p0, p1, ..., p3). For our purpose, /// p0 and p3 are always fixed at (0, 0) and (1, 1), respectively. +@available(iOS, introduced: 14.0, deprecated: 17.0, message: "use UnitCurve instead") +@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") public struct CubicBezierCurve: Curve { let p1: UnitPoint let p2: UnitPoint @@ -88,7 +92,7 @@ extension CubicBezierCurve { // MARK: - Preview -@available(iOS 13.0, macOS 12.0, tvOS 15.0, watchOS 8.0, *) +@available(iOS 15.0, macOS 12.0, tvOS 15.0, watchOS 8.0, *) struct CubicBezierCurve_Previews: PreviewProvider { static var previews: some View { Canvas(opaque: true) { context, size in diff --git a/Sources/SmoothGradient/Gradient+Smooth.swift b/Sources/SmoothGradient/Gradient+Smooth.swift index f1b8a65..4e44746 100644 --- a/Sources/SmoothGradient/Gradient+Smooth.swift +++ b/Sources/SmoothGradient/Gradient+Smooth.swift @@ -73,10 +73,10 @@ extension Gradient { // - curve: The easing function to use. // - steps: The number of steps to use when generating the gradient. Defaults to 16. // - Returns: A gradient. - @available(iOS, introduced: 13.0, deprecated: 17.0, renamed: "smooth(from:to:curve:steps:)") - @available(macOS, introduced: 10.15, deprecated: 14.0, renamed: "smooth(from:to:curve:steps:)") - @available(tvOS, introduced: 13.0, deprecated: 17.0, renamed: "smooth(from:to:curve:steps:)") - @available(watchOS, introduced: 6.0, deprecated: 10.0, renamed: "smooth(from:to:curve:steps:)") + @available(iOS, introduced: 14.0, deprecated: 17.0, renamed: "smooth(from:to:curve:steps:)") + @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:)") @_disfavoredOverload public static func smooth( from: Color, @@ -100,10 +100,10 @@ extension Gradient { // - curve: The easing function to use. // - steps: The number of steps to use when generating the gradient. Defaults to 16. // - Returns: A gradient. - @available(iOS, introduced: 13.0, deprecated: 17.0, renamed: "smooth(from:to:curve:steps:)") - @available(macOS, introduced: 10.15, deprecated: 14.0, renamed: "smooth(from:to:curve:steps:)") - @available(tvOS, introduced: 13.0, deprecated: 17.0, renamed: "smooth(from:to:curve:steps:)") - @available(watchOS, introduced: 6.0, deprecated: 10.0, renamed: "smooth(from:to:curve:steps:)") + @available(iOS, introduced: 14.0, deprecated: 17.0, renamed: "smooth(from:to:curve:steps:)") + @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:)") @_disfavoredOverload public static func smooth( from: Stop, diff --git a/Tests/SmoothGradientTests/__Snapshots__/GradientSmoothTests/test_easing_easeIn.1.png b/Tests/SmoothGradientTests/__Snapshots__/GradientSmoothTests/test_easing_easeIn.1.png index d1dd1a0..e12674b 100644 Binary files a/Tests/SmoothGradientTests/__Snapshots__/GradientSmoothTests/test_easing_easeIn.1.png and b/Tests/SmoothGradientTests/__Snapshots__/GradientSmoothTests/test_easing_easeIn.1.png differ diff --git a/Tests/SmoothGradientTests/__Snapshots__/GradientSmoothTests/test_easing_easeInOut.1.png b/Tests/SmoothGradientTests/__Snapshots__/GradientSmoothTests/test_easing_easeInOut.1.png index 37c23b6..5fffc2e 100644 Binary files a/Tests/SmoothGradientTests/__Snapshots__/GradientSmoothTests/test_easing_easeInOut.1.png and b/Tests/SmoothGradientTests/__Snapshots__/GradientSmoothTests/test_easing_easeInOut.1.png differ diff --git a/Tests/SmoothGradientTests/__Snapshots__/GradientSmoothTests/test_easing_easeOut.1.png b/Tests/SmoothGradientTests/__Snapshots__/GradientSmoothTests/test_easing_easeOut.1.png index 67ff402..11b55d9 100644 Binary files a/Tests/SmoothGradientTests/__Snapshots__/GradientSmoothTests/test_easing_easeOut.1.png and b/Tests/SmoothGradientTests/__Snapshots__/GradientSmoothTests/test_easing_easeOut.1.png differ diff --git a/Tests/SmoothGradientTests/__Snapshots__/GradientSmoothTests/test_easing_stops.1.png b/Tests/SmoothGradientTests/__Snapshots__/GradientSmoothTests/test_easing_stops.1.png index 3fb33c3..c3c01d8 100644 Binary files a/Tests/SmoothGradientTests/__Snapshots__/GradientSmoothTests/test_easing_stops.1.png and b/Tests/SmoothGradientTests/__Snapshots__/GradientSmoothTests/test_easing_stops.1.png differ