I have my audioPlayer setup already
In addition to the current functionality of the stepper, I want to also play separate sounds for onIncrement & onDecrement.
This project uses Core Data to persist. $estimatorData.qty listens to published var my View Model when the qty changes the new qty is saved in my view model estimatorData.save()
Here is a link to docs Stepper
I am trying to wrap my head around if one of the initializers would fit with what I am trying to accomplish
Stepper("", value: $estimatorData.qty.onChange { qty in
estimatorData.save()
}, in: 0...10000)
.frame(width: 100, height: 35)
.offset(x: -4)
.background(colorScheme == .dark ? Color.blue : Color.blue)
.cornerRadius(8)
Here are my players
func incrementTaped() {
playSound(sound: "plus", type: "mp3")
}
func decrementTaped() {
playSound(sound: "minus", type: "m4a")
}