hmlongco / Factory

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

Typo in code example (Modular Development) #121

Closed FrankSolleveld closed 1 year ago

FrankSolleveld commented 1 year ago

Hi there!

Thanks for this package and it's awesome documentation! I've been checking out Modular Development, and I might be misunderstanding, but it feels like there is a typo in one code example.

It regards the examples shown in this specific section:

// Public Factory
extension Container {
    public var accountLoading: Factory<AccountLoading?> { self { nil } }
}

And later:

import ModuleP
import ModuleA
import ModuleB

extension Container: AutoRegistering {
    func autoRegister {
        accountLoader.register { AccountLoader() }
        ...
    }
}

I feel like the accountLoading name should be changed to accountLoader or the other way around, because Factory does not know of any accountLoader in the autoRegister method after having followed your example. I added a sample repo here for you to verify.

Happy to provide any addition info :)

hmlongco commented 1 year ago

Yep. That was a mistake. Fixed in 2.2.0.

Appreciate you taking the time to report it!