Skip to content

Instantly share code, notes, and snippets.

@Yoloabdo
Created July 18, 2015 18:34
Show Gist options
  • Select an option

  • Save Yoloabdo/f59a89261d681a73673c to your computer and use it in GitHub Desktop.

Select an option

Save Yoloabdo/f59a89261d681a73673c to your computer and use it in GitHub Desktop.
The update bar(slider) function
// in the mainView class we need to create an outlet for the slider, and the text label for the current time.
@IBOutlet weak var audioPlayerBar: UISlider!
@IBOutlet weak var timeViewer: UILabel!
// updating slider function
func updateSlider(){
let currentTime = Float(nsTimerToSeconds(audioPlayer.currentTime))
audioPlayerBar.value = currentTime
timeViewer.text = "\(currentTime) / \(audioLengthSeconds)"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment