var audioPlayerInstance : AVAudioPlayer! = nil // 再生するサウンドのインスタンス override func viewDidLoad() { super.viewDidLoad() // Do any additional setup after loading the view, typically from a nib. // サウンドファイルのパスを生成 let soundFilePath = Bundle.main.path(forResource: "test", ofType: "mp3")! let sound:URL = URL(fileURLWithPath: soundFilePath) // AVAudioPlayerのインスタンスを作成 do { audioPlayerInstance = try AVAudioPl
![[Swift3]ボタンを押した時に効果音を鳴らす](https://cdn-ak-scissors.b.st-hatena.com/image/square/7245082802d6fe323ef641f6fa7c7412ddf2a2ab/height=288;version=1;width=512/https%3A%2F%2Fpicolica.com%2Fwp-content%2Fuploads%2F2017%2F02%2FSwift.png)