Search code examples
iosuiviewcontrolleruitraitcollection

Detect if ViewController presented as FormSheet


I have two ViewControllers.

  1. Presenting
  2. Presented -> can be FullScreen or FormSheet (depending whether it is running on compact or regular horizontal size class)

How can Presented controller detect, whether it is presented as a modal or FormSheet?


Solution

  • Just check the modalPresentationStyle property of the UIViewController.