hmlongco / Factory

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

Refactor getting a factory given the context #105

Closed doozMen closed 1 year ago

doozMen commented 1 year ago

Functionally nothing changed just the early exit pattern with lots of ifs is split into multiple functions.

This is so the intention and hierarchy of how a context would map to a factory would be clear while reading the function.

hmlongco commented 1 year ago

If you look into the develop branch you'll see that some of that code has already been refactored to avoid the extra coping of options along with the associated retain cycles on the arrays.

doozMen commented 1 year ago

I'm looking into develop and phase similar issues. I tried to make a small pr and build on that to add a feature I need. I will make this feature on top of develop then.

doozMen commented 1 year ago

I do think even in develop the way the context is considered look for a factory could benefit from a code path with less early returns.