Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TabView Functionality #56

Open
ryangittings opened this issue Mar 3, 2022 · 3 comments
Open

TabView Functionality #56

ryangittings opened this issue Mar 3, 2022 · 3 comments

Comments

@ryangittings
Copy link

Hey,

Firstly - thank you so much for the OS love, it's brilliant.

Secondly - I'm using a TabCoordinatable to power a TabView, but by doing so in SwiftUI you lose some default functionality like popping to the root on active tab tap, and scrolling to top on tab tap. As far as I'm aware there's no SwiftUI workaround, but there's a package that seems to do the trick:

https://github.com/NicholasBellucci/StatefulTabView

Cheers!

@YuantongL
Copy link

Hi, there are still work around - create a custom TabCoordinatable. There are some examples in this other thread where we talked about how to make a custom tabbar #42

Basically the idea is:

  1. Hide the system tabbar
  2. Make a class conform to TabCoordinatable
  3. Use func customize(_ view: AnyView) -> some View to use a view which you made yourself as a tab bar
  4. You then get full control of what needs to be displayed on the tab bar (because it's a SwiftUI View)
  5. You will be able to achieve anything (you got the button call back in coordinator now, you can pass it around)

@ryangittings
Copy link
Author

Ah okay! I'm not 100% sure on this, but I'll see if I can hash something together.

Any idea how I'd get the stateful tab package above to work? I'd love to view some sample code or something, if some exists anywhere?

Thanks for all your help! 🙂

@YuantongL
Copy link

I don't have code example of the StatefulTabView, you could try use the func customize(_ view: AnyView) -> some View and implment the StatefulTabView there. Alternatively I think it is also possible to just not discard using of TabCoordinator since the StatefulTabView basically does the same thing, and use Stinsen in other places of the app.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants