ConfettiSwiftUI
ConfettiSwiftUI copied to clipboard
Dynamically added text
I try to add an emoji which is recieved by an APN:
@State private var receivedEmoji: String = "🎉"
@State private var cannonEmoji: String = "🥥"
[...]
VStack {
[...]
.onChange(of: receivedEmoji) { newValue in
animationCounter += 1
cannonEmoji = newValue
print("Emoji \(cannonEmoji)") <--- here it prints the recieved emoji and not the initialized one.
}
// .animation(.easeInOut(duration: 0.5), value: sortedActions)
ConfettiCannon(counter: $animationCounter ,confettis: [.text(cannonEmoji)], confettiSize: 20)
.text(cannonEmoji)
allways fires the coconut (🥥) - which looks also great. :D
How can I solve this?