diff --git a/Cartfile b/Cartfile index fa9f48b..ae8b185 100644 --- a/Cartfile +++ b/Cartfile @@ -1 +1 @@ -github "antitypical/Result" ~> 3.2.0 +github "antitypical/Result" ~> 4.1.0 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/JSONRPCKit.xcodeproj/project.pbxproj b/JSONRPCKit.xcodeproj/project.pbxproj index f31ac6e..062613b 100644 --- a/JSONRPCKit.xcodeproj/project.pbxproj +++ b/JSONRPCKit.xcodeproj/project.pbxproj @@ -219,6 +219,7 @@ developmentRegion = English; hasScannedForEncodings = 0; knownRegions = ( + English, en, Base, ); @@ -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/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/Info.plist b/Sources/JSONRPCKit/Info.plist index e0f4bf7..e677190 100644 --- a/Sources/JSONRPCKit/Info.plist +++ b/Sources/JSONRPCKit/Info.plist @@ -15,7 +15,7 @@ CFBundlePackageType FMWK CFBundleShortVersionString - 3.0.0 + 5.0.0 CFBundleSignature ???? CFBundleVersion 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 () } }