hmlongco / Factory

A new approach to Container-Based Dependency Injection for Swift and SwiftUI.
MIT License
1.7k stars 107 forks source link

Allows to disable auto registration #181

Closed doozMen closed 4 months ago

doozMen commented 5 months ago

When multiple registrations from different modules are needed it is more optimal to handle the registrations yourself instead of relying on autoregistrations.

But in the case of only one module loaded then autoRegistration is preferable.

Allowing this on the public interface would allow this behaviour to be configurable

hmlongco commented 5 months ago

Guess I'm missing something here. If you don't want auto registration behavior then don't make the container conform to AutoRegistering.

doozMen commented 5 months ago

I have several libraries that all have autoregistration when used individually. I have 1 library that includes them all. This is a library used in testing applications that have the requirement to be able to switch at runtime, the production app does not. So the auto registration in the 1 library that includes them all is redundant, as I need to register all anyway. Sorry should have added context.