Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

View controller inject using initializer with storyboard #270

Closed
7ynk3r opened this issue Oct 30, 2014 · 4 comments
Closed

View controller inject using initializer with storyboard #270

7ynk3r opened this issue Oct 30, 2014 · 4 comments

Comments

@7ynk3r
Copy link

7ynk3r commented Oct 30, 2014

I'm almost sure that is not possible but just to get the confirmation.

I want to use an initializer for a view controller as follow:

- (ChildViewController *)childViewController {
    return [TyphoonDefinition withClass:[ChildViewController class] configuration:^(TyphoonDefinition *definition) {
        [definition useInitializer:@selector(initWithData:) parameters:^(TyphoonMethod *initializer) {
            // self.data is defined somewhere.
            [initializer injectParameterWith:self.data];
        }];
    }];
}

But I want to create it using a storyboard.

UIStoryboard *board = [TyphoonStoryboard storyboardWithName:@"AStoryBoardName" factory:factory bundle:[NSBundle mainBundle]];

Is this possible? It worked with property injection.

@7ynk3r
Copy link
Author

7ynk3r commented Oct 30, 2014

Something similar happened to me with the appDelegate, only property injection worked. Maybe because we don't have control over the instance creation.

@jasperblues
Copy link
Member

Hi @7ynk3r Juan,

If I understood the question correctly, this answer on Stack Overflow should help: http://stackoverflow.com/a/24227246/404201

And the applicable section in this user guide: https://github.com/typhoon-framework/Typhoon/wiki/Types-of-Injections#injecting-objects-produced-by-other-components

Does this work for you?

Feel free to ask questions of a general nature on StackOverflow. . if need be, from there we can raise a new Feature or Bug ticket in Github.

@7ynk3r
Copy link
Author

7ynk3r commented Oct 31, 2014

Hi @jasperblues, thanks for the prompt response. I've added my question with clarifications in stackoverflow.

http://stackoverflow.com/questions/26678620/typhoon-using-storyboard-with-view-controller-initializers

@jasperblues
Copy link
Member

Great, I saw the question and good answer on SO.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants