How to make sound effects in spinning wheel?

—Hi guys, Is anyone can share any suggestions for me? I have this random shoinning wheel and the spinning speed is controlled by .timingCurve( beginning very fast at end get slowly) So I want to make sound effects for this action.But I don’t know how. Thank you in advance!

Could you show the code you have so far ?

Try to adapt from solution here:

https://stackoverflow.com/questions/47023700/swift-and-avfoundation-playing-audio-while-animating-a-label

You may have to compute yourself if you want to sync the sound effect with the spin speed. I would precompute a series of sound depending on typical spinning parameters and select the most appropriate when starting animation.

Use info from UICubicTimingParameters doc in Xcode to get the best parameters.

Hey @Claude31 I have no idea how to get typical spinning parameters :( .onTapGesture { withAnimation(Animation.timingCurve(0.0, 0.8, 0.2, 1.0, duration: 10)) {                  self.chanceVM.rotateDegree = Double.random(in: 5400.0...7200.0)                } }

How to make sound effects in spinning wheel?
 
 
Q