samedi 30 janvier 2016

swift reusability of ViewControllers

There are multiple view controllers in my current project that are used more than once in the app. My question is, how should I go about approaching reusing view controllers? So far I've thought of 3 possible ways:

  • Write the controller completely in code
  • Create the controller in the storyboard as usual, give it a storyboard id and call `instantiateViewControllerWithId:'
  • Create the controller in a nib file and load it up from nib.

My question becomes: What are the pros and cons of each method? Which one is cleaner in terms of maintenance and lastly which one would you, as a savvy/professional iOS app developper, favour?

Aucun commentaire:

Enregistrer un commentaire