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

Add onTapped to TabItems #77

Merged
merged 3 commits into from
Jul 10, 2022
Merged

Conversation

LePips
Copy link
Collaborator

@LePips LePips commented Jun 28, 2022

Adds an onTapped method for TabChildItems that can be passed through the property wrapper and indicate whether the tab was just tapped through the isRepeat parameter: false if the tab was just selected and true if it was previously selected and was selected again. The coordinator used along with the tab item is passed to the function for whatever behavior, like popping to the root of a navigation view which I provided in the sample app.

A probable solution to #56 is to have an internal notification fire when the tab is repeated and the corresponding view listens to that notification as I don't think that a ScrollView/List or any other information can be grabbed just by being passed a Coordinator or View. I would have to look more into that.

There is a small undesirable behavior where at least a few (3-4) views/coordinators are pushed, and then popToRoot() is called, instead of a single push occurring a few of the views/coordinators pop one at a time. I don't know if this was previous behavior with popToRoot() but was just an observation of mine.

I'm only iffy in the using function on Content by implicitly setting _output and force unwrapping it in onTapped. I just quickly took this shortcut as using is implicitly called when a TabChildItem is created but I would want to move setting _output to init. Let me know if this is requested and I'll readily make the change.

@rundfunk47
Copy link
Owner

This is awesome! Really great! 🥳

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

Successfully merging this pull request may close these issues.

2 participants