Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Polish #3

Merged
merged 9 commits into from
Aug 5, 2023
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
30 changes: 12 additions & 18 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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
13 changes: 13 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
.PHONY: build test lint format

build:
swift build

test:
swift test

lint:
swiftlint

format:
swiftlint --fix
7 changes: 5 additions & 2 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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)
],
Expand All @@ -32,6 +32,9 @@ let package = Package(
dependencies: [
"SmoothGradient",
.product(name: "SnapshotTesting", package: "swift-snapshot-testing")
],
exclude: [
"__Snapshots__"
]
)
]
Expand Down
6 changes: 5 additions & 1 deletion Sources/SmoothGradient/CubicBezierCurve.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
16 changes: 8 additions & 8 deletions Sources/SmoothGradient/Gradient+Smooth.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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,
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.