How to hide route button `showsRouteButton = false` in `MPVolumeView` without deprecation warning?

MPVolumeView's showsRouteButton was deprecated (https://developer.apple.com/documentation/mediaplayer/mpvolumeview/showsroutebutton?language=objc).

It's not clear how can we now hide this button without deprecation warning. The documentation is lacking.

Please advise.

Thank you!

Thanks so much for the post.

My answer will not be to find ways to suppress of the deprecation warning. Spoiler alert.

This warning indicates that the API including your method will cease to function, and the documentation advises utilizing the AVRoutePickerView as an alternative. Consequently, I would recommend transitioning entirely to the AVRoutePickerView.

As that class you are using including the method showsRouteButton will stop working in the future releases.

Please let me know if I can help you moving to the AVRoutePickerView as the documentation shows.

Albert Pascual
  Worldwide Developer Relations.

Thank you for a quick reply.

We are using non-deprecated MPVolumeView (https://developer.apple.com/documentation/mediaplayer/mpvolumeview) to control system audio output volume.

// volumeView is `MPVolumeView`
volumeView.showsRouteButton = false
volumeView.backgroundColor = .clear
addSubview(volumeView)
volumeView.snp.makeConstraints { make in
  make.top.greaterThanOrEqualTo(self)
  make.bottom.lessThanOrEqualTo(self)
  make.centerY.equalToSuperview()
   make.leading.equalTo(volumeMuteImageView.snp.trailing).offset(6). make.trailing.equalTo(volumeHighImageView.snp.leading).offset(-15)
  make.height.equalTo(44)
        }

What should we do?

Thank you!

Like the documentation explains to control the audio for that control use AVRoutePickerView

Thanks Albert 
  Worldwide Developer Relations.

Sorry, but for which control? Do you mean for the slider?

AVRoutePickerView
A view that presents a list of nearby media receivers.

My question is about MPVolumeView .

Sorry, but how do I wire up AVRoutePickerView with MPVolumeView, in the documentation there's no example. That documentation also doesn't say anything about controlling system volume, It only says about handling media receivers.

Can you help me?

How to hide route button `showsRouteButton = false` in `MPVolumeView` without deprecation warning?
 
 
Q