How to know when AVPlayer is ready to play and sent info to the controller
<p>I'm bulding a radio streaming app in swift. Currently is all working but i want to improve a little the user experience.</p>

<p>I have a RadioPlayer.swift class that handles my radio actions.</p>

<pre><code> import Foundation
 import AVFoundation

 class RadioPlayer {
 static let sharedInstance = RadioPlayer()
 private var player = AVPlayer(URL: NSURL(string:"http://rfcmedia.streamguys1.com/classicrock.mp3")!)

private var isPlaying = false


func play() {
    player = AVPlayer(URL: NSURL(string: "http://rfcmedia.streamguys1.com/classicrock.mp3")!)
    player.play()
    isPlaying = true

    player.currentItem?.status

}

func pause() {
    player.pause()
    isPlaying = false
    player.replaceCurrentItemWithPlayerItem(nil)
}

func toggle() {
    if isPlaying == true {
        pause()
    } else {
        play()
    }
}

func currentlyPlaying() -&gt; Bool {
    return isPlaying
}
</code></pre>

<p>Then i have a View Controller that implement that class. My objective is that when the player is loading, send a message saying that the streaming is being prepared, so the user know that have to wait (also disable the play button).</p>

<p>So my question is how can achieve that, in android i used broadcasts in order to send messages but i didn't found an equivalent in swift.</p>