How could my async effect results can be reflected in UI - show resulted from error or success(custom popup)?

Hi all,
Thanks for a great contribution to CTO - have been using it for the MCP project, really exciting.

Have faced with a few issus we can't resolve so far, decided to give a shot here
So our main question for now is there way to reflect changes on UI after effect finished.

Here is some example:

  1. User wants to reset password by typing email and press resset my pass

  2. We sent effect with specific mutation,
    case .resetPasswordEffectWith(let user),
    .authorizationPullback(.authorizationPullback(.resetPasswordEffectWith(let user))):
    state.showingPopup = true
    return
    environment.authClient.resetPasswordEffect(user)
    .catchToEffect()
    .map(AuthAction.didResetPassword)
    .eraseToEffect()

  3. map it to
    case didResetPassword(Swift.Result<Bool, Never>)
    And want to reflect at UI - show popup or dismiss modal, or present fill screen HUD etc
    Have a question on how to achieve that?

For popup, we were going to use https://github.com/exyte/PopupView, any other HUD alternative working with CTO is also appreciated.
Ex Usage .popup(presented: $showingTopPopup... which is linked to binding Bool - can I have it in state?

I tried to have it working with a var shouldShowPopup: Bool as a part of the state but I think CTO requires some other approach.

So, in short, how could my async effect results be reflected the UI - show resulted from error or success?
Any suggestions?

BR,
Dmitry

Terms of Service

Privacy Policy

Cookie Policy