Just a quick tip for those who are trying to set the presentation controller delegate to capture presentationControllerDidAttemptToDismiss from UIAdaptivePresentationControllerDelegate or any of the like – if your view is being presented via a UINavigationController, the presentation controller that will receive the feedback will actually be on the navigation controller itself.
So, instead of:
func viewDidLoad() { self.presentationController?.delegate = self }
you’ll need to dive a layer deeper:
func viewDidLoad() { self.navigationController?.presentationController?.delegate = self }
Not too fond of this behavior since it makes things a little messier and especially given UINavigationController is smart enough to receive isModalInPresentation from any other controllers in the stack (wouldn’t be better to forward events to the top most controller?)
Anyway, speculation aside — it took me awhile to put two and two together. Good luck out there!