Navigation, sheets, alert, and tabs - #23
Merged
Merged
Conversation
…ge, resolution effects @Environment gains keyPath form (\.dismiss) alongside object injection; StateStorage persists container reference objects by identity path; the evaluator installs state and injects environment for primitives, handles resolution-effect wrappers, and threads a per-screen title/detent sink.
Swift owns the stack; links push, dismiss pops, navigationDestination resolves value pushes, navigationTitle records per-screen titles. The stack emits every screen so Compose can animate and cache during a pop.
Modal content rides as a hidden child shown while its bound flag is true; drag-to-dismiss and dialog buttons write the flag back so Swift stays authoritative. Alert is new API the classic renderer never had.
NavStack renders a Scaffold with a back-arrow app bar and animates between cached screens; sheets present as a ModalBottomSheet, alerts as an AlertDialog, both skipped by the normal child loop; TabView renders a NavigationBar and shows the tagged tab.
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.
Sixth step of the Compose-backed architecture (#18–#22). Restores real navigation and adds the presentation surface — including
alert, which the classic-view renderer had no path to at all.Navigation
Swift owns the stack.
NavigationStackholds aNavigationModelpersisted by identity path; links push,@Environment(\.dismiss)pops,navigationDestination(for:)resolves value pushes,navigationTitlerecords per-screen titles. The stack emits every screen (root + pushed) as children, so the interpreter can animate between them withAnimatedContentand render the outgoing screen from cache during a pop.Scaffold+TopAppBargives the title and a back arrow; system back flows through the same pop callback.Presentation
.sheet(isPresented:)rides as a hidden child shown while the flag is true; the interpreter presents it as aModalBottomSheet. Drag-to-dismiss and the dismiss action write the flag back, so Swift stays authoritative.presentationDetentssupported..alert(_:isPresented:message:buttons:)→ Material 3AlertDialog. New API — noAlerttype existed under the old architecture.Tabs
TabView(selection:)with.tabItemand.tag; the interpreter renders aNavigationBarand shows the tagged tab. Selection is a@Statebinding, so both a tab tap and programmatic selection work.Core additions
@Environmentgains the keyPath form (\.dismiss) alongside object injection, both through the same reflection seam.StateStorage.persistentObject(at:)holds container reference state (the nav stack) that must survive re-evaluation without living in a view's@State._ResolutionEffectViewwrappers (title/destination registration), and threads a per-screen title/detent sink.Verification
swift test: 24 tests — classic push, value push throughnavigationDestination, dismiss-pops, sheet presentation, tab selection.navigationDestination, with its own title, and a further "Push value 2" link — the deepest path (a pushed screen registering a destination and pushing onto the same Swift-owned stack).@Environment(\.dismiss).@Stateand switches to Third tab.