The Swift Package Manager is a tool for managing the distribution of Swift code. It’s integrated with the Swift build system to automate the process of downloading, compiling, and linking dependencies.
To integrate ConfettiSwiftUI into your Xcode project using Xcode 12, specify it in File > Swift Packages > Add Package Dependency...:
If you prefer not to use any of dependency managers, you can integrate ConfettiSwiftUI into your project manually. Put Sources/ConfettiSwiftUI folder in your Xcode project. Make sure to enable Copy items if needed and Create groups.
🧳 Requirements
iOS 14.0+ | macOS 11+
Swift 5+
🛠 Usage
First, add import ConfettiSwiftUI on every swift file you would like to use ConfettiSwiftUI. Define a integer as a state varable which is responsible for triggering the animation. Any change to that variable will span a new animation (increment and decrement).
import ConfettiSwiftUI
import SwiftUI
struct ContentView: View {
@State private var counter: Int = 0
var body: some View {
Button("🎉") {
counter += 1
}
.confettiCannon(counter: $counter)
}
}
Parameters
parameter
type
description
default
counter
Binding
on any change of this variable triggers the animation
ConfettiSwiftUI
Customizable Confetti Animations in SwiftUI
🌄 Example
🔭 Overview
This is an open-source library to use with SwiftUI. It allows you to create and customize confetti animations.
🔨Support
If you like the project, don’t forget to
put star 🌟
.🧭 Navigation
💻 Installation
Swift Package Manager
The Swift Package Manager is a tool for managing the distribution of Swift code. It’s integrated with the Swift build system to automate the process of downloading, compiling, and linking dependencies.
To integrate
ConfettiSwiftUI
into your Xcode project using Xcode 12, specify it inFile > Swift Packages > Add Package Dependency...
:Manually
If you prefer not to use any of dependency managers, you can integrate
ConfettiSwiftUI
into your project manually. PutSources/ConfettiSwiftUI
folder in your Xcode project. Make sure to enableCopy items if needed
andCreate groups
.🧳 Requirements
🛠 Usage
First, add
import ConfettiSwiftUI
on everyswift
file you would like to useConfettiSwiftUI
. Define a integer as a state varable which is responsible for triggering the animation. Any change to that variable will span a new animation (increment and decrement).Parameters
Configurator Application With Live Preview
You can use the configurator app in demo project here to make your desired animation or get inspired by one of the many examples.
Examples
Color and Size Configuration
Repeat Configuration
Firework Configuration
Emoji Configuration
Endless Configuration
Make-it-Rain Configuration
👨💻 Contributors
All issue reports, feature requests, pull requests and GitHub stars are welcomed and much appreciated.
✍️ Author
Simon Bachmann
📃 License
ConfettiSwiftUI
is available under the MIT license. See the LICENSE file for more info.📦 Projects
The following projects have integrated ConfettiSwiftUI in their App.