Nav2, Nav3… Or Roll Your Own? — Building to Understand Nav3’s Design Intent
summary
Shows how to build a Compose navigation system starting from mutableStateListOf<Route>() and evolving it through six versions to address seven concrete problems: back stack history, surviving process death using rememberSaveable with Kotlin serialization, scoping per-route ViewModels via composition locals, and creating a responsive two-pane layout with a SceneStrategy. Compares each homemade implementation to Nav3 internals (NavBackStack, NavEntryDecorator, NavKeySerializer), discusses multi-module serializer decisions, and demonstrates a working prototype while noting Nav3 still handles animations and lifecycle edge cases the simple version does not.
AI-written summary · about
chapters (20)
- 0:00Introduction
- 1:15Nav3 challenges DIY
- 2:21Simple screen transitions
- 3:05Back stack intro
- 5:54Screen rotation state
- 6:38Home button serialization
- 8:25Serializer usage
- 9:09Nav3 back stack
- 11:45Search box state loss
- 13:30Screen state saving
- 15:40Nav3 state saving
- 17:31ViewModel scope
- 21:06Nav3 ViewModel lifecycle
- 22:30Tablet 2-pane layout
- 29:05Nav3 scenes strategies
- 29:46Multi-module challenges
- 31:55Multi-module implementation
- 35:54Nav3 multi-module
- 38:08Nav3 strengths limits
- 39:16Migration summary
related talks
39mWhat I Did to Migrate Navigation 2 to 3 (Planned)
30mBreaking the Rules: Dynamic Navigation in Modularized Apps
38mNavigating the future with Jetpack Navigation 3
46mExploring Navigation Libraries for Compose
06mType safe, multi-module best practices with Navigation Compose
36mNavigating the future with Jetpack Navigation 3
42mComposing your navigation: charting your route in the Jetpack ecosystem
49mNavigation Component, feedback from the trench
