Pure
Pure copied to clipboard
Minimal example
Hi,
Can you provide a minimal example ?
I don't get how to access dependencies, shouldn't Module have properties for dependencies and payload ? What the point of providing default initializers if dependencies / payload are thrown away ?
Hi, you can store dependency in the initializer like this if you needed to access the dependency after the initializing.
import UIKit
import Pure
final class SomeViewController: UIViewController, FactoryModule {
// MARK: Module
struct Dependency {
...
}
struct Payload {
...
}
// MARK: Properties
private let dependency: Dependency
// MARK: Initializing
init(dependency: Dependency, payload: Payload) {
self.dependency = dependency
super.init()
// Do initializing
}
...
}
I hope this is what you intended. 😃
Better late than never 😄
https://github.com/devxoul/Pure/pull/15 (example without Pure - Lazy Dependency)
https://github.com/devxoul/Pure/pull/14 (example with Pure)