diff --git a/GEON-PPANG-iOS.xcodeproj/project.pbxproj b/GEON-PPANG-iOS.xcodeproj/project.pbxproj index ade8897e..15f171d0 100644 --- a/GEON-PPANG-iOS.xcodeproj/project.pbxproj +++ b/GEON-PPANG-iOS.xcodeproj/project.pbxproj @@ -180,6 +180,8 @@ 3E3DEB7F2C3122E500CA5999 /* PostFilterRequestDTO.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3E3DEB7E2C3122E500CA5999 /* PostFilterRequestDTO.swift */; }; 3E3DEB812C31263600CA5999 /* PostFilterResponseDTO.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3E3DEB802C31263600CA5999 /* PostFilterResponseDTO.swift */; }; 3E3DEB852C312F6C00CA5999 /* GBDataError.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3E3DEB842C312F6C00CA5999 /* GBDataError.swift */; }; + 3E3DEBE42C31609500CA5999 /* GBNetwork.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3E3DEBE12C31608C00CA5999 /* GBNetwork.framework */; }; + 3E3DEBE52C31609500CA5999 /* GBNetwork.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 3E3DEBE12C31608C00CA5999 /* GBNetwork.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; 3E452B672A60E68000EA456D /* MyPageResponseDTO.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3E452B662A60E68000EA456D /* MyPageResponseDTO.swift */; }; 3E452B692A60FF7900EA456D /* MyPageCollectionViewFooter.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3E452B682A60FF7900EA456D /* MyPageCollectionViewFooter.swift */; }; 3E452B6B2A614AAE00EA456D /* ImageWithSubtitleButton.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3E452B6A2A614AAD00EA456D /* ImageWithSubtitleButton.swift */; }; @@ -289,6 +291,23 @@ DFFBE3872AB8B4C100D27548 /* DetailReasonTextView.swift in Sources */ = {isa = PBXBuildFile; fileRef = DFFBE3862AB8B4C100D27548 /* DetailReasonTextView.swift */; }; /* End PBXBuildFile section */ +/* Begin PBXContainerItemProxy section */ + 3E3DEBE02C31608C00CA5999 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 3E3DEBDB2C31608C00CA5999 /* GBNetwork.xcodeproj */; + proxyType = 2; + remoteGlobalIDString = 3E3DEB332C3117A300CA5999; + remoteInfo = GBNetwork; + }; + 3E3DEBE22C31608C00CA5999 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 3E3DEBDB2C31608C00CA5999 /* GBNetwork.xcodeproj */; + proxyType = 2; + remoteGlobalIDString = 3E3DEB3D2C3117A400CA5999; + remoteInfo = GBNetworkTests; + }; +/* End PBXContainerItemProxy section */ + /* Begin PBXCopyFilesBuildPhase section */ 3E3DEA002C26981200CA5999 /* Embed Frameworks */ = { isa = PBXCopyFilesBuildPhase; @@ -296,6 +315,7 @@ dstPath = ""; dstSubfolderSpec = 10; files = ( + 3E3DEBE52C31609500CA5999 /* GBNetwork.framework in Embed Frameworks */, ); name = "Embed Frameworks"; runOnlyForDeploymentPostprocessing = 0; @@ -467,6 +487,7 @@ 3E3DEB7E2C3122E500CA5999 /* PostFilterRequestDTO.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PostFilterRequestDTO.swift; sourceTree = ""; }; 3E3DEB802C31263600CA5999 /* PostFilterResponseDTO.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PostFilterResponseDTO.swift; sourceTree = ""; }; 3E3DEB842C312F6C00CA5999 /* GBDataError.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GBDataError.swift; sourceTree = ""; }; + 3E3DEBDB2C31608C00CA5999 /* GBNetwork.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = GBNetwork.xcodeproj; path = GBNetwork/GBNetwork.xcodeproj; sourceTree = ""; }; 3E452B662A60E68000EA456D /* MyPageResponseDTO.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MyPageResponseDTO.swift; sourceTree = ""; }; 3E452B682A60FF7900EA456D /* MyPageCollectionViewFooter.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MyPageCollectionViewFooter.swift; sourceTree = ""; }; 3E452B6A2A614AAD00EA456D /* ImageWithSubtitleButton.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ImageWithSubtitleButton.swift; sourceTree = ""; }; @@ -590,6 +611,7 @@ 090556382A51E16B00752067 /* Then in Frameworks */, 098227EA2AB8B17700872135 /* Sentry in Frameworks */, 0905563B2A51E17800752067 /* SnapKit in Frameworks */, + 3E3DEBE42C31609500CA5999 /* GBNetwork.framework in Frameworks */, 090556432A51E6FC00752067 /* Moya in Frameworks */, 095FB8802AB3427D00C69BD1 /* Amplitude in Frameworks */, 3E36D7D12A8DE65D00B2C1CC /* KakaoSDKUser in Frameworks */, @@ -1378,6 +1400,15 @@ path = Member; sourceTree = ""; }; + 3E3DEBDC2C31608C00CA5999 /* DTO */ = { + isa = PBXGroup; + children = ( + 3E3DEBE12C31608C00CA5999 /* GBNetwork.framework */, + 3E3DEBE32C31608C00CA5999 /* GBNetworkTests.xctest */, + ); + path = DTO; + sourceTree = ""; + }; 3E61EE8F2AA9530D004F25DB /* Review */ = { isa = PBXGroup; children = ( @@ -1454,6 +1485,7 @@ 3E8C47CE2BC385A800919E06 /* Core */ = { isa = PBXGroup; children = ( + 3E3DEBDB2C31608C00CA5999 /* GBNetwork.xcodeproj */, 3EF9F8892BBCE9D400F3E366 /* DesignSystem */, ); path = Core; @@ -2131,6 +2163,12 @@ ); productRefGroup = 098F32DE2A4200FD0092D09A /* Products */; projectDirPath = ""; + projectReferences = ( + { + ProductGroup = 3E3DEBDC2C31608C00CA5999 /* DTO */; + ProjectRef = 3E3DEBDB2C31608C00CA5999 /* GBNetwork.xcodeproj */; + }, + ); projectRoot = ""; targets = ( 098F32DC2A4200FD0092D09A /* GEON-PPANG-iOS */, @@ -2138,6 +2176,23 @@ }; /* End PBXProject section */ +/* Begin PBXReferenceProxy section */ + 3E3DEBE12C31608C00CA5999 /* GBNetwork.framework */ = { + isa = PBXReferenceProxy; + fileType = wrapper.framework; + path = GBNetwork.framework; + remoteRef = 3E3DEBE02C31608C00CA5999 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + 3E3DEBE32C31608C00CA5999 /* GBNetworkTests.xctest */ = { + isa = PBXReferenceProxy; + fileType = wrapper.cfbundle; + path = GBNetworkTests.xctest; + remoteRef = 3E3DEBE22C31608C00CA5999 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; +/* End PBXReferenceProxy section */ + /* Begin PBXResourcesBuildPhase section */ 098F32DB2A4200FD0092D09A /* Resources */ = { isa = PBXResourcesBuildPhase; diff --git a/GEON-PPANG-iOS/Core/GBNetwork/GBNetwork.xcodeproj/project.pbxproj b/GEON-PPANG-iOS/Core/GBNetwork/GBNetwork.xcodeproj/project.pbxproj new file mode 100644 index 00000000..0e332b8a --- /dev/null +++ b/GEON-PPANG-iOS/Core/GBNetwork/GBNetwork.xcodeproj/project.pbxproj @@ -0,0 +1,514 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 56; + objects = { + +/* Begin PBXBuildFile section */ + 3E3DEB382C3117A400CA5999 /* GBNetwork.docc in Sources */ = {isa = PBXBuildFile; fileRef = 3E3DEB372C3117A400CA5999 /* GBNetwork.docc */; }; + 3E3DEB3E2C3117A400CA5999 /* GBNetwork.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3E3DEB332C3117A300CA5999 /* GBNetwork.framework */; }; + 3E3DEB432C3117A400CA5999 /* GBNetworkTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3E3DEB422C3117A400CA5999 /* GBNetworkTests.swift */; }; + 3E3DEB442C3117A400CA5999 /* GBNetwork.h in Headers */ = {isa = PBXBuildFile; fileRef = 3E3DEB362C3117A300CA5999 /* GBNetwork.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 3E3DEB562C3117F600CA5999 /* GBNetworkError.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3E3DEB4D2C3117F500CA5999 /* GBNetworkError.swift */; }; + 3E3DEB572C3117F600CA5999 /* APIClient.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3E3DEB4E2C3117F500CA5999 /* APIClient.swift */; }; + 3E3DEB582C3117F600CA5999 /* URLRequest+Encoding.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3E3DEB4F2C3117F600CA5999 /* URLRequest+Encoding.swift */; }; + 3E3DEB592C3117F600CA5999 /* Response.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3E3DEB502C3117F600CA5999 /* Response.swift */; }; + 3E3DEB5B2C3117F600CA5999 /* RequestType.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3E3DEB522C3117F600CA5999 /* RequestType.swift */; }; + 3E3DEB5C2C3117F600CA5999 /* HTTPMethod.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3E3DEB532C3117F600CA5999 /* HTTPMethod.swift */; }; + 3E3DEB5D2C3117F600CA5999 /* HTTPTask.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3E3DEB542C3117F600CA5999 /* HTTPTask.swift */; }; + 3E3DEB5E2C3117F600CA5999 /* HTTPHeader.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3E3DEB552C3117F600CA5999 /* HTTPHeader.swift */; }; + 3E3DEB9C2C315DE000CA5999 /* RawResponse.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3E3DEB9B2C315DE000CA5999 /* RawResponse.swift */; }; +/* End PBXBuildFile section */ + +/* Begin PBXContainerItemProxy section */ + 3E3DEB3F2C3117A400CA5999 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 3E3DEB2A2C3117A300CA5999 /* Project object */; + proxyType = 1; + remoteGlobalIDString = 3E3DEB322C3117A300CA5999; + remoteInfo = GBNetwork; + }; +/* End PBXContainerItemProxy section */ + +/* Begin PBXFileReference section */ + 3E3DEB332C3117A300CA5999 /* GBNetwork.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = GBNetwork.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + 3E3DEB362C3117A300CA5999 /* GBNetwork.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GBNetwork.h; sourceTree = ""; }; + 3E3DEB372C3117A400CA5999 /* GBNetwork.docc */ = {isa = PBXFileReference; lastKnownFileType = folder.documentationcatalog; path = GBNetwork.docc; sourceTree = ""; }; + 3E3DEB3D2C3117A400CA5999 /* GBNetworkTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = GBNetworkTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; + 3E3DEB422C3117A400CA5999 /* GBNetworkTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GBNetworkTests.swift; sourceTree = ""; }; + 3E3DEB4D2C3117F500CA5999 /* GBNetworkError.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GBNetworkError.swift; sourceTree = ""; }; + 3E3DEB4E2C3117F500CA5999 /* APIClient.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = APIClient.swift; sourceTree = ""; }; + 3E3DEB4F2C3117F600CA5999 /* URLRequest+Encoding.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "URLRequest+Encoding.swift"; sourceTree = ""; }; + 3E3DEB502C3117F600CA5999 /* Response.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Response.swift; sourceTree = ""; }; + 3E3DEB522C3117F600CA5999 /* RequestType.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RequestType.swift; sourceTree = ""; }; + 3E3DEB532C3117F600CA5999 /* HTTPMethod.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = HTTPMethod.swift; sourceTree = ""; }; + 3E3DEB542C3117F600CA5999 /* HTTPTask.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = HTTPTask.swift; sourceTree = ""; }; + 3E3DEB552C3117F600CA5999 /* HTTPHeader.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = HTTPHeader.swift; sourceTree = ""; }; + 3E3DEB9B2C315DE000CA5999 /* RawResponse.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RawResponse.swift; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + 3E3DEB302C3117A300CA5999 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 3E3DEB3A2C3117A400CA5999 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 3E3DEB3E2C3117A400CA5999 /* GBNetwork.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 3E3DEB292C3117A300CA5999 = { + isa = PBXGroup; + children = ( + 3E3DEB352C3117A300CA5999 /* GBNetwork */, + 3E3DEB412C3117A400CA5999 /* GBNetworkTests */, + 3E3DEB342C3117A300CA5999 /* Products */, + ); + sourceTree = ""; + }; + 3E3DEB342C3117A300CA5999 /* Products */ = { + isa = PBXGroup; + children = ( + 3E3DEB332C3117A300CA5999 /* GBNetwork.framework */, + 3E3DEB3D2C3117A400CA5999 /* GBNetworkTests.xctest */, + ); + name = Products; + sourceTree = ""; + }; + 3E3DEB352C3117A300CA5999 /* GBNetwork */ = { + isa = PBXGroup; + children = ( + 3E3DEB362C3117A300CA5999 /* GBNetwork.h */, + 3E3DEB4E2C3117F500CA5999 /* APIClient.swift */, + 3E3DEB4D2C3117F500CA5999 /* GBNetworkError.swift */, + 3E3DEB552C3117F600CA5999 /* HTTPHeader.swift */, + 3E3DEB532C3117F600CA5999 /* HTTPMethod.swift */, + 3E3DEB542C3117F600CA5999 /* HTTPTask.swift */, + 3E3DEB522C3117F600CA5999 /* RequestType.swift */, + 3E3DEB9B2C315DE000CA5999 /* RawResponse.swift */, + 3E3DEB502C3117F600CA5999 /* Response.swift */, + 3E3DEB4F2C3117F600CA5999 /* URLRequest+Encoding.swift */, + 3E3DEB372C3117A400CA5999 /* GBNetwork.docc */, + ); + path = GBNetwork; + sourceTree = ""; + }; + 3E3DEB412C3117A400CA5999 /* GBNetworkTests */ = { + isa = PBXGroup; + children = ( + 3E3DEB422C3117A400CA5999 /* GBNetworkTests.swift */, + ); + path = GBNetworkTests; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXHeadersBuildPhase section */ + 3E3DEB2E2C3117A300CA5999 /* Headers */ = { + isa = PBXHeadersBuildPhase; + buildActionMask = 2147483647; + files = ( + 3E3DEB442C3117A400CA5999 /* GBNetwork.h in Headers */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXHeadersBuildPhase section */ + +/* Begin PBXNativeTarget section */ + 3E3DEB322C3117A300CA5999 /* GBNetwork */ = { + isa = PBXNativeTarget; + buildConfigurationList = 3E3DEB472C3117A400CA5999 /* Build configuration list for PBXNativeTarget "GBNetwork" */; + buildPhases = ( + 3E3DEB2E2C3117A300CA5999 /* Headers */, + 3E3DEB2F2C3117A300CA5999 /* Sources */, + 3E3DEB302C3117A300CA5999 /* Frameworks */, + 3E3DEB312C3117A300CA5999 /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = GBNetwork; + productName = GBNetwork; + productReference = 3E3DEB332C3117A300CA5999 /* GBNetwork.framework */; + productType = "com.apple.product-type.framework"; + }; + 3E3DEB3C2C3117A400CA5999 /* GBNetworkTests */ = { + isa = PBXNativeTarget; + buildConfigurationList = 3E3DEB4A2C3117A400CA5999 /* Build configuration list for PBXNativeTarget "GBNetworkTests" */; + buildPhases = ( + 3E3DEB392C3117A400CA5999 /* Sources */, + 3E3DEB3A2C3117A400CA5999 /* Frameworks */, + 3E3DEB3B2C3117A400CA5999 /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + 3E3DEB402C3117A400CA5999 /* PBXTargetDependency */, + ); + name = GBNetworkTests; + productName = GBNetworkTests; + productReference = 3E3DEB3D2C3117A400CA5999 /* GBNetworkTests.xctest */; + productType = "com.apple.product-type.bundle.unit-test"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + 3E3DEB2A2C3117A300CA5999 /* Project object */ = { + isa = PBXProject; + attributes = { + BuildIndependentTargetsInParallel = 1; + LastSwiftUpdateCheck = 1540; + LastUpgradeCheck = 1540; + TargetAttributes = { + 3E3DEB322C3117A300CA5999 = { + CreatedOnToolsVersion = 15.4; + }; + 3E3DEB3C2C3117A400CA5999 = { + CreatedOnToolsVersion = 15.4; + }; + }; + }; + buildConfigurationList = 3E3DEB2D2C3117A300CA5999 /* Build configuration list for PBXProject "GBNetwork" */; + compatibilityVersion = "Xcode 14.0"; + developmentRegion = en; + hasScannedForEncodings = 0; + knownRegions = ( + en, + Base, + ); + mainGroup = 3E3DEB292C3117A300CA5999; + productRefGroup = 3E3DEB342C3117A300CA5999 /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + 3E3DEB322C3117A300CA5999 /* GBNetwork */, + 3E3DEB3C2C3117A400CA5999 /* GBNetworkTests */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + 3E3DEB312C3117A300CA5999 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 3E3DEB3B2C3117A400CA5999 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + 3E3DEB2F2C3117A300CA5999 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 3E3DEB5E2C3117F600CA5999 /* HTTPHeader.swift in Sources */, + 3E3DEB562C3117F600CA5999 /* GBNetworkError.swift in Sources */, + 3E3DEB382C3117A400CA5999 /* GBNetwork.docc in Sources */, + 3E3DEB9C2C315DE000CA5999 /* RawResponse.swift in Sources */, + 3E3DEB5C2C3117F600CA5999 /* HTTPMethod.swift in Sources */, + 3E3DEB582C3117F600CA5999 /* URLRequest+Encoding.swift in Sources */, + 3E3DEB5D2C3117F600CA5999 /* HTTPTask.swift in Sources */, + 3E3DEB572C3117F600CA5999 /* APIClient.swift in Sources */, + 3E3DEB592C3117F600CA5999 /* Response.swift in Sources */, + 3E3DEB5B2C3117F600CA5999 /* RequestType.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 3E3DEB392C3117A400CA5999 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 3E3DEB432C3117A400CA5999 /* GBNetworkTests.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin PBXTargetDependency section */ + 3E3DEB402C3117A400CA5999 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 3E3DEB322C3117A300CA5999 /* GBNetwork */; + targetProxy = 3E3DEB3F2C3117A400CA5999 /* PBXContainerItemProxy */; + }; +/* End PBXTargetDependency section */ + +/* Begin XCBuildConfiguration section */ + 3E3DEB452C3117A400CA5999 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++20"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + COPY_PHASE_STRIP = NO; + CURRENT_PROJECT_VERSION = 1; + DEBUG_INFORMATION_FORMAT = dwarf; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_TESTABILITY = YES; + ENABLE_USER_SCRIPT_SANDBOXING = YES; + GCC_C_LANGUAGE_STANDARD = gnu17; + GCC_DYNAMIC_NO_PIC = NO; + GCC_NO_COMMON_BLOCKS = YES; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 15.0; + LOCALIZATION_PREFERS_STRING_CATALOGS = YES; + MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; + MTL_FAST_MATH = YES; + ONLY_ACTIVE_ARCH = YES; + SDKROOT = iphoneos; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = "DEBUG $(inherited)"; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + VERSIONING_SYSTEM = "apple-generic"; + VERSION_INFO_PREFIX = ""; + }; + name = Debug; + }; + 3E3DEB462C3117A400CA5999 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++20"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + COPY_PHASE_STRIP = NO; + CURRENT_PROJECT_VERSION = 1; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_USER_SCRIPT_SANDBOXING = YES; + GCC_C_LANGUAGE_STANDARD = gnu17; + GCC_NO_COMMON_BLOCKS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 15.0; + LOCALIZATION_PREFERS_STRING_CATALOGS = YES; + MTL_ENABLE_DEBUG_INFO = NO; + MTL_FAST_MATH = YES; + SDKROOT = iphoneos; + SWIFT_COMPILATION_MODE = wholemodule; + VALIDATE_PRODUCT = YES; + VERSIONING_SYSTEM = "apple-generic"; + VERSION_INFO_PREFIX = ""; + }; + name = Release; + }; + 3E3DEB482C3117A400CA5999 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + BUILD_LIBRARY_FOR_DISTRIBUTION = YES; + CODE_SIGN_STYLE = Automatic; + CURRENT_PROJECT_VERSION = 1; + DEFINES_MODULE = YES; + DEVELOPMENT_TEAM = S9G6YGQ76H; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + DYLIB_INSTALL_NAME_BASE = "@rpath"; + ENABLE_MODULE_VERIFIER = YES; + GENERATE_INFOPLIST_FILE = YES; + INFOPLIST_KEY_NSHumanReadableCopyright = ""; + INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + "@loader_path/Frameworks", + ); + MARKETING_VERSION = 1.0; + MODULE_VERIFIER_SUPPORTED_LANGUAGES = "objective-c objective-c++"; + MODULE_VERIFIER_SUPPORTED_LANGUAGE_STANDARDS = "gnu17 gnu++20"; + PRODUCT_BUNDLE_IDENTIFIER = "com-id.GBNetwork"; + PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; + SKIP_INSTALL = YES; + SWIFT_EMIT_LOC_STRINGS = YES; + SWIFT_INSTALL_OBJC_HEADER = NO; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Debug; + }; + 3E3DEB492C3117A400CA5999 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + BUILD_LIBRARY_FOR_DISTRIBUTION = YES; + CODE_SIGN_STYLE = Automatic; + CURRENT_PROJECT_VERSION = 1; + DEFINES_MODULE = YES; + DEVELOPMENT_TEAM = S9G6YGQ76H; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + DYLIB_INSTALL_NAME_BASE = "@rpath"; + ENABLE_MODULE_VERIFIER = YES; + GENERATE_INFOPLIST_FILE = YES; + INFOPLIST_KEY_NSHumanReadableCopyright = ""; + INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + "@loader_path/Frameworks", + ); + MARKETING_VERSION = 1.0; + MODULE_VERIFIER_SUPPORTED_LANGUAGES = "objective-c objective-c++"; + MODULE_VERIFIER_SUPPORTED_LANGUAGE_STANDARDS = "gnu17 gnu++20"; + PRODUCT_BUNDLE_IDENTIFIER = "com-id.GBNetwork"; + PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; + SKIP_INSTALL = YES; + SWIFT_EMIT_LOC_STRINGS = YES; + SWIFT_INSTALL_OBJC_HEADER = NO; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Release; + }; + 3E3DEB4B2C3117A400CA5999 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; + CODE_SIGN_STYLE = Automatic; + CURRENT_PROJECT_VERSION = 1; + DEVELOPMENT_TEAM = S9G6YGQ76H; + GENERATE_INFOPLIST_FILE = YES; + MARKETING_VERSION = 1.0; + PRODUCT_BUNDLE_IDENTIFIER = "com-id.GBNetworkTests"; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_EMIT_LOC_STRINGS = NO; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Debug; + }; + 3E3DEB4C2C3117A400CA5999 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; + CODE_SIGN_STYLE = Automatic; + CURRENT_PROJECT_VERSION = 1; + DEVELOPMENT_TEAM = S9G6YGQ76H; + GENERATE_INFOPLIST_FILE = YES; + MARKETING_VERSION = 1.0; + PRODUCT_BUNDLE_IDENTIFIER = "com-id.GBNetworkTests"; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_EMIT_LOC_STRINGS = NO; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + 3E3DEB2D2C3117A300CA5999 /* Build configuration list for PBXProject "GBNetwork" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 3E3DEB452C3117A400CA5999 /* Debug */, + 3E3DEB462C3117A400CA5999 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 3E3DEB472C3117A400CA5999 /* Build configuration list for PBXNativeTarget "GBNetwork" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 3E3DEB482C3117A400CA5999 /* Debug */, + 3E3DEB492C3117A400CA5999 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 3E3DEB4A2C3117A400CA5999 /* Build configuration list for PBXNativeTarget "GBNetworkTests" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 3E3DEB4B2C3117A400CA5999 /* Debug */, + 3E3DEB4C2C3117A400CA5999 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = 3E3DEB2A2C3117A300CA5999 /* Project object */; +} diff --git a/GEON-PPANG-iOS/Core/GBNetwork/GBNetwork.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/GEON-PPANG-iOS/Core/GBNetwork/GBNetwork.xcodeproj/project.xcworkspace/contents.xcworkspacedata new file mode 100644 index 00000000..919434a6 --- /dev/null +++ b/GEON-PPANG-iOS/Core/GBNetwork/GBNetwork.xcodeproj/project.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,7 @@ + + + + + diff --git a/GEON-PPANG-iOS/Core/GBNetwork/GBNetwork.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/GEON-PPANG-iOS/Core/GBNetwork/GBNetwork.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 00000000..18d98100 --- /dev/null +++ b/GEON-PPANG-iOS/Core/GBNetwork/GBNetwork.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + diff --git a/GEON-PPANG-iOS/Core/GBNetwork/GBNetwork/APIClient.swift b/GEON-PPANG-iOS/Core/GBNetwork/GBNetwork/APIClient.swift new file mode 100644 index 00000000..402fd33f --- /dev/null +++ b/GEON-PPANG-iOS/Core/GBNetwork/GBNetwork/APIClient.swift @@ -0,0 +1,37 @@ +// +// APIClient.swift +// GBNetwork +// +// Created by 이성민 on 6/29/24. +// + +import Foundation + +public final class APIClient { + + public init() {} + + public func send( + _ request: Request + ) async throws -> RawResponse { + let configuration = URLSessionConfiguration.default + let session = URLSession(configuration: configuration) + + let (data, urlResponse) = try await session.data(for: request.toURLRequest()) + + guard let httpResponse = urlResponse as? HTTPURLResponse else { + throw GBNetworkError.decodingFailure(.httpDecodingError) + } + + switch httpResponse.statusCode { + case 200..<300: + return .init(data: data, httpResponse: httpResponse) + case 400..<500: + throw GBNetworkError.responseFailure(.clientError(httpResponse)) + case 500..<600: + throw GBNetworkError.responseFailure(.serverError(httpResponse)) + default: + throw GBNetworkError.responseFailure(.invalidError(httpResponse)) + } + } +} diff --git a/GEON-PPANG-iOS/Core/GBNetwork/GBNetwork/GBNetwork.docc/GBNetwork.md b/GEON-PPANG-iOS/Core/GBNetwork/GBNetwork/GBNetwork.docc/GBNetwork.md new file mode 100755 index 00000000..c81ecc33 --- /dev/null +++ b/GEON-PPANG-iOS/Core/GBNetwork/GBNetwork/GBNetwork.docc/GBNetwork.md @@ -0,0 +1,13 @@ +# ``GBNetwork`` + +Summary + +## Overview + +Text + +## Topics + +### Group + +- ``Symbol`` \ No newline at end of file diff --git a/GEON-PPANG-iOS/Core/GBNetwork/GBNetwork/GBNetwork.h b/GEON-PPANG-iOS/Core/GBNetwork/GBNetwork/GBNetwork.h new file mode 100644 index 00000000..d8191aaa --- /dev/null +++ b/GEON-PPANG-iOS/Core/GBNetwork/GBNetwork/GBNetwork.h @@ -0,0 +1,18 @@ +// +// GBNetwork.h +// GBNetwork +// +// Created by 이성민 on 6/30/24. +// + +#import + +//! Project version number for GBNetwork. +FOUNDATION_EXPORT double GBNetworkVersionNumber; + +//! Project version string for GBNetwork. +FOUNDATION_EXPORT const unsigned char GBNetworkVersionString[]; + +// In this header, you should import all the public headers of your framework using statements like #import + + diff --git a/GEON-PPANG-iOS/Core/GBNetwork/GBNetwork/GBNetworkError.swift b/GEON-PPANG-iOS/Core/GBNetwork/GBNetwork/GBNetworkError.swift new file mode 100644 index 00000000..22d83625 --- /dev/null +++ b/GEON-PPANG-iOS/Core/GBNetwork/GBNetwork/GBNetworkError.swift @@ -0,0 +1,52 @@ +// +// GBNetworkError.swift +// GBNetwork +// +// Created by 이성민 on 6/29/24. +// + +import Foundation + +public enum GBNetworkError: Error { + + // MARK: - Request related errors + + /// Creating `URL` from `String` failure + case urlCreationFailure(urlString: String) + + /// Encoding to `URLRequest` failure + case requestEncodingFailure(EncodingFailureReason) + + // MARK: - Response related errors + + /// Failure received from response + case responseFailure(ResponseFailureReason) + + /// Decoding `Data` to response type failure + case decodingFailure(DecodingFailureReason) + + /// Failure other than the failures above + case unknownFailure(description: String) +} + + +public extension GBNetworkError { + + enum EncodingFailureReason { + case pathError(String) + case jsonError(String) + } + + /// detailed reason why `.responseFailure` occurred + enum ResponseFailureReason { + case clientError(HTTPURLResponse) + case serverError(HTTPURLResponse) + case invalidError(HTTPURLResponse) + } + + enum DecodingFailureReason { + case httpDecodingError + case dtoDecodingError + } +} + diff --git a/GEON-PPANG-iOS/Core/GBNetwork/GBNetwork/HTTPHeader.swift b/GEON-PPANG-iOS/Core/GBNetwork/GBNetwork/HTTPHeader.swift new file mode 100644 index 00000000..7131816f --- /dev/null +++ b/GEON-PPANG-iOS/Core/GBNetwork/GBNetwork/HTTPHeader.swift @@ -0,0 +1,49 @@ +// +// HTTPHeader.swift +// GBNetwork +// +// Created by 이성민 on 6/29/24. +// + +import Foundation + +public struct HTTPHeader { + private(set) var headers: [HTTPHeaderField] = [] + + public init(headers: [HTTPHeaderField]) { + self.headers = headers + } +} + +extension HTTPHeader { + var fields: [String: String] { + .init(uniqueKeysWithValues: headers.map { ($0.key, $0.value) }) + } +} + +public struct HTTPHeaderField { + let key: String + let value: String +} + +public extension HTTPHeaderField { + static func contentType(value: String) -> HTTPHeaderField { + .init(key: "Content-Type", value: value) + } + + static func accessToken(value: String) -> HTTPHeaderField { + .init(key: "Authorization", value: "Bearer \(value)") + } + + static func refreshToken(value: String) -> HTTPHeaderField { + .init(key: "Authorization-refresh", value: "Bearer \(value)") + } + + static func appleRefreshToken(value: String) -> HTTPHeaderField { + .init(key: "Apple-refresh", value: value) + } + + static func platformToken(value: String) -> HTTPHeaderField { + .init(key: "Platform-Token", value: value) + } +} diff --git a/GEON-PPANG-iOS/Core/GBNetwork/GBNetwork/HTTPMethod.swift b/GEON-PPANG-iOS/Core/GBNetwork/GBNetwork/HTTPMethod.swift new file mode 100644 index 00000000..2b707d9b --- /dev/null +++ b/GEON-PPANG-iOS/Core/GBNetwork/GBNetwork/HTTPMethod.swift @@ -0,0 +1,17 @@ +// +// HTTPMethod.swift +// GBNetwork +// +// Created by 이성민 on 6/29/24. +// + +import Foundation + +public enum HTTPMethod: String { + /// HTTP `GET` method + case GET + /// HTTP `POST` method + case POST + /// HTTP `DELETE` method + case DELETE +} diff --git a/GEON-PPANG-iOS/Core/GBNetwork/GBNetwork/HTTPTask.swift b/GEON-PPANG-iOS/Core/GBNetwork/GBNetwork/HTTPTask.swift new file mode 100644 index 00000000..b1119856 --- /dev/null +++ b/GEON-PPANG-iOS/Core/GBNetwork/GBNetwork/HTTPTask.swift @@ -0,0 +1,17 @@ +// +// HTTPTask.swift +// GBNetwork +// +// Created by 이성민 on 6/29/24. +// + +import Foundation + +public enum HTTPTask { + /// plain request + case requestPlain + /// request with query parameters + case requestQuery(_ query: [String: Any]) + /// request with encodable body + case requestEncodable(_ body: Encodable) +} diff --git a/GEON-PPANG-iOS/Core/GBNetwork/GBNetwork/RawResponse.swift b/GEON-PPANG-iOS/Core/GBNetwork/GBNetwork/RawResponse.swift new file mode 100644 index 00000000..dd0b1aa9 --- /dev/null +++ b/GEON-PPANG-iOS/Core/GBNetwork/GBNetwork/RawResponse.swift @@ -0,0 +1,28 @@ +// +// RawResponse.swift +// GBNetwork +// +// Created by 이성민 on 6/30/24. +// + +import Foundation + +public struct RawResponse { + public let data: Data + public let httpResponse: HTTPURLResponse + + init(data: Data, httpResponse: HTTPURLResponse) { + self.data = data + self.httpResponse = httpResponse + } +} + +extension RawResponse { + public func decode(to type: DTO.Type) throws -> Response { + do { + return try JSONDecoder().decode(Response.self, from: self.data) + } catch { + throw GBNetworkError.decodingFailure(.dtoDecodingError) + } + } +} diff --git a/GEON-PPANG-iOS/Core/GBNetwork/GBNetwork/RequestType.swift b/GEON-PPANG-iOS/Core/GBNetwork/GBNetwork/RequestType.swift new file mode 100644 index 00000000..c069831a --- /dev/null +++ b/GEON-PPANG-iOS/Core/GBNetwork/GBNetwork/RequestType.swift @@ -0,0 +1,57 @@ +// +// RequestType.swift +// GBNetwork +// +// Created by 이성민 on 6/29/24. +// + +import Foundation + +public protocol RequestType { + + /// Request를 보내는 Base URL + var baseURL: String { get } + + /// Base URL 뒤에 붙는 URL Path + var path: String { get } + + /// 실제로 사용하는 HTTP Method만 정의 - Get, Post, Delete + /// + /// - Request의 HTTP Method: + /// 현재는 GET, POST, DELETE만 사용하기 때문에 세 가지만 설정 + /// + /// - computed property로 한 이유는 encodable에 걸리지 않기 때문 + var method: HTTPMethod { get } + + /// 어떤 방식으로 Request를 보낼지에 대한 정보 + /// + /// - `.requestPlain` - 추가적인 body 또는 query 없이 요청 + /// - `.requestQuery(_ [String: Any])` - url path 뒤에 query 추가하여 요청 + /// - `.requestEncodable(_ : Encodable)` - encodable 한 body와 함께 요청 + var task: HTTPTask { get } + + /// Request 마다 필요한 Header Fields + var headers: HTTPHeader { get } +} + +extension RequestType { + + func toURLRequest() throws -> URLRequest { + guard let url = URL(string: baseURL + path) else { + throw URLError(.badURL) + } + + var urlRequest = URLRequest(url: url) + urlRequest.httpMethod = self.method.rawValue + urlRequest.allHTTPHeaderFields = self.headers.fields + + switch task { + case .requestPlain: + return urlRequest + case let .requestQuery(queries): + return try urlRequest.encode(queries: queries) + case let .requestEncodable(body): + return try urlRequest.encode(body: body) + } + } +} diff --git a/GEON-PPANG-iOS/Core/GBNetwork/GBNetwork/Response.swift b/GEON-PPANG-iOS/Core/GBNetwork/GBNetwork/Response.swift new file mode 100644 index 00000000..1db359d1 --- /dev/null +++ b/GEON-PPANG-iOS/Core/GBNetwork/GBNetwork/Response.swift @@ -0,0 +1,14 @@ +// +// ResponseType.swift +// GBNetwork +// +// Created by 이성민 on 6/29/24. +// + +import Foundation + +public struct Response: Decodable { + public let code: Int + public let message: String + public let data: DTO +} diff --git a/GEON-PPANG-iOS/Core/GBNetwork/GBNetwork/URLRequest+Encoding.swift b/GEON-PPANG-iOS/Core/GBNetwork/GBNetwork/URLRequest+Encoding.swift new file mode 100644 index 00000000..d51c16be --- /dev/null +++ b/GEON-PPANG-iOS/Core/GBNetwork/GBNetwork/URLRequest+Encoding.swift @@ -0,0 +1,40 @@ +// +// URLRequest+Encoding.swift +// GBNetwork +// +// Created by 이성민 on 6/29/24. +// + +import Foundation + +extension URLRequest { + func encode(queries: [String: Any]) throws -> URLRequest { + guard let url = self.url else { + throw GBNetworkError.requestEncodingFailure(.pathError("missing url")) + } + + var components = URLComponents(string: url.absoluteString) + components?.queryItems = queries.map(toQueryItem) + + guard let encodedURL = components?.url else { + throw GBNetworkError.requestEncodingFailure(.pathError("query encoding fail")) + } + return .init(url: encodedURL) + } + + func encode(body: Encodable) throws -> URLRequest { + do { + var request = self + request.httpBody = try JSONEncoder().encode(body) + return request + } catch { + throw GBNetworkError.requestEncodingFailure(.jsonError("incorrect body type")) + } + } +} + +private extension URLRequest { + func toQueryItem(_ query: (key: String, value: Any)) -> URLQueryItem { + .init(name: query.key, value: query.value as? String) + } +} diff --git a/GEON-PPANG-iOS/Core/GBNetwork/GBNetworkTests/GBNetworkTests.swift b/GEON-PPANG-iOS/Core/GBNetwork/GBNetworkTests/GBNetworkTests.swift new file mode 100644 index 00000000..200e9da3 --- /dev/null +++ b/GEON-PPANG-iOS/Core/GBNetwork/GBNetworkTests/GBNetworkTests.swift @@ -0,0 +1,36 @@ +// +// GBNetworkTests.swift +// GBNetworkTests +// +// Created by 이성민 on 6/30/24. +// + +import XCTest +@testable import GBNetwork + +final class GBNetworkTests: XCTestCase { + + override func setUpWithError() throws { + // Put setup code here. This method is called before the invocation of each test method in the class. + } + + override func tearDownWithError() throws { + // Put teardown code here. This method is called after the invocation of each test method in the class. + } + + func testExample() throws { + // This is an example of a functional test case. + // Use XCTAssert and related functions to verify your tests produce the correct results. + // Any test you write for XCTest can be annotated as throws and async. + // Mark your test throws to produce an unexpected failure when your test encounters an uncaught error. + // Mark your test async to allow awaiting for asynchronous code to complete. Check the results with assertions afterwards. + } + + func testPerformanceExample() throws { + // This is an example of a performance test case. + self.measure { + // Put the code you want to measure the time of here. + } + } + +}