How to add sound every time tapped?

Discussion in 'iOS Programming' started by RavenSoccer, Jan 6, 2018.

  1. RavenSoccer macrumors newbie

    Jan 6, 2018
    Hello. I made a flappy bird themed game. Everything is great, however I want to add a sound every time the screen is tapped. I create the app on Xcode using swift.

    Thank you.
  2. bjet767 macrumors 6502a

    Oct 2, 2010
    This is in objective c but it Swift would be an easy conversion.

    Remember Stack Overflow is your coding question friend.

    Oh for speed purposes I would initialize my sound when the view controller is loaded, not every time I touch the screen. The only part of the code in touchesbegan is the AudioServicesPlaySystemSound(soundID);

    Also make the sound very short or you’ll drive the user crazy.
  3. unbrako macrumors newbie

    Feb 2, 2018
    Totally agree with bjet767 about makign it short or even allowing it to be switched off. Its very easy when developing to think it adds to the experience but when your using it it can become VERY annoyuing

Share This Page