-
Notifications
You must be signed in to change notification settings - Fork 72
Magellan vs. Jetpack Navigation with Safeargs
This is a work in progress, and we'll update the associated issue when it's done.
Disclaimer: we are not as experienced with Jetpack Navigation as we are with Magellan, so if any of this information is inaccurate, please create an issue.
Magellan focuses on simplicity, flexibility, practicality, and testability, and makes some opinionated design choices. Jetpack Navigation, on the other hand, has to appeal to a broader range of developers and use cases in order to be Google’s official solution.
- Typesafe page parameters with no compiler plugin
- Dynamic navigation routes
- Implicitly defined when navigating, instead of XML-defined as required by the safeargs plugin
- Allows for more flexible navigation and quicker iteration
- Composition of
Step
s/Journey
s allowing for breaking down complex pages into smaller components (see LifecycleAware and "child" components) - Compile-time validation that navigation is possible (i.e. Magellan uses objects instead of
String
orInt
route identifiers) -
Step
s/Journey
s are easier to test and mock/fake/stub dependencies, since they're regular Java objects that can be directly instantiated
- All routes are declared at compile time (because of Safeargs, they need to be defined in XML)
- Allows for more controlled navigation
- Graphical editor for the XML route definitions
- Officially supported by Google and widely used by the community
Requiring one of these would obviously be a reason to choose Jetpack Navigation. Feel free to contribute features to handle these cases, but please consider creating an issue or a small prototype to validate your approach with the core maintainers first.
-
Automatic state restoration after process death: To avoid making everything
Parcelable
, we keep the state at theApplication
level, but that also means that whenever theApplication
is destroyed, all navigation and view state is lost.
Made with 💚 by the Wealthfront Android Team.