From a9ed860b7d6cbf57a124aedd5cfeafa0b4d2c7ab Mon Sep 17 00:00:00 2001 From: sanghyeok-kim Date: Fri, 4 Aug 2023 08:17:54 +0900 Subject: [PATCH] =?UTF-8?q?#8=20rename:=20TimerCreateViewModel,=20TimerEdi?= =?UTF-8?q?tingViewModel=EC=9D=98=20=EB=84=A4=EC=9D=B4=EB=B0=8D=20?= =?UTF-8?q?=EB=B3=80=EA=B2=BD=20(ViewModel=20->=20Reactor)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Multimer/Multimer.xcodeproj/project.pbxproj | 16 ++++++++-------- .../Home/DefaultHomeCoordinator.swift | 4 ++-- ...eViewModel.swift => TimerCreateReactor.swift} | 8 ++++---- .../TimerCreate/TimerCreateViewController.swift | 6 +++--- ...ViewModel.swift => TimerEditingReactor.swift} | 8 ++++---- .../TimerEditingViewController.swift | 6 +++--- 6 files changed, 24 insertions(+), 24 deletions(-) rename Multimer/Multimer/Presentation/TimerCreate/{TimerCreateViewModel.swift => TimerCreateReactor.swift} (96%) rename Multimer/Multimer/Presentation/TimerEditing/{TimerEditingViewModel.swift => TimerEditingReactor.swift} (95%) diff --git a/Multimer/Multimer.xcodeproj/project.pbxproj b/Multimer/Multimer.xcodeproj/project.pbxproj index 854fb9b..8ccb829 100644 --- a/Multimer/Multimer.xcodeproj/project.pbxproj +++ b/Multimer/Multimer.xcodeproj/project.pbxproj @@ -48,7 +48,7 @@ 1E651DAC2953165800B4F321 /* CountUpTimerUseCase.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1E651DAB2953165800B4F321 /* CountUpTimerUseCase.swift */; }; 1E651DAE2953168900B4F321 /* TimerUseCase.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1E651DAD2953168900B4F321 /* TimerUseCase.swift */; }; 1E651DB0295342BA00B4F321 /* TimerCreateViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1E651DAF295342BA00B4F321 /* TimerCreateViewController.swift */; }; - 1E651DB229534CEE00B4F321 /* TimerCreateViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1E651DB129534CEE00B4F321 /* TimerCreateViewModel.swift */; }; + 1E651DB229534CEE00B4F321 /* TimerCreateReactor.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1E651DB129534CEE00B4F321 /* TimerCreateReactor.swift */; }; 1E6A19C329937FE8001FA3ED /* NameTextField.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1E6A19C229937FE8001FA3ED /* NameTextField.swift */; }; 1E6A19C82993AF21001FA3ED /* SwipeRightToStopNoticeView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1E6A19C72993AF21001FA3ED /* SwipeRightToStopNoticeView.swift */; }; 1E6FAD9729403F900021B845 /* CoreDataTimerRepository.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1E6FAD9629403F900021B845 /* CoreDataTimerRepository.swift */; }; @@ -92,7 +92,7 @@ 1EBEEFE82925B73000299CE7 /* TagColor.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1EBEEFE72925B73000299CE7 /* TagColor.swift */; }; 1EBEEFEA2925B85700299CE7 /* TagButton.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1EBEEFE92925B85700299CE7 /* TagButton.swift */; }; 1EBEF029292909DD00299CE7 /* TimerModel.xcdatamodeld in Sources */ = {isa = PBXBuildFile; fileRef = 1EBEF027292909DD00299CE7 /* TimerModel.xcdatamodeld */; }; - 1EBFEE152919270D00747606 /* TimerEditingViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1EBFEE142919270D00747606 /* TimerEditingViewModel.swift */; }; + 1EBFEE152919270D00747606 /* TimerEditingReactor.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1EBFEE142919270D00747606 /* TimerEditingReactor.swift */; }; 7DE0DCB2BD437A3652CA4266 /* Pods_Multimer.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FB67573CFCDE896B6E52525A /* Pods_Multimer.framework */; }; 8C88084EF84FB8081FC09CDE /* Pods_MultimerTests.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 02A9A991A8E30450D4458665 /* Pods_MultimerTests.framework */; }; C60ADD68060EFDAE377DA4B2 /* Pods_Multimer_MultimerUITests.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 09D9588E5DAECA7EB7A30024 /* Pods_Multimer_MultimerUITests.framework */; }; @@ -173,7 +173,7 @@ 1E651DAB2953165800B4F321 /* CountUpTimerUseCase.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CountUpTimerUseCase.swift; sourceTree = ""; }; 1E651DAD2953168900B4F321 /* TimerUseCase.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TimerUseCase.swift; sourceTree = ""; }; 1E651DAF295342BA00B4F321 /* TimerCreateViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TimerCreateViewController.swift; sourceTree = ""; }; - 1E651DB129534CEE00B4F321 /* TimerCreateViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TimerCreateViewModel.swift; sourceTree = ""; }; + 1E651DB129534CEE00B4F321 /* TimerCreateReactor.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TimerCreateReactor.swift; sourceTree = ""; }; 1E6A19C229937FE8001FA3ED /* NameTextField.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NameTextField.swift; sourceTree = ""; }; 1E6A19C72993AF21001FA3ED /* SwipeRightToStopNoticeView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SwipeRightToStopNoticeView.swift; sourceTree = ""; }; 1E6FAD9629403F900021B845 /* CoreDataTimerRepository.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CoreDataTimerRepository.swift; sourceTree = ""; }; @@ -217,7 +217,7 @@ 1EBEEFE72925B73000299CE7 /* TagColor.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TagColor.swift; sourceTree = ""; }; 1EBEEFE92925B85700299CE7 /* TagButton.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TagButton.swift; sourceTree = ""; }; 1EBEF028292909DD00299CE7 /* TimerModel.xcdatamodel */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcdatamodel; path = TimerModel.xcdatamodel; sourceTree = ""; }; - 1EBFEE142919270D00747606 /* TimerEditingViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TimerEditingViewModel.swift; sourceTree = ""; }; + 1EBFEE142919270D00747606 /* TimerEditingReactor.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TimerEditingReactor.swift; sourceTree = ""; }; 2487B77C56F24FE0EFA05BD4 /* Pods-Multimer.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Multimer.release.xcconfig"; path = "Target Support Files/Pods-Multimer/Pods-Multimer.release.xcconfig"; sourceTree = ""; }; 50F7E195491911071C2CCC09 /* Pods-MultimerTests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-MultimerTests.debug.xcconfig"; path = "Target Support Files/Pods-MultimerTests/Pods-MultimerTests.debug.xcconfig"; sourceTree = ""; }; 6AE47EFBE8192C59957931B9 /* Pods-Multimer.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Multimer.debug.xcconfig"; path = "Target Support Files/Pods-Multimer/Pods-Multimer.debug.xcconfig"; sourceTree = ""; }; @@ -396,7 +396,7 @@ isa = PBXGroup; children = ( 1E482BCF2912887B00175B78 /* TimerEditingViewController.swift */, - 1EBFEE142919270D00747606 /* TimerEditingViewModel.swift */, + 1EBFEE142919270D00747606 /* TimerEditingReactor.swift */, 1E4CB4E82967395200FC918E /* TimePickerView */, 1E4CB4E7296738C100FC918E /* CustomView */, ); @@ -407,7 +407,7 @@ isa = PBXGroup; children = ( 1E651DAF295342BA00B4F321 /* TimerCreateViewController.swift */, - 1E651DB129534CEE00B4F321 /* TimerCreateViewModel.swift */, + 1E651DB129534CEE00B4F321 /* TimerCreateReactor.swift */, ); path = TimerCreate; sourceTree = ""; @@ -932,7 +932,7 @@ 1EBEEFDC292105F500299CE7 /* TimerTableViewDiffableDataSource.swift in Sources */, 1E651DB0295342BA00B4F321 /* TimerCreateViewController.swift in Sources */, 1E482BD6291353FF00175B78 /* TimePickerViewDelegate.swift in Sources */, - 1E651DB229534CEE00B4F321 /* TimerCreateViewModel.swift in Sources */, + 1E651DB229534CEE00B4F321 /* TimerCreateReactor.swift in Sources */, 1E482BD22913538800175B78 /* TimerViewCell.swift in Sources */, 1E744BAC296C488A00CD824D /* UIImage+makeSFSymbolImage.swift in Sources */, 1E4CB4DE2966BE9000FC918E /* TimerMO+CoreDataClass.swift in Sources */, @@ -969,7 +969,7 @@ 1EA3FCE8292E4B730073560D /* CoreDataStorage+TagMO.swift in Sources */, 1EA3FCE0292E43520073560D /* ManagedObjectConvertible.swift in Sources */, 1E4159EE29485C6900EDA065 /* TimerEditingView.swift in Sources */, - 1EBFEE152919270D00747606 /* TimerEditingViewModel.swift in Sources */, + 1EBFEE152919270D00747606 /* TimerEditingReactor.swift in Sources */, 1E4159F2294C0BDB00EDA065 /* TimeFactory.swift in Sources */, 1E48FE992911F9240090B246 /* AppDelegate.swift in Sources */, 1E744BB3296C488A00CD824D /* EditViewButtonType.swift in Sources */, diff --git a/Multimer/Multimer/Presentation/Coordinator/Home/DefaultHomeCoordinator.swift b/Multimer/Multimer/Presentation/Coordinator/Home/DefaultHomeCoordinator.swift index a3b7a0a..ddcb99d 100644 --- a/Multimer/Multimer/Presentation/Coordinator/Home/DefaultHomeCoordinator.swift +++ b/Multimer/Multimer/Presentation/Coordinator/Home/DefaultHomeCoordinator.swift @@ -54,7 +54,7 @@ private extension DefaultHomeCoordinator { func presentTimerCreateViewController(createdTimerRelay: PublishRelay) { let timerCreateViewController = TimerCreateViewController() - let timerCreateReactor = TimerCreateViewModel( + let timerCreateReactor = TimerCreateReactor( coordinator: self, createdTimerRelay: createdTimerRelay ) @@ -64,7 +64,7 @@ private extension DefaultHomeCoordinator { func pushTimerEditViewController(initialTimer: Timer, editedTimerRelay: PublishRelay) { let timerEditingViewController = TimerEditingViewController() - let timerEditingReactor = TimerEditingViewModel( + let timerEditingReactor = TimerEditingReactor( initialTimer: initialTimer, coordinator: self, editedTimerRelay: editedTimerRelay diff --git a/Multimer/Multimer/Presentation/TimerCreate/TimerCreateViewModel.swift b/Multimer/Multimer/Presentation/TimerCreate/TimerCreateReactor.swift similarity index 96% rename from Multimer/Multimer/Presentation/TimerCreate/TimerCreateViewModel.swift rename to Multimer/Multimer/Presentation/TimerCreate/TimerCreateReactor.swift index 4bf3f32..5962967 100644 --- a/Multimer/Multimer/Presentation/TimerCreate/TimerCreateViewModel.swift +++ b/Multimer/Multimer/Presentation/TimerCreate/TimerCreateReactor.swift @@ -1,5 +1,5 @@ // -// TimerCreateViewModel.swift +// TimerCreateReactor.swift // Multimer // // Created by 김상혁 on 2022/12/21. @@ -8,7 +8,7 @@ import ReactorKit import RxRelay -final class TimerCreateViewModel: Reactor { +final class TimerCreateReactor: Reactor { enum Action { case cancelButtonDidTap @@ -110,7 +110,7 @@ final class TimerCreateViewModel: Reactor { // MARK: - Supporting Methods -private extension TimerCreateViewModel { +private extension TimerCreateReactor { func validateCompleteButtonIsEnable(for timer: Timer) -> Bool { let isNameEmpty = timer.name.isEmpty let isTypeCountUp = timer.type == .countUp @@ -122,7 +122,7 @@ private extension TimerCreateViewModel { // MARK: - Side Effect Methods -private extension TimerCreateViewModel { +private extension TimerCreateReactor { func exitScene() -> Observable { coordinator?.coordinate(by: .finishTimerCreateScene) return .empty() diff --git a/Multimer/Multimer/Presentation/TimerCreate/TimerCreateViewController.swift b/Multimer/Multimer/Presentation/TimerCreate/TimerCreateViewController.swift index 3486d98..ab8428f 100644 --- a/Multimer/Multimer/Presentation/TimerCreate/TimerCreateViewController.swift +++ b/Multimer/Multimer/Presentation/TimerCreate/TimerCreateViewController.swift @@ -96,7 +96,7 @@ final class TimerCreateViewController: UIViewController, View { layout() } - func bind(reactor: TimerCreateViewModel) { + func bind(reactor: TimerCreateReactor) { bindAction(reactor: reactor) bindState(reactor: reactor) } @@ -105,7 +105,7 @@ final class TimerCreateViewController: UIViewController, View { // MARK: - Bind Reactor private extension TimerCreateViewController { - func bindAction(reactor: TimerCreateViewModel) { + func bindAction(reactor: TimerCreateReactor) { timerTypeSegmentControl.rx.selectedSegmentIndex .compactMap { TimerType(rawValue: $0) } .map { Reactor.Action.timerTypeDidSelect($0) } @@ -153,7 +153,7 @@ private extension TimerCreateViewController { .disposed(by: disposeBag) } - func bindState(reactor: TimerCreateViewModel) { + func bindState(reactor: TimerCreateReactor) { reactor.state.map { $0.isCompleteButtonEnabled } .distinctUntilChanged() .bind(to: completeButton.rx.isEnabled) diff --git a/Multimer/Multimer/Presentation/TimerEditing/TimerEditingViewModel.swift b/Multimer/Multimer/Presentation/TimerEditing/TimerEditingReactor.swift similarity index 95% rename from Multimer/Multimer/Presentation/TimerEditing/TimerEditingViewModel.swift rename to Multimer/Multimer/Presentation/TimerEditing/TimerEditingReactor.swift index e72c431..6f8df3d 100644 --- a/Multimer/Multimer/Presentation/TimerEditing/TimerEditingViewModel.swift +++ b/Multimer/Multimer/Presentation/TimerEditing/TimerEditingReactor.swift @@ -1,5 +1,5 @@ // -// TimerEditingViewModel.swift +// TimerEditingReactor.swift // Multimer // // Created by 김상혁 on 2022/11/07. @@ -8,7 +8,7 @@ import ReactorKit import RxRelay -final class TimerEditingViewModel: Reactor { +final class TimerEditingReactor: Reactor { enum Action { case cancelButtonDidTap @@ -100,7 +100,7 @@ final class TimerEditingViewModel: Reactor { // MARK: - Supporting Methods -private extension TimerEditingViewModel { +private extension TimerEditingReactor { func validateCompleteButtonIsEnable(currentTimer: Timer, newTimer: Timer) -> Bool { switch newTimer.type { case .countDown: @@ -113,7 +113,7 @@ private extension TimerEditingViewModel { // MARK: - Side Effect Methods -private extension TimerEditingViewModel { +private extension TimerEditingReactor { func exitScene() -> Observable { coordinator?.coordinate(by: .finishTimerEditScene) return .empty() diff --git a/Multimer/Multimer/Presentation/TimerEditing/TimerEditingViewController.swift b/Multimer/Multimer/Presentation/TimerEditing/TimerEditingViewController.swift index 53c637c..dc54cca 100644 --- a/Multimer/Multimer/Presentation/TimerEditing/TimerEditingViewController.swift +++ b/Multimer/Multimer/Presentation/TimerEditing/TimerEditingViewController.swift @@ -83,7 +83,7 @@ final class TimerEditingViewController: UIViewController, View { layout() } - func bind(reactor: TimerEditingViewModel) { + func bind(reactor: TimerEditingReactor) { bindAction(reactor: reactor) bindState(reactor: reactor) } @@ -92,7 +92,7 @@ final class TimerEditingViewController: UIViewController, View { // MARK: - Bind Reactor private extension TimerEditingViewController { - func bindAction(reactor: TimerEditingViewModel) { + func bindAction(reactor: TimerEditingReactor) { rx.viewDidLoad .map { Reactor.Action.viewDidLoad } .bind(to: reactor.action) @@ -135,7 +135,7 @@ private extension TimerEditingViewController { .disposed(by: disposeBag) } - func bindState(reactor: TimerEditingViewModel) { + func bindState(reactor: TimerEditingReactor) { reactor.state.map { $0.initialTimer } .distinctUntilChanged() .observe(on: MainScheduler.asyncInstance)