Have a look at Apple's AVFoundation framework. There are several classes you can use like AVPlayer, AVAudioPlay, AVQueuePlayer?, it all depends on your requiements.
here's an example to get you started: (you need to enable "Allow Outgoing Connections" in xcode under signing and capabilities for the audio to play.)
for the slider, you find out the duaration of the audio and set the slider maxVaue to duration. using addPeriodicTimeObserver we update the slider in real time with slider.doubleValue = ProgressTime.seconds
you can also be notified when the audio has ended with AVPlayerItemDidPlayToEndTime.
import AVFoundation
var player: AVPlayer! = nil //(needs to be outside of class)
@IBOutlet weak var slider: NSSliderCell!
let urlToPlay = URL(string: "https://audio-ssl.itunes.apple.com/itunes-assets/AudioPreview113/v4/99/c4/84/99c48467-71dd-0a95-8388-3c5d4d433ee2/mzaf_6642611679343132363.std.aac.p.m4a")
let asset = AVAsset(url: urlToPlay!)
let playerItem = AVPlayerItem(asset: asset)
if player == nil {
player = AVPlayer(playerItem: playerItem)
player.play()
}
//time observer to update slider.
player.addPeriodicTimeObserver(forInterval: CMTime(value: 1, timescale: 2), // used to monitor the current play time and update slider
queue: DispatchQueue.global(), using: { [weak self] (progressTime) in
DispatchQueue.main.async {
self!.slider.maxValue = player.currentItem!.asset.duration.seconds
self!.slider.doubleValue = progressTime.seconds
}
})