From 3939876f84e8cfdac3d294683637f22a823ebbc0 Mon Sep 17 00:00:00 2001 From: Georges Boumis Date: Tue, 8 Jan 2019 13:08:27 +0200 Subject: [PATCH] 2.4.2 Include any underlying error in ConnectionError --- ConnectionKit.podspec | 2 +- .../Classes/Protocols/Connection.swift | 15 ++-- ConnectionKit/Classes/SocketConnection.swift | 18 ++-- .../ConnectionKit.xcodeproj/project.pbxproj | 90 +++++++++---------- Example/Podfile.lock | 10 +-- .../Local Podspecs/ConnectionKit.podspec.json | 4 +- .../RepresentationKit.podspec.json | 10 ++- Example/Pods/Manifest.lock | 10 +-- .../ConnectionKit/Info.plist | 2 +- .../RepresentationKit/Info.plist | 2 +- .../RepresentationKit.xcconfig | 1 + 11 files changed, 83 insertions(+), 81 deletions(-) diff --git a/ConnectionKit.podspec b/ConnectionKit.podspec index 0c19648..9fe2829 100644 --- a/ConnectionKit.podspec +++ b/ConnectionKit.podspec @@ -8,7 +8,7 @@ Pod::Spec.new do |s| s.name = 'ConnectionKit' - s.version = '2.4.1' + s.version = '2.4.2' s.summary = 'Abstract possible connections' # This description is used to generate tags and improve search results. diff --git a/ConnectionKit/Classes/Protocols/Connection.swift b/ConnectionKit/Classes/Protocols/Connection.swift index 1363d06..ec13ff1 100644 --- a/ConnectionKit/Classes/Protocols/Connection.swift +++ b/ConnectionKit/Classes/Protocols/Connection.swift @@ -30,16 +30,21 @@ import RepresentationKit /// Represents generic Connection Errors. public enum ConnectionError: Error { /// The connection failed. Usually happens upon `connect()`. - case connectionFailed + /// - parameter error: Any underlying error that explains more the situation. + case connectionFailed(_ error: Error?) /// Reception failed. - case receptionFailed + /// - parameter error: Any underlying error that explains more the situation. + case receptionFailed(_ error: Error?) /// Send failed. - case sendFailed + /// - parameter error: Any underlying error that explains more the situation. + case sendFailed(_ error: Error?) /// Indicates that the connection disconnected due to the user requesting so. - case disconnection + /// - parameter error: Any underlying error that explains more the situation. + case disconnection(_ error: Error?) /// Error indicating an request for connection occured on an already /// established connection. - case alreadyConnected + /// - parameter error: Any underlying error that explains more the situation. + case alreadyConnected(_ error: Error?) } /// What a connection should be diff --git a/ConnectionKit/Classes/SocketConnection.swift b/ConnectionKit/Classes/SocketConnection.swift index 87a2d68..034363d 100644 --- a/ConnectionKit/Classes/SocketConnection.swift +++ b/ConnectionKit/Classes/SocketConnection.swift @@ -110,10 +110,10 @@ public final class SocketConnection: NSObject, Connection { catch { let nserror: NSError = error as NSError if nserror.code == GCDAsyncSocketError.alreadyConnected.rawValue { - self.errorDelegate?.connection(self, didFailWith: ConnectionError.alreadyConnected) + self.errorDelegate?.connection(self, didFailWith: ConnectionError.alreadyConnected(error)) } else { - self.errorDelegate?.connection(self, didFailWith: ConnectionError.connectionFailed) + self.errorDelegate?.connection(self, didFailWith: ConnectionError.connectionFailed(error)) } } } @@ -157,7 +157,7 @@ extension SocketConnection: GCDAsyncSocketDelegate { } else { self.errorDelegate?.connection(self, - didFailWith: ConnectionError.receptionFailed) + didFailWith: ConnectionError.receptionFailed(nil)) } self.socket.readData(to: GCDAsyncSocket.lfData(), @@ -179,15 +179,9 @@ extension SocketConnection: GCDAsyncSocketDelegate { @objc final public func socketDidDisconnect(_ sock: GCDAsyncSocket, - withError err: Error?) { - if let error = err { - self.delegate?.connection(self, - didDisconnectWithReason: error) - } - else { - self.delegate?.connection(self, - didDisconnectWithReason: ConnectionError.disconnection) - } + withError error: Error?) { + self.delegate?.connection(self, + didDisconnectWithReason: ConnectionError.disconnection(error)) } } diff --git a/Example/ConnectionKit.xcodeproj/project.pbxproj b/Example/ConnectionKit.xcodeproj/project.pbxproj index 1f810e5..ad7c01d 100644 --- a/Example/ConnectionKit.xcodeproj/project.pbxproj +++ b/Example/ConnectionKit.xcodeproj/project.pbxproj @@ -8,18 +8,18 @@ /* Begin PBXBuildFile section */ 607FACEC1AFB9204008FA782 /* Tests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 607FACEB1AFB9204008FA782 /* Tests.swift */; }; - 9F11E5E8102B17AF7466FFA6 /* Pods_ConnectionKit_Tests.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B1B04E67E77092D8B9F5F711 /* Pods_ConnectionKit_Tests.framework */; }; + 6598DF0D8C859CD900058EF2 /* Pods_ConnectionKit_Tests.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B2AF328A96DA91DE503DC7AB /* Pods_ConnectionKit_Tests.framework */; }; /* End PBXBuildFile section */ /* Begin PBXFileReference section */ - 13687BF652513B7AB03C775E /* Pods-ConnectionKit_Tests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-ConnectionKit_Tests.debug.xcconfig"; path = "Pods/Target Support Files/Pods-ConnectionKit_Tests/Pods-ConnectionKit_Tests.debug.xcconfig"; sourceTree = ""; }; 607FACE51AFB9204008FA782 /* ConnectionKit_Tests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = ConnectionKit_Tests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 607FACEA1AFB9204008FA782 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 607FACEB1AFB9204008FA782 /* Tests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Tests.swift; sourceTree = ""; }; 63F28757CD7DDA059E34A370 /* ConnectionKit.podspec */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text; name = ConnectionKit.podspec; path = ../ConnectionKit.podspec; sourceTree = ""; }; 8FE3A29E00BD57A1B96FFC5B /* LICENSE */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text; name = LICENSE; path = ../LICENSE; sourceTree = ""; }; - B1B04E67E77092D8B9F5F711 /* Pods_ConnectionKit_Tests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_ConnectionKit_Tests.framework; sourceTree = BUILT_PRODUCTS_DIR; }; - BEAD7470AD0E33F78E8811A5 /* Pods-ConnectionKit_Tests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-ConnectionKit_Tests.release.xcconfig"; path = "Pods/Target Support Files/Pods-ConnectionKit_Tests/Pods-ConnectionKit_Tests.release.xcconfig"; sourceTree = ""; }; + B2AF328A96DA91DE503DC7AB /* Pods_ConnectionKit_Tests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_ConnectionKit_Tests.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + D1A79703FD19F2D9360684B4 /* Pods-ConnectionKit_Tests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-ConnectionKit_Tests.release.xcconfig"; path = "Pods/Target Support Files/Pods-ConnectionKit_Tests/Pods-ConnectionKit_Tests.release.xcconfig"; sourceTree = ""; }; + EC65D48B4B29A2E9F2319B0D /* Pods-ConnectionKit_Tests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-ConnectionKit_Tests.debug.xcconfig"; path = "Pods/Target Support Files/Pods-ConnectionKit_Tests/Pods-ConnectionKit_Tests.debug.xcconfig"; sourceTree = ""; }; F5FA76F7EC935A2B786CA696 /* README.md */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = net.daringfireball.markdown; name = README.md; path = ../README.md; sourceTree = ""; }; /* End PBXFileReference section */ @@ -28,30 +28,21 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - 9F11E5E8102B17AF7466FFA6 /* Pods_ConnectionKit_Tests.framework in Frameworks */, + 6598DF0D8C859CD900058EF2 /* Pods_ConnectionKit_Tests.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ - 40B69FD796C14DCF60C4CA51 /* Pods */ = { - isa = PBXGroup; - children = ( - 13687BF652513B7AB03C775E /* Pods-ConnectionKit_Tests.debug.xcconfig */, - BEAD7470AD0E33F78E8811A5 /* Pods-ConnectionKit_Tests.release.xcconfig */, - ); - name = Pods; - sourceTree = ""; - }; 607FACC71AFB9204008FA782 = { isa = PBXGroup; children = ( 607FACF51AFB993E008FA782 /* Podspec Metadata */, 607FACE81AFB9204008FA782 /* Tests */, 607FACD11AFB9204008FA782 /* Products */, - 40B69FD796C14DCF60C4CA51 /* Pods */, - F36A06EC08A1090E05A55D77 /* Frameworks */, + EE4D332EAB1F5282BF23103F /* Pods */, + 9FF8D7D45E26435FC8774E32 /* Frameworks */, ); sourceTree = ""; }; @@ -90,14 +81,23 @@ name = "Podspec Metadata"; sourceTree = ""; }; - F36A06EC08A1090E05A55D77 /* Frameworks */ = { + 9FF8D7D45E26435FC8774E32 /* Frameworks */ = { isa = PBXGroup; children = ( - B1B04E67E77092D8B9F5F711 /* Pods_ConnectionKit_Tests.framework */, + B2AF328A96DA91DE503DC7AB /* Pods_ConnectionKit_Tests.framework */, ); name = Frameworks; sourceTree = ""; }; + EE4D332EAB1F5282BF23103F /* Pods */ = { + isa = PBXGroup; + children = ( + EC65D48B4B29A2E9F2319B0D /* Pods-ConnectionKit_Tests.debug.xcconfig */, + D1A79703FD19F2D9360684B4 /* Pods-ConnectionKit_Tests.release.xcconfig */, + ); + name = Pods; + sourceTree = ""; + }; /* End PBXGroup section */ /* Begin PBXNativeTarget section */ @@ -105,11 +105,11 @@ isa = PBXNativeTarget; buildConfigurationList = 607FACF21AFB9204008FA782 /* Build configuration list for PBXNativeTarget "ConnectionKit_Tests" */; buildPhases = ( - 6514A67B026741A5618E5817 /* [CP] Check Pods Manifest.lock */, + 6EB6DB0D62822FBAB61BB3DA /* [CP] Check Pods Manifest.lock */, 607FACE11AFB9204008FA782 /* Sources */, 607FACE21AFB9204008FA782 /* Frameworks */, 607FACE31AFB9204008FA782 /* Resources */, - 069967E8CC190888080B57AE /* [CP] Embed Pods Frameworks */, + B07741908C1C5333A0712E8E /* [CP] Embed Pods Frameworks */, ); buildRules = ( ); @@ -166,7 +166,29 @@ /* End PBXResourcesBuildPhase section */ /* Begin PBXShellScriptBuildPhase section */ - 069967E8CC190888080B57AE /* [CP] Embed Pods Frameworks */ = { + 6EB6DB0D62822FBAB61BB3DA /* [CP] Check Pods Manifest.lock */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + ); + inputPaths = ( + "${PODS_PODFILE_DIR_PATH}/Podfile.lock", + "${PODS_ROOT}/Manifest.lock", + ); + name = "[CP] Check Pods Manifest.lock"; + outputFileListPaths = ( + ); + outputPaths = ( + "$(DERIVED_FILE_DIR)/Pods-ConnectionKit_Tests-checkManifestLockResult.txt", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; + showEnvVarsInLog = 0; + }; + B07741908C1C5333A0712E8E /* [CP] Embed Pods Frameworks */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; files = ( @@ -192,28 +214,6 @@ shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-ConnectionKit_Tests/Pods-ConnectionKit_Tests-frameworks.sh\"\n"; showEnvVarsInLog = 0; }; - 6514A67B026741A5618E5817 /* [CP] Check Pods Manifest.lock */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputFileListPaths = ( - ); - inputPaths = ( - "${PODS_PODFILE_DIR_PATH}/Podfile.lock", - "${PODS_ROOT}/Manifest.lock", - ); - name = "[CP] Check Pods Manifest.lock"; - outputFileListPaths = ( - ); - outputPaths = ( - "$(DERIVED_FILE_DIR)/Pods-ConnectionKit_Tests-checkManifestLockResult.txt", - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; - showEnvVarsInLog = 0; - }; /* End PBXShellScriptBuildPhase section */ /* Begin PBXSourcesBuildPhase section */ @@ -333,7 +333,7 @@ }; 607FACF31AFB9204008FA782 /* Debug */ = { isa = XCBuildConfiguration; - baseConfigurationReference = 13687BF652513B7AB03C775E /* Pods-ConnectionKit_Tests.debug.xcconfig */; + baseConfigurationReference = EC65D48B4B29A2E9F2319B0D /* Pods-ConnectionKit_Tests.debug.xcconfig */; buildSettings = { FRAMEWORK_SEARCH_PATHS = ( "$(SDKROOT)/Developer/Library/Frameworks", @@ -353,7 +353,7 @@ }; 607FACF41AFB9204008FA782 /* Release */ = { isa = XCBuildConfiguration; - baseConfigurationReference = BEAD7470AD0E33F78E8811A5 /* Pods-ConnectionKit_Tests.release.xcconfig */; + baseConfigurationReference = D1A79703FD19F2D9360684B4 /* Pods-ConnectionKit_Tests.release.xcconfig */; buildSettings = { FRAMEWORK_SEARCH_PATHS = ( "$(SDKROOT)/Developer/Library/Frameworks", diff --git a/Example/Podfile.lock b/Example/Podfile.lock index 171f0be..33e484d 100644 --- a/Example/Podfile.lock +++ b/Example/Podfile.lock @@ -1,9 +1,9 @@ PODS: - CocoaAsyncSocket (7.6.3) - - ConnectionKit (2.4.1): + - ConnectionKit (2.4.2): - CocoaAsyncSocket - RepresentationKit - - RepresentationKit (2.3.1) + - RepresentationKit (2.4) DEPENDENCIES: - CocoaAsyncSocket (from `https://github.com/averello/CocoaAsyncSocket.git`) @@ -23,13 +23,13 @@ CHECKOUT OPTIONS: :commit: 5a0f3244814de52bf3337f3425d52c569d082f1b :git: https://github.com/averello/CocoaAsyncSocket.git RepresentationKit: - :commit: baaf595efcf402d212d0f121d661ec4559614b50 + :commit: 8d9f927eff31beaea2d3479c5da961e572994438 :git: https://github.com/averello/RepresentationKit.git SPEC CHECKSUMS: CocoaAsyncSocket: eafaa68a7e0ec99ead0a7b35015e0bf25d2c8987 - ConnectionKit: 6e634b6ed318baca7fa197308c5d188c75e9bbcb - RepresentationKit: 14798022f1519aefdfa56a2367e116e12133088d + ConnectionKit: d71f9e4cc0a420eb86aa8c3e8269d1990362999b + RepresentationKit: dfffb127499021627b35ba8766c4ce22d6b21532 PODFILE CHECKSUM: 07d6c8f50eb80bbbbebd56772d08c62b9a4cd972 diff --git a/Example/Pods/Local Podspecs/ConnectionKit.podspec.json b/Example/Pods/Local Podspecs/ConnectionKit.podspec.json index 344cf23..7bc97a7 100644 --- a/Example/Pods/Local Podspecs/ConnectionKit.podspec.json +++ b/Example/Pods/Local Podspecs/ConnectionKit.podspec.json @@ -1,6 +1,6 @@ { "name": "ConnectionKit", - "version": "2.4.1", + "version": "2.4.2", "summary": "Abstract possible connections", "description": "TODO: Add long description of the pod here.", "homepage": "https://github.com/averello/ConnectionKit", @@ -13,7 +13,7 @@ }, "source": { "git": "https://github.com/averello/ConnectionKit.git", - "tag": "2.4.1" + "tag": "2.4.2" }, "platforms": { "ios": "8.0" diff --git a/Example/Pods/Local Podspecs/RepresentationKit.podspec.json b/Example/Pods/Local Podspecs/RepresentationKit.podspec.json index 560a37a..6c5fc1d 100644 --- a/Example/Pods/Local Podspecs/RepresentationKit.podspec.json +++ b/Example/Pods/Local Podspecs/RepresentationKit.podspec.json @@ -1,6 +1,6 @@ { "name": "RepresentationKit", - "version": "2.3.1", + "version": "2.4", "summary": "Create representation of objects.", "description": "TODO: Add long description of the pod here.", "homepage": "https://github.com/averello/RepresentationKit", @@ -13,10 +13,12 @@ }, "source": { "git": "https://github.com/averello/RepresentationKit.git", - "tag": "2.3.1" + "tag": "2.4" }, "platforms": { - "ios": "8.0" + "ios": "8.0", + "osx": "10.9" }, - "source_files": "RepresentationKit/Classes/**/*" + "source_files": "RepresentationKit/Classes/**/*", + "frameworks": "Foundation" } diff --git a/Example/Pods/Manifest.lock b/Example/Pods/Manifest.lock index 171f0be..33e484d 100644 --- a/Example/Pods/Manifest.lock +++ b/Example/Pods/Manifest.lock @@ -1,9 +1,9 @@ PODS: - CocoaAsyncSocket (7.6.3) - - ConnectionKit (2.4.1): + - ConnectionKit (2.4.2): - CocoaAsyncSocket - RepresentationKit - - RepresentationKit (2.3.1) + - RepresentationKit (2.4) DEPENDENCIES: - CocoaAsyncSocket (from `https://github.com/averello/CocoaAsyncSocket.git`) @@ -23,13 +23,13 @@ CHECKOUT OPTIONS: :commit: 5a0f3244814de52bf3337f3425d52c569d082f1b :git: https://github.com/averello/CocoaAsyncSocket.git RepresentationKit: - :commit: baaf595efcf402d212d0f121d661ec4559614b50 + :commit: 8d9f927eff31beaea2d3479c5da961e572994438 :git: https://github.com/averello/RepresentationKit.git SPEC CHECKSUMS: CocoaAsyncSocket: eafaa68a7e0ec99ead0a7b35015e0bf25d2c8987 - ConnectionKit: 6e634b6ed318baca7fa197308c5d188c75e9bbcb - RepresentationKit: 14798022f1519aefdfa56a2367e116e12133088d + ConnectionKit: d71f9e4cc0a420eb86aa8c3e8269d1990362999b + RepresentationKit: dfffb127499021627b35ba8766c4ce22d6b21532 PODFILE CHECKSUM: 07d6c8f50eb80bbbbebd56772d08c62b9a4cd972 diff --git a/Example/Pods/Target Support Files/ConnectionKit/Info.plist b/Example/Pods/Target Support Files/ConnectionKit/Info.plist index 6810787..e0fc6f3 100644 --- a/Example/Pods/Target Support Files/ConnectionKit/Info.plist +++ b/Example/Pods/Target Support Files/ConnectionKit/Info.plist @@ -15,7 +15,7 @@ CFBundlePackageType FMWK CFBundleShortVersionString - 2.4.1 + 2.4.2 CFBundleSignature ???? CFBundleVersion diff --git a/Example/Pods/Target Support Files/RepresentationKit/Info.plist b/Example/Pods/Target Support Files/RepresentationKit/Info.plist index a7b58ed..e526849 100644 --- a/Example/Pods/Target Support Files/RepresentationKit/Info.plist +++ b/Example/Pods/Target Support Files/RepresentationKit/Info.plist @@ -15,7 +15,7 @@ CFBundlePackageType FMWK CFBundleShortVersionString - 2.3.1 + 2.4.0 CFBundleSignature ???? CFBundleVersion diff --git a/Example/Pods/Target Support Files/RepresentationKit/RepresentationKit.xcconfig b/Example/Pods/Target Support Files/RepresentationKit/RepresentationKit.xcconfig index abb7a4f..5d17c28 100644 --- a/Example/Pods/Target Support Files/RepresentationKit/RepresentationKit.xcconfig +++ b/Example/Pods/Target Support Files/RepresentationKit/RepresentationKit.xcconfig @@ -1,5 +1,6 @@ CONFIGURATION_BUILD_DIR = ${PODS_CONFIGURATION_BUILD_DIR}/RepresentationKit GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 +OTHER_LDFLAGS = -framework "Foundation" OTHER_SWIFT_FLAGS = $(inherited) "-D" "COCOAPODS" PODS_BUILD_DIR = ${BUILD_DIR} PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)