SimpleInjector
要求
iOS 8.0+
安装
SimpleInjector可通过CocoaPods访问。要安装它,只需将以下行添加到Podfile中即可
pod 'SimpleInjector'
使用
protocol FooService {}
class FooServiceImplementation: RandomService {}
class Bar {
let fooService: FooService
init(injector: Injector) {
fooService = injector.dependency()
}
}
let fooService = FooServiceImplementation()
let injector = Injector([fooService])
let bar = Bar(injector: injector)
作者
Tancrède Chazallet, [email protected]
许可证
SimpleInjector 可以在 MIT 许可证下使用。更多信息请查看 LICENSE 文件。