Skip to content

Commit

Permalink
[Feat] sopt-makers#329 - Repository 주입
Browse files Browse the repository at this point in the history
  • Loading branch information
lsj8706 committed Dec 21, 2023
1 parent ec4ff88 commit cb934b8
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -143,5 +143,12 @@ extension AppDelegate {
)
}
)
container.register(interface: PokeMyFriendsRepositoryInterface.self,
implement: {
PokeMyFriendsRepository(
service: DefaultPokeService()
)
}
)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import Domain

public final class PokeBuilder {
@Injected public var pokeMainRepository: PokeMainRepositoryInterface
@Injected public var pokeMyFriendsRepository: PokeMyFriendsRepositoryInterface

public init() {}
}
Expand All @@ -25,7 +26,8 @@ extension PokeBuilder: PokeFeatureBuildable {
}

public func makePokeMyFriends() -> PokeFeatureInterface.PokeMyFriendsPresentable {
let viewModel = PokeMyFriendsViewModel()
let useCase = DefaultPokeMyFriendsUseCase(repository: pokeMyFriendsRepository)
let viewModel = PokeMyFriendsViewModel(useCase: useCase)
let pokeMyFriendsVC = PokeMyFriendsVC(viewModel: viewModel)

return (pokeMyFriendsVC, viewModel)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ public class PokeMyFriendsViewModel:

// MARK: - Properties

private let useCase: PokeMyFriendsUseCase
private var cancelBag = CancelBag()

// MARK: - Inputs
Expand All @@ -34,8 +35,8 @@ public class PokeMyFriendsViewModel:

// MARK: - initialization

public init() {

public init(useCase: PokeMyFriendsUseCase) {
self.useCase = useCase
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,5 +143,12 @@ extension AppDelegate {
)
}
)
container.register(interface: PokeMyFriendsRepositoryInterface.self,
implement: {
PokeMyFriendsRepository(
service: DefaultPokeService()
)
}
)
}
}

0 comments on commit cb934b8

Please sign in to comment.