andreamazz / BubbleTransition

A custom modal transition that presents and dismiss a controller with an expanding bubble effect.
MIT License
3.32k stars 250 forks source link

Fix nil when there is not background color set #62

Closed juanjovn closed 4 years ago

juanjovn commented 4 years ago

If there is not background color set e.g in default created buttons, a nil stops execution when the optional is unwrapped.

andreamazz commented 4 years ago

Hey @juanjovn To be honest I rather have the code crash in this instance (that's why I used the IUO), the user is required to have a background color, or the effect can be jarring, so I rather have an early crash that is easier to debug. An alternative that I might consider is add a nil check with a fatalError with a more detailed explanation, but it might be overkill for such a simple use case.