-
-
Notifications
You must be signed in to change notification settings - Fork 121
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
Unexpected Behavior with viewDidLoad in Inject Due to Early addAsChild Invocation #104
Comments
Can you test if it works well for you if you delay the addAsChild call to host viewDidLoad callback? if you don't see issues with that we could change it in upstream |
Code example: let demoVCHost = Inject.ViewControllerHost(DemoViewController(conversation: selectedConversation))
// demoVCHost.someValue = ... // someValue is used in viewDidLoad method
navigationController?.pushViewController(demoVCHost, animated: true) In this setup, calling I'm currently unsure how to modify this to resolve the issue. |
Couldn't we just do add subview in viewDidLoad of the host? |
I try to place the necessary values, like |
I'm having trouble also in my VIPER project due to this, is there any way to avoid this? Passing the arguments through the init solves part of them, but since I need to give the references afterwards, I might find myself with missing references depending on the timing |
I ended up removing the I noticed that the tab bar icons and texts broke with this change, I ended up moving back part of the add child implementation: main...raulolmedocheca:Inject:main |
Inject is great for efficiently adjusting the UI, but I've encountered some side effects. Specifically, viewDidLoad is called early due to the addAsChild invocation, which leads to some properties set after initialization not being effective in viewDidLoad. This behavior can cause issues with certain setup configurations and property initializations that rely on the typical lifecycle sequence.
The text was updated successfully, but these errors were encountered: