I am working on a mobile app and I would like to know when a user closes the Airplay route selection window. In the documentation for the AVRoutePickerView, its delegate supposedly has a function, "routePickerViewDidEndPresentingRoutes" https://developer.apple.com/documentation/avkit/avroutepickerview
Here's my implementation. The Route selection detail opens and closes, but the delegate's function is not fired. Perhaps I don't understand Swift 5.2? How can I detect this change?
@available(iOS 11.0, *)
class RouteCheckDelegate: NSObject, AVRoutePickerViewDelegate {
func routePickerViewDidEndPresentingRoutes(_ routePickerView: AVRoutePickerView) {
print("FINISHED PRESENTING ROUTES")
}
}
@objc(RCTAirPlayButton)
@available(iOS 11.0, *)
class ShowAirplay: RCTViewManager {
@objc
override static func requiresMainQueueSetup() -> Bool {
return true
}
override func view() -> AVRoutePickerView {
let routerPickerView = AVRoutePickerView(frame: CGRect(x: 50, y: 50, width: 100, height: 100))
let delegate = RouteCheckDelegate()
routerPickerView.delegate = delegate
return routerPickerView
}
}```