Skip to content

Commit 8351a44

Browse files
Polish (#3)
* Mark `CubicBezierCurve` as deprecated * Test lowering iOS version * Fix build * Update versions * Add Makefile * Exclude snapshots * Re-enable tests * Fix build * Update snapshots
1 parent a1fb836 commit 8351a44

File tree

9 files changed

+43
-29
lines changed

9 files changed

+43
-29
lines changed

.github/workflows/build.yml

Lines changed: 12 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -14,22 +14,14 @@ concurrency:
1414
group: build-${{ github.workflow }}-${{ github.ref }}
1515
cancel-in-progress: true
1616
jobs:
17-
build-macos:
18-
name: Build macOS
19-
runs-on: macos-13
20-
steps:
21-
- uses: actions/checkout@v3
22-
- uses: maxim-lobanov/setup-xcode@v1
23-
with:
24-
xcode-version: '14.3.1'
25-
- name: Run tests
26-
run: swift test -v
27-
build-other-platforms:
17+
build:
2818
runs-on: macos-13
2919
name: Build ${{ matrix.destination.name }}
3020
strategy:
3121
matrix:
3222
destination:
23+
- name: macOS
24+
value: "platform=macOS,arch=x86_64"
3325
-
3426
name: iOS
3527
value: "platform=iOS Simulator,name=iPhone 14,OS=latest"
@@ -50,10 +42,12 @@ jobs:
5042
-scheme SmoothGradient \
5143
-destination '${{ matrix.destination.value }}' \
5244
| xcpretty
53-
# - name: Run tests
54-
# run: |-
55-
# set -o pipefail && NSUnbufferedIO=YES xcodebuild test \
56-
# -scheme SmoothGradient \
57-
# -destination '${{ matrix.destination.value }}' \
58-
# -sdk iphonesimulator \
59-
# | xcpretty
45+
- name: Run tests
46+
# only run tests for iOS
47+
if: ${{ matrix.destination.name == 'iOS' }}
48+
run: |-
49+
set -o pipefail && NSUnbufferedIO=YES xcodebuild test \
50+
-scheme SmoothGradient \
51+
-destination '${{ matrix.destination.value }}' \
52+
-sdk iphonesimulator \
53+
| xcpretty

Makefile

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
.PHONY: build test lint format
2+
3+
build:
4+
swift build
5+
6+
test:
7+
swift test
8+
9+
lint:
10+
swiftlint
11+
12+
format:
13+
swiftlint --fix

Package.swift

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@ import PackageDescription
55
let package = Package(
66
name: "SmoothGradient",
77
platforms: [
8-
.iOS(.v15),
8+
.iOS(.v14),
99
.macOS(.v11),
10-
.macCatalyst(.v13),
10+
.macCatalyst(.v14),
1111
.tvOS(.v14),
1212
.watchOS(.v7)
1313
],
@@ -32,6 +32,9 @@ let package = Package(
3232
dependencies: [
3333
"SmoothGradient",
3434
.product(name: "SnapshotTesting", package: "swift-snapshot-testing")
35+
],
36+
exclude: [
37+
"__Snapshots__"
3538
]
3639
)
3740
]

Sources/SmoothGradient/CubicBezierCurve.swift

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,10 @@ import SwiftUI
1414
///
1515
/// A Cubic Bezier is defined by four points: p0, p1, ..., p3). For our purpose,
1616
/// p0 and p3 are always fixed at (0, 0) and (1, 1), respectively.
17+
@available(iOS, introduced: 14.0, deprecated: 17.0, message: "use UnitCurve instead")
18+
@available(macOS, introduced: 11.0, deprecated: 14.0, message: "use UnitCurve instead")
19+
@available(tvOS, introduced: 14.0, deprecated: 17.0, message: "use UnitCurve instead")
20+
@available(watchOS, introduced: 7.0, deprecated: 10.0, message: "use UnitCurve instead")
1721
public struct CubicBezierCurve: Curve {
1822
let p1: UnitPoint
1923
let p2: UnitPoint
@@ -88,7 +92,7 @@ extension CubicBezierCurve {
8892

8993
// MARK: - Preview
9094

91-
@available(iOS 13.0, macOS 12.0, tvOS 15.0, watchOS 8.0, *)
95+
@available(iOS 15.0, macOS 12.0, tvOS 15.0, watchOS 8.0, *)
9296
struct CubicBezierCurve_Previews: PreviewProvider {
9397
static var previews: some View {
9498
Canvas(opaque: true) { context, size in

Sources/SmoothGradient/Gradient+Smooth.swift

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -73,10 +73,10 @@ extension Gradient {
7373
// - curve: The easing function to use.
7474
// - steps: The number of steps to use when generating the gradient. Defaults to 16.
7575
// - Returns: A gradient.
76-
@available(iOS, introduced: 13.0, deprecated: 17.0, renamed: "smooth(from:to:curve:steps:)")
77-
@available(macOS, introduced: 10.15, deprecated: 14.0, renamed: "smooth(from:to:curve:steps:)")
78-
@available(tvOS, introduced: 13.0, deprecated: 17.0, renamed: "smooth(from:to:curve:steps:)")
79-
@available(watchOS, introduced: 6.0, deprecated: 10.0, renamed: "smooth(from:to:curve:steps:)")
76+
@available(iOS, introduced: 14.0, deprecated: 17.0, renamed: "smooth(from:to:curve:steps:)")
77+
@available(macOS, introduced: 11.0, deprecated: 14.0, renamed: "smooth(from:to:curve:steps:)")
78+
@available(tvOS, introduced: 14.0, deprecated: 17.0, renamed: "smooth(from:to:curve:steps:)")
79+
@available(watchOS, introduced: 7.0, deprecated: 10.0, renamed: "smooth(from:to:curve:steps:)")
8080
@_disfavoredOverload
8181
public static func smooth(
8282
from: Color,
@@ -100,10 +100,10 @@ extension Gradient {
100100
// - curve: The easing function to use.
101101
// - steps: The number of steps to use when generating the gradient. Defaults to 16.
102102
// - Returns: A gradient.
103-
@available(iOS, introduced: 13.0, deprecated: 17.0, renamed: "smooth(from:to:curve:steps:)")
104-
@available(macOS, introduced: 10.15, deprecated: 14.0, renamed: "smooth(from:to:curve:steps:)")
105-
@available(tvOS, introduced: 13.0, deprecated: 17.0, renamed: "smooth(from:to:curve:steps:)")
106-
@available(watchOS, introduced: 6.0, deprecated: 10.0, renamed: "smooth(from:to:curve:steps:)")
103+
@available(iOS, introduced: 14.0, deprecated: 17.0, renamed: "smooth(from:to:curve:steps:)")
104+
@available(macOS, introduced: 11.0, deprecated: 14.0, renamed: "smooth(from:to:curve:steps:)")
105+
@available(tvOS, introduced: 14.0, deprecated: 17.0, renamed: "smooth(from:to:curve:steps:)")
106+
@available(watchOS, introduced: 7.0, deprecated: 10.0, renamed: "smooth(from:to:curve:steps:)")
107107
@_disfavoredOverload
108108
public static func smooth(
109109
from: Stop,
236 Bytes
Loading
-361 Bytes
Loading
-481 Bytes
Loading
-11.9 KB
Loading

0 commit comments

Comments
 (0)