WWDC22 SALE: Save 50% on all my Swift books and bundles! >>

Problem with Tabs under TabView "More..."

Forums > SwiftUI

In TabView, when it exceeds the width of device (for example, 5 on some phones), user can click on "More," to access rest of tabs.

However, for those tabs under More, it doesn't behave as well as those not in "More"

When "sheet" "popover" "alert" pop out from those tabs, dismissing the popout won't always go back to the correct one. It usually goes to the last Tab one used before. In other words, it doesn't come back to the right Tab.

Another question is that in iphone, one can use "Edit" to reorder the tabs, however, I didn't success to do so, the one outside of "More" switching back to original one within few seconds.

I have a workaround, is to passing @SceneStorage("selectedView") var selectedView: String?, and set to the "right" tab to back to before it gets dismissed.

However, it doesn't look so neat and feel more like hardcoded...

Anyone has met this before?

Thank you very much!

1      

Hacking with Swift is sponsored by Emerge

SPONSORED Why are Swift reference types bad for app startup time, and what’s the performance cost of protocol conformances? That’s just a couple of the topics you can learn about on the Emerge blog — written by the app performance experts behind Emerge’s advanced app optimization and monitoring tools, based on their experience of working at companies like Apple, Airbnb, Snap, and Spotify.

Find out more

Sponsor Hacking with Swift and reach the world's largest Swift community!

Archived topic

This topic has been closed due to inactivity, so you can't reply. Please create a new topic if you need to.

All interactions here are governed by our code of conduct.

 
Unknown user

You are not logged in

Log in or create account
 

Link copied to your pasteboard.