diff --git a/.swift-version b/.swift-version deleted file mode 100644 index 5186d07..0000000 --- a/.swift-version +++ /dev/null @@ -1 +0,0 @@ -4.0 diff --git a/.swift-versions b/.swift-versions new file mode 100644 index 0000000..a75b92f --- /dev/null +++ b/.swift-versions @@ -0,0 +1 @@ +5.1 diff --git a/.travis.yml b/.travis.yml index d4800cc..5fab9c3 100644 --- a/.travis.yml +++ b/.travis.yml @@ -9,19 +9,20 @@ branches: matrix: include: - os: osx - osx_image: xcode9 + osx_image: xcode11.1 language: objective-c env: - JOB=Xcode script: - set -o pipefail - xcodebuild build-for-testing test-without-building -workspace JSONRPCKit.xcworkspace -scheme JSONRPCKit | xcpretty -c - - xcodebuild build-for-testing test-without-building -workspace JSONRPCKit.xcworkspace -scheme JSONRPCKit -sdk iphonesimulator -destination "name=iPhone SE" | xcpretty -c - - xcodebuild build-for-testing test-without-building -workspace JSONRPCKit.xcworkspace -scheme JSONRPCKit -sdk appletvsimulator -destination "name=Apple TV 1080p" | xcpretty -c + - xcodebuild build-for-testing test-without-building -workspace JSONRPCKit.xcworkspace -scheme JSONRPCKit -sdk iphonesimulator -destination "name=iPhone 11" | xcpretty -c + - xcodebuild build-for-testing test-without-building -workspace JSONRPCKit.xcworkspace -scheme JSONRPCKit -sdk appletvsimulator -destination "name=Apple TV" | xcpretty -c - xcodebuild build -workspace JSONRPCKit.xcworkspace -scheme JSONRPCKit -sdk watchsimulator | xcpretty -c + - gem install cocoapods --pre - pod lib lint - os: osx - osx_image: xcode9 + osx_image: xcode11.1 language: generic env: - JOB=SPM @@ -33,7 +34,7 @@ matrix: language: generic env: - JOB=Linux - - SWIFT_VERSION=4.0.3 + - SWIFT_VERSION=5.1 script: - swift --version - swift build diff --git a/Cartfile b/Cartfile index fa9f48b..fc26a15 100644 --- a/Cartfile +++ b/Cartfile @@ -1 +1 @@ -github "antitypical/Result" ~> 3.2.0 +github "antitypical/Result" ~> 5.0.0 diff --git a/Cartfile.private b/Cartfile.private index 8b3aa2a..762c767 100644 --- a/Cartfile.private +++ b/Cartfile.private @@ -1 +1 @@ -github "ishkawa/APIKit" ~> 3.2.0 +github "ishkawa/APIKit" ~> 5.0.0 diff --git a/Cartfile.resolved b/Cartfile.resolved index 3d02dae..44a0e4f 100644 --- a/Cartfile.resolved +++ b/Cartfile.resolved @@ -1,2 +1,2 @@ -github "antitypical/Result" "3.2.4" -github "ishkawa/APIKit" "3.2.0" +github "antitypical/Result" "5.0.0" +github "ishkawa/APIKit" "5.0.0" diff --git a/Carthage/Checkouts/APIKit b/Carthage/Checkouts/APIKit index 0afa74d..862a8f8 160000 --- a/Carthage/Checkouts/APIKit +++ b/Carthage/Checkouts/APIKit @@ -1 +1 @@ -Subproject commit 0afa74dedff0df678af02fc2b474c4eafba37a67 +Subproject commit 862a8f80dd117693750c6ddaba2fe6a85b061a9a diff --git a/Carthage/Checkouts/Result b/Carthage/Checkouts/Result index 7477584..12920a5 160000 --- a/Carthage/Checkouts/Result +++ b/Carthage/Checkouts/Result @@ -1 +1 @@ -Subproject commit 7477584259bfce2560a19e06ad9f71db441fff11 +Subproject commit 12920a5c2595926efab9274d6003e29f503dbb66 diff --git a/Example/Example.xcodeproj/project.pbxproj b/Example/Example.xcodeproj/project.pbxproj index a2cac19..1375a49 100644 --- a/Example/Example.xcodeproj/project.pbxproj +++ b/Example/Example.xcodeproj/project.pbxproj @@ -7,12 +7,13 @@ objects = { /* Begin PBXBuildFile section */ - 7FD0A33F1D4B5926007C9EAB /* APIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 7FD0A33E1D4B5926007C9EAB /* APIKit.framework */; }; 7FD0A3431D4B5E80007C9EAB /* UIViewController+Error.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7FD0A3421D4B5E80007C9EAB /* UIViewController+Error.swift */; }; - CB31EFB11CF6E88100DD13DD /* JSONRPCKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = CB31EFB01CF6E88100DD13DD /* JSONRPCKit.framework */; }; - CB31EFB21CF6E88100DD13DD /* JSONRPCKit.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = CB31EFB01CF6E88100DD13DD /* JSONRPCKit.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; - CB31EFB41CF6E88800DD13DD /* Result.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = CB31EFB31CF6E88800DD13DD /* Result.framework */; }; - CB31EFB51CF6E88800DD13DD /* Result.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = CB31EFB31CF6E88800DD13DD /* Result.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; + AF5885C4234DE8EF0068D373 /* APIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = AF5885C3234DE8EF0068D373 /* APIKit.framework */; }; + AF5885C5234DE8EF0068D373 /* APIKit.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = AF5885C3234DE8EF0068D373 /* APIKit.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; + AF5885C6234DE8EF0068D373 /* JSONRPCKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = AF5885BD234DE5AC0068D373 /* JSONRPCKit.framework */; }; + AF5885C7234DE8EF0068D373 /* JSONRPCKit.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = AF5885BD234DE5AC0068D373 /* JSONRPCKit.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; + AF5885C8234DE8EF0068D373 /* Result.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = AF5885BE234DE5AC0068D373 /* Result.framework */; }; + AF5885C9234DE8EF0068D373 /* Result.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = AF5885BE234DE5AC0068D373 /* Result.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; CB63E2471CE2309100E22B5C /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = CB63E2461CE2309100E22B5C /* AppDelegate.swift */; }; CB63E24C1CE2309100E22B5C /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = CB63E24A1CE2309100E22B5C /* Main.storyboard */; }; CB63E24E1CE2309100E22B5C /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = CB63E24D1CE2309100E22B5C /* Assets.xcassets */; }; @@ -23,14 +24,15 @@ /* End PBXBuildFile section */ /* Begin PBXCopyFilesBuildPhase section */ - CB31EFAF1CF6E84400DD13DD /* Embed Frameworks */ = { + AF5885CA234DE8EF0068D373 /* Embed Frameworks */ = { isa = PBXCopyFilesBuildPhase; buildActionMask = 2147483647; dstPath = ""; dstSubfolderSpec = 10; files = ( - CB31EFB21CF6E88100DD13DD /* JSONRPCKit.framework in Embed Frameworks */, - CB31EFB51CF6E88800DD13DD /* Result.framework in Embed Frameworks */, + AF5885C9234DE8EF0068D373 /* Result.framework in Embed Frameworks */, + AF5885C5234DE8EF0068D373 /* APIKit.framework in Embed Frameworks */, + AF5885C7234DE8EF0068D373 /* JSONRPCKit.framework in Embed Frameworks */, ); name = "Embed Frameworks"; runOnlyForDeploymentPostprocessing = 0; @@ -40,6 +42,9 @@ /* Begin PBXFileReference section */ 7FD0A33E1D4B5926007C9EAB /* APIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = APIKit.framework; path = ../Carthage/Checkouts/APIKit/build/Debug/APIKit.framework; sourceTree = ""; }; 7FD0A3421D4B5E80007C9EAB /* UIViewController+Error.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "UIViewController+Error.swift"; sourceTree = ""; }; + AF5885BD234DE5AC0068D373 /* JSONRPCKit.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = JSONRPCKit.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + AF5885BE234DE5AC0068D373 /* Result.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = Result.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + AF5885C3234DE8EF0068D373 /* APIKit.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = APIKit.framework; sourceTree = BUILT_PRODUCTS_DIR; }; CB31EFB01CF6E88100DD13DD /* JSONRPCKit.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; name = JSONRPCKit.framework; path = "../Debug-iphonesimulator/JSONRPCKit.framework"; sourceTree = BUILT_PRODUCTS_DIR; }; CB31EFB31CF6E88800DD13DD /* Result.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; name = Result.framework; path = "../Debug-iphonesimulator/Result.framework"; sourceTree = BUILT_PRODUCTS_DIR; }; CB31EFB61CF6E8B400DD13DD /* Alamofire.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; name = Alamofire.framework; path = "../Debug-iphonesimulator/Alamofire.framework"; sourceTree = BUILT_PRODUCTS_DIR; }; @@ -59,9 +64,9 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - 7FD0A33F1D4B5926007C9EAB /* APIKit.framework in Frameworks */, - CB31EFB11CF6E88100DD13DD /* JSONRPCKit.framework in Frameworks */, - CB31EFB41CF6E88800DD13DD /* Result.framework in Frameworks */, + AF5885C8234DE8EF0068D373 /* Result.framework in Frameworks */, + AF5885C4234DE8EF0068D373 /* APIKit.framework in Frameworks */, + AF5885C6234DE8EF0068D373 /* JSONRPCKit.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -104,6 +109,9 @@ CB63E26E1CE232C700E22B5C /* Frameworks */ = { isa = PBXGroup; children = ( + AF5885C3234DE8EF0068D373 /* APIKit.framework */, + AF5885BD234DE5AC0068D373 /* JSONRPCKit.framework */, + AF5885BE234DE5AC0068D373 /* Result.framework */, 7FD0A33E1D4B5926007C9EAB /* APIKit.framework */, CB31EFB61CF6E8B400DD13DD /* Alamofire.framework */, CB31EFB01CF6E88100DD13DD /* JSONRPCKit.framework */, @@ -122,7 +130,7 @@ CB63E23F1CE2309100E22B5C /* Sources */, CB63E2401CE2309100E22B5C /* Frameworks */, CB63E2411CE2309100E22B5C /* Resources */, - CB31EFAF1CF6E84400DD13DD /* Embed Frameworks */, + AF5885CA234DE8EF0068D373 /* Embed Frameworks */, ); buildRules = ( ); @@ -145,7 +153,9 @@ TargetAttributes = { CB63E2421CE2309100E22B5C = { CreatedOnToolsVersion = 7.3.1; + DevelopmentTeam = 6AS4N82Q9E; LastSwiftMigration = 0920; + ProvisioningStyle = Automatic; }; }; }; @@ -154,6 +164,7 @@ developmentRegion = English; hasScannedForEncodings = 0; knownRegions = ( + English, en, Base, ); @@ -321,10 +332,14 @@ isa = XCBuildConfiguration; buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CODE_SIGN_IDENTITY = "Apple Development"; + CODE_SIGN_STYLE = Automatic; + DEVELOPMENT_TEAM = 6AS4N82Q9E; INFOPLIST_FILE = Example/Info.plist; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = com.bricklife.ios.Example; PRODUCT_NAME = "$(TARGET_NAME)"; + PROVISIONING_PROFILE_SPECIFIER = ""; SWIFT_VERSION = 4.0; }; name = Debug; @@ -333,10 +348,14 @@ isa = XCBuildConfiguration; buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CODE_SIGN_IDENTITY = "Apple Development"; + CODE_SIGN_STYLE = Automatic; + DEVELOPMENT_TEAM = 6AS4N82Q9E; INFOPLIST_FILE = Example/Info.plist; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = com.bricklife.ios.Example; PRODUCT_NAME = "$(TARGET_NAME)"; + PROVISIONING_PROFILE_SPECIFIER = ""; SWIFT_VERSION = 4.0; }; name = Release; diff --git a/Example/Example.xcodeproj/xcshareddata/xcschemes/Example.xcscheme b/Example/Example.xcodeproj/xcshareddata/xcschemes/Example.xcscheme new file mode 100644 index 0000000..50fe757 --- /dev/null +++ b/Example/Example.xcodeproj/xcshareddata/xcschemes/Example.xcscheme @@ -0,0 +1,78 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Example/Example/Assets.xcassets/AppIcon.appiconset/Contents.json b/Example/Example/Assets.xcassets/AppIcon.appiconset/Contents.json index eeea76c..d8db8d6 100644 --- a/Example/Example/Assets.xcassets/AppIcon.appiconset/Contents.json +++ b/Example/Example/Assets.xcassets/AppIcon.appiconset/Contents.json @@ -1,5 +1,15 @@ { "images" : [ + { + "idiom" : "iphone", + "size" : "20x20", + "scale" : "2x" + }, + { + "idiom" : "iphone", + "size" : "20x20", + "scale" : "3x" + }, { "idiom" : "iphone", "size" : "29x29", @@ -30,6 +40,16 @@ "size" : "60x60", "scale" : "3x" }, + { + "idiom" : "ipad", + "size" : "20x20", + "scale" : "1x" + }, + { + "idiom" : "ipad", + "size" : "20x20", + "scale" : "2x" + }, { "idiom" : "ipad", "size" : "29x29", @@ -64,6 +84,11 @@ "idiom" : "ipad", "size" : "83.5x83.5", "scale" : "2x" + }, + { + "idiom" : "ios-marketing", + "size" : "1024x1024", + "scale" : "1x" } ], "info" : { diff --git a/JSONRPCKit.podspec b/JSONRPCKit.podspec index 91337fe..e50bece 100644 --- a/JSONRPCKit.podspec +++ b/JSONRPCKit.podspec @@ -28,6 +28,6 @@ Pod::Spec.new do |s| THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. LICENSE } - s.dependency "Result", "~> 3.2.0" + s.dependency "Result", "~> 4.0.0" end diff --git a/JSONRPCKit.xcodeproj/project.pbxproj b/JSONRPCKit.xcodeproj/project.pbxproj index f31ac6e..cffccf0 100644 --- a/JSONRPCKit.xcodeproj/project.pbxproj +++ b/JSONRPCKit.xcodeproj/project.pbxproj @@ -206,11 +206,11 @@ TargetAttributes = { 7FC654FF1D49EA19004C390C = { CreatedOnToolsVersion = 7.3.1; - LastSwiftMigration = 0920; + LastSwiftMigration = 1010; }; CBB0C34D1BF0B1D6006A7D41 = { CreatedOnToolsVersion = 7.1; - LastSwiftMigration = 0920; + LastSwiftMigration = 1010; }; }; }; @@ -219,6 +219,7 @@ developmentRegion = English; hasScannedForEncodings = 0; knownRegions = ( + English, en, Base, ); @@ -298,7 +299,7 @@ "LD_RUNPATH_SEARCH_PATHS[sdk=macosx*]" = "$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = "-.Tests"; PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_VERSION = 4.0; + SWIFT_VERSION = 4.2; }; name = Debug; }; @@ -312,7 +313,7 @@ "LD_RUNPATH_SEARCH_PATHS[sdk=macosx*]" = "$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = "-.Tests"; PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_VERSION = 4.0; + SWIFT_VERSION = 4.2; }; name = Release; }; @@ -445,7 +446,7 @@ PRODUCT_NAME = "$(PROJECT_NAME)"; SKIP_INSTALL = YES; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; - SWIFT_VERSION = 4.0; + SWIFT_VERSION = 5.0; }; name = Debug; }; @@ -467,7 +468,7 @@ PRODUCT_BUNDLE_IDENTIFIER = com.bricklife.JSONRPCKit; PRODUCT_NAME = "$(PROJECT_NAME)"; SKIP_INSTALL = YES; - SWIFT_VERSION = 4.0; + SWIFT_VERSION = 5.0; }; name = Release; }; diff --git a/JSONRPCKit.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/JSONRPCKit.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 0000000..18d9810 --- /dev/null +++ b/JSONRPCKit.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + diff --git a/Package.resolved b/Package.resolved index 3236c9e..dc09c89 100644 --- a/Package.resolved +++ b/Package.resolved @@ -6,8 +6,8 @@ "repositoryURL": "https://github.com/antitypical/Result.git", "state": { "branch": null, - "revision": "7477584259bfce2560a19e06ad9f71db441fff11", - "version": "3.2.4" + "revision": "8fc088dcf72802801efeecba76ea8fb041fb773d", + "version": "4.0.0" } } ] diff --git a/Package.swift b/Package.swift index a1bec29..aed5491 100644 --- a/Package.swift +++ b/Package.swift @@ -9,7 +9,7 @@ let package = Package( .library(name: "JSONRPCKit", targets: ["JSONRPCKit"]), ], dependencies: [ - .package(url: "https://github.com/antitypical/Result.git", from: "3.2.0"), + .package(url: "https://github.com/antitypical/Result.git", from: "4.0.0"), ], targets: [ .target(name: "JSONRPCKit", dependencies: ["Result"]), diff --git a/Sources/JSONRPCKit/Batch.swift b/Sources/JSONRPCKit/Batch.swift index bec1a47..1b6c93d 100644 --- a/Sources/JSONRPCKit/Batch.swift +++ b/Sources/JSONRPCKit/Batch.swift @@ -40,7 +40,7 @@ public struct Batch1: Batch { } public static func responses(from results: Results) throws -> Responses { - return try results.dematerialize() + return try results.get() } } @@ -85,8 +85,8 @@ public struct Batch2: Batch { public static func responses(from results: Results) throws -> Responses { return ( - try results.0.dematerialize(), - try results.1.dematerialize() + try results.0.get(), + try results.1.get() ) } } @@ -137,9 +137,9 @@ public struct Batch3: B public static func responses(from results: Results) throws -> Responses { return ( - try results.0.dematerialize(), - try results.1.dematerialize(), - try results.2.dematerialize() + try results.0.get(), + try results.1.get(), + try results.2.get() ) } } @@ -195,10 +195,10 @@ public struct Batch4 Responses { return ( - try results.0.dematerialize(), - try results.1.dematerialize(), - try results.2.dematerialize(), - try results.3.dematerialize() + try results.0.get(), + try results.1.get(), + try results.2.get(), + try results.3.get() ) } } @@ -259,11 +259,11 @@ public struct Batch5 Responses { return ( - try results.0.dematerialize(), - try results.1.dematerialize(), - try results.2.dematerialize(), - try results.3.dematerialize(), - try results.4.dematerialize() + try results.0.get(), + try results.1.get(), + try results.2.get(), + try results.3.get(), + try results.4.get() ) } } @@ -329,12 +329,12 @@ public struct Batch6 Responses { return ( - try results.0.dematerialize(), - try results.1.dematerialize(), - try results.2.dematerialize(), - try results.3.dematerialize(), - try results.4.dematerialize(), - try results.5.dematerialize() + try results.0.get(), + try results.1.get(), + try results.2.get(), + try results.3.get(), + try results.4.get(), + try results.5.get() ) } } diff --git a/Sources/JSONRPCKit/BatchElement.swift b/Sources/JSONRPCKit/BatchElement.swift index c8e3649..cd20411 100644 --- a/Sources/JSONRPCKit/BatchElement.swift +++ b/Sources/JSONRPCKit/BatchElement.swift @@ -26,7 +26,7 @@ internal protocol BatchElementProcotol { internal extension BatchElementProcotol { /// - Throws: JSONRPCError - internal func response(from object: Any) throws -> Request.Response { + func response(from object: Any) throws -> Request.Response { switch result(from: object) { case .success(let response): return response @@ -37,7 +37,7 @@ internal extension BatchElementProcotol { } /// - Throws: JSONRPCError - internal func response(from objects: [Any]) throws -> Request.Response { + func response(from objects: [Any]) throws -> Request.Response { switch result(from: objects) { case .success(let response): return response @@ -47,7 +47,7 @@ internal extension BatchElementProcotol { } } - internal func result(from object: Any) -> Result { + func result(from object: Any) -> Result { guard let dictionary = object as? [String: Any] else { return .failure(.unexpectedTypeObject(object)) } @@ -80,9 +80,9 @@ internal extension BatchElementProcotol { } } - internal func result(from objects: [Any]) -> Result { + func result(from objects: [Any]) -> Result { let matchedObject = objects - .flatMap { $0 as? [String: Any] } + .compactMap { $0 as? [String: Any] } .filter { $0["id"].flatMap(Id.init) == id } .first @@ -95,19 +95,19 @@ internal extension BatchElementProcotol { } internal extension BatchElementProcotol where Request.Response == Void { - internal func response(_ object: Any) throws -> Request.Response { + func response(_ object: Any) throws -> Request.Response { return () } - internal func response(_ objects: [Any]) throws -> Request.Response { + func response(_ objects: [Any]) throws -> Request.Response { return () } - internal func result(_ object: Any) -> Result { + func result(_ object: Any) -> Result { return .success(()) } - internal func result(_ objects: [Any]) -> Result { + func result(_ objects: [Any]) -> Result { return .success(()) } } diff --git a/Sources/JSONRPCKit/Id.swift b/Sources/JSONRPCKit/Id.swift index b742cbd..f9bb716 100644 --- a/Sources/JSONRPCKit/Id.swift +++ b/Sources/JSONRPCKit/Id.swift @@ -38,12 +38,12 @@ extension Id { extension Id: Hashable { - public var hashValue: Int { + public func hash(into hasher: inout Hasher) { switch self { case .number(let number): - return number + hasher.combine(number) case .string(let string): - return string.hashValue + hasher.combine(string) } } } diff --git a/Sources/JSONRPCKit/Request.swift b/Sources/JSONRPCKit/Request.swift index 6394295..f4c1a00 100644 --- a/Sources/JSONRPCKit/Request.swift +++ b/Sources/JSONRPCKit/Request.swift @@ -21,25 +21,25 @@ public protocol Request { } public extension Request { - public var parameters: Any? { + var parameters: Any? { return nil } - public var extendedFields: [String: Any]? { + var extendedFields: [String: Any]? { return nil } - public var isNotification: Bool { + var isNotification: Bool { return false } } public extension Request where Response == Void { - public var isNotification: Bool { + var isNotification: Bool { return true } - public func response(from resultObject: Any) throws -> Response { + func response(from resultObject: Any) throws -> Response { return () } }