Skip to content

Instantly share code, notes, and snippets.

@ivangodfather
Created March 4, 2015 13:41
Show Gist options
  • Save ivangodfather/e78217b175ba616d27ee to your computer and use it in GitHub Desktop.
Save ivangodfather/e78217b175ba616d27ee to your computer and use it in GitHub Desktop.
I want to use some different templates (say like 5) for every viewController in my App.
There are some different approaches i can think of:
1-> have 5 different storyboards repeating the same navigation in each of them. Since the app may/would change, im discard this option since i have to redo in 5 storyboards every change i made in the navigation.
2- Have a storyboard with all the VCs and the relation between them, and for each VC have a containerView, where i instantiate from other Storyboards the viewControllers inside the container. The other storyboards only will have the vcs without navigation, just separate scenes.(The cons here is that i need a VC for the container just setting the content of the container, so for every scene i need 1 containerVC, and another VC that is actually the real code that all the vc share)
3- Having the same storyboard and creating 5 xibs for each scene in the storyboard, so ill set the file owner to the current vc in the storyboard, and i add a subview like:
view.addSubview(NSBundle.mainBundle().loadNibNamed(“Template1_First_Screen”, owner: self, options: nil).first! as UIView)
The down here maybe is that they are less maintained by apple and can be outdated?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment