From 7dee2eaf15c4ce19bf1e5cd0da9d9a29d24f4137 Mon Sep 17 00:00:00 2001 From: SeungHyun Hong Date: Thu, 25 Jan 2024 16:54:45 +0900 Subject: [PATCH] :closed_lock_with_key: Set up `XCConfig` for baseURL and update `.gitignore` --- .gitignore | 1 + APIService/Sources/HomeAPI/HomeEndPoint.swift | 2 - Core/Sources/Network/EndPoint.swift | 14 +++++ PyeonHaeng-iOS.xcodeproj/project.pbxproj | 55 ++++++++++++++++++- PyeonHaeng-iOS/Resources/Info.plist | 2 + 5 files changed, 71 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index b0df64a..e04264a 100644 --- a/.gitignore +++ b/.gitignore @@ -137,4 +137,5 @@ xcuserdata /*.gcno **/xcshareddata/WorkspaceSettings.xcsettings +XCConfig/* # End of https://www.toptal.com/developers/gitignore/api/macos,xcode,swift,swiftpackagemanager diff --git a/APIService/Sources/HomeAPI/HomeEndPoint.swift b/APIService/Sources/HomeAPI/HomeEndPoint.swift index 56d8be9..df67721 100644 --- a/APIService/Sources/HomeAPI/HomeEndPoint.swift +++ b/APIService/Sources/HomeAPI/HomeEndPoint.swift @@ -9,8 +9,6 @@ import Foundation import Network struct HomeEndPoint: EndPoint { - var baseURL: String - var method: HTTPMethod var path: String diff --git a/Core/Sources/Network/EndPoint.swift b/Core/Sources/Network/EndPoint.swift index cc9bf2a..13ebe55 100644 --- a/Core/Sources/Network/EndPoint.swift +++ b/Core/Sources/Network/EndPoint.swift @@ -5,6 +5,10 @@ // Created by 홍승현 on 1/25/24. // +import Foundation + +// MARK: - EndPoint + /// 네트워킹 작업 정보를 담습니다. public protocol EndPoint { /// 공통 base URL @@ -24,3 +28,13 @@ public protocol EndPoint { /// 헤더 값을 설정합니다. var headers: [String: String] { get } } + +public extension EndPoint { + var baseURL: String { + guard let urlString = Bundle.main.infoDictionary?["BaseURL"] as? String + else { + fatalError("URL 설정이 되어있지 않습니다. XCConfig 파일을 다시 한 번 확인해주세요.") + } + return urlString + } +} diff --git a/PyeonHaeng-iOS.xcodeproj/project.pbxproj b/PyeonHaeng-iOS.xcodeproj/project.pbxproj index d41d669..1342acb 100644 --- a/PyeonHaeng-iOS.xcodeproj/project.pbxproj +++ b/PyeonHaeng-iOS.xcodeproj/project.pbxproj @@ -8,6 +8,10 @@ /* Begin PBXBuildFile section */ BA0563FB2B61EAD5003D6DC7 /* .gitkeep in Resources */ = {isa = PBXBuildFile; fileRef = BA0563FA2B61EAD5003D6DC7 /* .gitkeep */; }; + BA0564062B624646003D6DC7 /* Shared.xcconfig in Resources */ = {isa = PBXBuildFile; fileRef = BA0564052B624646003D6DC7 /* Shared.xcconfig */; }; + BA0564092B6248EA003D6DC7 /* HomeAPI in Frameworks */ = {isa = PBXBuildFile; productRef = BA0564082B6248EA003D6DC7 /* HomeAPI */; }; + BA05640B2B6248EA003D6DC7 /* HomeAPISupport in Frameworks */ = {isa = PBXBuildFile; productRef = BA05640A2B6248EA003D6DC7 /* HomeAPISupport */; }; + BA05640D2B6248EA003D6DC7 /* Network in Frameworks */ = {isa = PBXBuildFile; productRef = BA05640C2B6248EA003D6DC7 /* Network */; }; BA28F17C2B6155450052855E /* PyeonHaeng_iOSTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = BA28F17B2B6155450052855E /* PyeonHaeng_iOSTests.swift */; }; BA28F1852B6155810052855E /* OnboardingView.swift in Sources */ = {isa = PBXBuildFile; fileRef = BA28F1842B6155810052855E /* OnboardingView.swift */; }; BA28F1882B6155910052855E /* HomeView.swift in Sources */ = {isa = PBXBuildFile; fileRef = BA28F1872B6155910052855E /* HomeView.swift */; }; @@ -47,6 +51,7 @@ BA0563FA2B61EAD5003D6DC7 /* .gitkeep */ = {isa = PBXFileReference; lastKnownFileType = text; path = .gitkeep; sourceTree = ""; }; BA0564022B62179A003D6DC7 /* Core */ = {isa = PBXFileReference; lastKnownFileType = wrapper; path = Core; sourceTree = ""; }; BA0564032B6219D4003D6DC7 /* APIService */ = {isa = PBXFileReference; lastKnownFileType = wrapper; path = APIService; sourceTree = ""; }; + BA0564052B624646003D6DC7 /* Shared.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Shared.xcconfig; path = XCConfig/Shared.xcconfig; sourceTree = SOURCE_ROOT; }; BA28F1792B6155450052855E /* PyeonHaeng-iOSTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "PyeonHaeng-iOSTests.xctest"; sourceTree = BUILT_PRODUCTS_DIR; }; BA28F17B2B6155450052855E /* PyeonHaeng_iOSTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PyeonHaeng_iOSTests.swift; sourceTree = ""; }; BA28F1842B6155810052855E /* OnboardingView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OnboardingView.swift; sourceTree = ""; }; @@ -87,6 +92,9 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + BA05640D2B6248EA003D6DC7 /* Network in Frameworks */, + BA05640B2B6248EA003D6DC7 /* HomeAPISupport in Frameworks */, + BA0564092B6248EA003D6DC7 /* HomeAPI in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -101,6 +109,22 @@ path = Components; sourceTree = ""; }; + BA0564042B624629003D6DC7 /* XCConfig */ = { + isa = PBXGroup; + children = ( + BA0564052B624646003D6DC7 /* Shared.xcconfig */, + ); + name = XCConfig; + path = "PyeonHaeng-iOS/XCConfig"; + sourceTree = ""; + }; + BA0564072B6248EA003D6DC7 /* Frameworks */ = { + isa = PBXGroup; + children = ( + ); + name = Frameworks; + sourceTree = ""; + }; BA28F1702B6152E90052855E /* Resources */ = { isa = PBXGroup; children = ( @@ -230,9 +254,11 @@ children = ( BA0564032B6219D4003D6DC7 /* APIService */, BA0564022B62179A003D6DC7 /* Core */, + BAA4D9AA2B5A1795005999F8 /* Products */, BAA4D9AB2B5A1795005999F8 /* PyeonHaeng-iOS */, BA28F17A2B6155450052855E /* PyeonHaeng-iOSTests */, - BAA4D9AA2B5A1795005999F8 /* Products */, + BA0564042B624629003D6DC7 /* XCConfig */, + BA0564072B6248EA003D6DC7 /* Frameworks */, ); sourceTree = ""; }; @@ -300,6 +326,11 @@ dependencies = ( ); name = "PyeonHaeng-iOS"; + packageProductDependencies = ( + BA0564082B6248EA003D6DC7 /* HomeAPI */, + BA05640A2B6248EA003D6DC7 /* HomeAPISupport */, + BA05640C2B6248EA003D6DC7 /* Network */, + ); productName = "PyeonHaeng-iOS"; productReference = BAA4D9A92B5A1795005999F8 /* PyeonHaeng-iOS.app */; productType = "com.apple.product-type.application"; @@ -367,6 +398,7 @@ BA28F1A42B61572A0052855E /* Pretendard-ExtraBold.otf in Resources */, BA28F1A02B61572A0052855E /* Pretendard-Regular.otf in Resources */, BAA4D9B12B5A1796005999F8 /* Assets.xcassets in Resources */, + BA0564062B624646003D6DC7 /* Shared.xcconfig in Resources */, BAF2BEB32B61236100931AF0 /* Localizable.xcstrings in Resources */, BA28F1A22B61572A0052855E /* Pretendard-Medium.otf in Resources */, BA0563FB2B61EAD5003D6DC7 /* .gitkeep in Resources */, @@ -454,6 +486,7 @@ /* Begin XCBuildConfiguration section */ BA28F1802B6155450052855E /* Debug */ = { isa = XCBuildConfiguration; + baseConfigurationReference = BA0564052B624646003D6DC7 /* Shared.xcconfig */; buildSettings = { BUNDLE_LOADER = "$(TEST_HOST)"; CODE_SIGN_STYLE = Automatic; @@ -472,6 +505,7 @@ }; BA28F1812B6155450052855E /* Release */ = { isa = XCBuildConfiguration; + baseConfigurationReference = BA0564052B624646003D6DC7 /* Shared.xcconfig */; buildSettings = { BUNDLE_LOADER = "$(TEST_HOST)"; CODE_SIGN_STYLE = Automatic; @@ -490,6 +524,7 @@ }; BAA4D9B52B5A1796005999F8 /* Debug */ = { isa = XCBuildConfiguration; + baseConfigurationReference = BA0564052B624646003D6DC7 /* Shared.xcconfig */; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES; @@ -553,6 +588,7 @@ }; BAA4D9B62B5A1796005999F8 /* Release */ = { isa = XCBuildConfiguration; + baseConfigurationReference = BA0564052B624646003D6DC7 /* Shared.xcconfig */; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES; @@ -609,6 +645,7 @@ }; BAA4D9B82B5A1796005999F8 /* Debug */ = { isa = XCBuildConfiguration; + baseConfigurationReference = BA0564052B624646003D6DC7 /* Shared.xcconfig */; buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; @@ -641,6 +678,7 @@ }; BAA4D9B92B5A1796005999F8 /* Release */ = { isa = XCBuildConfiguration; + baseConfigurationReference = BA0564052B624646003D6DC7 /* Shared.xcconfig */; buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; @@ -702,6 +740,21 @@ defaultConfigurationName = Release; }; /* End XCConfigurationList section */ + +/* Begin XCSwiftPackageProductDependency section */ + BA0564082B6248EA003D6DC7 /* HomeAPI */ = { + isa = XCSwiftPackageProductDependency; + productName = HomeAPI; + }; + BA05640A2B6248EA003D6DC7 /* HomeAPISupport */ = { + isa = XCSwiftPackageProductDependency; + productName = HomeAPISupport; + }; + BA05640C2B6248EA003D6DC7 /* Network */ = { + isa = XCSwiftPackageProductDependency; + productName = Network; + }; +/* End XCSwiftPackageProductDependency section */ }; rootObject = BAA4D9A12B5A1795005999F8 /* Project object */; } diff --git a/PyeonHaeng-iOS/Resources/Info.plist b/PyeonHaeng-iOS/Resources/Info.plist index 345ec73..3ebf96f 100644 --- a/PyeonHaeng-iOS/Resources/Info.plist +++ b/PyeonHaeng-iOS/Resources/Info.plist @@ -2,6 +2,8 @@ + BaseURL + $(BASE_URL) UIAppFonts Pretendard-Thin.otf