Our game feels a bit bland without sound effects, so we are going to add some. We will add background music and sound effects.
Sprite Kit is mostly a graphics library, and sound support is limited, but there are ways to add music to our game.
The first thing that we need to do is add music files to the project. To do this, drag-and-drop
shieldSmashed.wav to our project in Xcode. Select Copy items into destination group's folder and make sure that Add to targets has your project selected.
In order to play background music, we will need to add the
AVFoundation library to our project.
AVFoundation library is a collection of classes that allows for audio and video playback on iOS devices. ...