We have a scenario where we want to derive a new injector from an existing one with additional modules when displaying a new view controller. The existing injector has singleton instances that are already cached within it, and we need to use the same instance of them in the new injector.
Currently, using withModuleOfType: will create a new injector with the same global context, but with new injection entries that will create new instances of the singletons upon request.
It makes sense to me that derives injectors will produce the same singletons of the original injector, since we want to inherit the behavior of the original injector, including its context. What do you think?
Additionally, if anyone got any idea on how to overcome this in a different, elegant way, I'd be happy to know.
We have a scenario where we want to derive a new injector from an existing one with additional modules when displaying a new view controller. The existing injector has singleton instances that are already cached within it, and we need to use the same instance of them in the new injector.
Currently, using
withModuleOfType:
will create a new injector with the same global context, but with new injection entries that will create new instances of the singletons upon request.It makes sense to me that derives injectors will produce the same singletons of the original injector, since we want to inherit the behavior of the original injector, including its context. What do you think?
Additionally, if anyone got any idea on how to overcome this in a different, elegant way, I'd be happy to know.