SafePresentation

Throw common warnings of ViewController presentation as error.

Usage

Replace present(_:_:_:) to throwingPresent(_:_:_:).

let vc = ChildViewController()
- present(vc, animated: true)
+ try throwingPresent(vc, animated: true)

Installation

Swift Package Manager

Support warnings

  • Attempt to present ChildViewController on RootViewController whose view is not in the window hierarchy.
  • Attempt to present ChildViewController on RootViewController which is already presenting.

Support exception

  • Application tried to present modally a view controller ChildViewController that is already being presented by RootViewController.
  • UIPopoverPresentationController should have a non-nil sourceView or barButtonItem set before the presentation occurs.

Author

noppefoxwolf

License

MIT

GitHub

View Github