Configurator.shared.regist(type: SampleInteractorPtorocol.self, instance: SampleInteractor())
protocol SampleInteractorPtorocol {
func doSomething()
}
class ViewController: UIViewController {
lazy var interactor = Configurator.shared.inject(type: SampleInteractorPtorocol.self)
override func viewDidLoad() {
super.viewDidLoad()
interactor?.doSomething()
}
}
class SampleInteractor : SampleInteractorPtorocol {
func doSomething() {
print("doing something")
}
}
- Very simple one source file : Configurator Source Code