Since iOS 13, showsRouteButton from MPVolumeView has been deprecated
let vv = MPVolumeView()
vv.showsRouteButton = false
Warning is :
'showsRouteButton' was deprecated in iOS 13.0: Use AVRoutePickerView instead.
Apple is telling me to use AVRoutePickerView for routing, which makes no sense as in my case I do not want to use any routing stuff, I only want to hide it. It seems there's no more not deprecated way to do this.
If it's deprecated it should be hidden by default else apple should allow us to hide it...
Am I right to say it's an apple API error ?
For now just to remove the warning and the default route button I used this immediately after initializing the MPVolumeView
.
if volumeView.value(forKey: #keyPath(MPVolumeView.showsRouteButton)) as? Bool == true { volumeView.setValue(false, forKey: #keyPath(MPVolumeView.showsRouteButton)) }
I check via key value paths if the value of showsRouteButton
is true
and sets it to false
if it is.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With