Skip to content
This repository has been archived by the owner on Jul 20, 2023. It is now read-only.

replace precondition with guard to avoid unexpected crashes #220

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

okankocyigit
Copy link

I think you should consider to replace precondition with guard. There might be some cases where superview is not nil but view is not inserted in that superview which will cause a crash.

EasyTipView is a kind of tool that we give some tips for users. Generally, It doesn't matter whether the EasyTipView Message is displayed or not for application flow. Yes, that is an unexpected behaviour and should be fixed by developer, so we should warn developer with a log message, but not a crash.

It's very similar to Apple's present(_:animated:completion:)

If you try to present a viewController on a viewController which has already a presentedViewcontroller, it doesn't crash just prints out a warning message,

Warning: Attempt to present <UIAlertController: 0x147d2c6b0> on <SomeViewController: 0x147d614c0> which is already presenting.

@fr-kojiro-inoue
Copy link

@teodorpatras We have experienced more than 1000 crashes. This fix should solve the issue. Could you please merge this PR?

@vjard33
Copy link

vjard33 commented Jul 20, 2023

Please merge this pull request.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants