How to detect if a view controller is presented in a popover

I need to detect whether a view controller is presented in a popover or in fullscreen mode, as on iPhone.

I checked viewController.popoverPresentationController but it returns a non-nil value even on iPhone, when it's clearly not in a popover. I then checked viewController.presentationController?.adaptivePresentationStyle but it returns .formSheet even when it's presented in a popover!?! Why?

This whole adaptive presentation thingie is a mess. Heck, viewController.presentationController returns _UIPageSheetPresentationController even when the view controller is in a UINavigationController, so not presented at all.

Anybody got any ideas?

How to detect if a view controller is presented in a popover
 
 
Q