mirror of
https://github.com/otaviocc/Triton.git
synced 2026-01-29 19:54:27 +00:00
35 lines
730 B
Swift
35 lines
730 B
Swift
import MicroContainer
|
|
import SessionServiceInterface
|
|
|
|
struct AccountEnvironment {
|
|
|
|
// MARK: - Properties
|
|
|
|
var viewModelFactory: ViewModelFactory {
|
|
container.resolve()
|
|
}
|
|
|
|
private let container = DependencyContainer()
|
|
|
|
// MARK: - Lifecycle
|
|
|
|
init(
|
|
sessionService: any SessionServiceProtocol
|
|
) {
|
|
container.register(
|
|
type: (any SessionServiceProtocol).self,
|
|
allocation: .dynamic
|
|
) { _ in
|
|
sessionService
|
|
}
|
|
|
|
container.register(
|
|
type: ViewModelFactory.self,
|
|
allocation: .static
|
|
) { container in
|
|
ViewModelFactory(
|
|
container: container
|
|
)
|
|
}
|
|
}
|
|
}
|