I am loading view controllers from TyphoonStoryboard and have a definition for the class which works fine, several properties are injected with no problems. However one of the properties is a view which itself has a delegate property which I want to be the view controller instance. When the view comes to set the delegate property it tries to create a new instance of the view controller instead of using the instance which has been created by the storyboard. How can I make the delegate property use the current instance of the view controller? My definitions look something like this:
- (id)viewController
{
return [TyphoonDefinition withClass:[MyViewController class]
configuration:^(TyphoonDefinition *definition) {
[definition injectProperty:@selector(view) with:[self myView]];
}];
}
- (id)myView
{
return [TyphoonDefinition withClass:[MyView class]
configuration:^(TyphoonDefinition *definition) {
[definition injectProperty:@selector(delegate)
with:[self viewController]];
}];
}
From what I can see the view controller can never be used a reference as it doesn't added a shared reference anywhere and Typhoon has no option but to instantiate a new one?