Reputation: 9054
If I have UIViewController1
and I have it present UIViewController2
modally, but I then want UIViewController2
to present UIViewController1
modally as well but with slightly different functionality, what is best practice for re-usal? I not only want the UI Elements
to be similar, but most of the logic should be the same as well. The one key difference is that the second time UIViewController1
is presented, it will be using a different Prototype UITableViewCell
.
Edit
Is it ok to have a loop in navigation workflow?
Upvotes: 1
Views: 68
Reputation: 45490
Just reuse the class again, Drag n drop a new ViewController
to your Storyboard and re-assign it the same controller class.
Best practice is not to mix logic with UI
so you can reuse it, that's all MVC
is about
Upvotes: 2
Reputation: 8176
If the difference of UITableViewCell is only layout and presentation layer difference I would just use the same UIViewController1
and define two separate cell identifier and logic in cellForRow...
Upvotes: 0