-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Feat] #392 - DailySoptuneCardCoordinator 생성
- Loading branch information
1 parent
4c4260a
commit b76e5e7
Showing
8 changed files
with
173 additions
and
17 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
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
49 changes: 49 additions & 0 deletions
49
...ojects/Features/DailySoptuneFeature/Sources/Coordinator/DailySoptuneCardCoordinator.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,49 @@ | ||
// | ||
// DailySoptuneCardCoordinator.swift | ||
// DailySoptuneFeature | ||
// | ||
// Created by Jae Hyun Lee on 9/28/24. | ||
// Copyright © 2024 SOPT-iOS. All rights reserved. | ||
// | ||
|
||
import UIKit | ||
import Combine | ||
|
||
import Core | ||
import BaseFeatureDependency | ||
import DailySoptuneFeatureInterface | ||
import Domain | ||
|
||
public final class DailySoptuneCardCoordinator: DefaultCoordinator { | ||
|
||
public var finishFlow: (() -> Void)? | ||
|
||
private let factory: DailySoptuneFeatureBuildable | ||
private let router: Router | ||
|
||
private let cardModel: DailySoptuneCardModel | ||
|
||
private weak var rootController: UINavigationController? | ||
|
||
public init(router: Router, factory: DailySoptuneFeatureBuildable, cardModel: DailySoptuneCardModel) { | ||
self.router = router | ||
self.factory = factory | ||
self.cardModel = cardModel | ||
} | ||
|
||
public override func start() { | ||
showDailySoptuneCard() | ||
} | ||
|
||
private func showDailySoptuneCard() { | ||
var dailySoptuneCard = factory.makeDailySoptuneCardVC(cardModel: cardModel) | ||
|
||
dailySoptuneCard.vm.onBackButtonTapped = { [weak self] in | ||
self?.router.dismissModule(animated: true) | ||
self?.finishFlow?() | ||
} | ||
|
||
self.rootController = dailySoptuneCard.vc.asNavigationController | ||
self.router.present(self.rootController, animated: true, modalPresentationSytle: .overFullScreen) | ||
} | ||
} |
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
67 changes: 67 additions & 0 deletions
67
...s/DailySoptuneFeature/Sources/DailySoptuneScene/ViewModel/DailySoptuneCardViewModel.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,67 @@ | ||
// | ||
// DailySoptuneCardViewModel.swift | ||
// DailySoptuneFeature | ||
// | ||
// Created by Jae Hyun Lee on 9/28/24. | ||
// Copyright © 2024 SOPT-iOS. All rights reserved. | ||
// | ||
|
||
import Foundation | ||
import Combine | ||
|
||
import Core | ||
import Domain | ||
|
||
import DailySoptuneFeatureInterface | ||
|
||
public final class DailySoptuneCardViewModel: DailySoptuneCardViewModelType { | ||
|
||
public var onGoToHomeButtonTapped: (() -> Void)? | ||
public var onBackButtonTapped: (() -> Void)? | ||
|
||
// MARK: - Properties | ||
|
||
private let useCase: DailySoptuneUseCase | ||
private var cancelBag = CancelBag() | ||
|
||
// MARK: - Inputs | ||
|
||
public struct Input { | ||
let goToHomeButtonTap: Driver<Void> | ||
let backButtonTap: Driver<Void> | ||
} | ||
|
||
// MARK: - Outpust | ||
|
||
public struct Output { | ||
|
||
} | ||
|
||
// MARK: - initialization | ||
|
||
public init(useCase: DailySoptuneUseCase) { | ||
self.useCase = useCase | ||
} | ||
} | ||
|
||
extension DailySoptuneCardViewModel { | ||
|
||
public func transform(from input: Input, cancelBag: CancelBag) -> Output { | ||
let output = Output() | ||
|
||
input.goToHomeButtonTap | ||
.withUnretained(self) | ||
.sink { _ in | ||
self.onGoToHomeButtonTapped?() | ||
}.store(in: cancelBag) | ||
|
||
input.backButtonTap | ||
.withUnretained(self) | ||
.sink { _ in | ||
self.onBackButtonTapped?() | ||
}.store(in: cancelBag) | ||
|
||
return output | ||
} | ||
|
||
} |
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