futuredapp / futuredapp/FuturedKit
Add reset() extension to TabCoordinator
@ssestak is already working on this.
Since Apr 15, 2026.
- Dominant language
- Swift
- Stars
- 3
- Forks
- 0
- Avg merge
- 2d 23h
- Merged PRs (30d)
- 2
Description
Motivation
NavigationStackCoordinator has a built-in reset() (Coordinator.swift:116-119) that clears path and modalCover:
public func reset() {
path = []
modalCover = nil
}
TabCoordinator has no equivalent for resetting selectedTab + modalCover. Apps with tab-based roots that need to reset tab selection on logout / session-end currently write per-project boilerplate.
Proposal
Add a default implementation to TabCoordinator:
extension TabCoordinator {
/// Resets the tab coordinator: selects the given default tab and dismisses any modal cover.
/// Child flow coordinators should be reset separately via their own `reset()`.
public func reset(to defaultTab: Tab) {
selectedTab = defaultTab
modalCover = nil
}
}
The defaultTab parameter is required because Tab is a project-specific associated type — the framework can't hardcode a sensible default.
Usage example
smsticket-ios MainTabCoordinator.resetNavigation() currently:
func resetNavigation() {
selectedTab = .home
modalCover = nil
homeCoordinator.reset() // existing NavigationStackCoordinator.reset()
searchCoordinator.reset()
favoritesCoordinator.reset()
ticketsCoordinator.reset()
}
With the proposed extension, the first two lines become reset(to: .home) — consistent with the NavigationStackCoordinator pattern.
Open questions
- Should
reset()cascade to child flow coordinators if a children-tracking API were introduced? Probably out of scope — each parent knows its own children and reset order can matter per-app. - Per-tab modal covers — not currently supported by
TabCoordinatoranyway, so N/A.
Related
Surfaced during review on futuredapp/smsticket-ios#20 (see MainTabCoordinator.resetNavigation).
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.