I have a function that changed the volume at a certain time:

(MPVolumeView().subviews.filter{NSStringFromClass($0.classForCoder) == "MPVolumeSlider"}.first as? UISlider)?.setValue(Float(1.00), animated: false) 

When it's fired again a few mins later, it doesn't work anymore. I get a warning that this has to happen in the main thread, which I suspect is the reason for it only working ONCE.

But when I put it in DespatchQueue.main.async{ the volume change doesn't even change the first time.

What am I missing here?

Related posts

Recent Viewed