customRoutingController(_:handle:completionHandler:)
Connects to, or disconnects from, a device when a user requests it in the picker.
Parameters controller : A custom routing controller.
event : The routing event to handle.
completionHandler : A completion handler to call after processing the event. Pass True to the completion handler if the activation, reactivation, or deactivation of the route succeeds, and False , otherwise.
Discussion important:
You can call this method from synchronous code using a completion handler, as shown on this page, or you can call it as an asynchronous method that has the following declaration:
func customRoutingController ( _ controller: AVCustomRoutingController, handle event: AVCustomRoutingEvent) async -> Bool For information about concurrency and asynchronous code in Swift, see Calling Objective-C APIs Asynchronously .
See Also Handling controller events