title: Why is my sound making my game lag in Swift Spritekit?
body: <p>I have this sound effect when my hero node collects a coin and there is this small hiccup in my game. Its not smooth like in other games when there is sound involved when collecting a coin. What am I doing wrong? Heres my code for the sound: </p>
  
  <pre><code>  class GameScene: SKScene, SKPhysicsContactDelegate {
  
     var coinSound =  NSURL(fileURLWithPath: NSBundle.mainBundle().pathForResource("coin", ofType: "wav")!)
     var coinAudioPlayer = AVAudioPlayer()
  
     override func didMoveToView(view: SKView) {
  
     coinAudioPlayer = AVAudioPlayer(contentsOfURL: coinSound, error: nil)
     coinAudioPlayer.pause()
     }
  
     if firstBody.categoryBitMask == HeroCategory &amp;&amp; secondBody.categoryBitMask == CoinCategory {
  
     coinAudioPlayer.prepareToPlay()
     coinAudioPlayer.play()
     coinAudioPlayer.currentTime = NSTimeInterval(1.0)
      }
  </code></pre>