SwiftUIConfettiOverlay

1.0.1

Simple and Customizable SwiftUI Confetti Modifier Package That Lets You Add Confetti to Anything!
BertanT/SwiftUIConfettiOverlay

What's New

2024-07-07T13:17:46Z

Prepared documentation for adding repo to the Swift Package Index. No changes in source code.

SwiftUI ConfettiOverlay

👀 Overview

Simple and Customizable SwiftUI Confetti Modifier Package That Lets You Add Confetti to Anything!

Requires Mac Catalyst 15, iOS/iPadOS 15, tvOS 15, or newer. Built for SwiftUI.

Static Badge Static Badge

🚀 Usage

Add the .confettiOverlay modifier to any SwiftUI view you want to add confetti over, and that's it! The below example demonstrates how to add confetti to a View and toggle the emission with a Button. A boolean State property controls the emission.

import SwiftUIConfettiOverlay

struct ContentView: View {
    // Property controlling emission
    @State private var isEmitting = false
    
    var body: some View {
        VStack {
            Button("Party!") {
                // Toggle emission on button press
                isEmitting.toggle()
            }
        }
        // Add confetti over this VStack! 🎉
        .confettiOverlay(isEmitting: isEmitting)
    }
}

Customization

.confettiOverlay(amount: Float, colors: [UIColor], isEmitting: Bool)

You can also play with these optional parameters and make the confetti your own!

  • amount: Float value to control how much confetti you want!
    • Default: 10
  • colors: UIColor Array value that specifies the colors of your confetti pieces. Add as many as you wish!
    • Default: [.systemYellow, .systemMint, .systemIndigo, .systemPink]

Description

  • Swift Tools 5.6.0
View More Packages from this Author

Dependencies

  • None
Last updated: Mon May 12 2025 02:46:03 GMT-0900 (Hawaii-Aleutian Daylight Time)