https://github.com/noppefoxwolf/safepresentation
Throw common warnings of ViewController presentation as error.
https://github.com/noppefoxwolf/safepresentation
Last synced: 9 months ago
JSON representation
Throw common warnings of ViewController presentation as error.
- Host: GitHub
- URL: https://github.com/noppefoxwolf/safepresentation
- Owner: noppefoxwolf
- Created: 2022-05-31T13:50:10.000Z (about 4 years ago)
- Default Branch: main
- Last Pushed: 2022-05-31T13:56:50.000Z (about 4 years ago)
- Last Synced: 2025-07-01T14:44:10.763Z (12 months ago)
- Language: Swift
- Size: 5.86 KB
- Stars: 7
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# SafePresentation
Throw common warnings of ViewController presentation as error.
## Usage
Replace `present(_:_:_:)` to `throwingPresent(_:_:_:)`.
```diff
let vc = ChildViewController()
- present(vc, animated: true)
+ try throwingPresent(vc, animated: true)
```
## Installation
### Swift Package Manager
- File > Swift Packages > Add Package Dependency
- Add https://github.com/noppefoxwolf/SafePresentation.git
- Select "Up to Next Major" with "0.0.1"
## Support warnings
- [x] `Attempt to present ChildViewController on RootViewController whose view is not in the window hierarchy.`
- [x] `Attempt to present ChildViewController on RootViewController which is already presenting.`
## Support exception
- [x] `Application tried to present modally a view controller ChildViewController that is already being presented by RootViewController.`
- [x] `UIPopoverPresentationController should have a non-nil sourceView or barButtonItem set before the presentation occurs.`
## Author
[noppefoxwolf](https://twitter.com/noppefoxwolf)
## License
MIT