ekazaev / route-composer

Protocol oriented, Cocoa UI abstractions based library that helps to handle view controllers composition, navigation and deep linking tasks in the iOS application. Can be used as the universal replacement for the Coordinator pattern.
MIT License
896 stars 63 forks source link

Modular Architecture #81

Closed bagusandinata closed 2 years ago

bagusandinata commented 2 years ago

hi @ekazaev, may i have some enlightenment how to implement RouteComposer in Modular Architecture? I ran into a deadlock in unclean code and how to interaction of each module feature 😅

ekazaev commented 2 years ago

Hi @bagusandinata

I would love to help. Describe your problem. I am using RouteComposer in a modular architecture

bagusandinata commented 2 years ago

a simple example like this @ekazaev

Untitled Diagram drawio (1)

For now I write factory & destinationstep in the module, and the navigation is set in the App.

Sample scenario: Movie List -> Movie Detail -> Movie Favorite -> Movie Detail Movie Favorite -> Movie Detail

Can you help me, best way to implement routecomposer ? like where should I put the factory, destinationstep, and DefaultRouter().

fyi: I'm migrating monolithic to modular in stages, so not all features are modularized. There's no problem when I use routecomposer in monolithic, so I try to implement in modular too 😅

ekazaev commented 2 years ago

@bagusandinata Can you help me to understand something. Do you have every screen in a separate module? If so, then make a Context object and a ViewController public. But DefaultRouter should stay in the main app I assume, if those modules need some navigation - they also need to expose some routing delegate that will be implemented in the main module and below will call Default Router

bagusandinata commented 2 years ago

Thanks @ekazaev , I get it 😁 I forgot to check the example, apparently there is a modular implementation