player:AVAudioPlayer! @IBInspectable var path:String! override func awakeFromNib() { player = try! AVAudioPlayer(contentsOf: Bundle.main.url(forResource: path, withExtension: nil)!) } @IBAction func start(_ sender: Any) { player.play() } @IBAction func stop(_ sender: Any) { player.stop() player.currentTime = 0 } }