johnpatrickmorgan / FlowStacks

FlowStacks allows you to hoist SwiftUI navigation and presentation state into a Coordinator
MIT License
783 stars 56 forks source link

Inconsistent state of Routes variable after present/push when VC is presented on top (from UIKit) #73

Closed Scvairy closed 1 week ago

Scvairy commented 3 months ago

I have an SDK that pushes (through UIKit) a fullscreen cover on app start, and I have my own cover, also on app start (ask for notifications).

If SDK presents its cover and then I present my - only SDK's cover is presented. And when SDK's cover is dismissed, I see my root view, but I get an assertion failure: it tries to push view on top of "invisible" sheet that is not embedded into navigation view. If I embed it into navigation view, then assert's not firing, but push doesn't work either.

Can I somehow forcely update the hierarchy after SDK's modal dismissal? Or, maybe, synchronize routes array with actual state (if view wasn't presented, then it should disappear from (or not even be added to) routes array)

Thank you for your help!

johnpatrickmorgan commented 3 months ago

Thanks for raising this issue. Out of interest, which SDK is it? I don't see a good way to resolve the issue in this library, but I can see ways to work around the problem, such as:

Scvairy commented 3 months ago

Thank you for your answer and your suggestions!

The SDK is DivPro: https://github.com/divkit/divkitpro/

I think I have another one option, from the SDK side: I can write and inject own “presenter” (the sdk allows it) and wrap their UIViewController in SwiftUI view, and present it normally through FlowStacks.

I’ll try it out.

johnpatrickmorgan commented 3 months ago

Ah great, that would be ideal.