forked from DO-SOPT-iOS-Part/RyuHeeJae_assignment
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Refactor] MainCoordinator 코드 생성 DO-SOPT-iOS-Part#20
- Loading branch information
Showing
9 changed files
with
103 additions
and
73 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 13 additions & 0 deletions
13
Projects/Features/MainFeature/Interface/Sources/MainFeatureViewBuildable.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
// | ||
// MainFeatureViewBuildable.swift | ||
// MainFeatureInterface | ||
// | ||
// Created by 류희재 on 7/5/24. | ||
// Copyright © 2024 Weather-iOS. All rights reserved. | ||
// | ||
|
||
import Core | ||
|
||
public protocol MainFeatureViewBuildable { | ||
func makeMain() -> MainPresentable | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
49 changes: 0 additions & 49 deletions
49
Projects/Features/MainFeature/Sources/Coordinator/DefaultMainCoordinator.swift
This file was deleted.
Oops, something went wrong.
14 changes: 0 additions & 14 deletions
14
Projects/Features/MainFeature/Sources/Coordinator/Protocol/MainCoordinator.swift
This file was deleted.
Oops, something went wrong.
31 changes: 31 additions & 0 deletions
31
Projects/Features/MainFeature/Sources/Cooridinator/MainBuilder.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
// | ||
// MainBuilder.swift | ||
// MainFeatureInterface | ||
// | ||
// Created by 류희재 on 7/5/24. | ||
// Copyright © 2024 Weather-iOS. All rights reserved. | ||
// | ||
|
||
import Core | ||
import Domain | ||
|
||
import MainFeatureInterface | ||
|
||
public | ||
final class MainBuilder { | ||
public var repository: WeatherRepository | ||
|
||
public init(repository: WeatherRepository) { | ||
self.repository = repository | ||
} | ||
} | ||
|
||
extension MainBuilder: MainFeatureViewBuildable { | ||
public func makeMain() -> MainPresentable { | ||
let useCase = DefaultMainUseCase(repository: repository) | ||
let vm = MainViewModel(mainUseCase: useCase) | ||
let vc = MainViewController(viewModel: vm) | ||
vc.viewModel = vm | ||
return (vc, vm) | ||
} | ||
} |
38 changes: 38 additions & 0 deletions
38
Projects/Features/MainFeature/Sources/Cooridinator/MainCoordinator.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
// | ||
// MainCoordinator.swift | ||
// MainFeatureInterface | ||
// | ||
// Created by 류희재 on 7/5/24. | ||
// Copyright © 2024 Weather-iOS. All rights reserved. | ||
// | ||
|
||
import BaseFeatureDependency | ||
import Core | ||
|
||
public enum MainCoordinatorDestination { | ||
case detail | ||
} | ||
public protocol MainCoordinatorOutput { | ||
var requestCoordinating: ((MainCoordinatorDestination) -> Void)? { get set } | ||
} | ||
public typealias DefaultMainCoordinator = BaseCoordinator & MainCoordinatorOutput | ||
|
||
public | ||
final class MainCoordinator: DefaultMainCoordinator { | ||
|
||
public var requestCoordinating: ((MainCoordinatorDestination) -> Void)? | ||
|
||
private let factory: MainFeatureViewBuildable | ||
private let router: Router | ||
|
||
public init(router: Router, factory: MainFeatureViewBuildable) { | ||
self.factory = factory | ||
self.router = router | ||
} | ||
|
||
public override func start() { | ||
var main = factory.makeMain() | ||
|
||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters