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

Multiple instances injected into view controller when using storyboard reference #599

Closed
sergkovb opened this issue Mar 17, 2019 · 2 comments

Comments

@sergkovb
Copy link
Contributor

There is a problem with multiple property injection when detail view controller is loaded via a storyboard reference

Снимок экрана 2019-03-13 в 15 17 00

2019-03-13 15:11:16.919842+0300 TyphoonIssue[21295:445597] FirstViewController.initWithCoder
2019-03-13 15:11:16.924133+0300 TyphoonIssue[21295:445597] Model.init
2019-03-13 15:11:16.924500+0300 TyphoonIssue[21295:445597] FirstViewController.setModel: self = <FirstViewController: 0x7fefecb03800>, model = <Model: 0x60000249e560>
2019-03-13 15:11:20.583246+0300 TyphoonIssue[21295:445597] SecondViewController.initWithCoder
2019-03-13 15:11:20.583561+0300 TyphoonIssue[21295:445597] Model.init
2019-03-13 15:11:20.583764+0300 TyphoonIssue[21295:445597] SecondViewController.setModel: self = <SecondViewController: 0x7fefeae22b20>, model = <Model: 0x60000249e9c0>
2019-03-13 15:11:20.584012+0300 TyphoonIssue[21295:445597] Model.init
2019-03-13 15:11:20.584163+0300 TyphoonIssue[21295:445597] SecondViewController.setModel: self = <SecondViewController: 0x7fefeae22b20>, model = <Model: 0x6000024b8180>

https://github.com/sergkovb/Typhoon-issue

There is a similar problem here #505

sergkovb added a commit to sergkovb/typhoon that referenced this issue Mar 17, 2019
@sergkovb
Copy link
Contributor Author

sergkovb commented Mar 17, 2019

I suggest we fix the bug this way #600

I added this condition

if (storyboard && viewController.storyboard && ![viewController.storyboard isEqual:storyboard]) {
return;
}

to TyphoonViewControllerInjector.m

and added tests for this issue and #505

alexgarbarev added a commit that referenced this issue Mar 18, 2019
…injected-into-view-controller-when-using-storyboard-reference

Bugfix/#599 multiple instances injected into view controller when using storyboard reference
@alexgarbarev
Copy link
Contributor

Thanks @sergkovb, your changes were deployed as 4.0.8 to CocoaPods.

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