Skip to content

Commit

Permalink
😊 Single-color confetti option
Browse files Browse the repository at this point in the history
  • Loading branch information
benlmyers committed Jul 21, 2021
1 parent 504e492 commit f99dc2a
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion Sources/ConfettiView/ConfettiView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -69,14 +69,25 @@ fileprivate struct SingleConfettiView: View {

public struct ConfettiView: View {

/// The color of the confetti. Leave blank to imply random colors.
fileprivate var color: Color? = nil

public init() {}

public init(_ color: Color) {
self.color = color
}

public var body: some View {

ZStack {

ForEach(0...20, id: \.self) { _ in
SingleConfettiView()
if let color = self.color {
SingleConfettiView(color: color)
} else {
SingleConfettiView()
}
}
}
}
Expand Down

0 comments on commit f99dc2a

Please # to comment.