Skip to content

Commit

Permalink
[FEAT] Challenge Coordinator에서 Adaptor 생성 분리 (#155)
Browse files Browse the repository at this point in the history
  • Loading branch information
ffalswo2 committed Oct 19, 2023
1 parent 4b67d5d commit 93c0e8e
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@

import Foundation

typealias EntireChallengeNavigation = ChallengeNavigation

final class ChallengeAdaptor: ChallengeNavigation {
final class ChallengeAdaptor: EntireChallengeNavigation {

let coordinator: ChallengeCoordinator

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,7 @@ final class ChallengeCoordinatorImpl: ChallengeCoordinator {
}

func showChallengeViewController() {
let adaptor = ChallengeAdaptor(coordinator: self)
let challengeViewController = factory.makeChallengeViewController(adaptor: adaptor)
let challengeViewController = factory.makeChallengeViewController(coordinator: self)
navigationController.pushViewController(challengeViewController, animated: true)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,13 @@
import Foundation

struct ChallengeFactoryImpl: ChallengeFactory {
func makeChallengeViewController(adaptor: ChallengeAdaptor) -> ChallengeViewControllerable {
func makeAdaptor(coordinator: ChallengeCoordinator) -> ChallengeAdaptor {
let adaptor = ChallengeAdaptor(coordinator: coordinator)
return adaptor
}

func makeChallengeViewController(coordinator: ChallengeCoordinator) -> ChallengeViewControllerable {
let adaptor = self.makeAdaptor(coordinator: coordinator)
return ChallengeViewController(manager: ChallengeManagerImpl(challengeService: ChallengeServiceImpl(apiService: APIService())), navigator: adaptor)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,6 @@
import Foundation

protocol ChallengeFactory {
func makeChallengeViewController(adaptor: ChallengeAdaptor) -> ChallengeViewControllerable
func makeAdaptor(coordinator: ChallengeCoordinator) -> ChallengeAdaptor
func makeChallengeViewController(coordinator: ChallengeCoordinator) -> ChallengeViewControllerable
}

0 comments on commit 93c0e8e

Please sign in to comment.