stinsen icon indicating copy to clipboard operation
stinsen copied to clipboard

TabBar: present modal view from tabbar item

Open Luur opened this issue 1 year ago • 2 comments

Hi everyone,

First of all, thank you for the great framework.

I have a question. Is it possible to present the modal view from tabbar item? If yes, how can I do it? In the app I'm working on, I need to force users to log in before they can reach a specific tabbar item.

Luur avatar Aug 02 '22 12:08 Luur

I left a comment on this earlier and deleted it as I misunderstood the request.

Sort of, however is that what you should do? Somewhere in your code you store your session and authenticated state and the coordinator should not be concerned with that. Nonetheless, it is possible with the onTapped action in the @Route property wrapper.

Here is a minimal example of that: https://pastebin.com/xkpLbDpC

However, I don't think that's a proper implementation as the view should present the modal if unauthenticated.

Here is a minimal example of that: https://pastebin.com/we7p2Twy

However, there's a bug I experience some times when the router won't do anything so I should track that down as I experience it in my app but haven't bothered with it.

For reference, the Fidelity app has a similar flow.

LePips avatar Aug 03 '22 15:08 LePips

Hey, thank you very much for your response. I caught the idea. However, I do like your ideas from deleted comment. I'm going to discuss it with the UX designer to find which approach will suit us better.

Luur avatar Aug 03 '22 20:08 Luur