From 90fa58ce42a3829f999614999788cc6ade8432f9 Mon Sep 17 00:00:00 2001 From: GeonH0 Date: Thu, 11 Jul 2024 13:06:06 +0900 Subject: [PATCH] =?UTF-8?q?Fix:=20APIConfig=EB=A5=BC=20public=EC=9C=BC?= =?UTF-8?q?=EB=A1=9C=20=EC=82=AC=EC=9A=A9=ED=95=98=EA=B2=8C=20=EB=B3=80?= =?UTF-8?q?=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- HomeCafeRecipes/HomeCafeRecipes.xcodeproj/project.pbxproj | 6 ++++++ .../HomeCafeRecipes/Data/Network/RecipeFetchService.swift | 6 ++---- .../Data/Repositories/RecipeDetailRepository.swift | 8 +++----- 3 files changed, 11 insertions(+), 9 deletions(-) diff --git a/HomeCafeRecipes/HomeCafeRecipes.xcodeproj/project.pbxproj b/HomeCafeRecipes/HomeCafeRecipes.xcodeproj/project.pbxproj index 13a9dbd..6a79fef 100644 --- a/HomeCafeRecipes/HomeCafeRecipes.xcodeproj/project.pbxproj +++ b/HomeCafeRecipes/HomeCafeRecipes.xcodeproj/project.pbxproj @@ -25,6 +25,8 @@ 1D4741D22C1B4F8D009381CE /* RecipeDTO.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1D4741CD2C1B4F8D009381CE /* RecipeDTO.swift */; }; 1D4741D32C1B4F8D009381CE /* RecipePageDTO.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1D4741CE2C1B4F8D009381CE /* RecipePageDTO.swift */; }; 1D4741D42C1B4F8D009381CE /* NetworkResponseDTO.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1D4741CF2C1B4F8D009381CE /* NetworkResponseDTO.swift */; }; + 1D60CC422C3F916400D08FA3 /* APIConfig.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1D60CC412C3F916400D08FA3 /* APIConfig.swift */; }; + 1D60CC432C3F916400D08FA3 /* APIConfig.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1D60CC412C3F916400D08FA3 /* APIConfig.swift */; }; 1D7368B72C3442C8000EF904 /* String+Validation.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1D7368B52C3442C8000EF904 /* String+Validation.swift */; }; 1D7368B82C3442C8000EF904 /* UIImageViewImageLoading.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1D7368B62C3442C8000EF904 /* UIImageViewImageLoading.swift */; }; 1D7368BA2C3442DE000EF904 /* RecipeListMapper.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1D7368B92C3442DE000EF904 /* RecipeListMapper.swift */; }; @@ -95,6 +97,7 @@ 1D4741CD2C1B4F8D009381CE /* RecipeDTO.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RecipeDTO.swift; sourceTree = ""; }; 1D4741CE2C1B4F8D009381CE /* RecipePageDTO.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RecipePageDTO.swift; sourceTree = ""; }; 1D4741CF2C1B4F8D009381CE /* NetworkResponseDTO.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NetworkResponseDTO.swift; sourceTree = ""; }; + 1D60CC412C3F916400D08FA3 /* APIConfig.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = APIConfig.swift; sourceTree = ""; }; 1D7368B52C3442C8000EF904 /* String+Validation.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "String+Validation.swift"; sourceTree = ""; }; 1D7368B62C3442C8000EF904 /* UIImageViewImageLoading.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = UIImageViewImageLoading.swift; sourceTree = ""; }; 1D7368B92C3442DE000EF904 /* RecipeListMapper.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RecipeListMapper.swift; sourceTree = ""; }; @@ -200,6 +203,7 @@ 1D4741CB2C1B4F8D009381CE /* DTO */, 1D1283C92C16D9C600C5A870 /* RecipeFetchService.swift */, 1DE19EB02C1B42200031804A /* NetworkService.swift */, + 1D60CC412C3F916400D08FA3 /* APIConfig.swift */, ); path = Network; sourceTree = ""; @@ -548,6 +552,7 @@ 1DF829B12C299F1F00C337FC /* RecipeListInteractor.swift in Sources */, 1D2C16EA2BE532B700C04508 /* ViewController.swift in Sources */, 1D7368EA2C34FBF7000EF904 /* MainTabBarController.swift in Sources */, + 1D60CC422C3F916400D08FA3 /* APIConfig.swift in Sources */, 1D7368D42C34FAE8000EF904 /* RecipeDetailInteractor.swift in Sources */, 1DE19EC52C1B422F0031804A /* RecipeListView.swift in Sources */, 1D7368CB2C3443A1000EF904 /* User.swift in Sources */, @@ -592,6 +597,7 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( + 1D60CC432C3F916400D08FA3 /* APIConfig.swift in Sources */, 1D2C16FD2BE532B800C04508 /* HomeCafeRecipesTests.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; diff --git a/HomeCafeRecipes/HomeCafeRecipes/Data/Network/RecipeFetchService.swift b/HomeCafeRecipes/HomeCafeRecipes/Data/Network/RecipeFetchService.swift index b76b146..628b0ea 100644 --- a/HomeCafeRecipes/HomeCafeRecipes/Data/Network/RecipeFetchService.swift +++ b/HomeCafeRecipes/HomeCafeRecipes/Data/Network/RecipeFetchService.swift @@ -15,15 +15,13 @@ protocol RecipeFetchService { class RecipeFetchServiceImpl: RecipeFetchService { private let networkService: NetworkService - private let apiConfig: APIConfig - init(networkService: NetworkService, apiConfig: APIConfig) { + init(networkService: NetworkService) { self.networkService = networkService - self.apiConfig = apiConfig } private func makeURL(endpoint: String, queryItems: [URLQueryItem]) -> URL? { - let URL = apiConfig.baseURL.appendingPathComponent(endpoint) + let URL = APIConfig().baseURL.appendingPathComponent(endpoint) var URLComponents = URLComponents(url: URL, resolvingAgainstBaseURL: false) URLComponents?.queryItems = queryItems return URLComponents?.url diff --git a/HomeCafeRecipes/HomeCafeRecipes/Data/Repositories/RecipeDetailRepository.swift b/HomeCafeRecipes/HomeCafeRecipes/Data/Repositories/RecipeDetailRepository.swift index dddc119..fa76931 100644 --- a/HomeCafeRecipes/HomeCafeRecipes/Data/Repositories/RecipeDetailRepository.swift +++ b/HomeCafeRecipes/HomeCafeRecipes/Data/Repositories/RecipeDetailRepository.swift @@ -15,15 +15,13 @@ protocol RecipeDetailRepository { class RecipeDetailRepositoryImpl: RecipeDetailRepository { private let networkService: NetworkService - private let apiConfig: APIConfig - - init(networkService: NetworkService, apiConfig: APIConfig) { + + init(networkService: NetworkService) { self.networkService = networkService - self.apiConfig = apiConfig } private func makeURL(recipeId: Int) -> URL? { - return apiConfig.baseURL.appendingPathComponent("recipes/\(recipeId)") + return APIConfig().baseURL.appendingPathComponent("recipes/\(recipeId)") } func fetchRecipeDetail(recipeID: Int) -> Single {