strongself / Generamba

This codegenerator is too brilliant to be real!
MIT License
1.82k stars 183 forks source link

View controller as IBOutlet #192

Open emil622 opened 7 years ago

emil622 commented 7 years ago

I see the template has an Initialiser class which has a View controller as IBOutlet property. How am I supposed to connect the VC as IBOutlet? I never did this and couldn't find someone who did it.

Any help will be appreciated, Thanks.

piv199 commented 7 years ago

You could do it in xib, as far as I am concerned.

ghost commented 7 years ago

When you're using storyboards you could add Object to the scene:

zrzut ekranu 2017-08-12 o 08 55 15

Then connect view controller from your initializer object to view controller in storyboard:

zrzut ekranu 2017-08-12 o 08 57 26

That should work.

josmanperez commented 6 years ago

Hi!,

I'm trying to launch a view controller from within AppDelegate, but I'm not able to do it yet. If I just instantiate the ViewController and added that to the rootViewController like:

window?.rootViewController = TestViewController()

I has an empty black screen (because It's not connected to the Storyboard), but if I use:

window?.rootViewController = TestModuleInitializer().testViewController

I got an exception:

*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Application windows are expected to have a root view controller at the end of application launch'

I'm very new to VIPER and I want to know how I could achieve launching a ViewController from the AppDelegate using the Storyboard and the ModuleInitializer.

Thank you :)

Regards