From 4e45b382066f4f9ed94ded0c30bdcd8f973c4ed0 Mon Sep 17 00:00:00 2001 From: Loay Ashraf Date: Thu, 24 Aug 2023 19:11:51 +0300 Subject: [PATCH] Revert "v0.0.2 (#29)" (#30) This reverts commit 2bbfe48d2bca2e4c7bd9dcd36539a21fa735407f. --- .../iOS Example.xcodeproj/project.pbxproj | 45 +- .../contents.xcworkspacedata | 0 .../xcshareddata/IDEWorkspaceChecks.plist | 0 .../xcshareddata/swiftpm/Package.resolved | 0 .../xcschemes/iOS Example.xcscheme | 2 +- .../iOS Example/App/AppDelegate.swift | 0 .../AccentColor.colorset/Contents.json | 0 .../AppIcon.appiconset/Contents.json | 0 .../App/Assets.xcassets/Contents.json | 0 .../App/Base.lproj/LaunchScreen.storyboard | 0 .../iOS Example/App/Info.plist | 0 .../iOS Example/App/SceneDelegate.swift | 0 .../ViewController+NetworkEventMonitor.swift | 0 ...Controller+NetworkRequestInterceptor.swift | 0 .../Controller/ViewController.swift | 0 .../iOS Example/Model/Model.swift | 0 .../iOS Example/Network/DownloadRouter.swift | 0 .../iOS Example/Network/Router.swift | 0 .../iOS Example/View Model/ViewModel.swift | 0 .../View/Base.lproj/Main.storyboard | 17 +- .../iOS Example/View/TableViewCell.swift | 0 .../iOS Example/View/ViewLoadType.swift | 0 .../iOS Example/View/ViewState.swift | 0 .../macOS Example.xcodeproj/project.pbxproj | 516 ------------------ .../macOS/macOS Example/App/AppDelegate.swift | 33 -- .../AccentColor.colorset/Contents.json | 11 - .../AppIcon.appiconset/Contents.json | 58 -- .../App/Assets.xcassets/Contents.json | 6 - .../App/macOS_Example.entitlements | 14 - .../ViewController+NetworkEventMonitor.swift | 26 - ...Controller+NetworkRequestInterceptor.swift | 24 - .../Controller/ViewController.swift | 219 -------- .../macOS/macOS Example/Model/Model.swift | 21 - .../Network/DownloadRouter.swift | 34 -- .../macOS/macOS Example/Network/Router.swift | 38 -- .../macOS Example/View Model/ViewModel.swift | 69 --- .../View/Base.lproj/Main.storyboard | 290 ---------- .../macOS Example/View/TableCellView.swift | 19 - .../macOS Example/View/ViewLoadType.swift | 12 - .../macOS/macOS Example/View/ViewState.swift | 12 - RxNetworkKit.xcodeproj/project.pbxproj | 44 +- ...workKit.xcscheme => RxNetworking.xcscheme} | 2 +- .../contents.xcworkspacedata | 5 +- RxNetworkKitX.podspec | 4 +- ...ve+URLSessionAdaptedDownloadResponse.swift | 10 +- ...tive+URLSessionAdaptedUploadResponse.swift | 10 +- Source/Error/DefaultNetworkAPIError.swift | 2 +- Source/Error/NetworkClientError.swift | 2 +- Source/Error/NetworkError.swift | 13 +- Source/Error/NetworkServerError.swift | 2 +- Source/HTTP/DefaultHTTPErrorBody.swift | 14 - Source/HTTP/HTTPErrorBody.swift | 10 - Source/Manager/NetworkManager.swift | 33 +- .../ProcessInfo+operatingSystemName.swift | 38 -- ...onfiguration+setAdditionalHTTPHeader.swift | 21 - ...Configuration+setUserAgentHTTPHeader.swift | 21 - .../Observable/Observable+Decodable.swift | 22 +- .../Single/Single+Decodable.swift | 33 +- .../Single/Single+VerifyResponse.swift | 4 +- 59 files changed, 97 insertions(+), 1659 deletions(-) rename {Examples/iOS => Example}/iOS Example.xcodeproj/project.pbxproj (95%) rename {Examples/iOS => Example}/iOS Example.xcodeproj/project.xcworkspace/contents.xcworkspacedata (100%) rename {Examples/iOS => Example}/iOS Example.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist (100%) rename {Examples/iOS => Example}/iOS Example.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved (100%) rename {Examples/iOS => Example}/iOS Example.xcodeproj/xcshareddata/xcschemes/iOS Example.xcscheme (99%) rename {Examples/iOS => Example}/iOS Example/App/AppDelegate.swift (100%) rename {Examples/iOS => Example}/iOS Example/App/Assets.xcassets/AccentColor.colorset/Contents.json (100%) rename {Examples/iOS => Example}/iOS Example/App/Assets.xcassets/AppIcon.appiconset/Contents.json (100%) rename {Examples/iOS => Example}/iOS Example/App/Assets.xcassets/Contents.json (100%) rename {Examples/iOS => Example}/iOS Example/App/Base.lproj/LaunchScreen.storyboard (100%) rename {Examples/iOS => Example}/iOS Example/App/Info.plist (100%) rename {Examples/iOS => Example}/iOS Example/App/SceneDelegate.swift (100%) rename {Examples/iOS => Example}/iOS Example/Controller/ViewController+NetworkEventMonitor.swift (100%) rename {Examples/iOS => Example}/iOS Example/Controller/ViewController+NetworkRequestInterceptor.swift (100%) rename {Examples/iOS => Example}/iOS Example/Controller/ViewController.swift (100%) rename {Examples/iOS => Example}/iOS Example/Model/Model.swift (100%) rename {Examples/iOS => Example}/iOS Example/Network/DownloadRouter.swift (100%) rename {Examples/iOS => Example}/iOS Example/Network/Router.swift (100%) rename {Examples/iOS => Example}/iOS Example/View Model/ViewModel.swift (100%) rename {Examples/iOS => Example}/iOS Example/View/Base.lproj/Main.storyboard (96%) rename {Examples/iOS => Example}/iOS Example/View/TableViewCell.swift (100%) rename {Examples/iOS => Example}/iOS Example/View/ViewLoadType.swift (100%) rename {Examples/iOS => Example}/iOS Example/View/ViewState.swift (100%) delete mode 100644 Examples/macOS/macOS Example.xcodeproj/project.pbxproj delete mode 100644 Examples/macOS/macOS Example/App/AppDelegate.swift delete mode 100644 Examples/macOS/macOS Example/App/Assets.xcassets/AccentColor.colorset/Contents.json delete mode 100644 Examples/macOS/macOS Example/App/Assets.xcassets/AppIcon.appiconset/Contents.json delete mode 100644 Examples/macOS/macOS Example/App/Assets.xcassets/Contents.json delete mode 100644 Examples/macOS/macOS Example/App/macOS_Example.entitlements delete mode 100644 Examples/macOS/macOS Example/Controller/ViewController+NetworkEventMonitor.swift delete mode 100644 Examples/macOS/macOS Example/Controller/ViewController+NetworkRequestInterceptor.swift delete mode 100644 Examples/macOS/macOS Example/Controller/ViewController.swift delete mode 100644 Examples/macOS/macOS Example/Model/Model.swift delete mode 100644 Examples/macOS/macOS Example/Network/DownloadRouter.swift delete mode 100644 Examples/macOS/macOS Example/Network/Router.swift delete mode 100644 Examples/macOS/macOS Example/View Model/ViewModel.swift delete mode 100644 Examples/macOS/macOS Example/View/Base.lproj/Main.storyboard delete mode 100644 Examples/macOS/macOS Example/View/TableCellView.swift delete mode 100644 Examples/macOS/macOS Example/View/ViewLoadType.swift delete mode 100644 Examples/macOS/macOS Example/View/ViewState.swift rename RxNetworkKit.xcodeproj/xcshareddata/xcschemes/{RxNetworkKit.xcscheme => RxNetworking.xcscheme} (98%) delete mode 100644 Source/HTTP/DefaultHTTPErrorBody.swift delete mode 100644 Source/HTTP/HTTPErrorBody.swift delete mode 100644 Source/Manager/ProcessInfo+operatingSystemName.swift delete mode 100644 Source/Manager/URLSessionConfiguration+setAdditionalHTTPHeader.swift delete mode 100644 Source/Manager/URLSessionConfiguration+setUserAgentHTTPHeader.swift diff --git a/Examples/iOS/iOS Example.xcodeproj/project.pbxproj b/Example/iOS Example.xcodeproj/project.pbxproj similarity index 95% rename from Examples/iOS/iOS Example.xcodeproj/project.pbxproj rename to Example/iOS Example.xcodeproj/project.pbxproj index 26242a9..ba9f041 100644 --- a/Examples/iOS/iOS Example.xcodeproj/project.pbxproj +++ b/Example/iOS Example.xcodeproj/project.pbxproj @@ -7,6 +7,8 @@ objects = { /* Begin PBXBuildFile section */ + 0B568E5829DEDBEC00E51B21 /* RxNetworkKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0B568E5329DED93D00E51B21 /* RxNetworkKit.framework */; }; + 0B568E5929DEDBEC00E51B21 /* RxNetworkKit.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 0B568E5329DED93D00E51B21 /* RxNetworkKit.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; 1A78320FA3392498E8F9EA82 /* RxDataSources in Frameworks */ = {isa = PBXBuildFile; productRef = 819F858F2F093441234733F7 /* RxDataSources */; }; 39055093EB07D0FE09141EEC /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = EF62C70BEC0D6E6B113DF07D /* AppDelegate.swift */; }; 3AEB576B0CFFB902AAB9A011 /* ViewState.swift in Sources */ = {isa = PBXBuildFile; fileRef = A9C3894E572FDCE188F82EDC /* ViewState.swift */; }; @@ -22,13 +24,11 @@ 9083E2B5C56C9978FA9A88AF /* ViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = ED4C68630CA1328C530E000D /* ViewModel.swift */; }; A592421CEFFDBE0D3F6A504D /* ViewController+NetworkRequestInterceptor.swift in Sources */ = {isa = PBXBuildFile; fileRef = 636BE87DD1664C2D7FAECEDF /* ViewController+NetworkRequestInterceptor.swift */; }; BBC4FB455DB9EFC760A182E2 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 23795F79829D049A83D55440 /* Assets.xcassets */; }; - C68C3F692A9402DC0036FF9D /* RxNetworkKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C68C3F682A9401960036FF9D /* RxNetworkKit.framework */; }; - C68C3F6A2A9402DC0036FF9D /* RxNetworkKit.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = C68C3F682A9401960036FF9D /* RxNetworkKit.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; DD59F1300712C00933636CC2 /* SceneDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7D82BA0503FE7CC526E5586A /* SceneDelegate.swift */; }; /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ - C68C3F672A9401960036FF9D /* PBXContainerItemProxy */ = { + 0B568E5229DED93D00E51B21 /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = 0B77E0FA29D977390077FBC0 /* RxNetworkKit.xcodeproj */; proxyType = 2; @@ -44,7 +44,7 @@ dstPath = ""; dstSubfolderSpec = 10; files = ( - C68C3F6A2A9402DC0036FF9D /* RxNetworkKit.framework in Embed Frameworks */, + 0B568E5929DEDBEC00E51B21 /* RxNetworkKit.framework in Embed Frameworks */, ); name = "Embed Frameworks"; runOnlyForDeploymentPostprocessing = 0; @@ -53,7 +53,7 @@ /* Begin PBXFileReference section */ 0B568E4C29DED67300E51B21 /* RxNetworkKit.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = RxNetworkKit.framework; sourceTree = BUILT_PRODUCTS_DIR; }; - 0B77E0FA29D977390077FBC0 /* RxNetworkKit.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RxNetworkKit.xcodeproj; path = ../../RxNetworkKit.xcodeproj; sourceTree = ""; }; + 0B77E0FA29D977390077FBC0 /* RxNetworkKit.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RxNetworkKit.xcodeproj; path = ../RxNetworkKit.xcodeproj; sourceTree = ""; }; 0B77E10429D97A3E0077FBC0 /* iOS Example.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "iOS Example.app"; sourceTree = BUILT_PRODUCTS_DIR; }; 23795F79829D049A83D55440 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 417337DBE1D0E25D426FCAD6 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; @@ -78,7 +78,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - C68C3F692A9402DC0036FF9D /* RxNetworkKit.framework in Frameworks */, + 0B568E5829DEDBEC00E51B21 /* RxNetworkKit.framework in Frameworks */, 1A78320FA3392498E8F9EA82 /* RxDataSources in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; @@ -107,6 +107,14 @@ name = Frameworks; sourceTree = ""; }; + 0B568E4F29DED93D00E51B21 /* Products */ = { + isa = PBXGroup; + children = ( + 0B568E5329DED93D00E51B21 /* RxNetworkKit.framework */, + ); + name = Products; + sourceTree = ""; + }; 0B77E10529D97A3E0077FBC0 /* Products */ = { isa = PBXGroup; children = ( @@ -173,14 +181,6 @@ path = "View Model"; sourceTree = ""; }; - C68C3F642A9401920036FF9D /* Products */ = { - isa = PBXGroup; - children = ( - C68C3F682A9401960036FF9D /* RxNetworkKit.framework */, - ); - name = Products; - sourceTree = ""; - }; EDB69B1E108A08763BE6EEC7 = { isa = PBXGroup; children = ( @@ -221,9 +221,8 @@ 8FDDFD68FFEB45324727C0BA /* Project object */ = { isa = PBXProject; attributes = { - BuildIndependentTargetsInParallel = YES; LastSwiftUpdateCheck = 1420; - LastUpgradeCheck = 1430; + LastUpgradeCheck = 1420; TargetAttributes = { 26E9FD5EEA5FDD0B3C83D665 = { DevelopmentTeam = Z3SPAA69G7; @@ -247,7 +246,7 @@ projectDirPath = ""; projectReferences = ( { - ProductGroup = C68C3F642A9401920036FF9D /* Products */; + ProductGroup = 0B568E4F29DED93D00E51B21 /* Products */; ProjectRef = 0B77E0FA29D977390077FBC0 /* RxNetworkKit.xcodeproj */; }, ); @@ -259,11 +258,11 @@ /* End PBXProject section */ /* Begin PBXReferenceProxy section */ - C68C3F682A9401960036FF9D /* RxNetworkKit.framework */ = { + 0B568E5329DED93D00E51B21 /* RxNetworkKit.framework */ = { isa = PBXReferenceProxy; fileType = wrapper.framework; path = RxNetworkKit.framework; - remoteRef = C68C3F672A9401960036FF9D /* PBXContainerItemProxy */; + remoteRef = 0B568E5229DED93D00E51B21 /* PBXContainerItemProxy */; sourceTree = BUILT_PRODUCTS_DIR; }; /* End PBXReferenceProxy section */ @@ -398,7 +397,7 @@ DEVELOPMENT_TEAM = Z3SPAA69G7; FRAMEWORK_SEARCH_PATHS = ( "$(inherited)", - "$(PROJECT_DIR)", + "$(PROJECT_DIR)/Example", ); GENERATE_INFOPLIST_FILE = YES; INFOPLIST_FILE = "iOS Example/App/Info.plist"; @@ -412,7 +411,7 @@ "$(inherited)", "@executable_path/Frameworks", ); - MARKETING_VERSION = 0.0.2; + MARKETING_VERSION = 1.0; PRODUCT_BUNDLE_IDENTIFIER = com.las.RxNetworkKitExample; PRODUCT_NAME = "iOS Example"; SDKROOT = iphoneos; @@ -437,7 +436,7 @@ DEVELOPMENT_TEAM = Z3SPAA69G7; FRAMEWORK_SEARCH_PATHS = ( "$(inherited)", - "$(PROJECT_DIR)", + "$(PROJECT_DIR)/Example", ); GENERATE_INFOPLIST_FILE = YES; INFOPLIST_FILE = "iOS Example/App/Info.plist"; @@ -451,7 +450,7 @@ "$(inherited)", "@executable_path/Frameworks", ); - MARKETING_VERSION = 0.0.2; + MARKETING_VERSION = 1.0; PRODUCT_BUNDLE_IDENTIFIER = com.las.RxNetworkKitExample; PRODUCT_NAME = "iOS Example"; SDKROOT = iphoneos; diff --git a/Examples/iOS/iOS Example.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/Example/iOS Example.xcodeproj/project.xcworkspace/contents.xcworkspacedata similarity index 100% rename from Examples/iOS/iOS Example.xcodeproj/project.xcworkspace/contents.xcworkspacedata rename to Example/iOS Example.xcodeproj/project.xcworkspace/contents.xcworkspacedata diff --git a/Examples/iOS/iOS Example.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/Example/iOS Example.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist similarity index 100% rename from Examples/iOS/iOS Example.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist rename to Example/iOS Example.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist diff --git a/Examples/iOS/iOS Example.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved b/Example/iOS Example.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved similarity index 100% rename from Examples/iOS/iOS Example.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved rename to Example/iOS Example.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved diff --git a/Examples/iOS/iOS Example.xcodeproj/xcshareddata/xcschemes/iOS Example.xcscheme b/Example/iOS Example.xcodeproj/xcshareddata/xcschemes/iOS Example.xcscheme similarity index 99% rename from Examples/iOS/iOS Example.xcodeproj/xcshareddata/xcschemes/iOS Example.xcscheme rename to Example/iOS Example.xcodeproj/xcshareddata/xcschemes/iOS Example.xcscheme index ab95b45..3b0a0b9 100644 --- a/Examples/iOS/iOS Example.xcodeproj/xcshareddata/xcschemes/iOS Example.xcscheme +++ b/Example/iOS Example.xcodeproj/xcshareddata/xcschemes/iOS Example.xcscheme @@ -1,6 +1,6 @@ - + - - + @@ -12,7 +11,7 @@ - + @@ -21,7 +20,7 @@ - + @@ -81,7 +80,7 @@ diff --git a/Examples/iOS/iOS Example/View/TableViewCell.swift b/Example/iOS Example/View/TableViewCell.swift similarity index 100% rename from Examples/iOS/iOS Example/View/TableViewCell.swift rename to Example/iOS Example/View/TableViewCell.swift diff --git a/Examples/iOS/iOS Example/View/ViewLoadType.swift b/Example/iOS Example/View/ViewLoadType.swift similarity index 100% rename from Examples/iOS/iOS Example/View/ViewLoadType.swift rename to Example/iOS Example/View/ViewLoadType.swift diff --git a/Examples/iOS/iOS Example/View/ViewState.swift b/Example/iOS Example/View/ViewState.swift similarity index 100% rename from Examples/iOS/iOS Example/View/ViewState.swift rename to Example/iOS Example/View/ViewState.swift diff --git a/Examples/macOS/macOS Example.xcodeproj/project.pbxproj b/Examples/macOS/macOS Example.xcodeproj/project.pbxproj deleted file mode 100644 index f1b5bf1..0000000 --- a/Examples/macOS/macOS Example.xcodeproj/project.pbxproj +++ /dev/null @@ -1,516 +0,0 @@ -// !$*UTF8*$! -{ - archiveVersion = 1; - classes = { - }; - objectVersion = 56; - objects = { - -/* Begin PBXBuildFile section */ - C639752A2A95166A00D0AC13 /* ViewController+NetworkRequestInterceptor.swift in Sources */ = {isa = PBXBuildFile; fileRef = C63975132A95166A00D0AC13 /* ViewController+NetworkRequestInterceptor.swift */; }; - C639752B2A95166A00D0AC13 /* ViewController+NetworkEventMonitor.swift in Sources */ = {isa = PBXBuildFile; fileRef = C63975142A95166A00D0AC13 /* ViewController+NetworkEventMonitor.swift */; }; - C639752C2A95166A00D0AC13 /* ViewState.swift in Sources */ = {isa = PBXBuildFile; fileRef = C63975162A95166A00D0AC13 /* ViewState.swift */; }; - C639752D2A95166A00D0AC13 /* ViewLoadType.swift in Sources */ = {isa = PBXBuildFile; fileRef = C63975172A95166A00D0AC13 /* ViewLoadType.swift */; }; - C639752E2A95166A00D0AC13 /* TableCellView.swift in Sources */ = {isa = PBXBuildFile; fileRef = C63975182A95166A00D0AC13 /* TableCellView.swift */; }; - C63975302A95166A00D0AC13 /* Model.swift in Sources */ = {isa = PBXBuildFile; fileRef = C639751C2A95166A00D0AC13 /* Model.swift */; }; - C63975312A95166A00D0AC13 /* DownloadRouter.swift in Sources */ = {isa = PBXBuildFile; fileRef = C639751E2A95166A00D0AC13 /* DownloadRouter.swift */; }; - C63975322A95166A00D0AC13 /* Router.swift in Sources */ = {isa = PBXBuildFile; fileRef = C639751F2A95166A00D0AC13 /* Router.swift */; }; - C63975332A95166A00D0AC13 /* ViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = C63975212A95166A00D0AC13 /* ViewModel.swift */; }; - C69FBA182A9408740062BFD7 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = C69FBA172A9408740062BFD7 /* AppDelegate.swift */; }; - C69FBA1A2A9408740062BFD7 /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = C69FBA192A9408740062BFD7 /* ViewController.swift */; }; - C69FBA1C2A9408770062BFD7 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = C69FBA1B2A9408770062BFD7 /* Assets.xcassets */; }; - C69FBA1F2A9408770062BFD7 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = C69FBA1D2A9408770062BFD7 /* Main.storyboard */; }; - C69FBA322A940B090062BFD7 /* RxNetworkKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C69FBA312A940B090062BFD7 /* RxNetworkKit.framework */; }; - C69FBA332A940B090062BFD7 /* RxNetworkKit.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = C69FBA312A940B090062BFD7 /* RxNetworkKit.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; -/* End PBXBuildFile section */ - -/* Begin PBXContainerItemProxy section */ - C639750F2A9513FF00D0AC13 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = C69FBA262A9409900062BFD7 /* RxNetworkKit.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = 0B77DFD629D964D40077FBC0; - remoteInfo = RxNetworkKit; - }; -/* End PBXContainerItemProxy section */ - -/* Begin PBXCopyFilesBuildPhase section */ - C69FBA342A940B090062BFD7 /* Embed Frameworks */ = { - isa = PBXCopyFilesBuildPhase; - buildActionMask = 2147483647; - dstPath = ""; - dstSubfolderSpec = 10; - files = ( - C69FBA332A940B090062BFD7 /* RxNetworkKit.framework in Embed Frameworks */, - ); - name = "Embed Frameworks"; - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXCopyFilesBuildPhase section */ - -/* Begin PBXFileReference section */ - C63975132A95166A00D0AC13 /* ViewController+NetworkRequestInterceptor.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "ViewController+NetworkRequestInterceptor.swift"; sourceTree = ""; }; - C63975142A95166A00D0AC13 /* ViewController+NetworkEventMonitor.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "ViewController+NetworkEventMonitor.swift"; sourceTree = ""; }; - C63975162A95166A00D0AC13 /* ViewState.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ViewState.swift; sourceTree = ""; }; - C63975172A95166A00D0AC13 /* ViewLoadType.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ViewLoadType.swift; sourceTree = ""; }; - C63975182A95166A00D0AC13 /* TableCellView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TableCellView.swift; sourceTree = ""; }; - C639751C2A95166A00D0AC13 /* Model.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Model.swift; sourceTree = ""; }; - C639751E2A95166A00D0AC13 /* DownloadRouter.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DownloadRouter.swift; sourceTree = ""; }; - C639751F2A95166A00D0AC13 /* Router.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Router.swift; sourceTree = ""; }; - C63975212A95166A00D0AC13 /* ViewModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ViewModel.swift; sourceTree = ""; }; - C69FBA142A9408740062BFD7 /* macOS Example.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "macOS Example.app"; sourceTree = BUILT_PRODUCTS_DIR; }; - C69FBA172A9408740062BFD7 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; - C69FBA192A9408740062BFD7 /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = ""; }; - C69FBA1B2A9408770062BFD7 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; - C69FBA1E2A9408770062BFD7 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; - C69FBA202A9408770062BFD7 /* macOS_Example.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = macOS_Example.entitlements; sourceTree = ""; }; - C69FBA262A9409900062BFD7 /* RxNetworkKit.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RxNetworkKit.xcodeproj; path = ../../RxNetworkKit.xcodeproj; sourceTree = ""; }; - C69FBA312A940B090062BFD7 /* RxNetworkKit.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = RxNetworkKit.framework; sourceTree = BUILT_PRODUCTS_DIR; }; -/* End PBXFileReference section */ - -/* Begin PBXFrameworksBuildPhase section */ - C69FBA112A9408740062BFD7 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - C69FBA322A940B090062BFD7 /* RxNetworkKit.framework in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXFrameworksBuildPhase section */ - -/* Begin PBXGroup section */ - C639750C2A9513F900D0AC13 /* Products */ = { - isa = PBXGroup; - children = ( - C63975102A9513FF00D0AC13 /* RxNetworkKit.framework */, - ); - name = Products; - sourceTree = ""; - }; - C63975112A95166A00D0AC13 /* Controller */ = { - isa = PBXGroup; - children = ( - C69FBA192A9408740062BFD7 /* ViewController.swift */, - C63975132A95166A00D0AC13 /* ViewController+NetworkRequestInterceptor.swift */, - C63975142A95166A00D0AC13 /* ViewController+NetworkEventMonitor.swift */, - ); - path = Controller; - sourceTree = ""; - }; - C63975152A95166A00D0AC13 /* View */ = { - isa = PBXGroup; - children = ( - C69FBA1D2A9408770062BFD7 /* Main.storyboard */, - C63975182A95166A00D0AC13 /* TableCellView.swift */, - C63975162A95166A00D0AC13 /* ViewState.swift */, - C63975172A95166A00D0AC13 /* ViewLoadType.swift */, - ); - path = View; - sourceTree = ""; - }; - C639751B2A95166A00D0AC13 /* Model */ = { - isa = PBXGroup; - children = ( - C639751C2A95166A00D0AC13 /* Model.swift */, - ); - path = Model; - sourceTree = ""; - }; - C639751D2A95166A00D0AC13 /* Network */ = { - isa = PBXGroup; - children = ( - C639751E2A95166A00D0AC13 /* DownloadRouter.swift */, - C639751F2A95166A00D0AC13 /* Router.swift */, - ); - path = Network; - sourceTree = ""; - }; - C63975202A95166A00D0AC13 /* View Model */ = { - isa = PBXGroup; - children = ( - C63975212A95166A00D0AC13 /* ViewModel.swift */, - ); - path = "View Model"; - sourceTree = ""; - }; - C63975222A95166A00D0AC13 /* App */ = { - isa = PBXGroup; - children = ( - C69FBA172A9408740062BFD7 /* AppDelegate.swift */, - C69FBA1B2A9408770062BFD7 /* Assets.xcassets */, - C69FBA202A9408770062BFD7 /* macOS_Example.entitlements */, - ); - path = App; - sourceTree = ""; - }; - C69FBA0B2A9408740062BFD7 = { - isa = PBXGroup; - children = ( - C69FBA262A9409900062BFD7 /* RxNetworkKit.xcodeproj */, - C69FBA162A9408740062BFD7 /* macOS Example */, - C69FBA152A9408740062BFD7 /* Products */, - C69FBA302A940B090062BFD7 /* Frameworks */, - ); - sourceTree = ""; - }; - C69FBA152A9408740062BFD7 /* Products */ = { - isa = PBXGroup; - children = ( - C69FBA142A9408740062BFD7 /* macOS Example.app */, - ); - name = Products; - sourceTree = ""; - }; - C69FBA162A9408740062BFD7 /* macOS Example */ = { - isa = PBXGroup; - children = ( - C63975222A95166A00D0AC13 /* App */, - C63975112A95166A00D0AC13 /* Controller */, - C639751B2A95166A00D0AC13 /* Model */, - C639751D2A95166A00D0AC13 /* Network */, - C63975152A95166A00D0AC13 /* View */, - C63975202A95166A00D0AC13 /* View Model */, - ); - path = "macOS Example"; - sourceTree = ""; - }; - C69FBA302A940B090062BFD7 /* Frameworks */ = { - isa = PBXGroup; - children = ( - C69FBA312A940B090062BFD7 /* RxNetworkKit.framework */, - ); - name = Frameworks; - sourceTree = ""; - }; -/* End PBXGroup section */ - -/* Begin PBXNativeTarget section */ - C69FBA132A9408740062BFD7 /* macOS Example */ = { - isa = PBXNativeTarget; - buildConfigurationList = C69FBA232A9408770062BFD7 /* Build configuration list for PBXNativeTarget "macOS Example" */; - buildPhases = ( - C69FBA102A9408740062BFD7 /* Sources */, - C69FBA112A9408740062BFD7 /* Frameworks */, - C69FBA122A9408740062BFD7 /* Resources */, - C69FBA342A940B090062BFD7 /* Embed Frameworks */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = "macOS Example"; - packageProductDependencies = ( - ); - productName = "macOS Example"; - productReference = C69FBA142A9408740062BFD7 /* macOS Example.app */; - productType = "com.apple.product-type.application"; - }; -/* End PBXNativeTarget section */ - -/* Begin PBXProject section */ - C69FBA0C2A9408740062BFD7 /* Project object */ = { - isa = PBXProject; - attributes = { - BuildIndependentTargetsInParallel = 1; - LastSwiftUpdateCheck = 1420; - LastUpgradeCheck = 1430; - TargetAttributes = { - C69FBA132A9408740062BFD7 = { - CreatedOnToolsVersion = 14.2; - }; - }; - }; - buildConfigurationList = C69FBA0F2A9408740062BFD7 /* Build configuration list for PBXProject "macOS Example" */; - compatibilityVersion = "Xcode 14.0"; - developmentRegion = en; - hasScannedForEncodings = 0; - knownRegions = ( - en, - Base, - ); - mainGroup = C69FBA0B2A9408740062BFD7; - packageReferences = ( - C69FBA2D2A940AD80062BFD7 /* XCRemoteSwiftPackageReference "RxDataSources" */, - ); - productRefGroup = C69FBA152A9408740062BFD7 /* Products */; - projectDirPath = ""; - projectReferences = ( - { - ProductGroup = C639750C2A9513F900D0AC13 /* Products */; - ProjectRef = C69FBA262A9409900062BFD7 /* RxNetworkKit.xcodeproj */; - }, - ); - projectRoot = ""; - targets = ( - C69FBA132A9408740062BFD7 /* macOS Example */, - ); - }; -/* End PBXProject section */ - -/* Begin PBXReferenceProxy section */ - C63975102A9513FF00D0AC13 /* RxNetworkKit.framework */ = { - isa = PBXReferenceProxy; - fileType = wrapper.framework; - path = RxNetworkKit.framework; - remoteRef = C639750F2A9513FF00D0AC13 /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; -/* End PBXReferenceProxy section */ - -/* Begin PBXResourcesBuildPhase section */ - C69FBA122A9408740062BFD7 /* Resources */ = { - isa = PBXResourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - C69FBA1C2A9408770062BFD7 /* Assets.xcassets in Resources */, - C69FBA1F2A9408770062BFD7 /* Main.storyboard in Resources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXResourcesBuildPhase section */ - -/* Begin PBXSourcesBuildPhase section */ - C69FBA102A9408740062BFD7 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - C63975322A95166A00D0AC13 /* Router.swift in Sources */, - C63975302A95166A00D0AC13 /* Model.swift in Sources */, - C639752B2A95166A00D0AC13 /* ViewController+NetworkEventMonitor.swift in Sources */, - C63975312A95166A00D0AC13 /* DownloadRouter.swift in Sources */, - C639752E2A95166A00D0AC13 /* TableCellView.swift in Sources */, - C639752C2A95166A00D0AC13 /* ViewState.swift in Sources */, - C639752A2A95166A00D0AC13 /* ViewController+NetworkRequestInterceptor.swift in Sources */, - C639752D2A95166A00D0AC13 /* ViewLoadType.swift in Sources */, - C69FBA1A2A9408740062BFD7 /* ViewController.swift in Sources */, - C63975332A95166A00D0AC13 /* ViewModel.swift in Sources */, - C69FBA182A9408740062BFD7 /* AppDelegate.swift in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXSourcesBuildPhase section */ - -/* Begin PBXVariantGroup section */ - C69FBA1D2A9408770062BFD7 /* Main.storyboard */ = { - isa = PBXVariantGroup; - children = ( - C69FBA1E2A9408770062BFD7 /* Base */, - ); - name = Main.storyboard; - sourceTree = ""; - }; -/* End PBXVariantGroup section */ - -/* Begin XCBuildConfiguration section */ - C69FBA212A9408770062BFD7 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - 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; - DEAD_CODE_STRIPPING = YES; - DEBUG_INFORMATION_FORMAT = dwarf; - ENABLE_STRICT_OBJC_MSGSEND = YES; - ENABLE_TESTABILITY = YES; - GCC_C_LANGUAGE_STANDARD = gnu11; - 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; - MACOSX_DEPLOYMENT_TARGET = 11.0; - MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; - MTL_FAST_MATH = YES; - ONLY_ACTIVE_ARCH = YES; - SDKROOT = macosx; - SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; - SWIFT_OPTIMIZATION_LEVEL = "-Onone"; - }; - name = Debug; - }; - C69FBA222A9408770062BFD7 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - 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; - DEAD_CODE_STRIPPING = YES; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - ENABLE_NS_ASSERTIONS = NO; - ENABLE_STRICT_OBJC_MSGSEND = YES; - GCC_C_LANGUAGE_STANDARD = gnu11; - 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; - MACOSX_DEPLOYMENT_TARGET = 11.0; - MTL_ENABLE_DEBUG_INFO = NO; - MTL_FAST_MATH = YES; - SDKROOT = macosx; - SWIFT_COMPILATION_MODE = wholemodule; - SWIFT_OPTIMIZATION_LEVEL = "-O"; - }; - name = Release; - }; - C69FBA242A9408770062BFD7 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; - ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; - CODE_SIGN_ENTITLEMENTS = "macOS Example/App/macOS_Example.entitlements"; - "CODE_SIGN_IDENTITY[sdk=macosx*]" = "Apple Development"; - CODE_SIGN_STYLE = Automatic; - COMBINE_HIDPI_IMAGES = YES; - CURRENT_PROJECT_VERSION = 1; - DEAD_CODE_STRIPPING = YES; - DEVELOPMENT_TEAM = Z3SPAA69G7; - ENABLE_HARDENED_RUNTIME = YES; - GENERATE_INFOPLIST_FILE = YES; - INFOPLIST_KEY_NSHumanReadableCopyright = ""; - INFOPLIST_KEY_NSMainStoryboardFile = Main; - INFOPLIST_KEY_NSPrincipalClass = NSApplication; - LD_RUNPATH_SEARCH_PATHS = ( - "$(inherited)", - "@executable_path/../Frameworks", - ); - MACOSX_DEPLOYMENT_TARGET = 11.0; - MARKETING_VERSION = 0.0.2; - PRODUCT_BUNDLE_IDENTIFIER = com.las.RxNetworkKitMacOSExample; - PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_EMIT_LOC_STRINGS = YES; - SWIFT_VERSION = 5.0; - }; - name = Debug; - }; - C69FBA252A9408770062BFD7 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; - ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; - CODE_SIGN_ENTITLEMENTS = "macOS Example/App/macOS_Example.entitlements"; - "CODE_SIGN_IDENTITY[sdk=macosx*]" = "Apple Development"; - CODE_SIGN_STYLE = Automatic; - COMBINE_HIDPI_IMAGES = YES; - CURRENT_PROJECT_VERSION = 1; - DEAD_CODE_STRIPPING = YES; - DEVELOPMENT_TEAM = Z3SPAA69G7; - ENABLE_HARDENED_RUNTIME = YES; - GENERATE_INFOPLIST_FILE = YES; - INFOPLIST_KEY_NSHumanReadableCopyright = ""; - INFOPLIST_KEY_NSMainStoryboardFile = Main; - INFOPLIST_KEY_NSPrincipalClass = NSApplication; - LD_RUNPATH_SEARCH_PATHS = ( - "$(inherited)", - "@executable_path/../Frameworks", - ); - MACOSX_DEPLOYMENT_TARGET = 11.0; - MARKETING_VERSION = 0.0.2; - PRODUCT_BUNDLE_IDENTIFIER = com.las.RxNetworkKitMacOSExample; - PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_EMIT_LOC_STRINGS = YES; - SWIFT_VERSION = 5.0; - }; - name = Release; - }; -/* End XCBuildConfiguration section */ - -/* Begin XCConfigurationList section */ - C69FBA0F2A9408740062BFD7 /* Build configuration list for PBXProject "macOS Example" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - C69FBA212A9408770062BFD7 /* Debug */, - C69FBA222A9408770062BFD7 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Debug; - }; - C69FBA232A9408770062BFD7 /* Build configuration list for PBXNativeTarget "macOS Example" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - C69FBA242A9408770062BFD7 /* Debug */, - C69FBA252A9408770062BFD7 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Debug; - }; -/* End XCConfigurationList section */ - -/* Begin XCRemoteSwiftPackageReference section */ - C69FBA2D2A940AD80062BFD7 /* XCRemoteSwiftPackageReference "RxDataSources" */ = { - isa = XCRemoteSwiftPackageReference; - repositoryURL = "https://github.com/RxSwiftCommunity/RxDataSources"; - requirement = { - kind = upToNextMajorVersion; - minimumVersion = 5.0.0; - }; - }; -/* End XCRemoteSwiftPackageReference section */ - }; - rootObject = C69FBA0C2A9408740062BFD7 /* Project object */; -} diff --git a/Examples/macOS/macOS Example/App/AppDelegate.swift b/Examples/macOS/macOS Example/App/AppDelegate.swift deleted file mode 100644 index db58985..0000000 --- a/Examples/macOS/macOS Example/App/AppDelegate.swift +++ /dev/null @@ -1,33 +0,0 @@ -// -// AppDelegate.swift -// macOS Example -// -// Created by Loay Ashraf on 22/08/2023. -// - -import Cocoa -import RxDataSources -import RxNetworkKit - -@main -class AppDelegate: NSObject, NSApplicationDelegate { - - - - - func applicationDidFinishLaunching(_ aNotification: Notification) { - // Insert code here to initialize your application - NetworkReachability.shared.start() - } - - func applicationWillTerminate(_ aNotification: Notification) { - // Insert code here to tear down your application - } - - func applicationSupportsSecureRestorableState(_ app: NSApplication) -> Bool { - return true - } - - -} - diff --git a/Examples/macOS/macOS Example/App/Assets.xcassets/AccentColor.colorset/Contents.json b/Examples/macOS/macOS Example/App/Assets.xcassets/AccentColor.colorset/Contents.json deleted file mode 100644 index eb87897..0000000 --- a/Examples/macOS/macOS Example/App/Assets.xcassets/AccentColor.colorset/Contents.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "colors" : [ - { - "idiom" : "universal" - } - ], - "info" : { - "author" : "xcode", - "version" : 1 - } -} diff --git a/Examples/macOS/macOS Example/App/Assets.xcassets/AppIcon.appiconset/Contents.json b/Examples/macOS/macOS Example/App/Assets.xcassets/AppIcon.appiconset/Contents.json deleted file mode 100644 index 3f00db4..0000000 --- a/Examples/macOS/macOS Example/App/Assets.xcassets/AppIcon.appiconset/Contents.json +++ /dev/null @@ -1,58 +0,0 @@ -{ - "images" : [ - { - "idiom" : "mac", - "scale" : "1x", - "size" : "16x16" - }, - { - "idiom" : "mac", - "scale" : "2x", - "size" : "16x16" - }, - { - "idiom" : "mac", - "scale" : "1x", - "size" : "32x32" - }, - { - "idiom" : "mac", - "scale" : "2x", - "size" : "32x32" - }, - { - "idiom" : "mac", - "scale" : "1x", - "size" : "128x128" - }, - { - "idiom" : "mac", - "scale" : "2x", - "size" : "128x128" - }, - { - "idiom" : "mac", - "scale" : "1x", - "size" : "256x256" - }, - { - "idiom" : "mac", - "scale" : "2x", - "size" : "256x256" - }, - { - "idiom" : "mac", - "scale" : "1x", - "size" : "512x512" - }, - { - "idiom" : "mac", - "scale" : "2x", - "size" : "512x512" - } - ], - "info" : { - "author" : "xcode", - "version" : 1 - } -} diff --git a/Examples/macOS/macOS Example/App/Assets.xcassets/Contents.json b/Examples/macOS/macOS Example/App/Assets.xcassets/Contents.json deleted file mode 100644 index 73c0059..0000000 --- a/Examples/macOS/macOS Example/App/Assets.xcassets/Contents.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "info" : { - "author" : "xcode", - "version" : 1 - } -} diff --git a/Examples/macOS/macOS Example/App/macOS_Example.entitlements b/Examples/macOS/macOS Example/App/macOS_Example.entitlements deleted file mode 100644 index 40b639e..0000000 --- a/Examples/macOS/macOS Example/App/macOS_Example.entitlements +++ /dev/null @@ -1,14 +0,0 @@ - - - - - com.apple.security.app-sandbox - - com.apple.security.files.user-selected.read-only - - com.apple.security.network.client - - com.apple.security.network.server - - - diff --git a/Examples/macOS/macOS Example/Controller/ViewController+NetworkEventMonitor.swift b/Examples/macOS/macOS Example/Controller/ViewController+NetworkEventMonitor.swift deleted file mode 100644 index 50b5451..0000000 --- a/Examples/macOS/macOS Example/Controller/ViewController+NetworkEventMonitor.swift +++ /dev/null @@ -1,26 +0,0 @@ -// -// ViewController+NetworkEventMonitor.swift -// RxNetworkKit -// -// Created by Loay Ashraf on 01/04/2023. -// - -import Foundation -import RxNetworkKit - -extension ViewController: NetworkEventMonitor { - func urlSession(_ session: URLSession, didBecomeInvalidWithError error: Error?) { - debugPrint("") - } - func urlSessionDidFinishEvents(forBackgroundURLSession session: URLSession) { - debugPrint(session) - } - func urlSession(_ session: URLSession, didCreateTask task: URLSessionTask) { - debugPrint("Task created!") - } - func urlSession(_ session: URLSession, task: URLSessionTask, didCompleteWithError error: Error?) { - guard let error else { return } - debugPrint("Task did finish with error: \(error.localizedDescription)!") - } - func urlSession(_ session: URLSession, downloadTask: URLSessionDownloadTask, didFinishDownloadingTo location: URL) { } -} diff --git a/Examples/macOS/macOS Example/Controller/ViewController+NetworkRequestInterceptor.swift b/Examples/macOS/macOS Example/Controller/ViewController+NetworkRequestInterceptor.swift deleted file mode 100644 index e625612..0000000 --- a/Examples/macOS/macOS Example/Controller/ViewController+NetworkRequestInterceptor.swift +++ /dev/null @@ -1,24 +0,0 @@ -// -// ViewController+NetworkRequestInterceptor.swift -// RxNetworkKit -// -// Created by Loay Ashraf on 01/04/2023. -// - -import Foundation -import RxNetworkKit - -extension ViewController: NetworkRequestInterceptor { - func adapt(_ request: URLRequest, for session: URLSession) -> URLRequest { - return request - } - func retryMaxAttempts(_ request: URLRequest, for session: URLSession) -> Int { - 5 - } - func retryPolicy(_ request: URLRequest, for session: URLSession) -> NetworkRequestRetryPolicy { - .constant(time: 5_000) - } - func shouldRetry(_ request: URLRequest, for session: URLSession, dueTo error: NetworkError) -> Bool { - true - } -} diff --git a/Examples/macOS/macOS Example/Controller/ViewController.swift b/Examples/macOS/macOS Example/Controller/ViewController.swift deleted file mode 100644 index bf53473..0000000 --- a/Examples/macOS/macOS Example/Controller/ViewController.swift +++ /dev/null @@ -1,219 +0,0 @@ -// -// ViewController.swift -// macOS Example -// -// Created by Loay Ashraf on 22/08/2023. -// - -import Cocoa -import RxSwift -import RxCocoa -import RxNetworkKit - -class ViewController: NSViewController { - @IBOutlet weak var tableView: NSTableView! - @IBOutlet weak var reachbilityView: NSView! - @IBOutlet weak var reachabilityLabel: NSTextField! - @IBOutlet weak var errorView: NSStackView! - @IBOutlet weak var errorImageView: NSImageView! - @IBOutlet weak var errorLabel: NSTextField! - @IBOutlet weak var errorRetryButton: NSButton! - @IBOutlet weak var activityIndicator: NSProgressIndicator! - private var viewModel: ViewModel! - private var items: BehaviorRelay<[Model]> = .init(value: []) - private var refreshItems: PublishRelay = .init() - private let disposeBag: DisposeBag = .init() - /// View has loaded successfully. - override func viewDidLoad() { - super.viewDidLoad() - setupViewModel() - setupUI() - bindUI() - } - /// View is about to appear on screen. - override func viewWillAppear() { - super.viewWillAppear() - viewModel.viewState.accept(.loading(loadType: .initial)) - } - /// called when `Refresh Items` menu items is tapped. - /// - /// - Parameter sender: `NSMenuItem` object that sent event. - @IBAction func refreshItems(_ sender: NSMenuItem) { - refreshItems.accept(()) - } - /// Initializes ViewModel object. - private func setupViewModel() { - let manager = NetworkManager(configuration: .default, requestInterceptor: self, eventMonitor: self) - viewModel = .init(networkManager: manager) - } - /// Sets up views. - private func setupUI() { - tableView.dataSource = self - tableView.delegate = self - reachbilityView.wantsLayer = true - reachbilityView.layer?.backgroundColor = NSColor.systemIndigo.cgColor - } - // MARK: - Bindings - /// Binds view state and events. - private func bindUI() { - bindUIState() - bindUIEvents() - } - // MARK: UI State Bindings - /// Binds view state. - private func bindUIState() { - bindTableViewIsHidden() - bindTableViewItems() - bindActivityIndicatorIsAnimating() - bindErrorViewIsHidden() - bindErrorViewText() - bindReachabilityText() - } - /// Presents new reachability status. - /// - /// - Parameter status: `NetworkReachabilityStatus` object to be presented. - private func presentReachabilityStatus(_ status: NetworkReachabilityStatus) { - var reachabilityText = "" - switch status { - case .reachable(let interfaceType): - reachabilityText = "Network is reachable via \(interfaceType.rawValue)." - case .unReachable: - reachabilityText = "Network is unreachable." - } - self.reachabilityLabel.stringValue = reachabilityText - self.reachbilityView.isHidden = false - DispatchQueue.main.asyncAfter(deadline: .now() + 3.0) { - self.reachabilityLabel.stringValue = "" - self.reachbilityView.isHidden = true - } - } - // MARK: UI Events Bindings - /// Binds view events. - private func bindUIEvents() { - // Bind Refresh Items' tap event to viewModel's viewState. - bindRefreshItemsEvent() - // Bind errorView's retryButton to viewModel's viewState. - bindErrorViewRetryEvent() - } - /// Bind tableView's isHidden property to view state. - private func bindTableViewIsHidden() { - viewModel.viewState - .map({ $0 == .loading(loadType: .initial) || $0 == .error }) - .bind(to: tableView.rx.isHidden) - .disposed(by: disposeBag) - } - /// Bind viewModel's users sequence to tableView's items. - private func bindTableViewItems() { - viewModel.users - .drive(items) - .disposed(by: disposeBag) - items - .subscribe(onNext: { _ in - self.tableView.reloadData() - }) - .disposed(by: disposeBag) - } - /// Downloads image data to be displayed inside `TableViewCell` object - /// - /// - Parameters: - /// - url: `URL` used to download image data. - /// - cell: `TableViewCell` that the image data will be applied to. - private func downloadTableViewCellImage(using url: URL, applyTo cell: TableCellView) { - viewModel.downloadImage(DownloadRouter.default(url: url)) - .observe(on: MainScheduler.instance) - .subscribe(onNext: { - switch $0 { - case .completedWithData(let data): - guard let data = data, let image = NSImage(data: data) else { return } - cell.customImageView.image = image - default: - return - } - }) - .disposed(by: self.disposeBag) - } - /// Bind activityIndicator's isAnimating property to view state. - private func bindActivityIndicatorIsAnimating() { - viewModel.viewState - .map({ $0 == .loading(loadType: .initial) }) - .subscribe(onNext: { shouldAnimate in - if shouldAnimate { - self.activityIndicator.startAnimation(self) - } else { - self.activityIndicator.stopAnimation(self) - } - }) - .disposed(by: disposeBag) - } - /// Bind errorView's isHidden property to view state. - private func bindErrorViewIsHidden() { - viewModel.viewState - .map({ $0 != .error }) - .bind(to: errorView.rx.isHidden) - .disposed(by: disposeBag) - } - /// Bind viewModel's error sequence to errorLabel's text. - private func bindErrorViewText() { - viewModel.error - .map({ $0.localizedDescription }) - .drive(errorLabel.rx.text) - .disposed(by: disposeBag) - } - /// Bind NetworkReachability's status sequence to reachabiliytView and reachabilityLabel. - private func bindReachabilityText() { - NetworkReachability.shared.status - .observe(on: MainScheduler.instance) - .bind(onNext: { - self.presentReachabilityStatus($0) - }) - .disposed(by: disposeBag) - } - /// Bind Refresh Items' tap event to viewModel's viewState. - private func bindRefreshItemsEvent() { - refreshItems - .map({ .loading(loadType: .refresh) }) - .bind(to: viewModel.viewState) - .disposed(by: disposeBag) - } - /// Bind errorView's retryButton to viewModel's viewState. - private func bindErrorViewRetryEvent() { - errorRetryButton.rx - .tap - .map({ .loading(loadType: .initial) }) - .bind(to: viewModel.viewState) - .disposed(by: disposeBag) - } - /// Navigates to user profile. - /// - /// - Parameter url: HTML `URL` to user profile. - private func navigateToUserProfile(with url: URL) { - NSWorkspace.shared.open(url) - } -} - -extension ViewController: NSTableViewDataSource { - func numberOfRows(in tableView: NSTableView) -> Int { - items.value.count - } - func tableView(_ tableView: NSTableView, heightOfRow row: Int) -> CGFloat { - 130 - } - func tableView(_ tableView: NSTableView, viewFor tableColumn: NSTableColumn?, row: Int) -> NSView? { - let user = items.value[row] - guard let cellView = tableView.makeView(withIdentifier: tableColumn!.identifier, owner: nil) as? TableCellView else { return nil } - cellView.customTextField.stringValue = user.login - downloadTableViewCellImage(using: user.avatarURL, applyTo: cellView) - return cellView - } -} - -extension ViewController: NSTableViewDelegate { - func tableViewSelectionDidChange(_ notification: Notification) { - let tableView = notification.object as! NSTableView - let rowIndex = tableView.selectedRow - guard rowIndex >= 0 else { return } - tableView.deselectRow(rowIndex) - let user = items.value[rowIndex] - navigateToUserProfile(with: user.htmlURL) - } -} diff --git a/Examples/macOS/macOS Example/Model/Model.swift b/Examples/macOS/macOS Example/Model/Model.swift deleted file mode 100644 index a7104db..0000000 --- a/Examples/macOS/macOS Example/Model/Model.swift +++ /dev/null @@ -1,21 +0,0 @@ -// -// Model.swift -// RxNetworkKit -// -// Created by Loay Ashraf on 20/03/2023. -// - -import Foundation - -struct Model: Decodable { - let id: Int - let avatarURL: URL - let htmlURL: URL - let login: String - enum CodingKeys: String, CodingKey { - case id - case avatarURL = "avatar_url" - case htmlURL = "html_url" - case login - } -} diff --git a/Examples/macOS/macOS Example/Network/DownloadRouter.swift b/Examples/macOS/macOS Example/Network/DownloadRouter.swift deleted file mode 100644 index cffa683..0000000 --- a/Examples/macOS/macOS Example/Network/DownloadRouter.swift +++ /dev/null @@ -1,34 +0,0 @@ -// -// DownloadRouter.swift -// RxNetworkKit -// -// Created by Loay Ashraf on 01/04/2023. -// - -import Foundation -import RxNetworkKit - -enum DownloadRouter: NetworkDownloadRouter { - case `default`(url: URL) - var scheme: HTTPScheme { - .https - } - var domain: String { - "" - } - var path: String { - "" - } - var headers: [String : String] { - [:] - } - var parameters: [String : String]? { - nil - } - var url: URL? { - switch self { - case .default(let url): - return url - } - } -} diff --git a/Examples/macOS/macOS Example/Network/Router.swift b/Examples/macOS/macOS Example/Network/Router.swift deleted file mode 100644 index 564a378..0000000 --- a/Examples/macOS/macOS Example/Network/Router.swift +++ /dev/null @@ -1,38 +0,0 @@ -// -// Router.swift -// RxNetworkKit -// -// Created by Loay Ashraf on 01/04/2023. -// - -import Foundation -import RxNetworkKit - -enum Router: NetworkRouter { - case `default` - var scheme: HTTPScheme { - .https - } - var method: HTTPMethod { - .get - } - var domain: String { - "api.github.com" - } - var path: String { - "users" - } - var headers: [String : String] { - ["Accept": "application/vnd.github+json"] - } - var parameters: [String : String]? { - nil - } - var body: [String : Any]? { - nil - } - var url: URL? { - let urlString = scheme.rawValue + domain + "/" + path - return URL(string: urlString) - } -} diff --git a/Examples/macOS/macOS Example/View Model/ViewModel.swift b/Examples/macOS/macOS Example/View Model/ViewModel.swift deleted file mode 100644 index dfe174f..0000000 --- a/Examples/macOS/macOS Example/View Model/ViewModel.swift +++ /dev/null @@ -1,69 +0,0 @@ -// -// ViewModel.swift -// RxNetworkKit -// -// Created by Loay Ashraf on 31/03/2023. -// - -import Foundation -import RxSwift -import RxCocoa -import RxNetworkKit - -class ViewModel { - // MARK: Input - // Input sequence is the same as view state (only for loading states) - private(set) var viewState: PublishRelay = .init() - // MARK: Output - private(set) var users: Driver<[Model]>! - private(set) var error: Driver! - // MARK: Properties and Dependencies - private let networkManager: NetworkManager - private let disposeBag = DisposeBag() - /// Creates `ViewModel` instance - /// - /// - Parameter networkManager: `NetworkManager` object used for making network API calls. - init(networkManager: NetworkManager) { - self.networkManager = networkManager - bindOutput() - } - /// Creates observable sequence that results in image data. - /// - /// - Parameter router: `DownloadRouter` used to download image data. - /// - /// - Returns: observable sequence that results in image data. - func downloadImage(_ router: DownloadRouter) -> Observable { - networkManager.download(router) - } - /// Binds output sequence to input sequence. - private func bindOutput() { - // Create default sequence with default API call request. - let loadObservable = viewState - .filter( { ![.idle, .loading(loadType: .paginate), .error].contains($0) }) - .flatMapLatest{ _ in - let single: Single<[Model]> = self.networkManager.request(Router.default) - return single - .asObservable() - .materialize() - } - .share() - // Initialize users and error sequence outputs - self.users = loadObservable - .compactMap { $0.element } - .asDriver(onErrorJustReturn: []) - self.error = loadObservable - .compactMap { $0.error as? NetworkError } - .asDriver(onErrorJustReturn: NetworkError.client(.transport(NSError(domain: "", code: 1, userInfo: nil)))) - // Bind output sequence to input sequence (view state) - self.users - .asObservable() - .map({ _ in .idle }) - .bind(to: viewState) - .disposed(by: disposeBag) - self.error - .asObservable() - .map({ _ in .error }) - .bind(to: viewState) - .disposed(by: disposeBag) - } -} diff --git a/Examples/macOS/macOS Example/View/Base.lproj/Main.storyboard b/Examples/macOS/macOS Example/View/Base.lproj/Main.storyboard deleted file mode 100644 index 0ca0524..0000000 --- a/Examples/macOS/macOS Example/View/Base.lproj/Main.storyboard +++ /dev/null @@ -1,290 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - NSAllRomanInputSourcesLocaleIdentifier - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/Examples/macOS/macOS Example/View/TableCellView.swift b/Examples/macOS/macOS Example/View/TableCellView.swift deleted file mode 100644 index b0e3550..0000000 --- a/Examples/macOS/macOS Example/View/TableCellView.swift +++ /dev/null @@ -1,19 +0,0 @@ -// -// TableCellView.swift -// RxNetworkKit -// -// Created by Loay Ashraf on 01/04/2023. -// - -import Cocoa - -class TableCellView: NSTableCellView { - @IBOutlet weak var customTextField: NSTextField! - @IBOutlet weak var customImageView: NSImageView! - override func awakeFromNib() { - super.awakeFromNib() - customImageView.wantsLayer = true - customImageView.layer?.cornerRadius = 50.0 - customImageView.layer?.cornerCurve = .continuous - } -} diff --git a/Examples/macOS/macOS Example/View/ViewLoadType.swift b/Examples/macOS/macOS Example/View/ViewLoadType.swift deleted file mode 100644 index 3aab992..0000000 --- a/Examples/macOS/macOS Example/View/ViewLoadType.swift +++ /dev/null @@ -1,12 +0,0 @@ -// -// ViewLoadType.swift -// RxNetworkKit -// -// Created by Loay Ashraf on 01/04/2023. -// - -enum ViewLoadType { - case initial - case refresh - case paginate -} diff --git a/Examples/macOS/macOS Example/View/ViewState.swift b/Examples/macOS/macOS Example/View/ViewState.swift deleted file mode 100644 index e5cd81d..0000000 --- a/Examples/macOS/macOS Example/View/ViewState.swift +++ /dev/null @@ -1,12 +0,0 @@ -// -// ViewState.swift -// RxNetworkKit -// -// Created by Loay Ashraf on 01/04/2023. -// - -enum ViewState: Equatable { - case idle - case loading(loadType: ViewLoadType) - case error -} diff --git a/RxNetworkKit.xcodeproj/project.pbxproj b/RxNetworkKit.xcodeproj/project.pbxproj index 5c67b7c..371acf1 100644 --- a/RxNetworkKit.xcodeproj/project.pbxproj +++ b/RxNetworkKit.xcodeproj/project.pbxproj @@ -22,6 +22,7 @@ 0B77E09529D965D30077FBC0 /* RequestRetryPolicy.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0B77E05B29D965D30077FBC0 /* RequestRetryPolicy.swift */; }; 0B77E09629D965D30077FBC0 /* RequestAdapter.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0B77E05C29D965D30077FBC0 /* RequestAdapter.swift */; }; 0B77E09729D965D30077FBC0 /* RequestRetrier.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0B77E05D29D965D30077FBC0 /* RequestRetrier.swift */; }; + 0B77E09829D965D30077FBC0 /* RxNetworking.h in Headers */ = {isa = PBXBuildFile; fileRef = 0B77E05E29D965D30077FBC0 /* RxNetworking.h */; }; 0B77E09929D965D30077FBC0 /* NetworkManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0B77E06029D965D30077FBC0 /* NetworkManager.swift */; }; 0B77E09A29D965D30077FBC0 /* HTTPMIMEType.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0B77E06229D965D30077FBC0 /* HTTPMIMEType.swift */; }; 0B77E09B29D965D30077FBC0 /* HTTPMethod.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0B77E06329D965D30077FBC0 /* HTTPMethod.swift */; }; @@ -56,12 +57,6 @@ 0B77E0BB29D968DE0077FBC0 /* RxRelay in Frameworks */ = {isa = PBXBuildFile; productRef = 0B77E0BA29D968DE0077FBC0 /* RxRelay */; }; 0B77E0BD29D968DE0077FBC0 /* RxSwift in Frameworks */ = {isa = PBXBuildFile; productRef = 0B77E0BC29D968DE0077FBC0 /* RxSwift */; }; 0B77E0C029D969370077FBC0 /* RxSwiftExt in Frameworks */ = {isa = PBXBuildFile; productRef = 0B77E0BF29D969370077FBC0 /* RxSwiftExt */; }; - C6049B162A95307800E5727E /* RxNetworkKit.h in Headers */ = {isa = PBXBuildFile; fileRef = C6049B152A95307800E5727E /* RxNetworkKit.h */; }; - C6A9BEF62A93E2AE00459E32 /* DefaultHTTPErrorBody.swift in Sources */ = {isa = PBXBuildFile; fileRef = C6A9BEF52A93E2AE00459E32 /* DefaultHTTPErrorBody.swift */; }; - C6A9BEF82A93E2D600459E32 /* HTTPErrorBody.swift in Sources */ = {isa = PBXBuildFile; fileRef = C6A9BEF72A93E2D600459E32 /* HTTPErrorBody.swift */; }; - C6A9BEFA2A93F16200459E32 /* URLSessionConfiguration+setAdditionalHTTPHeader.swift in Sources */ = {isa = PBXBuildFile; fileRef = C6A9BEF92A93F16200459E32 /* URLSessionConfiguration+setAdditionalHTTPHeader.swift */; }; - C6A9BEFD2A93FAF100459E32 /* URLSessionConfiguration+setUserAgentHTTPHeader.swift in Sources */ = {isa = PBXBuildFile; fileRef = C6A9BEFC2A93FAF100459E32 /* URLSessionConfiguration+setUserAgentHTTPHeader.swift */; }; - C6A9BEFF2A93FB1D00459E32 /* ProcessInfo+operatingSystemName.swift in Sources */ = {isa = PBXBuildFile; fileRef = C6A9BEFE2A93FB1D00459E32 /* ProcessInfo+operatingSystemName.swift */; }; /* End PBXBuildFile section */ /* Begin PBXFileReference section */ @@ -82,6 +77,7 @@ 0B77E05B29D965D30077FBC0 /* RequestRetryPolicy.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RequestRetryPolicy.swift; sourceTree = ""; }; 0B77E05C29D965D30077FBC0 /* RequestAdapter.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RequestAdapter.swift; sourceTree = ""; }; 0B77E05D29D965D30077FBC0 /* RequestRetrier.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RequestRetrier.swift; sourceTree = ""; }; + 0B77E05E29D965D30077FBC0 /* RxNetworking.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RxNetworking.h; sourceTree = ""; }; 0B77E06029D965D30077FBC0 /* NetworkManager.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NetworkManager.swift; sourceTree = ""; }; 0B77E06229D965D30077FBC0 /* HTTPMIMEType.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = HTTPMIMEType.swift; sourceTree = ""; }; 0B77E06329D965D30077FBC0 /* HTTPMethod.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = HTTPMethod.swift; sourceTree = ""; }; @@ -112,12 +108,6 @@ 0B77E08629D965D30077FBC0 /* NetworkDownloadRouter.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NetworkDownloadRouter.swift; sourceTree = ""; }; 0B77E08729D965D30077FBC0 /* NetworkRouter.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NetworkRouter.swift; sourceTree = ""; }; 0B77E08829D965D30077FBC0 /* NetworkUploadRouter.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NetworkUploadRouter.swift; sourceTree = ""; }; - C6049B152A95307800E5727E /* RxNetworkKit.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RxNetworkKit.h; sourceTree = ""; }; - C6A9BEF52A93E2AE00459E32 /* DefaultHTTPErrorBody.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DefaultHTTPErrorBody.swift; sourceTree = ""; }; - C6A9BEF72A93E2D600459E32 /* HTTPErrorBody.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HTTPErrorBody.swift; sourceTree = ""; }; - C6A9BEF92A93F16200459E32 /* URLSessionConfiguration+setAdditionalHTTPHeader.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "URLSessionConfiguration+setAdditionalHTTPHeader.swift"; sourceTree = ""; }; - C6A9BEFC2A93FAF100459E32 /* URLSessionConfiguration+setUserAgentHTTPHeader.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "URLSessionConfiguration+setUserAgentHTTPHeader.swift"; sourceTree = ""; }; - C6A9BEFE2A93FB1D00459E32 /* ProcessInfo+operatingSystemName.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "ProcessInfo+operatingSystemName.swift"; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -164,7 +154,7 @@ 0B77E07029D965D30077FBC0 /* Error */, 0B77E07629D965D30077FBC0 /* Rx Extensions */, 0B77E08529D965D30077FBC0 /* Router */, - C6049B152A95307800E5727E /* RxNetworkKit.h */, + 0B77E05E29D965D30077FBC0 /* RxNetworking.h */, ); path = Source; sourceTree = ""; @@ -218,9 +208,6 @@ isa = PBXGroup; children = ( 0B77E06029D965D30077FBC0 /* NetworkManager.swift */, - C6A9BEF92A93F16200459E32 /* URLSessionConfiguration+setAdditionalHTTPHeader.swift */, - C6A9BEFC2A93FAF100459E32 /* URLSessionConfiguration+setUserAgentHTTPHeader.swift */, - C6A9BEFE2A93FB1D00459E32 /* ProcessInfo+operatingSystemName.swift */, ); path = Manager; sourceTree = ""; @@ -228,13 +215,11 @@ 0B77E06129D965D30077FBC0 /* HTTP */ = { isa = PBXGroup; children = ( - C6A9BEF52A93E2AE00459E32 /* DefaultHTTPErrorBody.swift */, - C6A9BEF72A93E2D600459E32 /* HTTPErrorBody.swift */, 0B77E06229D965D30077FBC0 /* HTTPMIMEType.swift */, 0B77E06329D965D30077FBC0 /* HTTPMethod.swift */, 0B77E06429D965D30077FBC0 /* HTTPScheme.swift */, - 0B77E06629D965D30077FBC0 /* HTTPStatusCode.swift */, 0B77E06529D965D30077FBC0 /* HTTPURLResponse+StatusCode.swift */, + 0B77E06629D965D30077FBC0 /* HTTPStatusCode.swift */, ); path = HTTP; sourceTree = ""; @@ -345,7 +330,7 @@ isa = PBXHeadersBuildPhase; buildActionMask = 2147483647; files = ( - C6049B162A95307800E5727E /* RxNetworkKit.h in Headers */, + 0B77E09829D965D30077FBC0 /* RxNetworking.h in Headers */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -383,7 +368,7 @@ isa = PBXProject; attributes = { BuildIndependentTargetsInParallel = 1; - LastUpgradeCheck = 1430; + LastUpgradeCheck = 1420; TargetAttributes = { 0B77DFD529D964D40077FBC0 = { CreatedOnToolsVersion = 14.2; @@ -431,7 +416,6 @@ 0B77E0B529D965D30077FBC0 /* NetworkRouter.swift in Sources */, 0B77E09529D965D30077FBC0 /* RequestRetryPolicy.swift in Sources */, 0B77E0B329D965D30077FBC0 /* Reactive+Curl.swift in Sources */, - C6A9BEF82A93E2D600459E32 /* HTTPErrorBody.swift in Sources */, 0B77E0A929D965D30077FBC0 /* NetworkError.swift in Sources */, 0B77E09F29D965D30077FBC0 /* NWPath+InterfaceType.swift in Sources */, 0B77E09C29D965D30077FBC0 /* HTTPScheme.swift in Sources */, @@ -440,7 +424,6 @@ 0B77E0AE29D965D30077FBC0 /* Single+VerifyResponse.swift in Sources */, 0B77E0B429D965D30077FBC0 /* NetworkDownloadRouter.swift in Sources */, 0B77E09A29D965D30077FBC0 /* HTTPMIMEType.swift in Sources */, - C6A9BEFF2A93FB1D00459E32 /* ProcessInfo+operatingSystemName.swift in Sources */, 0B77E08E29D965D30077FBC0 /* UploadFile.swift in Sources */, 0B77E09729D965D30077FBC0 /* RequestRetrier.swift in Sources */, 0B77E09E29D965D30077FBC0 /* HTTPStatusCode.swift in Sources */, @@ -451,9 +434,7 @@ 0B77E0B129D965D30077FBC0 /* Observable+Decodable.swift in Sources */, 0B77E09929D965D30077FBC0 /* NetworkManager.swift in Sources */, 0B77E08A29D965D30077FBC0 /* DownloadEvent.swift in Sources */, - C6A9BEFD2A93FAF100459E32 /* URLSessionConfiguration+setUserAgentHTTPHeader.swift in Sources */, 0B77E09129D965D30077FBC0 /* Reactive+URLSessionAdaptedUploadResponse.swift in Sources */, - C6A9BEFA2A93F16200459E32 /* URLSessionConfiguration+setAdditionalHTTPHeader.swift in Sources */, 0B77E0A629D965D30077FBC0 /* DefaultNetworkAPIError.swift in Sources */, 0B77E0A429D965D30077FBC0 /* NetworkReachability.swift in Sources */, 0B77E0B229D965D30077FBC0 /* Completable+Retry.swift in Sources */, @@ -461,7 +442,6 @@ 0B77E08B29D965D30077FBC0 /* URLSession+DownloadTask.swift in Sources */, 0B77E0A729D965D30077FBC0 /* NetworkServerError.swift in Sources */, 0B77E0B629D965D30077FBC0 /* NetworkUploadRouter.swift in Sources */, - C6A9BEF62A93E2AE00459E32 /* DefaultHTTPErrorBody.swift in Sources */, 0B77E0AB29D965D30077FBC0 /* Single+Retry.swift in Sources */, 0B77E08F29D965D30077FBC0 /* URLSession+UploadTask.swift in Sources */, 0B77E08C29D965D30077FBC0 /* Reactive+URLSessionAdaptedDownloadResponse.swift in Sources */, @@ -609,7 +589,6 @@ isa = XCBuildConfiguration; buildSettings = { BUILD_LIBRARY_FOR_DISTRIBUTION = NO; - CODE_SIGN_IDENTITY = ""; CODE_SIGN_STYLE = Automatic; CURRENT_PROJECT_VERSION = 1; DEFINES_MODULE = YES; @@ -617,7 +596,6 @@ 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"; @@ -628,9 +606,7 @@ "@loader_path/Frameworks", ); MACOSX_DEPLOYMENT_TARGET = 11.0; - MARKETING_VERSION = 0.0.2; - MODULE_VERIFIER_SUPPORTED_LANGUAGES = "objective-c objective-c++"; - MODULE_VERIFIER_SUPPORTED_LANGUAGE_STANDARDS = "gnu11 gnu++20"; + MARKETING_VERSION = 1.0; PRODUCT_BUNDLE_IDENTIFIER = com.las.RxNetworkKit; PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; SKIP_INSTALL = YES; @@ -647,7 +623,6 @@ isa = XCBuildConfiguration; buildSettings = { BUILD_LIBRARY_FOR_DISTRIBUTION = YES; - CODE_SIGN_IDENTITY = ""; CODE_SIGN_STYLE = Automatic; CURRENT_PROJECT_VERSION = 1; DEFINES_MODULE = YES; @@ -655,7 +630,6 @@ 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"; @@ -666,9 +640,7 @@ "@loader_path/Frameworks", ); MACOSX_DEPLOYMENT_TARGET = 11.0; - MARKETING_VERSION = 0.0.2; - MODULE_VERIFIER_SUPPORTED_LANGUAGES = "objective-c objective-c++"; - MODULE_VERIFIER_SUPPORTED_LANGUAGE_STANDARDS = "gnu11 gnu++20"; + MARKETING_VERSION = 1.0; PRODUCT_BUNDLE_IDENTIFIER = com.las.RxNetworkKit; PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; SKIP_INSTALL = YES; diff --git a/RxNetworkKit.xcodeproj/xcshareddata/xcschemes/RxNetworkKit.xcscheme b/RxNetworkKit.xcodeproj/xcshareddata/xcschemes/RxNetworking.xcscheme similarity index 98% rename from RxNetworkKit.xcodeproj/xcshareddata/xcschemes/RxNetworkKit.xcscheme rename to RxNetworkKit.xcodeproj/xcshareddata/xcschemes/RxNetworking.xcscheme index 1a7445c..5483893 100644 --- a/RxNetworkKit.xcodeproj/xcshareddata/xcschemes/RxNetworkKit.xcscheme +++ b/RxNetworkKit.xcodeproj/xcshareddata/xcschemes/RxNetworking.xcscheme @@ -1,6 +1,6 @@ - - + location = "container:Example/iOS Example.xcodeproj"> diff --git a/RxNetworkKitX.podspec b/RxNetworkKitX.podspec index 1104206..31a0c90 100644 --- a/RxNetworkKitX.podspec +++ b/RxNetworkKitX.podspec @@ -4,7 +4,7 @@ Pod::Spec.new do |s| s.macos.deployment_target = '11.0' s.name = 'RxNetworkKitX' s.module_name = 'RxNetworkKit' - s.version = '0.0.2' + s.version = '0.0.1' s.summary = 'a lightweight FRP networking framework.' s.description = 'a FRP networking framework built on top of URLSession and uses RxSwift and RxCocoa.' s.homepage = 'https://github.com/loay-ashraf/RxNetworkKit' @@ -17,4 +17,4 @@ Pod::Spec.new do |s| s.dependency 'RxSwiftExt', '~> 6.0.1' s.source_files = 'Source/**/*.{swift,m,h}' s.swift_version = '5.0' - end + end \ No newline at end of file diff --git a/Source/Custom Requests/Download/Reactive+URLSessionAdaptedDownloadResponse.swift b/Source/Custom Requests/Download/Reactive+URLSessionAdaptedDownloadResponse.swift index 99adaba..63318e6 100644 --- a/Source/Custom Requests/Download/Reactive+URLSessionAdaptedDownloadResponse.swift +++ b/Source/Custom Requests/Download/Reactive+URLSessionAdaptedDownloadResponse.swift @@ -14,11 +14,10 @@ extension Reactive where Base: URLSession { /// /// - Parameters: /// - request: `URLRequest` used to create upload task and its observables. - /// - httpErrorType: `HTTPErrorBody` http error body type. /// - apiErrorType: `NetworkAPIError` type for expected error in HTTP response body. /// /// - Returns: a `Observable` object of `DownloadEvent` type. - func downloadResponse(request: URLRequest, httpErrorType: E.Type, apiErrorType: AE.Type) -> Observable { + func downloadResponse(request: URLRequest, apiErrorType: AE.Type) -> Observable { let observables = downloadResponse(request: request) let progressObservable = observables .0 @@ -26,7 +25,7 @@ extension Reactive where Base: URLSession { .asObservable() let responseObservable = observables .1 - .decodable(E.self, apiErrorType: AE.self) + .decodable(AE.self) .map { DownloadEvent.completedWithData(data: $0.data) } .asObservable() let mergedObservable = responseObservable.merge(with: progressObservable) @@ -37,11 +36,10 @@ extension Reactive where Base: URLSession { /// - Parameters: /// - request: `URLRequest` used to create upload task and its observables. /// - url: `URL` used to save downloaded file to disk. - /// - httpErrorType: `HTTPErrorBody` http error body type. /// - apiErrorType: `NetworkAPIError` type for expected error in HTTP response body. /// /// - Returns: a `Observable` object of `DownloadEvent` type. - func downloadResponse(request: URLRequest, saveTo url: URL, httpErrorType: E.Type, apiErrorType: AE.Type) -> Observable { + func downloadResponse(request: URLRequest, saveTo url: URL, apiErrorType: AE.Type) -> Observable { let observables = downloadResponse(request: request, saveTo: url) let progressObservable = observables .0 @@ -49,7 +47,7 @@ extension Reactive where Base: URLSession { .asObservable() let responseObservable = observables .1 - .decodable(E.self, apiErrorType: AE.self) + .decodable(AE.self) .map { _ in DownloadEvent.completed } .asObservable() let mergedObservable = responseObservable.merge(with: progressObservable) diff --git a/Source/Custom Requests/Upload/Reactive+URLSessionAdaptedUploadResponse.swift b/Source/Custom Requests/Upload/Reactive+URLSessionAdaptedUploadResponse.swift index 88ae8a4..3c53b84 100644 --- a/Source/Custom Requests/Upload/Reactive+URLSessionAdaptedUploadResponse.swift +++ b/Source/Custom Requests/Upload/Reactive+URLSessionAdaptedUploadResponse.swift @@ -16,11 +16,10 @@ extension Reactive where Base: URLSession { /// - request: `URLRequest` used to create upload task and its observables. /// - file: `UploadFile` object to be uploaded. /// - modelType: `Decodable` type for model in HTTP response body. - /// - httpErrorType: `HTTPErrorBody` http error body type. /// - apiErrorType: `NetworkAPIError` type for expected error in HTTP response body. /// /// - Returns: a `Observable` object of `UploadEvent` type. - func uploadResponse(request: URLRequest, file: UploadFile, modelType: T.Type, httpErrorType: E.Type, apiErrorType: AE.Type) -> Observable> { + func uploadResponse(request: URLRequest, file: UploadFile, modelType: T.Type, apiErrorType: AE.Type) -> Observable> { let observables = uploadResponse(request: request, file: file) let progressObservable = observables .0 @@ -28,7 +27,7 @@ extension Reactive where Base: URLSession { .asObservable() let responseObservable = observables .1 - .decodable(T.self, httpErrorType: E.self, apiErrorType: AE.self) + .decodable(T.self, errorType: AE.self) .map { UploadEvent.completed(model: $0) } .asObservable() let mergedObservable = responseObservable.merge(with: progressObservable) @@ -40,11 +39,10 @@ extension Reactive where Base: URLSession { /// - request: `URLRequest` used to create upload task and its observables. /// - formData: `UploadFormData` object that includes parameters and files to be uploaded. /// - modelType: `Decodable` type for model in HTTP response body. - /// - httpErrorType: `HTTPErrorBody` http error body type. /// - apiErrorType: `NetworkAPIError` type for expected error in HTTP response body. /// /// - Returns: a `Observable` object of `UploadEvent` type. - func uploadResponse(request: URLRequest, formData: UploadFormData, modelType: T.Type, httpErrorType: E.Type, apiErrorType: AE.Type) -> Observable> { + func uploadResponse(request: URLRequest, formData: UploadFormData, modelType: T.Type, apiErrorType: AE.Type) -> Observable> { let observables = uploadResponse(request: request, formData: formData) let progressObservable = observables .0 @@ -52,7 +50,7 @@ extension Reactive where Base: URLSession { .asObservable() let responseObservable = observables .1 - .decodable(T.self, httpErrorType: E.self, apiErrorType: AE.self) + .decodable(T.self, errorType: AE.self) .map { UploadEvent.completed(model: $0) } .asObservable() let mergedObservable = responseObservable.merge(with: progressObservable) diff --git a/Source/Error/DefaultNetworkAPIError.swift b/Source/Error/DefaultNetworkAPIError.swift index e9af7dd..ee320b3 100644 --- a/Source/Error/DefaultNetworkAPIError.swift +++ b/Source/Error/DefaultNetworkAPIError.swift @@ -5,6 +5,6 @@ // Created by Loay Ashraf on 19/02/2023. // -public struct DefaultNetworkAPIError: NetworkAPIError { +struct DefaultNetworkAPIError: NetworkAPIError { let message: String } diff --git a/Source/Error/NetworkClientError.swift b/Source/Error/NetworkClientError.swift index b0e8ee4..42623bf 100644 --- a/Source/Error/NetworkClientError.swift +++ b/Source/Error/NetworkClientError.swift @@ -7,7 +7,7 @@ /// Client-side (transport) error public enum NetworkClientError: Error { - case http(HTTPStatusCode, HTTPErrorBody?) + case http(HTTPStatusCode) case serialization(Error) case transport(Error) } diff --git a/Source/Error/NetworkError.swift b/Source/Error/NetworkError.swift index bcb136f..279b1c4 100644 --- a/Source/Error/NetworkError.swift +++ b/Source/Error/NetworkError.swift @@ -14,20 +14,15 @@ public enum NetworkError: Error { /// Creates `NetworkError` instance. /// /// - Parameter response: `HTTPURLResponse` used to get response status code. - init?(_ response: HTTPURLResponse?, data: Data?, errorType: E.Type) { + init?(_ response: HTTPURLResponse?) { if let response = response, - let httpStatusCode = response.status { - // Get Error body from response data if possible. - var httpErrorBody: E? - if let data = data { - httpErrorBody = try? JSONDecoder().decode(errorType.self, from: data) - } + let httpStatusCode = HTTPStatusCode(rawValue: response.statusCode) { // Get Error from response status code switch httpStatusCode.responseType { case .clientError: - self = .client(.http(httpStatusCode, httpErrorBody)) + self = .client(.http(httpStatusCode)) case .serverError: - self = .server(.http(httpStatusCode, httpErrorBody)) + self = .server(.http(httpStatusCode)) default: return nil } diff --git a/Source/Error/NetworkServerError.swift b/Source/Error/NetworkServerError.swift index 6c059c7..75a80a1 100644 --- a/Source/Error/NetworkServerError.swift +++ b/Source/Error/NetworkServerError.swift @@ -7,6 +7,6 @@ /// Server-side error public enum NetworkServerError: Error { - case http(HTTPStatusCode, HTTPErrorBody?) + case http(HTTPStatusCode) case generic(Error) } diff --git a/Source/HTTP/DefaultHTTPErrorBody.swift b/Source/HTTP/DefaultHTTPErrorBody.swift deleted file mode 100644 index 89238f8..0000000 --- a/Source/HTTP/DefaultHTTPErrorBody.swift +++ /dev/null @@ -1,14 +0,0 @@ -// -// DefaultHTTPErrorBody.swift -// RxNetworkKit -// -// Created by Loay Ashraf on 21/08/2023. -// - -import Foundation - -public struct DefaultHTTPErrorBody: HTTPErrorBody { - let statusCode: Int? - let message: String? - let supportId: String? -} diff --git a/Source/HTTP/HTTPErrorBody.swift b/Source/HTTP/HTTPErrorBody.swift deleted file mode 100644 index 0366e4b..0000000 --- a/Source/HTTP/HTTPErrorBody.swift +++ /dev/null @@ -1,10 +0,0 @@ -// -// HTTPErrorBody.swift -// RxNetworkKit -// -// Created by Loay Ashraf on 21/08/2023. -// - -import Foundation - -public protocol HTTPErrorBody: Decodable { } diff --git a/Source/Manager/NetworkManager.swift b/Source/Manager/NetworkManager.swift index db90b27..b45c3ae 100644 --- a/Source/Manager/NetworkManager.swift +++ b/Source/Manager/NetworkManager.swift @@ -21,9 +21,6 @@ public class NetworkManager { /// - requestInterceptor: `NetworkRequestInterceptor` object used for intercepting requests. /// - eventMonitor: `NetworkEventMonitor` object for monitoring events for session. public init(configuration: URLSessionConfiguration, requestInterceptor: NetworkRequestInterceptor, eventMonitor: NetworkEventMonitor) { - // Apply User-Agent header as a part of HTTP aditional headers. - configuration.setUserAgentHTTPHeader() - // Initialize manager's properties. self.session = .init(configuration: configuration, delegate: eventMonitor, delegateQueue: nil) self.requestInterceptor = requestInterceptor self.eventMonitor = eventMonitor @@ -33,11 +30,10 @@ public class NetworkManager { /// /// - Parameters: /// - router: `Router` object used to create request. - /// - httpErrorType: `HTTPErrorBody` http error body type. /// - apiErrorType: `NetworkAPIError` type expected to be received in response body. /// /// - Returns: `Completable` observable encapsulating data request. - public func request(_ router: NetworkRouter, _ httpErrorType: E.Type = DefaultHTTPErrorBody.self, _ apiErrorType: AE.Type = DefaultNetworkAPIError.self) -> Completable { + public func request(_ router: NetworkRouter, _ apiErrorType: AE.Type = DefaultNetworkAPIError.self) -> Completable { let originalRequest = router.asURLRequest() let adaptedRequest = requestInterceptor.adapt(originalRequest, for: session) @@ -49,7 +45,7 @@ public class NetworkManager { let observable = session .rx .response(request: adaptedRequest) - .decodable(E.self, apiErrorType: AE.self) + .decodable(AE.self) .retry(retryMaxAttempts, delay: retryPolicy, shouldRetry: shouldRetry) return observable } @@ -58,11 +54,10 @@ public class NetworkManager { /// /// - Parameters: /// - router: `Router` object used to create request. - /// - httpErrorType: `HTTPErrorBody` http error body type. /// - apiErrorType: `NetworkAPIError` type expected to be received in response body. /// /// - Returns: `Single` observable encapsulating data request. - public func request(_ router: NetworkRouter, _ httpErrorType: E.Type = DefaultHTTPErrorBody.self, _ apiErrorType: AE.Type = DefaultNetworkAPIError.self) -> Single { + public func request(_ router: NetworkRouter, _ apiErrorType: AE.Type = DefaultNetworkAPIError.self) -> Single { let originalRequest = router.asURLRequest() let adaptedRequest = requestInterceptor.adapt(originalRequest, for: session) let retryMaxAttempts = requestInterceptor.retryMaxAttempts(adaptedRequest, for: session) @@ -73,7 +68,7 @@ public class NetworkManager { let observable = session .rx .response(request: adaptedRequest) - .decodable(T.self, httpErrorType: E.self, apiErrorType: AE.self) + .decodable(T.self, errorType: AE.self) .retry(retryMaxAttempts, delay: retryPolicy, shouldRetry: shouldRetry) return observable } @@ -82,11 +77,10 @@ public class NetworkManager { /// /// - Parameters: /// - router: `Router` object used to create request. - /// - httpErrorType: `HTTPErrorBody` http error body type. /// - apiErrorType: `NetworkAPIError` type expected to be received in response body. /// /// - Returns: `Observable` object encapsulating download request. - public func download(_ router: NetworkRouter, _ httpErrorType: E.Type = DefaultHTTPErrorBody.self, _ apiErrorType: AE.Type = DefaultNetworkAPIError.self) -> Observable { + public func download(_ router: NetworkRouter, _ apiErrorType: AE.Type = DefaultNetworkAPIError.self) -> Observable { let originalRequest = router.asURLRequest() let adaptedRequest = requestInterceptor.adapt(originalRequest, for: session) let retryMaxAttempts = requestInterceptor.retryMaxAttempts(adaptedRequest, for: session) @@ -96,7 +90,7 @@ public class NetworkManager { } let observable = session .rx - .downloadResponse(request: adaptedRequest, httpErrorType: E.self, apiErrorType: AE.self) + .downloadResponse(request: adaptedRequest, apiErrorType: AE.self) .retry(retryMaxAttempts, delay: retryPolicy, shouldRetry: shouldRetry) return observable } @@ -106,11 +100,10 @@ public class NetworkManager { /// - Parameters: /// - router: `Router` object used to create request. /// - fileURL: `URL` used to save downloaded file to disk. - /// - httpErrorType: `HTTPErrorBody` http error body type. /// - apiErrorType: `NetworkAPIError` type expected to be received in response body. /// /// - Returns: `Observable` object encapsulating download request. - public func download(_ router: NetworkRouter, _ fileURL: URL, _ httpErrorType: E.Type = DefaultHTTPErrorBody.self, _ apiErrorType: AE.Type = DefaultNetworkAPIError.self) -> Observable { + public func download(_ router: NetworkRouter, _ fileURL: URL, _ apiErrorType: AE.Type = DefaultNetworkAPIError.self) -> Observable { let originalRequest = router.asURLRequest() let adaptedRequest = requestInterceptor.adapt(originalRequest, for: session) let retryMaxAttempts = requestInterceptor.retryMaxAttempts(adaptedRequest, for: session) @@ -120,7 +113,7 @@ public class NetworkManager { } let observable = session .rx - .downloadResponse(request: adaptedRequest, saveTo: fileURL, httpErrorType: E.self, apiErrorType: AE.self) + .downloadResponse(request: adaptedRequest, saveTo: fileURL, apiErrorType: AE.self) .retry(retryMaxAttempts, delay: retryPolicy, shouldRetry: shouldRetry) return observable } @@ -130,11 +123,10 @@ public class NetworkManager { /// - Parameters: /// - router: `Router` object used to create request. /// - file: `UploadFile` object including file details for upload. - /// - httpErrorType: `HTTPErrorBody` http error body type. /// - apiErrorType: `NetworkAPIError` type expected to be received in response body. /// /// - Returns: `Observable` object encapsulating upload request. - public func upload(_ router: NetworkUploadRouter, _ file: UploadFile, _ httpErrorType: E.Type = DefaultHTTPErrorBody.self, _ apiErrorType: AE.Type = DefaultNetworkAPIError.self) -> Observable> { + public func upload(_ router: NetworkUploadRouter, _ file: UploadFile, _ apiErrorType: AE.Type = DefaultNetworkAPIError.self) -> Observable> { let originalRequest = router.asURLRequest() let adaptedRequest = requestInterceptor.adapt(originalRequest, for: session) let retryMaxAttempts = requestInterceptor.retryMaxAttempts(adaptedRequest, for: session) @@ -144,7 +136,7 @@ public class NetworkManager { } let observable = session .rx - .uploadResponse(request: adaptedRequest, file: file, modelType: T.self, httpErrorType: E.self, apiErrorType: AE.self) + .uploadResponse(request: adaptedRequest, file: file, modelType: T.self, apiErrorType: AE.self) .retry(retryMaxAttempts, delay: retryPolicy, shouldRetry: shouldRetry) return observable } @@ -154,11 +146,10 @@ public class NetworkManager { /// - Parameters: /// - router: `Router` object used to create request. /// - formData: `UploadFormData` object including parameters and files for upload. - /// - httpErrorType: `HTTPErrorBody` http error body type. /// - apiErrorType: `NetworkAPIError` type expected to be received in response body. /// /// - Returns: `Observable` object encapsulating upload request. - public func upload(_ router: NetworkUploadRouter, _ formData: UploadFormData, _ httpErrorType: E.Type = DefaultHTTPErrorBody.self, _ apiErrorType: AE.Type = DefaultNetworkAPIError.self) -> Observable> { + public func upload(_ router: NetworkUploadRouter, _ formData: UploadFormData, _ apiErrorType: AE.Type = DefaultNetworkAPIError.self) -> Observable> { let originalRequest = router.asURLRequest() let adaptedRequest = requestInterceptor.adapt(originalRequest, for: session) let retryMaxAttempts = requestInterceptor.retryMaxAttempts(adaptedRequest, for: session) @@ -168,7 +159,7 @@ public class NetworkManager { } let observable = session .rx - .uploadResponse(request: adaptedRequest, formData: formData, modelType: T.self, httpErrorType: E.self, apiErrorType: AE.self) + .uploadResponse(request: adaptedRequest, formData: formData, modelType: T.self, apiErrorType: AE.self) .retry(retryMaxAttempts, delay: retryPolicy, shouldRetry: shouldRetry) return observable } diff --git a/Source/Manager/ProcessInfo+operatingSystemName.swift b/Source/Manager/ProcessInfo+operatingSystemName.swift deleted file mode 100644 index bd87aae..0000000 --- a/Source/Manager/ProcessInfo+operatingSystemName.swift +++ /dev/null @@ -1,38 +0,0 @@ -// -// ProcessInfo+operatingSystemName.swift -// RxNetworkKit -// -// Created by Loay Ashraf on 21/08/2023. -// - -import Foundation -#if canImport(UIKit) -import UIKit -#endif - -extension ProcessInfo { - /// Name of current operating system (iOS, iPadOS, watchOS, etc.) - var operatingSystemName: String { - var osName: String = "" -#if os(iOS) -#if targetEnvironment(macCatalyst) - osName = "macOS - Catalyst" -#else - if UIDevice.current.userInterfaceIdiom == .pad { - osName = "iPadOS" - } else { - osName = "iOS" - } -#endif -#elseif os(macOS) - osName = "macOS" -#elseif os(watchOS) - osName = "watchOS" -#elseif os(tvOS) - osName = "tvOS" -#elseif os(visionOS) - osName = "visionOS" -#endif - return osName - } -} diff --git a/Source/Manager/URLSessionConfiguration+setAdditionalHTTPHeader.swift b/Source/Manager/URLSessionConfiguration+setAdditionalHTTPHeader.swift deleted file mode 100644 index 7f4139f..0000000 --- a/Source/Manager/URLSessionConfiguration+setAdditionalHTTPHeader.swift +++ /dev/null @@ -1,21 +0,0 @@ -// -// URLSessionConfiguration+setAdditionalHTTPHeader.swift -// RxNetworkKit -// -// Created by Loay Ashraf on 21/08/2023. -// - -import Foundation - -extension URLSessionConfiguration { - /// Sets additional HTTP header for a given key and value. - /// - /// - Parameters: - /// - key: `AnyHashable` key for the HTTP header. - /// - value: `Any` value for the HTTP header. - func setAdditionalHTTPHeader(_ key: AnyHashable, value: Any) { - var modifiedAdditionalHTTPHeaders = httpAdditionalHeaders ?? [:] - modifiedAdditionalHTTPHeaders[key] = value - httpAdditionalHeaders = modifiedAdditionalHTTPHeaders - } -} diff --git a/Source/Manager/URLSessionConfiguration+setUserAgentHTTPHeader.swift b/Source/Manager/URLSessionConfiguration+setUserAgentHTTPHeader.swift deleted file mode 100644 index ae43e45..0000000 --- a/Source/Manager/URLSessionConfiguration+setUserAgentHTTPHeader.swift +++ /dev/null @@ -1,21 +0,0 @@ -// -// URLSessionConfiguration+setUserAgentHTTPHeader.swift -// RxNetworkKit -// -// Created by Loay Ashraf on 21/08/2023. -// - -import Foundation - -extension URLSessionConfiguration { - /// Sets `User-Agent` header as an additional HTTP header. - func setUserAgentHTTPHeader() { - let mainBundle = Bundle.main - let frameworkBundle = Bundle.init(for: NetworkManager.self) - let mainBundleIndentifier = mainBundle.bundleIdentifier ?? "Unknown Client Identifier" - let frameworkBundleVersion = frameworkBundle.object(forInfoDictionaryKey: "CFBundleShortVersionString") as! String - let osName = ProcessInfo.processInfo.operatingSystemName - let osVersion = ProcessInfo.processInfo.operatingSystemVersionString - setAdditionalHTTPHeader("User-Agent", value: "RxNetworkKit/\(frameworkBundleVersion) (\(osName) \(osVersion)-\(mainBundleIndentifier))") - } -} diff --git a/Source/Rx Extensions/Rx+NetworkOps/Observable/Observable+Decodable.swift b/Source/Rx Extensions/Rx+NetworkOps/Observable/Observable+Decodable.swift index 084cca8..c8e7851 100644 --- a/Source/Rx Extensions/Rx+NetworkOps/Observable/Observable+Decodable.swift +++ b/Source/Rx Extensions/Rx+NetworkOps/Observable/Observable+Decodable.swift @@ -12,35 +12,33 @@ extension Observable where Element == (response: HTTPURLResponse, data: Data) { /// Creates `Completable` observable + handles transport errors. /// /// - Parameters: - /// - httpErrorType: `Decodable` http error body type. - /// - apiErrorType: `Decodable` api error type. + /// - errorType: `Decodable` api error type. /// /// - Returns: Observable to be observed for values. - func decodable(_ httpErrorType: E.Type, apiErrorType: AE.Type) -> Completable { + func decodable(_ errorType: E.Type) -> Completable { asSingle() // catch any transport errors if thrown. .catchTransportError() - // verify response status code and decode error body if possible. - .verifyResponse(E.self) + // verify response status code. + .verifyResponse() // serialize data into given error type and throw it. - .decode(AE.self) + .decode(E.self) } /// Creates `Single` observable with Decodable element type + handles transport and serialization errors. /// /// - Parameters: /// - modelType: `Decodable` model type. - /// - httpErrorType: `Decodable` http error body type. - /// - apiErrorType: `Decodable` api error type. + /// - errorType: `Decodable` api error type. /// /// - Returns: Observable to be observed for values. - func decodable(_ modelType: M.Type, httpErrorType: E.Type, apiErrorType: AE.Type) -> Single { + func decodable(_ modelType: M.Type, errorType: E.Type) -> Single { asSingle() // catch any transport errors if thrown. .catchTransportError() - // verify response status code and decode error body if possible. - .verifyResponse(E.self) + // verify response status code. + .verifyResponse() // serialize data into given model type or error type if serialization failed. - .decode(M.self, errorType: AE.self) + .decode(M.self, errorType: E.self) // catch any serialization errors if found. .catchSerializationError() } diff --git a/Source/Rx Extensions/Rx+NetworkOps/Single/Single+Decodable.swift b/Source/Rx Extensions/Rx+NetworkOps/Single/Single+Decodable.swift index 592ee9b..07a112b 100644 --- a/Source/Rx Extensions/Rx+NetworkOps/Single/Single+Decodable.swift +++ b/Source/Rx Extensions/Rx+NetworkOps/Single/Single+Decodable.swift @@ -13,51 +13,48 @@ extension PrimitiveSequence where Trait == SingleTrait, Element == (response: HT /// Creates `Completable` observable + handles transport errors. /// /// - Parameters: - /// - httpErrorType: `Decodable` http error body type. - /// - apiErrorType: `Decodable` api error type. + /// - errorType: `Decodable` api error type. /// /// - Returns: Observable to be observed for values. - func decodable(_ httpErrorType: E.Type, apiErrorType: AE.Type) -> Completable { + func decodable(_ errorType: E.Type) -> Completable { self // catch any transport errors if thrown. .catchTransportError() - // verify response status code and decode error body if possible. - .verifyResponse(E.self) + // verify response status code. + .verifyResponse() // serialize data into given error type and throw it. - .decode(AE.self) + .decode(E.self) } /// Creates `Single` observable with the same element type + handles transport errors. /// /// - Parameters: - /// - httpErrorType: `Decodable` http error body type. - /// - apiErrorType: `Decodable` api error type. + /// - errorType: `Decodable` api error type. /// /// - Returns: Observable to be observed for values. - func decodable(_ httpErrorType: E.Type, apiErrorType: AE.Type) -> Single { + func decodable(_ errorType: E.Type) -> Single { self // catch any transport errors if thrown. .catchTransportError() - // verify response status code and decode error body if possible. - .verifyResponse(E.self) + // verify response status code. + .verifyResponse() // serialize data into given error type and throw it. - .decode(AE.self) + .decode(E.self) } /// Creates `Single` observable with Decodable element type + handles transport and serialization errors. /// /// - Parameters: /// - modelType: `Decodable` model type. - /// - httpErrorType: `Decodable` http error body type. - /// - apiErrorType: `Decodable` api error type. + /// - errorType: `Decodable` api error type. /// /// - Returns: Observable to be observed for values. - func decodable(_ modelType: M.Type, httpErrorType: E.Type, apiErrorType: AE.Type) -> Single { + func decodable(_ modelType: M.Type, errorType: E.Type) -> Single { self // catch any transport errors if thrown. .catchTransportError() - // verify response status code and decode error body if possible. - .verifyResponse(E.self) + // verify response status code. + .verifyResponse() // serialize data into given model type or error type if serialization failed. - .decode(M.self, errorType: AE.self) + .decode(M.self, errorType: E.self) // catch any serialization errors if found. .catchSerializationError() } diff --git a/Source/Rx Extensions/Rx+NetworkOps/Single/Single+VerifyResponse.swift b/Source/Rx Extensions/Rx+NetworkOps/Single/Single+VerifyResponse.swift index 650f548..5b6bc48 100644 --- a/Source/Rx Extensions/Rx+NetworkOps/Single/Single+VerifyResponse.swift +++ b/Source/Rx Extensions/Rx+NetworkOps/Single/Single+VerifyResponse.swift @@ -13,9 +13,9 @@ extension PrimitiveSequence where Trait == SingleTrait, Element == (response: HT /// Verifies response's status code. /// /// - Returns: `Single` observable to be observed for values. - func verifyResponse(_ httpErrorType: E.Type) -> Single { + func verifyResponse() -> Single { map { (response: HTTPURLResponse, data: Data) in - if let networkError = NetworkError.init(response, data: data, errorType: E.self) { + if let networkError = NetworkError.init(response) { throw networkError } else { return (response, data)