This question is no duplicate to:
I'd like to hide the system volume HUD while adjusting the volume programmately without the need of a loaded View.
So this solution is not what I'd like to get (in my case this is not acceptable):
let volumeView = MPVolumeView(frame: .zero)
view.addSubview(volumeView)
I'd like to get a working function to hide the volumeView while avoiding to add hidden Subview instead.
This is what I've got so far (however this is not working currently) :
func hideHUD() {
let volumeWindow: UIWindow = UIWindow()
let volumeView = MPVolumeView(frame: .zero)
volumeView.isHidden = false
volumeWindow.isHidden = true
volumeWindow.addSubview(volumeView)
}
Note: I'm pretty sure It is possible to hide the volume HUD programmately because the VolumeBar API (you can find here) is able to hide the HUD and replace it with it's own style!