Basically something to the effect of this would show the AVRoutePicker's view and hide it behind a custom button. the AVRoutePicker button was available in iOS 13, and before that we used the MPVolumeView to do about the same. There is no direct way to select the routes, only show the system UI to show the view.
var button: UIButton?
var picker: AVRoutePickerView = AVRoutePickerView()
var detector: AVRouteDetector = AVRouteDetector()
detector.isRouteDetectionEnabled = true
addSubview(picker)
picker.frame = CGRect.zero
picker.isHidden = true
button = picker.subviews.filter({$0 is UIButton}).first as? UIButton
button?.sendActions(for: .touchUpInside)
Topic:
App & System Services
SubTopic:
Core OS
Tags: