With Swift I should be able to initialise a Service with its dependencies for example RepositoryA and RepositoryB
Let's say the Service should be transient and the repositories are singletons
All I could find was this:
https://github.com/appsquickly/Typhoon/wiki/Types-of-Injections#injection-with-run-time-arguments
But I'm missing a swift sample for the initialiser of the Service and for the container with initWithParameter using the initialiser that has several parameters
Any code available ?
To perform an initializer injection with Typhoon, use the equivalent Swift code for the example shown in the user guide. It looks like this:
public dynamic func citiesListController() -> AnyObject {
return TyphoonDefinition.withClass(CitiesListViewController.self) {
(definition) in
definition.useInitializer("initWithCityDao:theme:") {
(initializer) in
initializer.injectParameterWith(self.coreComponents.cityDao())
initializer.injectParameterWith(self.themeAssembly.currentTheme())
}
}
}
The Typhoon Swift sample application, from which the above code was taken, shows further examples.