Repository navigation
Route gate - #158
Closed
NickTheFreak97 wants to merge 28 commits into
Closed
Route gate#158NickTheFreak97 wants to merge 28 commits into
NickTheFreak97 wants to merge 28 commits into
Conversation
… function to be rethrowing
…ns a specified slice
… of another router
…pes NodeWithPath and NullableNodeWithPath
…dded reduceNeighbours
… and NavigationView New ZNavigation target (product ZTronNavigationKit), Apple-only: ZRoute, ZNavigator with a NavigationStack and a NavigationView backend of identical observable behaviour, ZNavigationStack and ZNavigationScope containers, ZRouteLink, ZRouteDestinationView, resolvers over a TrieRouter, ZRouteModels, ZNavigationHub and ZPageViewReporter. Model tests run with swift test; the hosted parity suite and a plain NavigationStack baseline run on an iOS simulator. The design article with the ZombieTron migration plan is in Sources/ZNavigation/Docs.docc. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Constants are still tried first at every node; when the rest of the path cannot be matched below the constant, the search falls back to the parameter branch, so a constant never shadows a parameter route. Catch-alls keep the lowest precedence. Parameters captured on a failed branch are restored and a path that matches nothing leaves the bag untouched; the matching path allocates nothing it did not allocate before. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Ours wins on conflicts and the fork stays a drop-in replacement for upstream. Kept: the mutable routing-kit 4 API (TrieRouter.init(options:), register(_:at:)), the traversal helpers, the macOS 10.15 / iOS 13 platforms and the Swift 5 language mode, without upstream's Swift 6.2-only settings or its swift-algorithms dependency. Added on top, from routing-kit 5: RouterBuilder, TrieRouterBuilder with value semantics, TrieRouter.Configuration, partial parameters, a root catch-all matching the empty path, and the string utilities. Output is not required to be Sendable; TrieRouter and TrieRouterBuilder are Sendable when it is. The upstream product name RoutingKit is exported next to ZTronRoutingKit, and the Benchmarks manifest references the parent package by its identity. Upstream's swift-testing suite runs against the fork unchanged; the fork's own tests move to TrieRouterExtensionTests. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
A chain of constants with no wildcard, partial or catch-all beside it needs no decision, so the matcher follows it in a loop and recurses only where backtracking could ever be needed. Same results, less overhead on the common case of a route made of constants. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Znavigation and backtracking
A DocC article with the nine app-side steps and the code each one needs: resolving the ZTronNavigationKit product, the database model resolver, the compatibility breadcrumb, the app's resolver, installing ZNavigationScope in the navigation-view modifier, ZRouteLink at the three link sites, the hub with Spotlight, page views through ZPageViewReporter, what to remove afterwards and how to verify. Linked from the module page and from the design article's migration section. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Step 1 now contains the whole resolver, mirroring ZTronHomePageModel.loadGames, ZTronMapSelection.loadMaps and ZTronMapToolsPicker.loadToolsAndTabs call for call (readAllGames with .all, readAllMaps and readAllSubmaps limited to first-level masters paired with submap counts, readTabsWithToolsForMap), and assembling for every level the complete environment the screens inject today, including the serialised map and the tool for tool routes. Unknown maps and tools are left out rather than thrown, so constant routes keep opening. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
The resolver is built lazily next to the one route table instead of once per tab, so there is a single trie, a single database cache and a single Spotlight table; the modifier only reads it. Nothing is registered twice. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
… too A NavigationStack destination inherits the environment of the stack's root, not of the pushing screen, so the tool level must carry everything it received before, the same set the resolver of step 1 produces for a deep link. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
A dependency-free hook that lets the host gate a route without the routing kit knowing about the paywall kit (freemium design, milestone 5). - ZRouteGate (decision(for:), wrap(_:for:presence:)) and ZRouteGateDecision. - gate: parameter on ZNavigator.init and ZNavigationScope.init, nil by default. - ZNavigator.canPass(_:) and presence(of:). - ZRouteLink asks the gate once per tap and does nothing on .denied. - ZDestinationState wraps the erased screen once per push, on the carried and the async path. push, navigate(to:) and the hub do not consult it. With gate == nil no hook runs; the parity suite passes unmodified. New model-level tests and hosted tests (real link taps on both backends) count decisions and wraps with a probe gate. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.