Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 10 additions & 13 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,40 +2,37 @@ 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
jobs:
build:
runs-on: macos-13
runs-on: macos-14
name: Build ${{ matrix.destination.name }}
strategy:
matrix:
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"
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 \
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -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
Expand Down
5 changes: 3 additions & 2 deletions Package.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// swift-tools-version:5.6
// swift-tools-version:5.9

import PackageDescription

Expand All @@ -9,7 +9,8 @@ let package = Package(
.macOS(.v11),
.macCatalyst(.v14),
.tvOS(.v14),
.watchOS(.v7)
.watchOS(.v7),
.visionOS(.v1)
],
products: [
.library(
Expand Down
11 changes: 6 additions & 5 deletions Sources/SmoothGradient/CubicBezierCurve.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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
Expand Down Expand Up @@ -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")

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
2 changes: 1 addition & 1 deletion Sources/SmoothGradient/Curve.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
4 changes: 3 additions & 1 deletion Sources/SmoothGradient/Gradient+Smooth.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down
4 changes: 2 additions & 2 deletions Sources/SmoothGradient/GradientInterpolator.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion Sources/SmoothGradient/SmoothLinearGradient.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion Tests/SmoothGradientTests/CubicBezierCurveTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion Tests/SmoothGradientTests/GradientSmoothTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion Tests/SmoothGradientTests/SmoothLinearGradientTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down