Added the ViewController Storyboard Identifiers to each storyboard #32
Conversation
…iew Controllers are now all grouped in one spot. This way View Controllers can have multiple Storyboard identifiers. It also means we already have the correct type for the initial View Controller.
Related #27 |
It does fix the problem in #27 even though I took a totally different approach. |
Would you mind update README according to this changes ? |
I have already updated the README. |
oh sorry, missed that ;) the PR looks really nice. good work! |
Added the ViewController Storyboard Identifiers to each storyboard
@CallumOz there is a problem with Example project, can you please look at it and PR the fix asap? |
Somehow I missed this. An easy fix is to change: static func MainViewController() -> MainViewController! {
return self.storyboard.instantiateViewControllerWithIdentifier("MainViewController") as! MainViewController
} To: static func instantiateMainViewController() -> MainViewController! {
return self.storyboard.instantiateViewControllerWithIdentifier("MainViewController") as! MainViewController
} If you agree with my fix, I'll add it straight away. |
We'll change that back after they fix it in Swift. The other way is use camel case for function name but nobody will find it then. |
I think this method is probably better anyway, this way all functions for creating a ViewController start with "instantiate". |
Hi,
I modified quite a few things, the main reason was to be able to use the same ViewController class multiple times in different storyboards each with a different Storyboard ID.
This was impossible before because you would end up adding an extension twice to the same class.
Now because the storyboards are structs, it means that I was able to specialise instantiateInitialViewController method so that the return type is the same as the type of the ViewController.
To instantiate a Viewcontroller with id "ListVC" in storyboard Main, you do:
If you have any questions or remarks, my ears are open.