1. 头文件和声明
import AVFoundation
var ap_play: AVAudioPlayer!
2. 播放声音
let path = NSBundle.mainBundle().pathForResource("Hello", ofType: "mp3")
let url = NSURL(fileURLWithPath: path!)
ap_play = try? AVAudioPlayer(contentsOfURL: url)
ap_play.numberOfLoops = -1
ap_play.volume = 1
ap_play.prepareToPlay()
ap_play.play()