1

I am trying to add audio to my game and just cannot figure out how. There are tons of tutorials on how to add sound for Swift but not Swift 2.0. All I am trying to do is have sound effects when I tap the screen.

I've seen some people say to use "init" but I cannot get that to work.

Thank you!

  • Can you give some more specifics about what you have tried? – tegancp Jul 03 '15 at 22:51
  • I've testing AVAudioPlayer in a couple of ways: One - http://stackoverflow.com/questions/30786877/avaudioplayer-no-longer-working-in-swift-2-0-xcode-7-beta/ Two - https://www.youtube.com/watch?v=TaFvJajJo8k/ Three - https://www.reddit.com/r/swift/comments/38zgvr/avaudioplayer_is_not_playing_sound/ – moniker4544 Jul 04 '15 at 00:30
  • Some code looked like this: var coinSound = NSURL(fileURLWithPath: NSBundle.mainBundle().pathForResource("coin", ofType: "wav")) /// audioPlayer = AVAudioPlayer(contentsOfURL: coinSound, error: nil) /// – moniker4544 Jul 04 '15 at 00:33
  • With Swift 2.0 (error: nil) does not work anymore. Also when using init I keep running into problems. Thanks. – moniker4544 Jul 04 '15 at 00:34

0 Answers0