Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Resetting Global color in config does not work as expected #14

Open
WestFlow127 opened this issue Jan 10, 2024 · 0 comments
Open

Resetting Global color in config does not work as expected #14

WestFlow127 opened this issue Jan 10, 2024 · 0 comments
Assignees
Labels
bug Something isn't working

Comments

@WestFlow127
Copy link

  • iOS Version: 17.2
  • Framework Version: 1.4.1
  • Installed via SPM

Context:
I show different confetti in various places of my app. I like to use the Globals for easy use.

Problem:
When I set the global SPConfettiConfiguration's color for the first time, it works:

SPConfettiConfiguration.particlesConfig.colors = [.red]

But when I reset it to some other color, the next confetti animation remains the color that was set in the first place.
Here's an example:

func rainHearts() {
   SPConfettiConfiguration.particlesConfig.colors = [.red]
   SPConfettiConfiguration.particlesConfig.contentsScale = 0.60
   SPConfetti.startAnimating(.fullWidthToDown, particles: [.custom(UIImage(systemName: "heart.fill")!)], duration: 3)
}
    
func rainConfetti() {
   SPConfettiConfiguration.particlesConfig.colors = [.yellow]
   SPConfettiConfiguration.particlesConfig.contentsScale = 0.5
   SPConfetti.startAnimating(.fullWidthToDown, particles: [.triangle, .arc, .heart, .star, .custom(UIImage(named: "Trophy")!)], duration: 3)
}

self.rainHearts() /// this rains `red` hearts perfectly
self.rainConfetti() /// this rains triangle, arc, heart, etc but in `red` color, when I expect it to be `yellow`

I even tried setting the SPConfettiConfiguration to it's default value:
SPConfettiConfiguration.particlesConfig = .defaultValue

That did not work.
Am I doing something wrong or is this a bug?
Either way, any suggestions?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants