From baa8ac8fa466aea53226d568e38a7a126fec5406 Mon Sep 17 00:00:00 2001 From: GeonH0 Date: Sat, 20 Jul 2024 16:50:29 +0900 Subject: [PATCH 1/8] =?UTF-8?q?Feat:=20Router=20=EC=A0=95=EC=9D=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../HomeCafeRecipes/Router/Router.swift | 93 +++++++++++++++++++ 1 file changed, 93 insertions(+) create mode 100644 HomeCafeRecipes/HomeCafeRecipes/Router/Router.swift diff --git a/HomeCafeRecipes/HomeCafeRecipes/Router/Router.swift b/HomeCafeRecipes/HomeCafeRecipes/Router/Router.swift new file mode 100644 index 0000000..d092968 --- /dev/null +++ b/HomeCafeRecipes/HomeCafeRecipes/Router/Router.swift @@ -0,0 +1,93 @@ +// +// Router.swift +// HomeCafeRecipes +// +// Created by 김건호 on 7/9/24. +// + +import UIKit + +public typealias NavigationBackClosure = () -> Void + +public protocol Drawable { + var viewController: UIViewController? { get } +} + +public protocol RouterProtocol { + func push ( + _ drawable: Drawable, + from viewController: UIViewController, + isAnimated: Bool, + onNavigateBack closure: NavigationBackClosure? + ) +} + +class Router: NSObject, RouterProtocol { + private var closures: [String: NavigationBackClosure] = [:] + + func push( + _ drawable: Drawable, + from viewController: UIViewController, + isAnimated: Bool, + onNavigateBack closure: NavigationBackClosure? + ) { + guard let targetViewController = drawable.viewController else { + return + } + + if let closure = closure { + closures.updateValue(closure, forKey: targetViewController.description) + } + viewController.navigationController?.pushViewController(targetViewController, animated: isAnimated) + } + + private func executeClosure(_ viewController: UIViewController) { + guard let closure = closures.removeValue(forKey: viewController.description) else { return } + closure() + } +} + +extension Router { + func createRecipeListDependencies() -> RecipeListViewController { + let baseNetworkService = BaseNetworkService() + let recipeFetchService = RecipeFetchServiceImpl(networkService: baseNetworkService) + let feedListRepository = FeedListRepositoryImpl(networkService: recipeFetchService) + let searchFeedRepository = SearchFeedRepositoryImpl(networkService: recipeFetchService) + let fetchFeedListUseCase = FetchFeedListUseCaseImpl(repository: feedListRepository) + let searchFeedListUseCase = SearchFeedListUseCaseImpl(repository: searchFeedRepository) + let recipeListInteractor = RecipeListInteractorImpl( + fetchFeedListUseCase: fetchFeedListUseCase, + searchFeedListUseCase: searchFeedListUseCase + ) + let recipeListRouter = RecipeListRouterImpl(router: self) + let recipeListVC = RecipeListViewController( + interactor: recipeListInteractor, + router: recipeListRouter + ) + recipeListInteractor.delegate = recipeListVC + return recipeListVC + } + + func createAddRecipeDependencies(recipeType: RecipeType) -> AddRecipeViewController { + let baseNetworkService = BaseNetworkService() + let recipePostService = RecipePostServiceImpl(networkService: baseNetworkService) + let saveRepository = AddRecipeRepositoryImpl(recipePostService: recipePostService) + let saveRecipeUseCase = SaveRecipeUseCaseImpl(repository: saveRepository) + let addRecipeInteractor = AddRecipeInteractorImpl(saveRecipeUseCase: saveRecipeUseCase) + let addRecipeVC = AddRecipeViewController(recipeType: recipeType, addRecipeInteractor: addRecipeInteractor) + return addRecipeVC + } + + func createRecipeDetailDependencies(recipeID: Int) -> RecipeDetailViewController { + let baseNetworkService = BaseNetworkService() + let recipeDetailRepository = RecipeDetailRepositoryImpl(networkService: baseNetworkService) + let fetchRecipeDetailUseCase = FetchRecipeDetailUseCaseImpl(repository: recipeDetailRepository) + let detailInteractor = RecipeDetailInteractorImpl( + fetchRecipeDetailUseCase: fetchRecipeDetailUseCase, + recipeID: recipeID + ) + let detailVC = RecipeDetailViewController(interactor: detailInteractor) + detailInteractor.delegate = detailVC + return detailVC + } +} From 6f1738b309d1a3ab3d71f2e5070621839d75c256 Mon Sep 17 00:00:00 2001 From: GeonH0 Date: Sat, 20 Jul 2024 16:53:00 +0900 Subject: [PATCH 2/8] =?UTF-8?q?Fix:=20RecipeListRouter=20=EC=A0=95?= =?UTF-8?q?=EC=9D=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Router/RecipeListRouter.swift | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 HomeCafeRecipes/HomeCafeRecipes/Router/RecipeListRouter.swift diff --git a/HomeCafeRecipes/HomeCafeRecipes/Router/RecipeListRouter.swift b/HomeCafeRecipes/HomeCafeRecipes/Router/RecipeListRouter.swift new file mode 100644 index 0000000..4e0c7a3 --- /dev/null +++ b/HomeCafeRecipes/HomeCafeRecipes/Router/RecipeListRouter.swift @@ -0,0 +1,25 @@ +// +// RecipeListRouter.swift +// HomeCafeRecipes +// +// Created by 김건호 on 7/9/24. +// + +import UIKit + +protocol RecipeListRouter { + func navigateToRecipeDetail(from viewController: UIViewController, recipeID: Int) +} + +class RecipeListRouterImpl: RecipeListRouter { + private let router: Router + + init(router: Router) { + self.router = router + } + + func navigateToRecipeDetail(from viewController: UIViewController, recipeID: Int) { + let detailVC = router.createRecipeDetailDependencies(recipeID: recipeID) + router.push(detailVC, from: viewController, isAnimated: true, onNavigateBack: nil) + } +} From 396e9bca617b47ccd7be9695283e16612d0c1084 Mon Sep 17 00:00:00 2001 From: GeonH0 Date: Sat, 20 Jul 2024 18:48:40 +0900 Subject: [PATCH 3/8] =?UTF-8?q?Fix:=20RecipeListViewController,RecipeListV?= =?UTF-8?q?iew=20coordinator=EC=82=AD=EC=A0=9C=20router=20=EC=A0=81?= =?UTF-8?q?=EC=9A=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../FeedList/View/RecipeListView.swift | 1 - .../FeedList/View/RecipeListViewController.swift | 14 ++++++++------ 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/HomeCafeRecipes/HomeCafeRecipes/Presentation/FeedList/View/RecipeListView.swift b/HomeCafeRecipes/HomeCafeRecipes/Presentation/FeedList/View/RecipeListView.swift index 28ab024..e3bac63 100644 --- a/HomeCafeRecipes/HomeCafeRecipes/Presentation/FeedList/View/RecipeListView.swift +++ b/HomeCafeRecipes/HomeCafeRecipes/Presentation/FeedList/View/RecipeListView.swift @@ -23,7 +23,6 @@ final class RecipeListView: UIView { private let collectionView = UICollectionView(frame: .zero, collectionViewLayout: UICollectionViewFlowLayout()) private var recipes: [RecipeListItemViewModel] = [] - weak var coordinator: RecipeDetailCoordinatorProtocol? weak var delegate: RecipeListViewDelegate? override init(frame: CGRect) { diff --git a/HomeCafeRecipes/HomeCafeRecipes/Presentation/FeedList/View/RecipeListViewController.swift b/HomeCafeRecipes/HomeCafeRecipes/Presentation/FeedList/View/RecipeListViewController.swift index 710f217..434158c 100644 --- a/HomeCafeRecipes/HomeCafeRecipes/Presentation/FeedList/View/RecipeListViewController.swift +++ b/HomeCafeRecipes/HomeCafeRecipes/Presentation/FeedList/View/RecipeListViewController.swift @@ -13,12 +13,14 @@ final class RecipeListViewController: UIViewController { private var recipes: [RecipeListItemViewModel] = [] private let searchBar = SearchBar() private let recipeListView = RecipeListView() - - init(interactor: RecipeListInteractor) { - self.interactor = interactor - super.init(nibName: nil, bundle: nil) + private let recipeListMapper = RecipeListMapper() + private let router: RecipeListRouter + + init(interactor: RecipeListInteractor, router: RecipeListRouter) { self.interactor.setDelegate(self) - + self.interactor = interactor + self.router = router + super.init(nibName: nil, bundle: nil) } required init?(coder: NSCoder) { @@ -90,7 +92,7 @@ extension RecipeListViewController: RecipeListInteractorDelegate { } func showRecipeDetail(ID: Int) { - coordinator.showRecipeDetail(from: self, recipeID: ID) + router.navigateToRecipeDetail(from: self, recipeID: ID) } } From 4213bfc3ded5c1140285d918d0ffe6e14d90cf15 Mon Sep 17 00:00:00 2001 From: GeonH0 Date: Sat, 20 Jul 2024 18:56:56 +0900 Subject: [PATCH 4/8] =?UTF-8?q?Fix:=20RecipeDetailViewController=EC=97=90?= =?UTF-8?q?=20Drawable=20=EC=A0=81=EC=9A=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Presentation/Feed/View/RecipeDetailViewController.swift | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/HomeCafeRecipes/HomeCafeRecipes/Presentation/Feed/View/RecipeDetailViewController.swift b/HomeCafeRecipes/HomeCafeRecipes/Presentation/Feed/View/RecipeDetailViewController.swift index c6ec16d..b7c65ff 100644 --- a/HomeCafeRecipes/HomeCafeRecipes/Presentation/Feed/View/RecipeDetailViewController.swift +++ b/HomeCafeRecipes/HomeCafeRecipes/Presentation/Feed/View/RecipeDetailViewController.swift @@ -64,3 +64,9 @@ extension RecipeDetailViewController: RecipeDetailInteractorDelegate { } } } + +extension RecipeDetailViewController: Drawable { + var viewController: UIViewController? { + return self + } +} From d49fa45c81f994da8278d2db3cc027cfc0949643 Mon Sep 17 00:00:00 2001 From: GeonH0 Date: Sat, 20 Jul 2024 18:59:32 +0900 Subject: [PATCH 5/8] =?UTF-8?q?Fix:=20MainTabbarController=EC=97=90=20rout?= =?UTF-8?q?er=20=EC=A0=81=EC=9A=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Tabbar/MainTabBarController.swift | 45 ++++++++++++------- 1 file changed, 29 insertions(+), 16 deletions(-) diff --git a/HomeCafeRecipes/HomeCafeRecipes/Presentation/Tabbar/MainTabBarController.swift b/HomeCafeRecipes/HomeCafeRecipes/Presentation/Tabbar/MainTabBarController.swift index e592ca4..ea666a3 100644 --- a/HomeCafeRecipes/HomeCafeRecipes/Presentation/Tabbar/MainTabBarController.swift +++ b/HomeCafeRecipes/HomeCafeRecipes/Presentation/Tabbar/MainTabBarController.swift @@ -11,6 +11,16 @@ class MainTabBarController: UITabBarController, UITabBarControllerDelegate { private let addButton = UIButton(type: .custom) private let buttonSize = CGSize(all: 64.0) + private let router = Router() + + init(router: Router) { + self.router = router + super.init(nibName: nil, bundle: nil) + } + + required init?(coder: NSCoder) { + fatalError("init(coder:) has not been implemented") + } override func viewDidLoad() { super.viewDidLoad() @@ -33,23 +43,26 @@ class MainTabBarController: UITabBarController, UITabBarControllerDelegate { } private func setupTabBar() { - let baseneworkServie = BaseNetworkService() - let networkService = RecipeFetchServiceImpl(networkService: baseneworkServie) - let repository = FeedListRepositoryImpl(networkService: networkService) - let searchrepository = SearchFeedRepositoryImpl(networkService: networkService) - let fetchFeedListUseCase = FetchFeedListUseCaseImpl(repository: repository) - let searchFeedListUsecase = SearchFeedListUseCaseImpl(repository: searchrepository) - - let recipeListViewModel = RecipeListInteractor(fetchFeedListUseCase: fetchFeedListUseCase, searchFeedListUseCase: searchFeedListUsecase) - - let recipeListVC = RecipeListViewController(interactor: recipeListViewModel) - recipeListVC.tabBarItem = UITabBarItem(title: "Recipes", image: UIImage(systemName: "list.bullet"), tag: 0) + let recipeListVC = router.createRecipeListDependencies() + let favoritesVC = createFavoritesViewController() + recipeListVC.tabBarItem = UITabBarItem( + title: "Recipes", + image: UIImage(systemName: "list.bullet"), + tag: 0 + ) + favoritesVC.tabBarItem = UITabBarItem( + title: "Favorites", + image: UIImage(systemName: "bookmark"), + tag: 1 + ) + viewControllers = [recipeListVC, favoritesVC] + } + + private func createFavoritesViewController() -> UIViewController { let favoritesVC = UIViewController() favoritesVC.view.backgroundColor = .white - favoritesVC.tabBarItem = UITabBarItem(title: "Favorites", image: UIImage(systemName: "bookmark"), tag: 1) - - viewControllers = [recipeListVC, favoritesVC] + return favoritesVC } private func setupActionButton() { @@ -68,12 +81,12 @@ class MainTabBarController: UITabBarController, UITabBarControllerDelegate { let alert = UIAlertController(title: "게시물 작성", message: "어떤 게시물을 작성하실 건가요?", preferredStyle: .actionSheet) alert.addAction(UIAlertAction(title: "Coffee", style: .default, handler: { [weak self] _ in guard let self else { return } - let addRecipeVC = AddRecipeViewController(recipeType: .coffee) + let addRecipeVC = self.router.createAddRecipeDependencies(recipeType: .coffee) self.navigationController?.pushViewController(addRecipeVC, animated: true) })) alert.addAction(UIAlertAction(title: "Dessert", style: .default, handler: { [weak self] _ in guard let self else { return } - let addRecipeVC = AddRecipeViewController(recipeType: .dessert) + let addRecipeVC = self.router.createAddRecipeDependencies(recipeType: .dessert) self.navigationController?.pushViewController(addRecipeVC, animated: true) })) alert.addAction(UIAlertAction(title: "Cancel", style: .cancel, handler: nil)) From dfdf9a6a082e71d2e5d96d48a7effba282c615d0 Mon Sep 17 00:00:00 2001 From: GeonH0 Date: Sun, 21 Jul 2024 16:26:09 +0900 Subject: [PATCH 6/8] =?UTF-8?q?Fix:=20SceneDelegate=EC=97=90=20Router=20?= =?UTF-8?q?=EC=84=A4=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- HomeCafeRecipes/HomeCafeRecipes/SceneDelegate.swift | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/HomeCafeRecipes/HomeCafeRecipes/SceneDelegate.swift b/HomeCafeRecipes/HomeCafeRecipes/SceneDelegate.swift index aa44d9a..1e8615b 100644 --- a/HomeCafeRecipes/HomeCafeRecipes/SceneDelegate.swift +++ b/HomeCafeRecipes/HomeCafeRecipes/SceneDelegate.swift @@ -10,7 +10,7 @@ import UIKit class SceneDelegate: UIResponder, UIWindowSceneDelegate { var window: UIWindow? - + var router: Router? func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) { // Use this method to optionally configure and attach the UIWindow `window` to the provided UIWindowScene `scene`. @@ -18,8 +18,12 @@ class SceneDelegate: UIResponder, UIWindowSceneDelegate { // This delegate does not imply the connecting scene or session are new (see `application:configurationForConnectingSceneSession` instead). guard let windowScene = (scene as? UIWindowScene) else { return } window = UIWindow(windowScene: windowScene) - let mainViewController = ViewController() - let navigationController = UINavigationController(rootViewController : mainViewController) + router = Router() + guard let router else { return } + + let tabBarController = MainTabBarController(router: router) + let navigationController = UINavigationController(rootViewController: tabBarController) + navigationController.isNavigationBarHidden = true window?.rootViewController = navigationController window?.makeKeyAndVisible() } From e4b31153795db79c4aed17ef216eb6c495654667 Mon Sep 17 00:00:00 2001 From: GeonH0 Date: Tue, 23 Jul 2024 14:40:39 +0900 Subject: [PATCH 7/8] =?UTF-8?q?Fix:=20=EC=83=81=EC=88=98=EC=82=AD=EC=A0=9C?= =?UTF-8?q?=ED=9B=84=20=EB=B0=94=EB=A1=9C=20=EC=A3=BC=EC=9E=85=EC=8B=9C?= =?UTF-8?q?=ED=82=A4=EB=8A=94=20=EC=BD=94=EB=93=9C=EB=A1=9C=20=EC=88=98?= =?UTF-8?q?=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../HomeCafeRecipes/Router/Router.swift | 51 ++++++++++++------- 1 file changed, 33 insertions(+), 18 deletions(-) diff --git a/HomeCafeRecipes/HomeCafeRecipes/Router/Router.swift b/HomeCafeRecipes/HomeCafeRecipes/Router/Router.swift index d092968..0ada8ca 100644 --- a/HomeCafeRecipes/HomeCafeRecipes/Router/Router.swift +++ b/HomeCafeRecipes/HomeCafeRecipes/Router/Router.swift @@ -49,15 +49,21 @@ class Router: NSObject, RouterProtocol { extension Router { func createRecipeListDependencies() -> RecipeListViewController { - let baseNetworkService = BaseNetworkService() - let recipeFetchService = RecipeFetchServiceImpl(networkService: baseNetworkService) - let feedListRepository = FeedListRepositoryImpl(networkService: recipeFetchService) - let searchFeedRepository = SearchFeedRepositoryImpl(networkService: recipeFetchService) - let fetchFeedListUseCase = FetchFeedListUseCaseImpl(repository: feedListRepository) - let searchFeedListUseCase = SearchFeedListUseCaseImpl(repository: searchFeedRepository) let recipeListInteractor = RecipeListInteractorImpl( - fetchFeedListUseCase: fetchFeedListUseCase, - searchFeedListUseCase: searchFeedListUseCase + fetchFeedListUseCase: FetchFeedListUseCaseImpl( + repository: FeedListRepositoryImpl( + networkService: RecipeFetchServiceImpl( + networkService: BaseNetworkService() + ) + ) + ), + searchFeedListUseCase: SearchFeedListUseCaseImpl( + repository: SearchFeedRepositoryImpl( + networkService: RecipeFetchServiceImpl( + networkService: BaseNetworkService() + ) + ) + ) ) let recipeListRouter = RecipeListRouterImpl(router: self) let recipeListVC = RecipeListViewController( @@ -69,21 +75,30 @@ extension Router { } func createAddRecipeDependencies(recipeType: RecipeType) -> AddRecipeViewController { - let baseNetworkService = BaseNetworkService() - let recipePostService = RecipePostServiceImpl(networkService: baseNetworkService) - let saveRepository = AddRecipeRepositoryImpl(recipePostService: recipePostService) - let saveRecipeUseCase = SaveRecipeUseCaseImpl(repository: saveRepository) - let addRecipeInteractor = AddRecipeInteractorImpl(saveRecipeUseCase: saveRecipeUseCase) - let addRecipeVC = AddRecipeViewController(recipeType: recipeType, addRecipeInteractor: addRecipeInteractor) + let addRecipeInteractor = AddRecipeInteractorImpl( + saveRecipeUseCase: AddRecipeUseCaseImpl( + repository: AddRecipeRepositoryImpl( + recipePostService: RecipePostServiceImpl( + networkService: BaseNetworkService() + ) + ) + ) + ) + let addRecipeVC = AddRecipeViewController( + recipeType: recipeType, + addRecipeInteractor: addRecipeInteractor + ) + addRecipeInteractor.delegate = addRecipeVC return addRecipeVC } func createRecipeDetailDependencies(recipeID: Int) -> RecipeDetailViewController { - let baseNetworkService = BaseNetworkService() - let recipeDetailRepository = RecipeDetailRepositoryImpl(networkService: baseNetworkService) - let fetchRecipeDetailUseCase = FetchRecipeDetailUseCaseImpl(repository: recipeDetailRepository) let detailInteractor = RecipeDetailInteractorImpl( - fetchRecipeDetailUseCase: fetchRecipeDetailUseCase, + fetchRecipeDetailUseCase: FetchRecipeDetailUseCaseImpl( + repository: RecipeDetailRepositoryImpl( + networkService: BaseNetworkService() + ) + ), recipeID: recipeID ) let detailVC = RecipeDetailViewController(interactor: detailInteractor) From 9c07a9b1677f8e9df46c3c99119d7200d17ac3ae Mon Sep 17 00:00:00 2001 From: GeonH0 Date: Tue, 23 Jul 2024 14:44:05 +0900 Subject: [PATCH 8/8] =?UTF-8?q?Fix:=20create=5F=5F=5FDependencies=20?= =?UTF-8?q?=EC=97=90=EC=84=9C=20make=5F=5F=5FViewController=EB=A1=9C=20?= =?UTF-8?q?=EB=84=A4=EC=9D=B4=EB=B0=8D=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Presentation/Tabbar/MainTabBarController.swift | 4 ++-- .../HomeCafeRecipes/Router/RecipeListRouter.swift | 2 +- HomeCafeRecipes/HomeCafeRecipes/Router/Router.swift | 6 +++--- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/HomeCafeRecipes/HomeCafeRecipes/Presentation/Tabbar/MainTabBarController.swift b/HomeCafeRecipes/HomeCafeRecipes/Presentation/Tabbar/MainTabBarController.swift index ea666a3..a57e50c 100644 --- a/HomeCafeRecipes/HomeCafeRecipes/Presentation/Tabbar/MainTabBarController.swift +++ b/HomeCafeRecipes/HomeCafeRecipes/Presentation/Tabbar/MainTabBarController.swift @@ -81,12 +81,12 @@ class MainTabBarController: UITabBarController, UITabBarControllerDelegate { let alert = UIAlertController(title: "게시물 작성", message: "어떤 게시물을 작성하실 건가요?", preferredStyle: .actionSheet) alert.addAction(UIAlertAction(title: "Coffee", style: .default, handler: { [weak self] _ in guard let self else { return } - let addRecipeVC = self.router.createAddRecipeDependencies(recipeType: .coffee) + let addRecipeVC = router.makeAddRecipeViewController(recipeType: .coffee) self.navigationController?.pushViewController(addRecipeVC, animated: true) })) alert.addAction(UIAlertAction(title: "Dessert", style: .default, handler: { [weak self] _ in guard let self else { return } - let addRecipeVC = self.router.createAddRecipeDependencies(recipeType: .dessert) + let addRecipeVC = router.makeAddRecipeViewController(recipeType: .dessert) self.navigationController?.pushViewController(addRecipeVC, animated: true) })) alert.addAction(UIAlertAction(title: "Cancel", style: .cancel, handler: nil)) diff --git a/HomeCafeRecipes/HomeCafeRecipes/Router/RecipeListRouter.swift b/HomeCafeRecipes/HomeCafeRecipes/Router/RecipeListRouter.swift index 4e0c7a3..bf15166 100644 --- a/HomeCafeRecipes/HomeCafeRecipes/Router/RecipeListRouter.swift +++ b/HomeCafeRecipes/HomeCafeRecipes/Router/RecipeListRouter.swift @@ -19,7 +19,7 @@ class RecipeListRouterImpl: RecipeListRouter { } func navigateToRecipeDetail(from viewController: UIViewController, recipeID: Int) { - let detailVC = router.createRecipeDetailDependencies(recipeID: recipeID) + let detailVC = router.makeRecipeDetailViewController(recipeID: recipeID) router.push(detailVC, from: viewController, isAnimated: true, onNavigateBack: nil) } } diff --git a/HomeCafeRecipes/HomeCafeRecipes/Router/Router.swift b/HomeCafeRecipes/HomeCafeRecipes/Router/Router.swift index 0ada8ca..570dbf0 100644 --- a/HomeCafeRecipes/HomeCafeRecipes/Router/Router.swift +++ b/HomeCafeRecipes/HomeCafeRecipes/Router/Router.swift @@ -48,7 +48,7 @@ class Router: NSObject, RouterProtocol { } extension Router { - func createRecipeListDependencies() -> RecipeListViewController { + func makeRecipeListViewController() -> RecipeListViewController { let recipeListInteractor = RecipeListInteractorImpl( fetchFeedListUseCase: FetchFeedListUseCaseImpl( repository: FeedListRepositoryImpl( @@ -74,7 +74,7 @@ extension Router { return recipeListVC } - func createAddRecipeDependencies(recipeType: RecipeType) -> AddRecipeViewController { + func makeAddRecipeViewController(recipeType: RecipeType) -> AddRecipeViewController { let addRecipeInteractor = AddRecipeInteractorImpl( saveRecipeUseCase: AddRecipeUseCaseImpl( repository: AddRecipeRepositoryImpl( @@ -92,7 +92,7 @@ extension Router { return addRecipeVC } - func createRecipeDetailDependencies(recipeID: Int) -> RecipeDetailViewController { + func makeRecipeDetailViewController(recipeID: Int) -> RecipeDetailViewController { let detailInteractor = RecipeDetailInteractorImpl( fetchRecipeDetailUseCase: FetchRecipeDetailUseCaseImpl( repository: RecipeDetailRepositoryImpl(