-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathRootBuilder.swift
More file actions
68 lines (52 loc) · 1.66 KB
/
Copy pathRootBuilder.swift
File metadata and controls
68 lines (52 loc) · 1.66 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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
//
// RootBuilder.swift
// RootFeature
//
// Created by kimnahun on 2026-01-21.
// Copyright © 2026 NDGL-iOS. All rights reserved.
//
import Domain
import MainFeature
import RIBs
// MARK: - RootDependency
public protocol RootDependency: Dependency {
var homeUsecase: HomeUsecaseProtocol { get }
var followDetailUsecase: FollowDetailUsecaseProtocol { get }
var authRepository: AuthRepositoryInterface { get }
var tokenRepository: TokenRepositoryProtocol { get }
}
// MARK: - RootComponent
final class RootComponent: Component<RootDependency>, MainDependency {
var followDetailUsecase: FollowDetailUsecaseProtocol {
dependency.followDetailUsecase
}
var homeUsecase: HomeUsecaseProtocol {
dependency.homeUsecase
}
}
// MARK: - RootBuildable
public protocol RootBuildable: Buildable {
func build() -> LaunchRouting
}
// MARK: - RootBuilder
public final class RootBuilder: Builder<RootDependency>, RootBuildable {
override public init(dependency: RootDependency) {
super.init(dependency: dependency)
}
public func build() -> LaunchRouting {
let component = RootComponent(dependency: dependency)
let viewController = RootViewController()
let interactor = RootInteractor(
presenter: viewController,
authRepository: dependency.authRepository,
tokenRepository: dependency.tokenRepository
)
let mainBuilder = MainBuilder(dependency: component)
let router = RootRouter(
interactor: interactor,
viewController: viewController,
mainBuilder: mainBuilder
)
return router
}
}