# SwiftUIメモ. 音を鳴らす

# AVFoundation

import AVFoundation

let soundData = NSDataAsset(name: "sound1")!.data
var player: AVAudioPlayer!

do {
    player = try AVAudioPlayer(data: soundData)
    player.play()
} catch {
    print("エラー..")
}

[ 📩 ご意見 ]