Recursive navigation

Another way of doing this is just using explicit types for holding navigation state of particular screen:

struct AState {
  indirect enum Route {
    case b(BState)
    // Other possible routes from screen A
  }
  // ....
  var route: Route?
}

struct BState {
  indirect enum Route {
    case a(AState)
    // Other possible routes from screen B
  }
  // ....
  var route: Route?
}

The same idea applies to Actions as well.