Home Check if addObserver for keyPath is assigned
Reply: 0

Check if addObserver for keyPath is assigned

user380
1#
user380 Published in May 20, 2018, 10:01 am

I have an avplayer to play audio and I add an observer when the audio starts

 audioPlayer?.addObserver(self, forKeyPath: "currentItem.loadedTimeRanges", options: .new, context: nil)

Is there a way that I can run a check in one of my functions to see if the observer exists or nil. If it exists, I can remove it. Any suggestions?

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.30563 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO