I have a problem dealing with the return of some info from a module that has been presented by another module. In my case I have two modules, Map and Search. The MapView
notifies that it wants to search an address, so the MapPresenter
begins the actions to show the Search module (its view is shown modally). Inside the Search module I make a text search, obtain the results, show it and select one. That selection has to be returned to the Map module. How can I achieve that without breaking boundaries?
Taking into account, and please correct me if I'm wrong, that the communication between modules has to be achieved only via routing (not "jumping" between modules with notifications, completion blocks and so on), I implemented this scenario:
(Sorry, maybe a sequence diagram would be better)
MapWireframe
implements the regular interface but also another one I called MapModuleInput
, so when I begin the search action (blue) I pass to the SearchWireframe
the MapWireframe
implementing that interface.
After that, in the red flow, in the SearchView
I begin the search case, it obtains the results from the interactor, etc. After that the results are presented and the user selects one (green), so the selected result is returned to the map via the MapModuleInput
interface.
So, is that correct?
Thank you!