diff --git a/EggTimer.xcodeproj/project.xcworkspace/xcuserdata/mac.xcuserdatad/UserInterfaceState.xcuserstate b/EggTimer.xcodeproj/project.xcworkspace/xcuserdata/mac.xcuserdatad/UserInterfaceState.xcuserstate index bd37f93..54aa79d 100644 Binary files a/EggTimer.xcodeproj/project.xcworkspace/xcuserdata/mac.xcuserdatad/UserInterfaceState.xcuserstate and b/EggTimer.xcodeproj/project.xcworkspace/xcuserdata/mac.xcuserdatad/UserInterfaceState.xcuserstate differ diff --git a/EggTimer/Base.lproj/Main.storyboard b/EggTimer/Base.lproj/Main.storyboard index 4a873e2..679658c 100644 --- a/EggTimer/Base.lproj/Main.storyboard +++ b/EggTimer/Base.lproj/Main.storyboard @@ -125,23 +125,23 @@ - + - + - - + + diff --git a/EggTimer/ViewController.swift b/EggTimer/ViewController.swift index b764436..41b2742 100644 --- a/EggTimer/ViewController.swift +++ b/EggTimer/ViewController.swift @@ -7,6 +7,7 @@ // import UIKit +import AVFoundation class ViewController: UIViewController { @@ -16,7 +17,7 @@ class ViewController: UIViewController { var gameTimer: Timer? var counter: Int = 0 var setTime: Int = 0 - + var player: AVAudioPlayer! @IBOutlet weak var softPic: UIButton! @IBOutlet weak var mediumPic: UIButton! @@ -47,7 +48,7 @@ print("none") } gameTimer?.invalidate() titleLabel.text = "How do you like your eggs?" counter = time - setTime = time + setTime = time gameTimer = Timer.scheduledTimer(timeInterval: 1, target: self, selector: #selector(timer), userInfo: nil, repeats: true) } @@ -65,8 +66,16 @@ print("none") } titleLabel.text = "Done" cookingProgress.progress = 1 gameTimer?.invalidate() + playSound() } } + + func playSound() { + let url = Bundle.main.url(forResource: "alarm_sound", withExtension: "mp3") + player = try! AVAudioPlayer(contentsOf: url!) + player.play() + + } }