Skip to content

Latest commit

 

History

History
46 lines (35 loc) · 1.17 KB

README.md

File metadata and controls

46 lines (35 loc) · 1.17 KB

RSConfettiView

A Swift UIView with animated confetti to present success states

Installation

  • Swift Package Manager (SPM) - https://github.com/rursache/RSConfettiView
  • Copy RSConfettiView.swift (from Sources/) in your project

How to use

  1. One time use
import RSConfettiView

func showConfetti() {
  RSConfettiView.showConfetti(inView: UIView, type: .confetti, intensity: Float, duration: Double, confettiBlocksUI: Bool) {
    // completition handler
  }
}
  1. Storyboard view / Programatic mode
import RSConfettiView

@IBOutlet private weak var confettiView: RSConfettiView!

func showConfetti() {
  self.confettiView.type = .confetti
  self.confettiView.intensity = 10 // optional customization
  self.confettiView.startConfetti()
}

func hideConfetti() {
  self.confettiView.stopConfetti()
}

func confettiIsActive() -> Bool {
  return self.confettiView.isActive()
}

Customization

You can provide a custom image for the confetti particles using type: .image(UIImage) at init

License

RSConfettiView is available under the MPL-2.0 license. See the LICENSE file for more info.