-
Notifications
You must be signed in to change notification settings - Fork 3
Dependency
apleshkov edited this page Jul 26, 2018
·
1 revision
// @saber.container(AppContainer)
// @saber.scope(App)
protocol AppContaining {}
// @saber.scope(App)
class NetworkManager {
}
// @saber.container(UserContainer)
// @saber.scope(User)
// @saber.dependsOn(AppContainer)
protocol UserContaining {}
// @saber.scope(User)
class UserAPI {
init(networkManager: NetworkManager) {
// ...
}
}
Generated:
internal class UserContainer: UserContaining {
internal unowned let appContainer: AppContainer
internal init(appContainer: AppContainer) {
self.appContainer = appContainer
}
internal var userAPI: UserAPI {
let userAPI = self.makeUserAPI()
return userAPI
}
private func makeUserAPI() -> UserAPI {
return UserAPI(networkManager: self.appContainer.networkManager)
}
}
- User's Guide
- Advanced