Skip to content

Sharing singleton scope when deriving a new injector  #81

Description

@StatusReport

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions