-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathDependencyGraph.swift
More file actions
48 lines (38 loc) · 1.55 KB
/
DependencyGraph.swift
File metadata and controls
48 lines (38 loc) · 1.55 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
//
// DependencyGraph.swift
// RoutingExample
//
// Created by Cassius Pacheco on 11/3/20.
// Copyright © 2020 Cassius Pacheco. All rights reserved.
//
import Foundation
import DependencyContainer
final class DependencyGraph {
let container = DependencyContainer()
func registerDependencies() {
setupViewModels()
}
private func setupViewModels() {
container.register(LoginViewModelInterface.self) { (_, routes: LoginViewModel.Routes) in
return LoginViewModel(router: routes)
}
container.register(ForgottenPasswordViewModelInterface.self) { (_, routes: ForgottenPasswordViewModel.Routes) in
return ForgottenPasswordViewModel(router: routes)
}
container.register(SignUpViewModelInterface.self) { (_, routes: SignUpViewModel.Routes) in
return SignUpViewModel(router: routes)
}
container.register(PopUpViewModelInterface.self) { (_, message: String, routes: PopUpViewModel.Routes) in
return PopUpViewModel(message: message, router: routes)
}
container.register(ProductViewModelInterface.self) { (_, routes: ProductViewModel.Routes) in
return ProductViewModel(router: routes)
}
container.register(ShopViewModelInterface.self) { (_, routes: ShopViewModel.Routes) in
return ShopViewModel(router: routes)
}
container.register(WishlistViewModelInterface.self) { (_, routes: WishlistViewModel.Routes) in
return WishlistViewModel(router: routes)
}
}
}