Pros and cons of tree-based vs stack-based navigation

Episode Clip • Free • Feb 9, 2023

In this clip from our livestream we discuss the pros and cons of tree-based and stack-based navigation. For tree-based navigation:

  • Pros:
    • Concise way of describing navigation
    • Can describe the finite number of paths in your app
    • Feature modules are fully self-contained
    • Easy to test integration
    • Unifies all types of navigation APIs
  • Cons:
    • Can’t express complex or recursive navigation paths
    • Couples destinations together
    • Still very buggy in iOS 16

For stack-based navigation:

  • Pros:
    • Can handle complex and recursive navigation paths
    • Each screen in the stack can be fully decoupled from the other screens in the stack
    • Way fewer bugs in the iOS 16 APIs
  • Cons
    • It is not concise and allows for potentially non-sensical navigation paths.
    • Feature modules become mostly inert when run in isolation since they cannot navigate anywhere else.
    • It is more difficult to integrate features together and test.

Subscribe to Point-Free

👋 Hey there! If you got this far, then you must have enjoyed this post. You may want to also check out Point-Free, a video series covering advanced programming topics in Swift. Consider subscribing today!