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] Detail Coordinator 세팅 DO-SOPT-iOS-Part#20
- Loading branch information
Showing
7 changed files
with
100 additions
and
52 deletions.
There are no files selected for viewing
14 changes: 14 additions & 0 deletions
14
Projects/Features/DetailFeature/Interface/Sources/DetailFeatureViewBuildable.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,14 @@ | ||
// | ||
// DetailFeatureViewBuildable.swift | ||
// DetailFeatureInterface | ||
// | ||
// Created by 류희재 on 7/5/24. | ||
// Copyright © 2024 Weather-iOS. All rights reserved. | ||
// | ||
|
||
import Core | ||
|
||
public protocol DetailFeatureViewBuildable { | ||
func makeDetail() -> DetailPresentable | ||
} | ||
|
16 changes: 14 additions & 2 deletions
16
Projects/Features/DetailFeature/Interface/Sources/DetailPresentable.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 |
---|---|---|
@@ -1,8 +1,20 @@ | ||
// | ||
// DetailPresentable.swift | ||
// DetailFeatureManifests | ||
// DetailFeatureInterface | ||
// | ||
// Created by 류희재 on 6/28/24. | ||
// Created by 류희재 on 7/5/24. | ||
// Copyright © 2024 Weather-iOS. All rights reserved. | ||
// | ||
|
||
import Foundation | ||
|
||
import BaseFeatureDependency | ||
import Core | ||
|
||
public protocol DetailViewControllable: ViewControllable { } | ||
public protocol DetailCoordinatable {} | ||
|
||
public typealias DetailViewModelType = ViewModelType & DetailCoordinatable | ||
public typealias DetailPresentable = (vc: DetailViewControllable, vm: any DetailViewModelType) | ||
|
||
|
36 changes: 0 additions & 36 deletions
36
Projects/Features/DetailFeature/Sources/Coordinator/DefaultDetailCoordinator.swift
This file was deleted.
Oops, something went wrong.
32 changes: 32 additions & 0 deletions
32
Projects/Features/DetailFeature/Sources/Coordinator/DetailBuilder.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,32 @@ | ||
// | ||
// DetailBuilder.swift | ||
// DetailFeatureInterface | ||
// | ||
// Created by 류희재 on 7/5/24. | ||
// Copyright © 2024 Weather-iOS. All rights reserved. | ||
// | ||
|
||
import Core | ||
import Domain | ||
|
||
import DetailFeatureInterface | ||
|
||
public | ||
final class DetailBuilder { | ||
public var repository: WeatherRepository | ||
|
||
public init(repository: WeatherRepository) { | ||
self.repository = repository | ||
} | ||
} | ||
|
||
extension DetailBuilder: DetailFeatureViewBuildable { | ||
public func makeMain() -> DetailPresentable { | ||
let useCase = DefaultMainUseCase(repository: repository) | ||
let vm = DetailViewModel(mainUseCase: useCase) | ||
let vc = DetailViewController(viewModel: vm) | ||
vc.viewModel = vm | ||
return (vc, vm) | ||
} | ||
} | ||
|
38 changes: 38 additions & 0 deletions
38
Projects/Features/DetailFeature/Sources/Coordinator/DetailCoordinator.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 @@ | ||
// | ||
// DetailCoordinator.swift | ||
// DetailFeatureInterface | ||
// | ||
// Created by 류희재 on 7/5/24. | ||
// Copyright © 2024 Weather-iOS. All rights reserved. | ||
// | ||
|
||
import BaseFeatureDependency | ||
import Core | ||
|
||
public enum DetailCoordinatorDestination { | ||
case detail | ||
} | ||
public protocol DetailCoordinatorOutput { | ||
var requestCoordinating: ((DetailCoordinatorDestination) -> Void)? { get set } | ||
} | ||
public typealias DefaultDetailCoordinator = BaseCoordinator & DetailCoordinatorOutput | ||
|
||
public | ||
final class DetailCoordinator: DefaultDetailCoordinator { | ||
|
||
public var requestCoordinating: ((DetailCoordinatorDestination) -> Void)? | ||
|
||
private let factory: DetailFeatureViewBuildable | ||
private let router: Router | ||
|
||
public init(router: Router, factory: DetailFeatureViewBuildable) { | ||
self.factory = factory | ||
self.router = router | ||
} | ||
|
||
public override func start() { | ||
var main = factory.makeDetail() | ||
|
||
} | ||
} | ||
|
13 changes: 0 additions & 13 deletions
13
Projects/Features/DetailFeature/Sources/Coordinator/Protocol/DetailCoordinator.swift
This file was deleted.
Oops, something went wrong.
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