Setting up the target ViewController without Segues
I am using Clean-Swift architecture (Clean-Swift page ). I saw that I can use most of the ViewController interface I have. For example, I have one ViewController to load one image. Until there are many ViewControllers, this is chaos creating segues from all over the place to them.
I know you can instantiate the target ViewController and then push it, but it will give up the Clean-Swift philosophy as scenes can only send data through a router. But the passDataToNextScene function requires the Segue as parameter.
So, I would like to know if there is a way that gives two scenes with its respectful routers, with any segue generated via StoryBoard sending data to the targets view manager.
Thank.
source to share
Instead of using a segue, let the router get data from the current interactor (define the protocol RouterDatasource
that matches Interactor
), and let the router configure the destination view controller:
// Router code
...
let requiredData = datasource.getRequiredData()
destinationViewController.requiredData = requiredData
...
source to share