From 8fbc4443eeca0f56f50b0300b782df732d0299d9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EB=B0=95=EC=A4=80=ED=95=98?= Date: Wed, 28 Feb 2024 00:40:32 +0900 Subject: [PATCH 1/8] =?UTF-8?q?=F0=9F=9A=AB::=20[#255]=20=EC=95=88?= =?UTF-8?q?=EC=93=B0=EB=8A=94=20flow=20=EC=82=AD=EC=A0=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../RootFeature/Sources/StartFlow.swift | 23 ------------------- 1 file changed, 23 deletions(-) delete mode 100644 Projects/Features/RootFeature/Sources/StartFlow.swift diff --git a/Projects/Features/RootFeature/Sources/StartFlow.swift b/Projects/Features/RootFeature/Sources/StartFlow.swift deleted file mode 100644 index 5e47a3af..00000000 --- a/Projects/Features/RootFeature/Sources/StartFlow.swift +++ /dev/null @@ -1,23 +0,0 @@ -import UIKit -import AuthFeature -import RxFlow -import RxSwift -import RxCocoa - -class StartFlow: Flow { - var root: Presentable { - return self.rootViewController - } - - private let rootViewController = UINavigationController() - - init() { - let viewController = StartViewController(StartViewModel()) - viewController.view.backgroundColor = .white - rootViewController.setViewControllers([viewController], animated: false) - } - - func navigate(to step: Step) -> FlowContributors { - return .none - } -} From ee39c8fe52e66225c7ec27b2d74d831aa4fe3474 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EB=B0=95=EC=A4=80=ED=95=98?= Date: Wed, 28 Feb 2024 00:43:01 +0900 Subject: [PATCH 2/8] =?UTF-8?q?=F0=9F=8D=97::=20[#255]=20=EC=BD=94?= =?UTF-8?q?=EB=93=9C=20=EB=A6=AC=ED=8E=99=ED=86=A0=EB=A7=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Sources/{ => Coordinator}/Setp/AppStep.swift | 5 +++++ .../Model/Posture/PostureSearchModel.swift | 10 +++++++++- .../SignupScene/VC/NicknameViewController.swift | 2 +- .../TimerScene/Supporter/HomeTimerView.swift | 2 +- .../Supporter/TimerAlarmAlertView.swift | 2 +- .../Supporter/TimerCollectionViewCell.swift | 2 +- .../TimerScene/View/TimerViewController.swift | 6 +++--- .../Supporter/Profile/UserProfileView.swift | 4 ++-- .../RootFeature/Demo/Sources/SceneDelegate.swift | 5 ++++- .../Features/RootFeature/Sources/AppFlow.swift | 4 ++-- .../Features/RootFeature/Sources/HomeFlow.swift | 14 +++++++------- .../Features/RootFeature/Sources/PickleFlow.swift | 2 +- .../RootFeature/Sources/PostureFlow.swift | 2 +- .../Features/RootFeature/Sources/ShopFlow.swift | 2 +- .../HomeScene/SelfCareHomeViewController.swift | 15 ++++++--------- .../ViewModel/SelfCareMyRoutineDetail+VM.swift | 1 + 16 files changed, 46 insertions(+), 32 deletions(-) rename Projects/Core/Sources/{ => Coordinator}/Setp/AppStep.swift (77%) diff --git a/Projects/Core/Sources/Setp/AppStep.swift b/Projects/Core/Sources/Coordinator/Setp/AppStep.swift similarity index 77% rename from Projects/Core/Sources/Setp/AppStep.swift rename to Projects/Core/Sources/Coordinator/Setp/AppStep.swift index d5ec076c..52546b11 100644 --- a/Projects/Core/Sources/Setp/AppStep.swift +++ b/Projects/Core/Sources/Coordinator/Setp/AppStep.swift @@ -11,4 +11,9 @@ public enum AppStep: Step { case pickleRequired case otherDestination + + case initialization + + //selfCore + case myProfileRequired } diff --git a/Projects/Domain/Sources/Model/Posture/PostureSearchModel.swift b/Projects/Domain/Sources/Model/Posture/PostureSearchModel.swift index d56f5dd2..180ba654 100644 --- a/Projects/Domain/Sources/Model/Posture/PostureSearchModel.swift +++ b/Projects/Domain/Sources/Model/Posture/PostureSearchModel.swift @@ -1,3 +1,11 @@ +// +// PostureSearchModel.swift +// Domain +// +// Created by 박준하 on 2/27/24. +// Copyright © 2024 MaeumGaGym-iOS. All rights reserved. +// + import UIKit public struct PostureSearchModel { @@ -13,7 +21,7 @@ public struct PostureSearchContentModel { public var exerciseName: String public var exercisePart: String - public init(exerciseImage: UIImage, + public init(exerciseImage: UIImage, exerciseName: String, exercisePart: String ) { diff --git a/Projects/Features/AuthFeature/Sources/SignupScene/VC/NicknameViewController.swift b/Projects/Features/AuthFeature/Sources/SignupScene/VC/NicknameViewController.swift index e5b3e713..12c1cee5 100644 --- a/Projects/Features/AuthFeature/Sources/SignupScene/VC/NicknameViewController.swift +++ b/Projects/Features/AuthFeature/Sources/SignupScene/VC/NicknameViewController.swift @@ -32,7 +32,7 @@ public class NicknameViewController: BaseViewController { private let nicknameTF = MGTextField(placeholder: "닉네임") - private let cancelButton = MGImageButton(image: DSKitAsset.Assets.cancle.image) + private let cancelButton = MGImageButton(image: DSKitAsset.Assets.whiteCancel.image) private var checkButton = MGCheckButton(text: "회원가입") diff --git a/Projects/Features/HomeFeature/Sources/TimerScene/Supporter/HomeTimerView.swift b/Projects/Features/HomeFeature/Sources/TimerScene/Supporter/HomeTimerView.swift index a0017c5a..ca05cb8a 100644 --- a/Projects/Features/HomeFeature/Sources/TimerScene/Supporter/HomeTimerView.swift +++ b/Projects/Features/HomeFeature/Sources/TimerScene/Supporter/HomeTimerView.swift @@ -39,7 +39,7 @@ public class HomeTimerView: UIView { } private let alarmImage = UIImageView().then { - $0.image = DSKitAsset.Assets.homeTimerBell.image + $0.image = DSKitAsset.Assets.timerActIcon.image } private var timerAlarmTitle = UILabel().then { diff --git a/Projects/Features/HomeFeature/Sources/TimerScene/Supporter/TimerAlarmAlertView.swift b/Projects/Features/HomeFeature/Sources/TimerScene/Supporter/TimerAlarmAlertView.swift index a633bc3c..014a3787 100644 --- a/Projects/Features/HomeFeature/Sources/TimerScene/Supporter/TimerAlarmAlertView.swift +++ b/Projects/Features/HomeFeature/Sources/TimerScene/Supporter/TimerAlarmAlertView.swift @@ -21,7 +21,7 @@ public class TimerAlarmAlertView: BaseView { $0.layer.shadowRadius = 6 } private let timerImage = UIImageView().then { - $0.image = DSKitAsset.Assets.homeTimerLogo.image + $0.image = DSKitAsset.Assets.timerActIcon.image } private let timerTitleLabel = UILabel().then { diff --git a/Projects/Features/HomeFeature/Sources/TimerScene/Supporter/TimerCollectionViewCell.swift b/Projects/Features/HomeFeature/Sources/TimerScene/Supporter/TimerCollectionViewCell.swift index 0c49d5e7..7edf78dc 100644 --- a/Projects/Features/HomeFeature/Sources/TimerScene/Supporter/TimerCollectionViewCell.swift +++ b/Projects/Features/HomeFeature/Sources/TimerScene/Supporter/TimerCollectionViewCell.swift @@ -13,7 +13,7 @@ public class TimerCollectionViewCell: UICollectionViewCell { private var containerView = UIView() private var checkImage = UIImageView().then { - $0.image = DSKitAsset.Assets.yesCheck.image + $0.image = DSKitAsset.Assets.yesCheckActIcon.image $0.isHidden = true } diff --git a/Projects/Features/HomeFeature/Sources/TimerScene/View/TimerViewController.swift b/Projects/Features/HomeFeature/Sources/TimerScene/View/TimerViewController.swift index a0df180e..83dac27b 100644 --- a/Projects/Features/HomeFeature/Sources/TimerScene/View/TimerViewController.swift +++ b/Projects/Features/HomeFeature/Sources/TimerScene/View/TimerViewController.swift @@ -17,11 +17,11 @@ public class TimerViewController: BaseViewController { private var alaertView = TimerAlarmAlertView() - private var navBeforeButton = MGImageButton(image: DSKitAsset.Assets.timerNavLeft.image) + private var navBeforeButton = MGImageButton(image: DSKitAsset.Assets.leftBarArrow.image) - private var navAddButton = MGImageButton(image: DSKitAsset.Assets.timerNavPlus.image) + private var navAddButton = MGImageButton(image: DSKitAsset.Assets.blackPlus.image) - private var navEditButton = MGImageButton(image: DSKitAsset.Assets.timerNavDots.image) + private var navEditButton = MGImageButton(image: DSKitAsset.Assets.dotsActIcon.image) private var editView = TimerEditView() diff --git a/Projects/Features/PickleFeature/Sources/Supporter/Profile/UserProfileView.swift b/Projects/Features/PickleFeature/Sources/Supporter/Profile/UserProfileView.swift index 0c86784b..f78e9e6f 100644 --- a/Projects/Features/PickleFeature/Sources/Supporter/Profile/UserProfileView.swift +++ b/Projects/Features/PickleFeature/Sources/Supporter/Profile/UserProfileView.swift @@ -13,11 +13,11 @@ open class UserProfileView: UIView { public init( userName: String, - userProfileImage: UIImage? = DSKitAsset.Assets.basicProfile.image + userProfileImage: UIImage? = DSKitAsset.Assets.basicProfileIcon.image ) { super.init(frame: .zero) - setupUI(text: userName, image: userProfileImage ?? DSKitAsset.Assets.basicProfile.image) + setupUI(text: userName, image: userProfileImage ?? DSKitAsset.Assets.basicProfileIcon.image) } required public init?(coder: NSCoder) { diff --git a/Projects/Features/RootFeature/Demo/Sources/SceneDelegate.swift b/Projects/Features/RootFeature/Demo/Sources/SceneDelegate.swift index ddd9caf5..57328159 100644 --- a/Projects/Features/RootFeature/Demo/Sources/SceneDelegate.swift +++ b/Projects/Features/RootFeature/Demo/Sources/SceneDelegate.swift @@ -2,6 +2,7 @@ import UIKit import RootFeature import RxFlow import Core +import Foundation class SceneDelegate: UIResponder, UIWindowSceneDelegate { @@ -9,7 +10,9 @@ class SceneDelegate: UIResponder, UIWindowSceneDelegate { var coordinator = FlowCoordinator() var mainFlow: AppFlow! - func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) { + func scene(_ scene: UIScene, + willConnectTo session: UISceneSession, + options connectionOptions: UIScene.ConnectionOptions) { guard let windowScene = (scene as? UIWindowScene) else { return } window = UIWindow(windowScene: windowScene) diff --git a/Projects/Features/RootFeature/Sources/AppFlow.swift b/Projects/Features/RootFeature/Sources/AppFlow.swift index d3a618e1..9ce624a0 100644 --- a/Projects/Features/RootFeature/Sources/AppFlow.swift +++ b/Projects/Features/RootFeature/Sources/AppFlow.swift @@ -41,7 +41,7 @@ public class AppFlow: Flow { let homeService = HomeService() let homeRepository = HomeRepository(networkService: homeService) let homeFlow = HomeFlow(repository: homeRepository) - + let postureFlow = PostureFlow() let shopFlow = ShopFlow() let pickleFlow = PickleFlow() @@ -61,6 +61,6 @@ public class AppFlow: Flow { } public init() { - + } } diff --git a/Projects/Features/RootFeature/Sources/HomeFlow.swift b/Projects/Features/RootFeature/Sources/HomeFlow.swift index b8a05bd4..bd422cc7 100644 --- a/Projects/Features/RootFeature/Sources/HomeFlow.swift +++ b/Projects/Features/RootFeature/Sources/HomeFlow.swift @@ -12,9 +12,9 @@ import HomeFeature import HomeFeatureInterface public class HomeFlow: Flow { - + public var repository: HomeRepositoryInterface - + public var root: Presentable { return self.rootViewController } @@ -23,15 +23,15 @@ public class HomeFlow: Flow { init(repository: HomeRepositoryInterface) { self.repository = repository - + let useCase = DefaultHomeUseCase(repository: repository) let viewModel = HomeViewModel(useCase: useCase) let viewController = HomeViewController(viewModel) - + viewController.view.backgroundColor = DSKitAsset.Colors.gray25.color viewController.tabBarItem = UITabBarItem(title: "홈", - image: DSKitAsset.Assets.blackHome.image, - selectedImage: DSKitAsset.Assets.blueHome.image + image: DSKitAsset.Assets.blackHomeTapBar.image, + selectedImage: DSKitAsset.Assets.blueHomeTapBar.image ) self.rootViewController.setViewControllers([viewController], animated: false) @@ -42,7 +42,7 @@ public class HomeFlow: Flow { switch step { case .otherDestination: - rootViewController.tabBarItem.image = DSKitAsset.Assets.blackHome.image + rootViewController.tabBarItem.image = DSKitAsset.Assets.blackHomeTapBar.image return .none default: return .none diff --git a/Projects/Features/RootFeature/Sources/PickleFlow.swift b/Projects/Features/RootFeature/Sources/PickleFlow.swift index 1dfae065..79a92beb 100644 --- a/Projects/Features/RootFeature/Sources/PickleFlow.swift +++ b/Projects/Features/RootFeature/Sources/PickleFlow.swift @@ -15,7 +15,7 @@ class PickleFlow: Flow { init() { let viewController = PickleViewController() viewController.view.backgroundColor = .white - viewController.tabBarItem = UITabBarItem(title: "피클", image: DSKitAsset.Assets.blackPickle.image, selectedImage: DSKitAsset.Assets.bluePickle.image) + viewController.tabBarItem = UITabBarItem(title: "피클", image: DSKitAsset.Assets.bluePickleTapBar.image, selectedImage: DSKitAsset.Assets.bluePickleTapBar.image) rootViewController.setViewControllers([viewController], animated: false) } diff --git a/Projects/Features/RootFeature/Sources/PostureFlow.swift b/Projects/Features/RootFeature/Sources/PostureFlow.swift index 7557d7dc..643c42de 100644 --- a/Projects/Features/RootFeature/Sources/PostureFlow.swift +++ b/Projects/Features/RootFeature/Sources/PostureFlow.swift @@ -14,7 +14,7 @@ class PostureFlow: Flow { init() { let viewController = UIViewController() viewController.view.backgroundColor = .white - viewController.tabBarItem = UITabBarItem(title: "자세", image: DSKitAsset.Assets.maeumGaGymBlackPeople.image, selectedImage: DSKitAsset.Assets.maeumGaGymBluePeople.image) + viewController.tabBarItem = UITabBarItem(title: "자세", image: DSKitAsset.Assets.maeumGaGymBlackPeopleTapBar.image, selectedImage: DSKitAsset.Assets.maeumGaGymBluePeopleTapBar.image) rootViewController.setViewControllers([viewController], animated: false) } diff --git a/Projects/Features/RootFeature/Sources/ShopFlow.swift b/Projects/Features/RootFeature/Sources/ShopFlow.swift index 8f37ea97..d637f4d9 100644 --- a/Projects/Features/RootFeature/Sources/ShopFlow.swift +++ b/Projects/Features/RootFeature/Sources/ShopFlow.swift @@ -14,7 +14,7 @@ class ShopFlow: Flow { init() { let viewController = UIViewController() viewController.view.backgroundColor = .white - viewController.tabBarItem = UITabBarItem(title: "샵", image: DSKitAsset.Assets.blackShop.image, selectedImage: DSKitAsset.Assets.blueShop.image) + viewController.tabBarItem = UITabBarItem(title: "샵", image: DSKitAsset.Assets.blackShopTapBar.image, selectedImage: DSKitAsset.Assets.blueShopTapBar.image) rootViewController.setViewControllers([viewController], animated: false) } diff --git a/Projects/Features/SelfCareFeature/Sources/HomeScene/SelfCareHomeViewController.swift b/Projects/Features/SelfCareFeature/Sources/HomeScene/SelfCareHomeViewController.swift index c7216dc1..3b0d83c3 100644 --- a/Projects/Features/SelfCareFeature/Sources/HomeScene/SelfCareHomeViewController.swift +++ b/Projects/Features/SelfCareFeature/Sources/HomeScene/SelfCareHomeViewController.swift @@ -151,13 +151,10 @@ extension SelfCareHomeViewController: UITableViewDataSource { return cell } } -// -// public func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { -// self.showCaveatPopUp(title: "회원탈퇴", -// message: "정말 탈퇴하실건가요?\n30일 뒤에 활동이 모두 삭제돼요.", -// leftActionTitle: "취소", -// rightActionTitle: "탈퇴", -// leftActionCompletion: { print("취소")}, -// rightActionCompletion: { print("탈퇴") }) -// } + + public func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { + if indexPath.row == 1 { + AppStepper.shared.steps.accept(AppStep.myProfileRequired) + } + } } diff --git a/Projects/Features/SelfCareFeature/Sources/SelfCareScene/ViewModel/SelfCareMyRoutineDetail+VM.swift b/Projects/Features/SelfCareFeature/Sources/SelfCareScene/ViewModel/SelfCareMyRoutineDetail+VM.swift index 9475b4d1..b262a4ee 100644 --- a/Projects/Features/SelfCareFeature/Sources/SelfCareScene/ViewModel/SelfCareMyRoutineDetail+VM.swift +++ b/Projects/Features/SelfCareFeature/Sources/SelfCareScene/ViewModel/SelfCareMyRoutineDetail+VM.swift @@ -9,6 +9,7 @@ import Domain import MGLogger public class SelfCareMyRoutineDetailViewModel: BaseViewModel { + private let disposeBag = DisposeBag() private let useCase: SelfCareUseCase From c27aa36e5d9121b8e3121b56d9b3344950431b84 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EB=B0=95=EC=A4=80=ED=95=98?= Date: Wed, 28 Feb 2024 00:43:19 +0900 Subject: [PATCH 3/8] =?UTF-8?q?=F0=9F=8D=97::=20[#255]=20=EC=BD=94?= =?UTF-8?q?=EB=93=9C=20=EB=A6=AC=ED=8E=99=ED=86=A0=EB=A7=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../PickleFeature/Sources/PickleScene/VC/PickleCell.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Projects/Features/PickleFeature/Sources/PickleScene/VC/PickleCell.swift b/Projects/Features/PickleFeature/Sources/PickleScene/VC/PickleCell.swift index d4dff702..78082eca 100644 --- a/Projects/Features/PickleFeature/Sources/PickleScene/VC/PickleCell.swift +++ b/Projects/Features/PickleFeature/Sources/PickleScene/VC/PickleCell.swift @@ -64,7 +64,7 @@ public class PickleCell: PickleCollectionViewCell { self.contentStackView.addArrangedSubviews(heartButton, commentButton, shareButton, dotButton) bottomSheetItems = [ - BottomSheetItem(icon: DSKitAsset.Assets.pencil.image, title: "신고") + BottomSheetItem(icon: DSKitAsset.Assets.pencilActIcon.image, title: "신고") ] bottomSheetViewController.bottomSheetDelegate = self From 8a723fb4e39a15d3b13c2e5fe895a773168e42fb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EB=B0=95=EC=A4=80=ED=95=98?= Date: Wed, 28 Feb 2024 00:43:46 +0900 Subject: [PATCH 4/8] =?UTF-8?q?=F0=9F=8D=97::=20[#255]=20selfCareFlow=20?= =?UTF-8?q?=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../RootFeature/Sources/SelfCareFlow.swift | 26 ++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) diff --git a/Projects/Features/RootFeature/Sources/SelfCareFlow.swift b/Projects/Features/RootFeature/Sources/SelfCareFlow.swift index 07e1b220..1e5c7076 100644 --- a/Projects/Features/RootFeature/Sources/SelfCareFlow.swift +++ b/Projects/Features/RootFeature/Sources/SelfCareFlow.swift @@ -5,21 +5,41 @@ import RxSwift import RxCocoa import DSKit +import Core + class SelfCareFlow: Flow { var root: Presentable { return self.rootViewController } - private let rootViewController = UINavigationController() + private let rootViewController = UINavigationController( + rootViewController: SelfCareHomeViewController(SelfCareHomeViewModel())) init() { - let viewController = SelfCareViewController() + let viewController = SelfCareHomeViewController(SelfCareHomeViewModel()) viewController.view.backgroundColor = .white - viewController.tabBarItem = UITabBarItem(title: "자기관리", image: DSKitAsset.Assets.blackMuscle.image, selectedImage: DSKitAsset.Assets.blueMuscle.image) + viewController.tabBarItem = UITabBarItem( + title: "자기관리", + image: DSKitAsset.Assets.blackMuscleTapBar.image, + selectedImage: DSKitAsset.Assets.blackMuscleTapBar.image) rootViewController.setViewControllers([viewController], animated: false) } func navigate(to step: Step) -> FlowContributors { + guard let step = step as? AppStep else { return .none } + + switch step { + case .myProfileRequired: + return navigateToProfileViewScreen() + default: + return .none + } + } + + private func navigateToProfileViewScreen() -> FlowContributors { + let viewcontroller = SelfCareProfileViewController(ProfileEditViewModel()) + rootViewController.pushViewController(viewcontroller, animated: true) +// MainTabBarContoller.shared.tabBar.isHidden = true return .none } } From dd96aed2dad858778f37eaec51204835400ecc35 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EB=B0=95=EC=A4=80=ED=95=98?= Date: Wed, 28 Feb 2024 00:44:19 +0900 Subject: [PATCH 5/8] =?UTF-8?q?=E2=9A=93=EF=B8=8F::=20[#255]=20initFlow=20?= =?UTF-8?q?=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../RootFeature/Sources/InitFlow.swift | 67 +++++++++++++++++++ 1 file changed, 67 insertions(+) create mode 100644 Projects/Features/RootFeature/Sources/InitFlow.swift diff --git a/Projects/Features/RootFeature/Sources/InitFlow.swift b/Projects/Features/RootFeature/Sources/InitFlow.swift new file mode 100644 index 00000000..5bdb2873 --- /dev/null +++ b/Projects/Features/RootFeature/Sources/InitFlow.swift @@ -0,0 +1,67 @@ +import Foundation +import Data +import UIKit + +import RxFlow +import RxCocoa +import RxSwift + +import Core +import DSKit + +import Domain +import MGNetworks + +import HomeFeatureInterface +public class InitFlow: Flow { + public var root: Presentable { + return self.rootViewController + } + + private lazy var rootViewController: UITabBarController = { + let tabBarController = UITabBarController() + tabBarController.tabBar.tintColor = DSKitAsset.Colors.blue500.color + return tabBarController + }() + + public func navigate(to step: Step) -> FlowContributors { + guard let step = step as? AppStep else { return .none } + + switch step { + case .tabBarIsRequired: + return setupTabBar() + default: + return .none + } + } + + private func setupTabBar() -> FlowContributors { + + let homeService = HomeService() + let homeRepository = HomeRepository(networkService: homeService) + let homeFlow = HomeFlow(repository: homeRepository) + + let postureFlow = PostureFlow() + let shopFlow = ShopFlow() + let pickleFlow = PickleFlow() + let selfCareFlow = SelfCareFlow() + + let flows: [Flow] = [homeFlow, postureFlow, shopFlow, pickleFlow, selfCareFlow] + + Flows.use(flows, when: .ready, block: { [weak self] root in + guard let `self` = self else { return } + self.rootViewController.viewControllers = root + }) + return .multiple(flowContributors: [ + FlowContributor.contribute(withNextPresentable: homeFlow, withNextStepper: OneStepper(withSingleStep: AppStep.homeIsRequired)), + FlowContributor.contribute(withNextPresentable: postureFlow, withNextStepper: OneStepper(withSingleStep: AppStep.postureIsRequired)), + FlowContributor.contribute(withNextPresentable: shopFlow, withNextStepper: OneStepper(withSingleStep: AppStep.shopIsRequired)), + FlowContributor.contribute(withNextPresentable: pickleFlow, withNextStepper: OneStepper(withSingleStep: AppStep.pickleRequired)), + FlowContributor.contribute(withNextPresentable: selfCareFlow, withNextStepper: OneStepper(withSingleStep: AppStep.selfCareIsRequired)), + ]) + } + + public init() { + + } +} From c95b0ddaa7ddbe93d1e9b2ba3afe1d9480e87236 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EB=B0=95=EC=A4=80=ED=95=98?= Date: Wed, 28 Feb 2024 00:44:38 +0900 Subject: [PATCH 6/8] =?UTF-8?q?=F0=9F=92=89::=20[#255]=20viewModel=20?= =?UTF-8?q?=EC=84=B1=EB=8A=A5=20=EC=B5=9C=EC=A0=81=ED=99=94?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Core/Sources/Base/BaseViewModel.swift | 3 +- .../Core/Sources/Supporter/ViewModel.swift | 30 +++++++++++++++++++ 2 files changed, 32 insertions(+), 1 deletion(-) create mode 100644 Projects/Core/Sources/Supporter/ViewModel.swift diff --git a/Projects/Core/Sources/Base/BaseViewModel.swift b/Projects/Core/Sources/Base/BaseViewModel.swift index 2aec5b46..2de0e32e 100644 --- a/Projects/Core/Sources/Base/BaseViewModel.swift +++ b/Projects/Core/Sources/Base/BaseViewModel.swift @@ -4,7 +4,8 @@ import RxSwift import RxCocoa import RxFlow -public protocol BaseViewModel { +public protocol BaseViewModel: ViewModel { + associatedtype Input associatedtype Output diff --git a/Projects/Core/Sources/Supporter/ViewModel.swift b/Projects/Core/Sources/Supporter/ViewModel.swift new file mode 100644 index 00000000..851f49d7 --- /dev/null +++ b/Projects/Core/Sources/Supporter/ViewModel.swift @@ -0,0 +1,30 @@ +// +// ViewModel.swift +// Core +// +// Created by 박준하 on 2/27/24. +// Copyright © 2024 MaeumGaGym-iOS. All rights reserved. +// + +import UIKit + +public protocol ViewModel { +} + +public protocol ServicesViewModel: ViewModel { + associatedtype Services + var services: Services! { get set } +} + +public protocol ViewModelProtocol: AnyObject { + associatedtype ViewModelType: ViewModel + var viewModel: ViewModelType! { get set } +} + +public extension ViewModelProtocol where Self: UIViewController { + static func instantiate (withViewModel viewModel: ViewModelType) -> Self where ViewModelType == Self.ViewModelType { + let viewController = Self() + viewController.viewModel = viewModel + return viewController + } +} From 94942d6e03c11e9dcdcedb14c53d95ffb94d90b4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EB=B0=95=EC=A4=80=ED=95=98?= Date: Wed, 28 Feb 2024 00:44:56 +0900 Subject: [PATCH 7/8] =?UTF-8?q?=E2=9A=93=EF=B8=8F::=20[#255]=20FlowSugar?= =?UTF-8?q?=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Core/Sources/Coordinator/FlowSugar.swift | 112 ++++++++++++++++++ 1 file changed, 112 insertions(+) create mode 100644 Projects/Core/Sources/Coordinator/FlowSugar.swift diff --git a/Projects/Core/Sources/Coordinator/FlowSugar.swift b/Projects/Core/Sources/Coordinator/FlowSugar.swift new file mode 100644 index 00000000..c309f5c3 --- /dev/null +++ b/Projects/Core/Sources/Coordinator/FlowSugar.swift @@ -0,0 +1,112 @@ +import RxFlow +import UIKit +import Then + +typealias ViewModelStepper = BaseViewModel & Stepper +typealias ViewModelController = ViewModelProtocol & UIViewController + +class FlowSugar: NSObject where VM: ViewModelStepper, VC: ViewModelController { + var vm: VM! + var vc: VC? + + override init() { + fatalError("init() has not been supported") + } + + init(viewModel vm: VM) { + self.vm = vm + super.init() + } + + init(_ flow: Flow, _ step: Step) { + } + + init(_ vm: VM, _ vc: VC.Type) { + self.vm = vm + self.vc = VC().then { + $0.viewModel = vm as? VC.ViewModelType + } + super.init() + } + + func presentable(_ vc: VC.Type) -> Self { + self.vc = VC().then { + $0.viewModel = vm as? VC.ViewModelType + } + return self + } + + func presentableForStoryBoard(_ vc: VC) -> Self { + self.vc = vc + vc.viewModel = vm as? VC.ViewModelType + return self + } + + func navigationItem(with block: @escaping (UIViewController) -> Void) -> Self { + if let vc = self.vc { + block(vc) + } + return self + } + + func getViewController() -> VC? { + if let vc = self.vc { + return vc + } else { + return nil + } + } + + func setVCProperty(viewControllerBlock block: @escaping (VC) -> Void) -> Self { + if let vc = self.vc { + block(vc) + } + return self + } + + func justRegiste() -> FlowContributor? { + if let vc = self.vc { + return .contribute(withNextPresentable: vc, withNextStepper: vm) + } + return nil + } + + func oneStepPushBy(_ navi: UINavigationController, isHideBottombar: Bool = false, includeOpaqueBar: Bool = false, animation: Bool = true) -> FlowContributors { + if let vc = self.vc { + vc.hidesBottomBarWhenPushed = isHideBottombar + vc.extendedLayoutIncludesOpaqueBars = includeOpaqueBar + navi.pushViewController(vc, animated: animation) + return .one(flowContributor: .contribute(withNextPresentable: vc, withNextStepper: vm)) + } + return .none + } + + func oneStepModalPresent(_ parentVC: UIViewController, _ modalStyle: UIModalPresentationStyle = .fullScreen, _ animated: Bool = true) -> FlowContributors { + if let vc = self.vc { + vc.modalPresentationStyle = modalStyle + parentVC.present(vc, animated: animated) + return .one(flowContributor: .contribute(withNextPresentable: vc, withNextStepper: vm)) + } + return .none + } + + func oneStepPopoverPresent(_ parentVC: UIViewController, _ modalStyle: UIModalPresentationStyle = .popover, _ animated: Bool = true) -> FlowContributors { + if let vc = self.vc { + vc.modalPresentationStyle = modalStyle + parentVC.present(vc, animated: animated) + return .one(flowContributor: .contribute(withNextPresentable: vc, withNextStepper: vm)) + } + return .none + } + + func oneStepModalPresentMakeNavi(_ parentVC: UIViewController, _ modalStyle: UIModalPresentationStyle = .fullScreen, _ animated: Bool = true) -> FlowContributors { + if let vc = self.vc { + let navigationController = UINavigationController(rootViewController: vc) + navigationController.setNavigationBarHidden(true, animated: true) + navigationController.modalPresentationStyle = modalStyle + parentVC.present(navigationController, animated: animated) + return .one(flowContributor: .contribute(withNextPresentable: navigationController, withNextStepper: vm)) + } + return .none + } +} From cdae1d47a973106438b2d6c7a428037e73fa86f7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EB=B0=95=EC=A4=80=ED=95=98?= Date: Wed, 28 Feb 2024 00:45:08 +0900 Subject: [PATCH 8/8] =?UTF-8?q?=E2=9A=93=EF=B8=8F::=20[#255]=20AppStepper?= =?UTF-8?q?=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Coordinator/Stepper/AppStepper.swift | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 Projects/Core/Sources/Coordinator/Stepper/AppStepper.swift diff --git a/Projects/Core/Sources/Coordinator/Stepper/AppStepper.swift b/Projects/Core/Sources/Coordinator/Stepper/AppStepper.swift new file mode 100644 index 00000000..fd3e5075 --- /dev/null +++ b/Projects/Core/Sources/Coordinator/Stepper/AppStepper.swift @@ -0,0 +1,18 @@ +import Foundation +import UIKit +import RxFlow +import RxCocoa + +public class AppStepper: Stepper { + public static let shared = AppStepper() + + public var steps = PublishRelay() + + public var initialStep: Step { + return AppStep.initialization + } + + public init(steps: PublishRelay = PublishRelay()) { + self.steps = steps + } +}