1

In my code I have many pushViewController() (with instantiateViewController() and other stuff) methods in one ViewController. I am just thinking how I can avoid repeating on this chunk of code and make it more clear and dry.

I have found protocol solution here https://stackoverflow.com/a/43124539/6866265

It looks nice but I would like to see other options. Thanks

Nikolai Prokofev
  • 184
  • 3
  • 14
  • 1
    you can just do an extension of UIViewController maybe? – koropok Aug 25 '17 at 03:36
  • protocol won't help you with this, because you still need reimplement it's methods every time. If all your `pushViewController` calls are exactly the same then you can extend `UIViewController`, as @koropok suggested. – thedp Aug 25 '17 at 07:42

0 Answers0