rockbruno / RouterService

💉Type-safe Navigation/Dependency Injection Framework for Swift
MIT License
332 stars 27 forks source link

What's the use case for routes being an array #3

Closed JanGorman closed 4 years ago

JanGorman commented 4 years ago

First of all thanks a lot for making the effort to put this repository together. I enjoyed the accompanying article you posted earlier this year as well.

Could you share the reason of why in RouteHandler, the routes property is defined as an array. Neither the sample code nor the README make that clear (and to that point, the example in the README even does a type check specifically for the single route type defined for profile).

rockbruno commented 4 years ago

In the context where this was created, a feature target could contain multiple features or entry points (like a "food delivery" feature that could have home/restaurant/dish selection screens). So for us, these features can have multiple routes, and the route handler is capable of deciding where each route should go to. That's why it's an array :)

JanGorman commented 4 years ago

👏 Understood. Thanks a lot for the clarification!