SwiftKickMobile / SwiftMessages

A very flexible message bar for UIKit and SwiftUI.
MIT License
7.24k stars 742 forks source link

SwiftMessages can only present a single custom alert and constraints become broken #433

Closed danielsaidi closed 3 years ago

danielsaidi commented 3 years ago

This commit causes strange UI glitches in our app. We use SwiftMessages to present custom alerts and with the changes in this PR, we can't present any alerts after closing the first one.

Also, when this happens, any view collections we push to the screen also get messed up, with their cells becoming tiny, like all constraints are broken.

This works in 8.0.3.

wtmoose commented 3 years ago

I haven't reproduced this in the demo app or my other test apps.

Got repro steps?

danielsaidi commented 3 years ago

This happens in the main app of the company that I work for, so I unfortunately can't share any sample code.

To sum up, we use SwiftMessages for custom alerts. After an alert has been shown, any subsequent alert presentations fail. Sometimes, this also messes up the constraints. For instance, this list:

fails to render correctly after an alert has been presented, and looks like this:

I suspect that this line is what's causing it:

if let becomeKeyWindow = config.becomeKeyWindow { return becomeKeyWindow }

I could create a fork and verify this, but it must be something in the commit mentioned above, since 8.3 works.

wtmoose commented 3 years ago

Are you setting config.becomeKeyWindow? The change on that line of code only affects the case where you've set config.becomeKeyWindow = false. Otherwise, the change would have no effect – you can verify this yourself by inspecting the logic.

wtmoose commented 3 years ago

Closing since there hasn't been any followup in weeks.