Skip to content

Commit e1bc164

Browse files
committed
2.0.1
1 parent ee6a841 commit e1bc164

File tree

15 files changed

+313
-82
lines changed

15 files changed

+313
-82
lines changed

.github/workflows/swift.yml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# This workflow will build a Swift project
2+
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-swift
3+
4+
name: Build
5+
6+
on:
7+
push:
8+
branches: [ "main" ]
9+
pull_request:
10+
branches: [ "main" ]
11+
12+
jobs:
13+
build:
14+
runs-on: macos-latest
15+
steps:
16+
- uses: actions/checkout@v4
17+
- name: Set up Xcode version
18+
run: sudo xcode-select -s /Applications/Xcode_16.2.app/Contents/Developer
19+
- name: Show available destinations
20+
run: xcodebuild -scheme Ignition -showdestinations
21+
- name: Build for macOS
22+
run: xcodebuild -scheme Ignition -destination 'platform=macOS' build
23+
- name: Build for Catalyst
24+
run: xcodebuild -scheme Ignition -destination 'platform=macOS,variant=Mac Catalyst' build
25+
- name: Build for iOS
26+
run: xcodebuild -scheme Ignition -destination 'platform=iOS Simulator,name=iPhone 16' build
27+
- name: Build for watchOS
28+
run: xcodebuild -scheme Ignition -destination 'platform=watchOS Simulator,name=Apple Watch Ultra 2 (49mm)' build
29+
- name: Build for tvOS
30+
run: xcodebuild -scheme Ignition -destination 'platform=tvOS Simulator,name=Apple TV 4K (3rd generation)' build
31+
- name: Build for visionOS
32+
run: xcodebuild -scheme Ignition -destination 'platform=visionOS Simulator,name=Apple Vision Pro' build

.spi.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
version: 1
2+
builder:
3+
configs:
4+
- documentation_targets: [Ignition]
5+
platform: macos
6+
- documentation_targets: [Ignition]
7+
platform: ios
8+
- documentation_targets: [Ignition]
9+
platform: tvos
10+
- documentation_targets: [Ignition]
11+
platform: watchos
12+
- documentation_targets: [Ignition]
13+
platform: visionos

.swiftpm/xcode/package.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist

Lines changed: 0 additions & 8 deletions
This file was deleted.

.swiftpm/xcode/xcshareddata/xcschemes/Ignition.xcscheme

Lines changed: 0 additions & 66 deletions
This file was deleted.

Example/Example.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Example/Example/ContentView.swift

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,28 @@ struct ContentView: View {
7171
)
7272
.foregroundColor(.green)
7373

74+
makeEffectPair(
75+
name: "Blur",
76+
shape: Rectangle(),
77+
effect: .blur(radius: 10),
78+
animation: .asymmetric(
79+
insertion: .linear(duration: 0.25),
80+
removal: .linear(duration: 0.25)
81+
)
82+
)
83+
.foregroundColor(.purple)
84+
85+
makeEffectPair(
86+
name: "Opacity",
87+
shape: Circle(),
88+
effect: .opacity,
89+
animation: .asymmetric(
90+
insertion: .linear(duration: 0.25),
91+
removal: .linear(duration: 0.25)
92+
)
93+
)
94+
.foregroundColor(.pink)
95+
7496
makeEffectPair(
7597
name: "Overlay",
7698
shape: Circle(),
@@ -103,7 +125,7 @@ struct ContentView: View {
103125
)
104126
.foregroundColor(.orange)
105127
}
106-
.padding(24)
128+
.padding(.vertical, 24)
107129
}
108130
}
109131

Package.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ let package = Package(
1919
),
2020
],
2121
dependencies: [
22-
.package(url: "https://github.com/nathantannar4/Engine", from: "2.0.4"),
22+
.package(url: "https://github.com/nathantannar4/Engine", from: "2.1.14"),
2323
],
2424
targets: [
2525
.target(

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,10 @@ let package = Package(
5050
)
5151
```
5252

53+
## Documentation
54+
55+
Detailed documentation is available [here](https://swiftpackageindex.com/nathantannar4/Ignition/main/documentation/ignition).
56+
5357
## Effects
5458

5559
`Ignition` provides 5 built in effects, but you can also make your own by conforming to the `ViewEffect` protocol.

Sources/Ignition/BackgroundEffect.swift

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,23 @@ struct BackgroundEffect_Previews: PreviewProvider {
9494
},
9595
interval: 1
9696
)
97+
98+
Text("Hello, World")
99+
.scheduledEffect(
100+
.background {
101+
Rectangle()
102+
.stroke(Color.blue, lineWidth: 2)
103+
.padding(-2)
104+
.transition(
105+
.asymmetric(
106+
insertion: .scale(scale: 0.5),
107+
removal: .scale(scale: 2)
108+
)
109+
.combined(with: .opacity)
110+
)
111+
},
112+
interval: 0.05
113+
)
97114
}
98115
}
99116
}

Sources/Ignition/BlurEffect.swift

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
//
2+
// Copyright (c) Nathan Tannar
3+
//
4+
5+
import SwiftUI
6+
7+
@available(iOS 14.0, macOS 11.0, tvOS 14.0, watchOS 7.0, *)
8+
extension ViewEffect where Self == BlurEffect {
9+
10+
/// A ``ViewEffect`` that applies a blur to the view
11+
public static func blur(
12+
radius: Double,
13+
opaque: Bool = false
14+
) -> BlurEffect {
15+
BlurEffect(radius: radius, opaque: opaque)
16+
}
17+
}
18+
19+
/// A ``ViewEffect`` that applies a blur to the view
20+
@available(iOS 14.0, macOS 11.0, tvOS 14.0, watchOS 7.0, *)
21+
@frozen
22+
public struct BlurEffect: ViewEffect {
23+
24+
public var radius: Double
25+
public var opaque: Bool = false
26+
27+
@inlinable
28+
public init(radius: Double, opaque: Bool = false) {
29+
self.radius = radius
30+
self.opaque = opaque
31+
}
32+
33+
public func makeBody(configuration: Configuration) -> some View {
34+
configuration.content
35+
.blur(radius: configuration.isActive ? radius : 0, opaque: opaque)
36+
}
37+
}
38+
39+
// MARK: - Previews
40+
41+
@available(iOS 14.0, macOS 11.0, tvOS 14.0, watchOS 7.0, *)
42+
struct BlurEffect_Previews: PreviewProvider {
43+
static var previews: some View {
44+
VStack(spacing: 24) {
45+
Text("Hello, World")
46+
.scheduledEffect(
47+
.blur(radius: 5),
48+
interval: 1
49+
)
50+
51+
Text("Hello, World")
52+
.scheduledEffect(
53+
.blur(radius: 20),
54+
interval: 1
55+
)
56+
}
57+
}
58+
}

0 commit comments

Comments
 (0)