krzyzanowskim / Natalie

Natalie - Storyboard Code Generator (for Swift)
http://blog.krzyzanowskim.com/2015/04/15/natalie-storyboard-code-generator/
MIT License
1.17k stars 74 forks source link

identifiers without custom view controllers are not generated #36

Open Marwan-Al-Masri opened 9 years ago

Marwan-Al-Masri commented 9 years ago

some view controllers don't really need a custom class (at least in my case), so with your awesome script (which helped a lot), I can't get to those VCs without knowing their identifier by code.. wouldn't it be more helpful if you generate the "identifiers" of those VCs into an enum or smthn?

phimage commented 9 years ago

The normal code generated if custom class is defined for the Segue is

extension ScreenThreeViewController {
    enum Segue: String, Printable, SegueProtocol {
       case ToChildOfThreeView = "ToChildOfThreeView"

Now by defining only a storyboardIdentifier on view controller, for the example 'ScreenThreeViewController' , we could generate

extension XXX {
    struct ScreenThreeViewController {
        enum Segue: String, Printable, SegueProtocol {
            case ToChildOfThreeView = "ToChildOfThreeView"

with XXX =

with this last choice, in bonus we can have Storyboards.Main.ViewControllers.ScreenThreeViewController.instantiate()