As shown in the image, in the ViewController1 is a UiTableView. Both Cells present a new ViewController which is the same in both cases. ViewController2. The presented ViewController2 now presents two different ViewControllers. ViewController3 or ViewController4. How do I tell ViewController2 which of the two ViewControllers have to be presented, based on the TableView Cell selected in the ViewController1.
Currently I duplicated ViewController2 and just called them different names, but I think their has to be a better method.

The simplest method would be to have some kind of enum to distinguish the navigation
and to have this property in the
SecondViewController:Of course, you can make the property public / internal and avoid using setter function, but I find it more correct.
After that, when you push your
SecondViewControllerinFirstViewControlleryou can set the desired enum case. And handle it inSecondViewControllerwhen you pushThird/FourthVC.