From c23e55feba329ea624c62f903a1c272cfb34a5a8 Mon Sep 17 00:00:00 2001 From: Johannes Lund Date: Wed, 17 Aug 2016 14:39:11 +0200 Subject: [PATCH] Thoughtless fixes for beta 6 --- Generator/Generator.swift | 4 +- Sources/Castable.swift | 26 +- Sources/Decodable.swift | 16 +- Sources/Decoders.swift | 6 +- Sources/DecodingError.swift | 12 +- Sources/NSValueCastable.swift | 4 +- Sources/Operators.swift | 13 +- Sources/Overloads.swift | 326 ++++++++++++------------ Sources/Parse.swift | 12 +- Sources/RawRepresentableDecodable.swift | 2 +- Tests/ArrayTests.swift | 8 +- Tests/DecodableOperatorsTests.swift | 14 +- Tests/DecodableTests.swift | 2 +- Tests/DecodeAsOneOfTests.swift | 4 +- Tests/DictionaryTests.swift | 10 +- Tests/ErrorPathTests.swift | 18 +- Tests/ParseTests.swift | 2 +- Tests/Repository.swift | 4 +- Tests/Vehicle.swift | 6 +- 19 files changed, 247 insertions(+), 242 deletions(-) diff --git a/Generator/Generator.swift b/Generator/Generator.swift index 16e9f10..2b2e051 100755 --- a/Generator/Generator.swift +++ b/Generator/Generator.swift @@ -195,7 +195,7 @@ indirect enum Decodable { } let documentation = generateDocumentationComment(behaviour) - return overloads + [documentation + "public func \(operatorString) \(generics)(json: AnyObject, keyPath: \(keyPathType)) throws -> \(returnType) {\n" + + return overloads + [documentation + "public func \(operatorString) \(generics)(json: Any, keyPath: \(keyPathType)) throws -> \(returnType) {\n" + " return try parse(json, keyPath: keyPath, decoder: \(decodeClosure(provider)))\n" + "}" ] @@ -238,7 +238,7 @@ let types = overloads.map { $0.typeString(TypeNameProvider()) } let all = overloads.flatMap { $0.generateOverloads("=>") } + overloads.flatMap(filterOptionals).map{ $0.wrapInOptionalIfNeeded() }.flatMap { $0.generateOverloads("=>?") } do { - var template = try String(contentsOfFile: fileManager.currentDirectoryPath + "/Templates/Header.swift") as NSString + var template = try String(contentsOfFile: fileManager.currentDirectoryPath + "/Templates/Header.swift") template = template.replacingOccurrences(of: "{filename}", with: filename) template = template.replacingOccurrences(of: "{by}", with: "Generator.swift") template = template.replacingOccurrences(of: "{overloads}", with: types.joined(separator: ", ")) diff --git a/Sources/Castable.swift b/Sources/Castable.swift index 558cab1..aad3b7c 100644 --- a/Sources/Castable.swift +++ b/Sources/Castable.swift @@ -8,40 +8,40 @@ import Foundation -/// Attempt to cast an `AnyObject` to `T` or throw +/// Attempt to cast an `Any` to `T` or throw /// /// - throws: `DecodingError.typeMismatch(expected, actual, metadata)` -public func cast(_ object: AnyObject) throws -> T { +public func cast(_ object: Any) throws -> T { guard let result = object as? T else { let metadata = DecodingError.Metadata(object: object) - throw DecodingError.typeMismatch(expected: T.self, actual: object.dynamicType, metadata) + throw DecodingError.typeMismatch(expected: T.self, actual: type(of: object), metadata) } return result } public protocol DynamicDecodable { associatedtype DecodedType - static var decoder: (AnyObject) throws -> DecodedType {get set} + static var decoder: (Any) throws -> DecodedType {get set} } extension Decodable where Self: DynamicDecodable, Self.DecodedType == Self { - public static func decode(_ json: AnyObject) throws -> Self { + public static func decode(_ json: Any) throws -> Self { return try decoder(json) } } extension String: Decodable, DynamicDecodable { - public static var decoder: (AnyObject) throws -> String = { try cast($0) } + public static var decoder: (Any) throws -> String = { try cast($0) } } extension Int: Decodable, DynamicDecodable { - public static var decoder: (AnyObject) throws -> Int = { try cast($0) } + public static var decoder: (Any) throws -> Int = { try cast($0) } } extension Double: Decodable, DynamicDecodable { - public static var decoder: (AnyObject) throws -> Double = { try cast($0) } + public static var decoder: (Any) throws -> Double = { try cast($0) } } extension Bool: Decodable, DynamicDecodable { - public static var decoder: (AnyObject) throws -> Bool = { try cast($0) } + public static var decoder: (Any) throws -> Bool = { try cast($0) } } private let iso8601DateFormatter: DateFormatter = { @@ -52,7 +52,7 @@ private let iso8601DateFormatter: DateFormatter = { }() extension Date: Decodable, DynamicDecodable { - public static var decoder: (AnyObject) throws -> Date = { object in + public static var decoder: (Any) throws -> Date = { object in let string = try String.decode(object) guard let date = iso8601DateFormatter.date(from: string) else { let metadata = DecodingError.Metadata(object: object) @@ -63,14 +63,14 @@ extension Date: Decodable, DynamicDecodable { } extension NSDictionary: Decodable { - public static func decode(_ json: AnyObject) throws -> Self { + public static func decode(_ json: Any) throws -> Self { return try cast(json) } } extension NSArray: DynamicDecodable { - public static var decoder: (AnyObject) throws -> NSArray = { try cast($0) } - public static func decode(_ json: AnyObject) throws -> NSArray { + public static var decoder: (Any) throws -> NSArray = { try cast($0) } + public static func decode(_ json: Any) throws -> NSArray { return try decoder(json) } diff --git a/Sources/Decodable.swift b/Sources/Decodable.swift index 7a912db..18154d2 100644 --- a/Sources/Decodable.swift +++ b/Sources/Decodable.swift @@ -9,26 +9,26 @@ import Foundation public protocol Decodable { - static func decode(_ json: AnyObject) throws -> Self + static func decode(_ json: Any) throws -> Self } extension Dictionary where Key: Decodable, Value: Decodable { - public static func decode(_ j: AnyObject) throws -> Dictionary { + public static func decode(_ j: Any) throws -> Dictionary { return try Dictionary.decoder(key: Key.decode, value: Value.decode)(j) } } -extension Dictionary where Key: Decodable, Value: AnyObject { +extension Dictionary where Key: Decodable, Value: Any { - public static func decode(_ j: AnyObject) throws -> Dictionary { - let valueDecoder: (AnyObject) throws -> Value = { try cast($0) } + public static func decode(_ j: Any) throws -> Dictionary { + let valueDecoder: (Any) throws -> Value = { try cast($0) } return try Dictionary.decoder(key: Key.decode, value: valueDecoder)(j) } } extension Array where Element: Decodable { - public static func decode(_ j: AnyObject, ignoreInvalidObjects: Bool = false) throws -> [Element] { + public static func decode(_ j: Any, ignoreInvalidObjects: Bool = false) throws -> [Element] { if ignoreInvalidObjects { return try [Element?].decoder { try? Element.decode($0) }(j).flatMap {$0} } else { @@ -43,7 +43,7 @@ extension Array where Element: Decodable { // MARK: Helpers /// Attempt to decode one of multiple objects in order until: A: we get a positive match, B: we throw an exception if the last object does not decode -public func decodeAsOneOf(_ json: AnyObject, objectTypes: Decodable.Type...) throws -> Decodable { +public func decodeAsOneOf(_ json: Any, objectTypes: Decodable.Type...) throws -> Decodable { for decodable in objectTypes.dropLast() { if let decoded = try? decodable.decode(json) { return decoded @@ -53,7 +53,7 @@ public func decodeAsOneOf(_ json: AnyObject, objectTypes: Decodable.Type...) thr } /// Attempt to decode one of multiple objects in order until: A: we get a positive match, B: we throw an exception if the last object does not decode -public func decodeArrayAsOneOf(_ json: AnyObject, objectTypes: Decodable.Type...) throws -> [Decodable] { +public func decodeArrayAsOneOf(_ json: Any, objectTypes: Decodable.Type...) throws -> [Decodable] { return try NSArray.decode(json).map { for decodable in objectTypes.dropLast() { if let decoded = try? decodable.decode($0) { diff --git a/Sources/Decoders.swift b/Sources/Decoders.swift index 48b78e1..aa646ec 100644 --- a/Sources/Decoders.swift +++ b/Sources/Decoders.swift @@ -16,7 +16,7 @@ extension Optional { /// /// - parameter wrappedDecoder: A decoder (decode closure) for the wrapped type /// - returns: A closure takes an JSON object, checks it's `NSNull`, if so returns `nil`, otherwise calls the wrapped decode closure. - static func decoder(_ wrappedDecoder: (AnyObject) throws -> Wrapped) -> (AnyObject) throws -> Wrapped? { + static func decoder(_ wrappedDecoder: @escaping (Any) throws -> Wrapped) -> (Any) throws -> Wrapped? { return { json in if json is NSNull { return nil @@ -36,7 +36,7 @@ extension Array { /// - parameter elementDecoder: A decoder (decode closure) for the `Element` type /// - throws: if `NSArray.decode` throws or any element decode closure throws /// - returns: A closure that takes an `NSArray` and maps it using the element decode closure - public static func decoder(_ elementDecoder: (AnyObject) throws -> Element) -> (AnyObject) throws -> Array { + public static func decoder(_ elementDecoder: @escaping (Any) throws -> Element) -> (Any) throws -> Array { return { json in return try NSArray.decode(json).map { try elementDecoder($0) } } @@ -51,7 +51,7 @@ extension Dictionary { /// - parameter key: A decoder (decode closure) for the `Key` type /// - parameter value: A decoder (decode closure) for the `Value` type /// - returns: A closure that takes a `NSDictionary` and "maps" it using key and value decode closures - public static func decoder(key keyDecoder: (AnyObject) throws -> Key, value valueDecoder: (AnyObject) throws -> Value) -> (AnyObject) throws -> Dictionary { + public static func decoder(key keyDecoder: @escaping (Any) throws -> Key, value valueDecoder: @escaping (Any) throws -> Value) -> (Any) throws -> Dictionary { return { json in var dict = Dictionary() for (key, value) in try NSDictionary.decode(json) { diff --git a/Sources/DecodingError.swift b/Sources/DecodingError.swift index caf820f..044e200 100644 --- a/Sources/DecodingError.swift +++ b/Sources/DecodingError.swift @@ -15,7 +15,7 @@ public enum DecodingError: Error, Equatable { /// object graph. public struct Metadata: Equatable { - public init(path: [String] = [], object: AnyObject, rootObject: AnyObject? = nil) { + public init(path: [String] = [], object: Any, rootObject: Any? = nil) { self.path = path self.object = object self.rootObject = rootObject @@ -25,10 +25,10 @@ public enum DecodingError: Error, Equatable { public var path: [String] /// The JSON object that failed to be decoded - public let object: AnyObject + public let object: Any /// The root JSON object for which the `path` can be used to find `object` - public var rootObject: AnyObject? + public var rootObject: Any? /// Represents the path to the object that failed decoding with "." as a separator. public var formattedPath: String { @@ -36,7 +36,7 @@ public enum DecodingError: Error, Equatable { } } - /// Thrown when optional casting from `AnyObject` fails. + /// Thrown when optional casting from `Any` fails. /// /// This can happen both when trying to access a key on a object /// that isn't a `NSDictionary`, and failing to cast a `Castable` @@ -110,9 +110,9 @@ public func ~=(lhs: T.Type, rhs: Any.Type) -> Bool { // FIXME: I'm not sure about === equality public func ==(lhs: DecodingError.Metadata, rhs: DecodingError.Metadata) -> Bool { - return lhs.object === rhs.object + return lhs.object as AnyObject === rhs.object as AnyObject && lhs.path == rhs.path - && lhs.rootObject === rhs.rootObject + && lhs.rootObject as AnyObject === rhs.rootObject as AnyObject } public func ==(lhs: DecodingError, rhs: DecodingError) -> Bool { diff --git a/Sources/NSValueCastable.swift b/Sources/NSValueCastable.swift index bae8339..695c72d 100644 --- a/Sources/NSValueCastable.swift +++ b/Sources/NSValueCastable.swift @@ -43,7 +43,7 @@ public protocol NSNumberCastable: NSValueCastable { extension NSValueCastable { private typealias PointerOfSelf = UnsafeMutablePointer // Why do we have to do this? - public static func decode(_ j: AnyObject) throws -> Self { + public static func decode(_ j: Any) throws -> Self { let value: NSValue = try cast(j) let pointer = PointerOfSelf.allocate(capacity: 1) defer { pointer.deallocate(capacity: 1) } @@ -53,7 +53,7 @@ extension NSValueCastable { } extension NSNumberCastable { - public static func decode(_ json: AnyObject) throws -> Self { + public static func decode(_ json: Any) throws -> Self { return try convertFrom(cast(json)) } } diff --git a/Sources/Operators.swift b/Sources/Operators.swift index 79f5b31..6ace572 100644 --- a/Sources/Operators.swift +++ b/Sources/Operators.swift @@ -10,15 +10,20 @@ import Foundation // MARK: - Operators -infix operator => { associativity right precedence 150 } -infix operator =>? { associativity right precedence 150 } +precedencegroup DecodingPrecendence { + associativity: right + higherThan: CastingPrecedence +} + +infix operator => : DecodingPrecendence +infix operator =>? : DecodingPrecendence -public func => (lhs: AnyObject, rhs: KeyPath) throws -> AnyObject { +public func => (lhs: Any, rhs: KeyPath) throws -> Any { return try parse(lhs, keyPath: rhs, decoder: { $0 }) } -public func =>? (lhs: AnyObject, rhs: OptionalKeyPath) throws -> AnyObject? { +public func =>? (lhs: Any, rhs: OptionalKeyPath) throws -> Any? { return try parse(lhs, keyPath: rhs, decoder: { $0 }) } diff --git a/Sources/Overloads.swift b/Sources/Overloads.swift index 3c9eafb..a524eeb 100644 --- a/Sources/Overloads.swift +++ b/Sources/Overloads.swift @@ -16,7 +16,7 @@ /// - throws: `DecodingError` if a key is missing or decoding fails. /// - returns: `nil` if the object at `path` is `NSNull` /// -public func => (json: AnyObject, keyPath: KeyPath) throws -> [[A]?]? { +public func => (json: Any, keyPath: KeyPath) throws -> [[A]?]? { return try parse(json, keyPath: keyPath, decoder: Optional.decoder(Array.decoder(Optional.decoder(Array.decoder(A.decode))))) } @@ -27,7 +27,7 @@ public func => (json: AnyObject, keyPath: KeyPath) throws -> [[A]? /// - throws: `DecodingError` if a key is missing or decoding fails. /// - returns: `nil` if the object at `path` is `NSNull` /// -public func => (json: AnyObject, keyPath: KeyPath) throws -> [[A: B]?]? { +public func => (json: Any, keyPath: KeyPath) throws -> [[A: B]?]? { return try parse(json, keyPath: keyPath, decoder: Optional.decoder(Array.decoder(Optional.decoder(Dictionary.decoder(key: A.decode, value: B.decode))))) } @@ -38,7 +38,7 @@ public func => (json: AnyObject, keyPath: KeyPath) t /// - throws: `DecodingError` if a key is missing or decoding fails. /// - returns: `nil` if the object at `path` is `NSNull` /// -public func => (json: AnyObject, keyPath: KeyPath) throws -> [A?]? { +public func => (json: Any, keyPath: KeyPath) throws -> [A?]? { return try parse(json, keyPath: keyPath, decoder: Optional.decoder(Array.decoder(Optional.decoder(A.decode)))) } @@ -49,7 +49,7 @@ public func => (json: AnyObject, keyPath: KeyPath) throws -> [A?]? /// - throws: `DecodingError` if a key is missing or decoding fails. /// - returns: `nil` if the object at `path` is `NSNull` /// -public func => (json: AnyObject, keyPath: KeyPath) throws -> [[A?]]? { +public func => (json: Any, keyPath: KeyPath) throws -> [[A?]]? { return try parse(json, keyPath: keyPath, decoder: Optional.decoder(Array.decoder(Array.decoder(Optional.decoder(A.decode))))) } @@ -60,7 +60,7 @@ public func => (json: AnyObject, keyPath: KeyPath) throws -> [[A?] /// - throws: `DecodingError` if a key is missing or decoding fails. /// - returns: `nil` if the object at `path` is `NSNull` /// -public func => (json: AnyObject, keyPath: KeyPath) throws -> [[[A]]]? { +public func => (json: Any, keyPath: KeyPath) throws -> [[[A]]]? { return try parse(json, keyPath: keyPath, decoder: Optional.decoder(Array.decoder(Array.decoder(Array.decoder(A.decode))))) } @@ -71,7 +71,7 @@ public func => (json: AnyObject, keyPath: KeyPath) throws -> [[[A] /// - throws: `DecodingError` if a key is missing or decoding fails. /// - returns: `nil` if the object at `path` is `NSNull` /// -public func => (json: AnyObject, keyPath: KeyPath) throws -> [[[A: B]]]? { +public func => (json: Any, keyPath: KeyPath) throws -> [[[A: B]]]? { return try parse(json, keyPath: keyPath, decoder: Optional.decoder(Array.decoder(Array.decoder(Dictionary.decoder(key: A.decode, value: B.decode))))) } @@ -82,7 +82,7 @@ public func => (json: AnyObject, keyPath: KeyPath) t /// - throws: `DecodingError` if a key is missing or decoding fails. /// - returns: `nil` if the object at `path` is `NSNull` /// -public func => (json: AnyObject, keyPath: KeyPath) throws -> [[A]]? { +public func => (json: Any, keyPath: KeyPath) throws -> [[A]]? { return try parse(json, keyPath: keyPath, decoder: Optional.decoder(Array.decoder(Array.decoder(A.decode)))) } @@ -93,7 +93,7 @@ public func => (json: AnyObject, keyPath: KeyPath) throws -> [[A]] /// - throws: `DecodingError` if a key is missing or decoding fails. /// - returns: `nil` if the object at `path` is `NSNull` /// -public func => (json: AnyObject, keyPath: KeyPath) throws -> [[A: B?]]? { +public func => (json: Any, keyPath: KeyPath) throws -> [[A: B?]]? { return try parse(json, keyPath: keyPath, decoder: Optional.decoder(Array.decoder(Dictionary.decoder(key: A.decode, value: Optional.decoder(B.decode))))) } @@ -104,7 +104,7 @@ public func => (json: AnyObject, keyPath: KeyPath) t /// - throws: `DecodingError` if a key is missing or decoding fails. /// - returns: `nil` if the object at `path` is `NSNull` /// -public func => (json: AnyObject, keyPath: KeyPath) throws -> [[A: [B]]]? { +public func => (json: Any, keyPath: KeyPath) throws -> [[A: [B]]]? { return try parse(json, keyPath: keyPath, decoder: Optional.decoder(Array.decoder(Dictionary.decoder(key: A.decode, value: Array.decoder(B.decode))))) } @@ -115,7 +115,7 @@ public func => (json: AnyObject, keyPath: KeyPath) t /// - throws: `DecodingError` if a key is missing or decoding fails. /// - returns: `nil` if the object at `path` is `NSNull` /// -public func => (json: AnyObject, keyPath: KeyPath) throws -> [[A: [B: C]]]? { +public func => (json: Any, keyPath: KeyPath) throws -> [[A: [B: C]]]? { return try parse(json, keyPath: keyPath, decoder: Optional.decoder(Array.decoder(Dictionary.decoder(key: A.decode, value: Dictionary.decoder(key: B.decode, value: C.decode))))) } @@ -126,7 +126,7 @@ public func => (json: AnyObject, keyPa /// - throws: `DecodingError` if a key is missing or decoding fails. /// - returns: `nil` if the object at `path` is `NSNull` /// -public func => (json: AnyObject, keyPath: KeyPath) throws -> [[A: B]]? { +public func => (json: Any, keyPath: KeyPath) throws -> [[A: B]]? { return try parse(json, keyPath: keyPath, decoder: Optional.decoder(Array.decoder(Dictionary.decoder(key: A.decode, value: B.decode)))) } @@ -137,7 +137,7 @@ public func => (json: AnyObject, keyPath: KeyPath) t /// - throws: `DecodingError` if a key is missing or decoding fails. /// - returns: `nil` if the object at `path` is `NSNull` /// -public func => (json: AnyObject, keyPath: KeyPath) throws -> [A]? { +public func => (json: Any, keyPath: KeyPath) throws -> [A]? { return try parse(json, keyPath: keyPath, decoder: Optional.decoder(Array.decoder(A.decode))) } @@ -148,7 +148,7 @@ public func => (json: AnyObject, keyPath: KeyPath) throws -> [A]? /// - throws: `DecodingError` if a key is missing or decoding fails. /// - returns: `nil` if the object at `path` is `NSNull` /// -public func => (json: AnyObject, keyPath: KeyPath) throws -> [A: [B]?]? { +public func => (json: Any, keyPath: KeyPath) throws -> [A: [B]?]? { return try parse(json, keyPath: keyPath, decoder: Optional.decoder(Dictionary.decoder(key: A.decode, value: Optional.decoder(Array.decoder(B.decode))))) } @@ -159,7 +159,7 @@ public func => (json: AnyObject, keyPath: KeyPath) t /// - throws: `DecodingError` if a key is missing or decoding fails. /// - returns: `nil` if the object at `path` is `NSNull` /// -public func => (json: AnyObject, keyPath: KeyPath) throws -> [A: [B: C]?]? { +public func => (json: Any, keyPath: KeyPath) throws -> [A: [B: C]?]? { return try parse(json, keyPath: keyPath, decoder: Optional.decoder(Dictionary.decoder(key: A.decode, value: Optional.decoder(Dictionary.decoder(key: B.decode, value: C.decode))))) } @@ -170,7 +170,7 @@ public func => (json: AnyObject, keyPa /// - throws: `DecodingError` if a key is missing or decoding fails. /// - returns: `nil` if the object at `path` is `NSNull` /// -public func => (json: AnyObject, keyPath: KeyPath) throws -> [A: B?]? { +public func => (json: Any, keyPath: KeyPath) throws -> [A: B?]? { return try parse(json, keyPath: keyPath, decoder: Optional.decoder(Dictionary.decoder(key: A.decode, value: Optional.decoder(B.decode)))) } @@ -181,7 +181,7 @@ public func => (json: AnyObject, keyPath: KeyPath) t /// - throws: `DecodingError` if a key is missing or decoding fails. /// - returns: `nil` if the object at `path` is `NSNull` /// -public func => (json: AnyObject, keyPath: KeyPath) throws -> [A: [B?]]? { +public func => (json: Any, keyPath: KeyPath) throws -> [A: [B?]]? { return try parse(json, keyPath: keyPath, decoder: Optional.decoder(Dictionary.decoder(key: A.decode, value: Array.decoder(Optional.decoder(B.decode))))) } @@ -192,7 +192,7 @@ public func => (json: AnyObject, keyPath: KeyPath) t /// - throws: `DecodingError` if a key is missing or decoding fails. /// - returns: `nil` if the object at `path` is `NSNull` /// -public func => (json: AnyObject, keyPath: KeyPath) throws -> [A: [[B]]]? { +public func => (json: Any, keyPath: KeyPath) throws -> [A: [[B]]]? { return try parse(json, keyPath: keyPath, decoder: Optional.decoder(Dictionary.decoder(key: A.decode, value: Array.decoder(Array.decoder(B.decode))))) } @@ -203,7 +203,7 @@ public func => (json: AnyObject, keyPath: KeyPath) t /// - throws: `DecodingError` if a key is missing or decoding fails. /// - returns: `nil` if the object at `path` is `NSNull` /// -public func => (json: AnyObject, keyPath: KeyPath) throws -> [A: [[B: C]]]? { +public func => (json: Any, keyPath: KeyPath) throws -> [A: [[B: C]]]? { return try parse(json, keyPath: keyPath, decoder: Optional.decoder(Dictionary.decoder(key: A.decode, value: Array.decoder(Dictionary.decoder(key: B.decode, value: C.decode))))) } @@ -214,7 +214,7 @@ public func => (json: AnyObject, keyPa /// - throws: `DecodingError` if a key is missing or decoding fails. /// - returns: `nil` if the object at `path` is `NSNull` /// -public func => (json: AnyObject, keyPath: KeyPath) throws -> [A: [B]]? { +public func => (json: Any, keyPath: KeyPath) throws -> [A: [B]]? { return try parse(json, keyPath: keyPath, decoder: Optional.decoder(Dictionary.decoder(key: A.decode, value: Array.decoder(B.decode)))) } @@ -225,7 +225,7 @@ public func => (json: AnyObject, keyPath: KeyPath) t /// - throws: `DecodingError` if a key is missing or decoding fails. /// - returns: `nil` if the object at `path` is `NSNull` /// -public func => (json: AnyObject, keyPath: KeyPath) throws -> [A: [B: C?]]? { +public func => (json: Any, keyPath: KeyPath) throws -> [A: [B: C?]]? { return try parse(json, keyPath: keyPath, decoder: Optional.decoder(Dictionary.decoder(key: A.decode, value: Dictionary.decoder(key: B.decode, value: Optional.decoder(C.decode))))) } @@ -236,7 +236,7 @@ public func => (json: AnyObject, keyPa /// - throws: `DecodingError` if a key is missing or decoding fails. /// - returns: `nil` if the object at `path` is `NSNull` /// -public func => (json: AnyObject, keyPath: KeyPath) throws -> [A: [B: [C]]]? { +public func => (json: Any, keyPath: KeyPath) throws -> [A: [B: [C]]]? { return try parse(json, keyPath: keyPath, decoder: Optional.decoder(Dictionary.decoder(key: A.decode, value: Dictionary.decoder(key: B.decode, value: Array.decoder(C.decode))))) } @@ -247,7 +247,7 @@ public func => (json: AnyObject, keyPa /// - throws: `DecodingError` if a key is missing or decoding fails. /// - returns: `nil` if the object at `path` is `NSNull` /// -public func => (json: AnyObject, keyPath: KeyPath) throws -> [A: [B: [C: D]]]? { +public func => (json: Any, keyPath: KeyPath) throws -> [A: [B: [C: D]]]? { return try parse(json, keyPath: keyPath, decoder: Optional.decoder(Dictionary.decoder(key: A.decode, value: Dictionary.decoder(key: B.decode, value: Dictionary.decoder(key: C.decode, value: D.decode))))) } @@ -258,7 +258,7 @@ public func => (json: An /// - throws: `DecodingError` if a key is missing or decoding fails. /// - returns: `nil` if the object at `path` is `NSNull` /// -public func => (json: AnyObject, keyPath: KeyPath) throws -> [A: [B: C]]? { +public func => (json: Any, keyPath: KeyPath) throws -> [A: [B: C]]? { return try parse(json, keyPath: keyPath, decoder: Optional.decoder(Dictionary.decoder(key: A.decode, value: Dictionary.decoder(key: B.decode, value: C.decode)))) } @@ -269,7 +269,7 @@ public func => (json: AnyObject, keyPa /// - throws: `DecodingError` if a key is missing or decoding fails. /// - returns: `nil` if the object at `path` is `NSNull` /// -public func => (json: AnyObject, keyPath: KeyPath) throws -> [A: B]? { +public func => (json: Any, keyPath: KeyPath) throws -> [A: B]? { return try parse(json, keyPath: keyPath, decoder: Optional.decoder(Dictionary.decoder(key: A.decode, value: B.decode))) } @@ -280,7 +280,7 @@ public func => (json: AnyObject, keyPath: KeyPath) t /// - throws: `DecodingError` if a key is missing or decoding fails. /// - returns: `nil` if the object at `path` is `NSNull` /// -public func => (json: AnyObject, keyPath: KeyPath) throws -> A? { +public func => (json: Any, keyPath: KeyPath) throws -> A? { return try parse(json, keyPath: keyPath, decoder: Optional.decoder(A.decode)) } @@ -291,7 +291,7 @@ public func => (json: AnyObject, keyPath: KeyPath) throws -> A? { /// - throws: `DecodingError.typeMismatchError`,`.other(error, metadata)` or possible `.missingKeyError` on required keys /// - returns: something /// -public func => (json: AnyObject, keyPath: KeyPath) throws -> [[A?]?] { +public func => (json: Any, keyPath: KeyPath) throws -> [[A?]?] { return try parse(json, keyPath: keyPath, decoder: Array.decoder(Optional.decoder(Array.decoder(Optional.decoder(A.decode))))) } @@ -302,7 +302,7 @@ public func => (json: AnyObject, keyPath: KeyPath) throws -> [[A?] /// - throws: `DecodingError.typeMismatchError`,`.other(error, metadata)` or possible `.missingKeyError` on required keys /// - returns: something /// -public func => (json: AnyObject, keyPath: KeyPath) throws -> [[[A]]?] { +public func => (json: Any, keyPath: KeyPath) throws -> [[[A]]?] { return try parse(json, keyPath: keyPath, decoder: Array.decoder(Optional.decoder(Array.decoder(Array.decoder(A.decode))))) } @@ -313,7 +313,7 @@ public func => (json: AnyObject, keyPath: KeyPath) throws -> [[[A] /// - throws: `DecodingError.typeMismatchError`,`.other(error, metadata)` or possible `.missingKeyError` on required keys /// - returns: something /// -public func => (json: AnyObject, keyPath: KeyPath) throws -> [[[A: B]]?] { +public func => (json: Any, keyPath: KeyPath) throws -> [[[A: B]]?] { return try parse(json, keyPath: keyPath, decoder: Array.decoder(Optional.decoder(Array.decoder(Dictionary.decoder(key: A.decode, value: B.decode))))) } @@ -324,7 +324,7 @@ public func => (json: AnyObject, keyPath: KeyPath) t /// - throws: `DecodingError.typeMismatchError`,`.other(error, metadata)` or possible `.missingKeyError` on required keys /// - returns: something /// -public func => (json: AnyObject, keyPath: KeyPath) throws -> [[A]?] { +public func => (json: Any, keyPath: KeyPath) throws -> [[A]?] { return try parse(json, keyPath: keyPath, decoder: Array.decoder(Optional.decoder(Array.decoder(A.decode)))) } @@ -335,7 +335,7 @@ public func => (json: AnyObject, keyPath: KeyPath) throws -> [[A]? /// - throws: `DecodingError.typeMismatchError`,`.other(error, metadata)` or possible `.missingKeyError` on required keys /// - returns: something /// -public func => (json: AnyObject, keyPath: KeyPath) throws -> [[A: B?]?] { +public func => (json: Any, keyPath: KeyPath) throws -> [[A: B?]?] { return try parse(json, keyPath: keyPath, decoder: Array.decoder(Optional.decoder(Dictionary.decoder(key: A.decode, value: Optional.decoder(B.decode))))) } @@ -346,7 +346,7 @@ public func => (json: AnyObject, keyPath: KeyPath) t /// - throws: `DecodingError.typeMismatchError`,`.other(error, metadata)` or possible `.missingKeyError` on required keys /// - returns: something /// -public func => (json: AnyObject, keyPath: KeyPath) throws -> [[A: [B]]?] { +public func => (json: Any, keyPath: KeyPath) throws -> [[A: [B]]?] { return try parse(json, keyPath: keyPath, decoder: Array.decoder(Optional.decoder(Dictionary.decoder(key: A.decode, value: Array.decoder(B.decode))))) } @@ -357,7 +357,7 @@ public func => (json: AnyObject, keyPath: KeyPath) t /// - throws: `DecodingError.typeMismatchError`,`.other(error, metadata)` or possible `.missingKeyError` on required keys /// - returns: something /// -public func => (json: AnyObject, keyPath: KeyPath) throws -> [[A: [B: C]]?] { +public func => (json: Any, keyPath: KeyPath) throws -> [[A: [B: C]]?] { return try parse(json, keyPath: keyPath, decoder: Array.decoder(Optional.decoder(Dictionary.decoder(key: A.decode, value: Dictionary.decoder(key: B.decode, value: C.decode))))) } @@ -368,7 +368,7 @@ public func => (json: AnyObject, keyPa /// - throws: `DecodingError.typeMismatchError`,`.other(error, metadata)` or possible `.missingKeyError` on required keys /// - returns: something /// -public func => (json: AnyObject, keyPath: KeyPath) throws -> [[A: B]?] { +public func => (json: Any, keyPath: KeyPath) throws -> [[A: B]?] { return try parse(json, keyPath: keyPath, decoder: Array.decoder(Optional.decoder(Dictionary.decoder(key: A.decode, value: B.decode)))) } @@ -379,7 +379,7 @@ public func => (json: AnyObject, keyPath: KeyPath) t /// - throws: `DecodingError.typeMismatchError`,`.other(error, metadata)` or possible `.missingKeyError` on required keys /// - returns: something /// -public func => (json: AnyObject, keyPath: KeyPath) throws -> [A?] { +public func => (json: Any, keyPath: KeyPath) throws -> [A?] { return try parse(json, keyPath: keyPath, decoder: Array.decoder(Optional.decoder(A.decode))) } @@ -390,7 +390,7 @@ public func => (json: AnyObject, keyPath: KeyPath) throws -> [A?] /// - throws: `DecodingError.typeMismatchError`,`.other(error, metadata)` or possible `.missingKeyError` on required keys /// - returns: something /// -public func => (json: AnyObject, keyPath: KeyPath) throws -> [[[A]?]] { +public func => (json: Any, keyPath: KeyPath) throws -> [[[A]?]] { return try parse(json, keyPath: keyPath, decoder: Array.decoder(Array.decoder(Optional.decoder(Array.decoder(A.decode))))) } @@ -401,7 +401,7 @@ public func => (json: AnyObject, keyPath: KeyPath) throws -> [[[A] /// - throws: `DecodingError.typeMismatchError`,`.other(error, metadata)` or possible `.missingKeyError` on required keys /// - returns: something /// -public func => (json: AnyObject, keyPath: KeyPath) throws -> [[[A: B]?]] { +public func => (json: Any, keyPath: KeyPath) throws -> [[[A: B]?]] { return try parse(json, keyPath: keyPath, decoder: Array.decoder(Array.decoder(Optional.decoder(Dictionary.decoder(key: A.decode, value: B.decode))))) } @@ -412,7 +412,7 @@ public func => (json: AnyObject, keyPath: KeyPath) t /// - throws: `DecodingError.typeMismatchError`,`.other(error, metadata)` or possible `.missingKeyError` on required keys /// - returns: something /// -public func => (json: AnyObject, keyPath: KeyPath) throws -> [[A?]] { +public func => (json: Any, keyPath: KeyPath) throws -> [[A?]] { return try parse(json, keyPath: keyPath, decoder: Array.decoder(Array.decoder(Optional.decoder(A.decode)))) } @@ -423,7 +423,7 @@ public func => (json: AnyObject, keyPath: KeyPath) throws -> [[A?] /// - throws: `DecodingError.typeMismatchError`,`.other(error, metadata)` or possible `.missingKeyError` on required keys /// - returns: something /// -public func => (json: AnyObject, keyPath: KeyPath) throws -> [[[A?]]] { +public func => (json: Any, keyPath: KeyPath) throws -> [[[A?]]] { return try parse(json, keyPath: keyPath, decoder: Array.decoder(Array.decoder(Array.decoder(Optional.decoder(A.decode))))) } @@ -434,7 +434,7 @@ public func => (json: AnyObject, keyPath: KeyPath) throws -> [[[A? /// - throws: `DecodingError.typeMismatchError`,`.other(error, metadata)` or possible `.missingKeyError` on required keys /// - returns: something /// -public func => (json: AnyObject, keyPath: KeyPath) throws -> [[[[A]]]] { +public func => (json: Any, keyPath: KeyPath) throws -> [[[[A]]]] { return try parse(json, keyPath: keyPath, decoder: Array.decoder(Array.decoder(Array.decoder(Array.decoder(A.decode))))) } @@ -445,7 +445,7 @@ public func => (json: AnyObject, keyPath: KeyPath) throws -> [[[[A /// - throws: `DecodingError.typeMismatchError`,`.other(error, metadata)` or possible `.missingKeyError` on required keys /// - returns: something /// -public func => (json: AnyObject, keyPath: KeyPath) throws -> [[[[A: B]]]] { +public func => (json: Any, keyPath: KeyPath) throws -> [[[[A: B]]]] { return try parse(json, keyPath: keyPath, decoder: Array.decoder(Array.decoder(Array.decoder(Dictionary.decoder(key: A.decode, value: B.decode))))) } @@ -456,7 +456,7 @@ public func => (json: AnyObject, keyPath: KeyPath) t /// - throws: `DecodingError.typeMismatchError`,`.other(error, metadata)` or possible `.missingKeyError` on required keys /// - returns: something /// -public func => (json: AnyObject, keyPath: KeyPath) throws -> [[[A]]] { +public func => (json: Any, keyPath: KeyPath) throws -> [[[A]]] { return try parse(json, keyPath: keyPath, decoder: Array.decoder(Array.decoder(Array.decoder(A.decode)))) } @@ -467,7 +467,7 @@ public func => (json: AnyObject, keyPath: KeyPath) throws -> [[[A] /// - throws: `DecodingError.typeMismatchError`,`.other(error, metadata)` or possible `.missingKeyError` on required keys /// - returns: something /// -public func => (json: AnyObject, keyPath: KeyPath) throws -> [[[A: B?]]] { +public func => (json: Any, keyPath: KeyPath) throws -> [[[A: B?]]] { return try parse(json, keyPath: keyPath, decoder: Array.decoder(Array.decoder(Dictionary.decoder(key: A.decode, value: Optional.decoder(B.decode))))) } @@ -478,7 +478,7 @@ public func => (json: AnyObject, keyPath: KeyPath) t /// - throws: `DecodingError.typeMismatchError`,`.other(error, metadata)` or possible `.missingKeyError` on required keys /// - returns: something /// -public func => (json: AnyObject, keyPath: KeyPath) throws -> [[[A: [B]]]] { +public func => (json: Any, keyPath: KeyPath) throws -> [[[A: [B]]]] { return try parse(json, keyPath: keyPath, decoder: Array.decoder(Array.decoder(Dictionary.decoder(key: A.decode, value: Array.decoder(B.decode))))) } @@ -489,7 +489,7 @@ public func => (json: AnyObject, keyPath: KeyPath) t /// - throws: `DecodingError.typeMismatchError`,`.other(error, metadata)` or possible `.missingKeyError` on required keys /// - returns: something /// -public func => (json: AnyObject, keyPath: KeyPath) throws -> [[[A: [B: C]]]] { +public func => (json: Any, keyPath: KeyPath) throws -> [[[A: [B: C]]]] { return try parse(json, keyPath: keyPath, decoder: Array.decoder(Array.decoder(Dictionary.decoder(key: A.decode, value: Dictionary.decoder(key: B.decode, value: C.decode))))) } @@ -500,7 +500,7 @@ public func => (json: AnyObject, keyPa /// - throws: `DecodingError.typeMismatchError`,`.other(error, metadata)` or possible `.missingKeyError` on required keys /// - returns: something /// -public func => (json: AnyObject, keyPath: KeyPath) throws -> [[[A: B]]] { +public func => (json: Any, keyPath: KeyPath) throws -> [[[A: B]]] { return try parse(json, keyPath: keyPath, decoder: Array.decoder(Array.decoder(Dictionary.decoder(key: A.decode, value: B.decode)))) } @@ -511,7 +511,7 @@ public func => (json: AnyObject, keyPath: KeyPath) t /// - throws: `DecodingError.typeMismatchError`,`.other(error, metadata)` or possible `.missingKeyError` on required keys /// - returns: something /// -public func => (json: AnyObject, keyPath: KeyPath) throws -> [[A]] { +public func => (json: Any, keyPath: KeyPath) throws -> [[A]] { return try parse(json, keyPath: keyPath, decoder: Array.decoder(Array.decoder(A.decode))) } @@ -522,7 +522,7 @@ public func => (json: AnyObject, keyPath: KeyPath) throws -> [[A]] /// - throws: `DecodingError.typeMismatchError`,`.other(error, metadata)` or possible `.missingKeyError` on required keys /// - returns: something /// -public func => (json: AnyObject, keyPath: KeyPath) throws -> [[A: [B]?]] { +public func => (json: Any, keyPath: KeyPath) throws -> [[A: [B]?]] { return try parse(json, keyPath: keyPath, decoder: Array.decoder(Dictionary.decoder(key: A.decode, value: Optional.decoder(Array.decoder(B.decode))))) } @@ -533,7 +533,7 @@ public func => (json: AnyObject, keyPath: KeyPath) t /// - throws: `DecodingError.typeMismatchError`,`.other(error, metadata)` or possible `.missingKeyError` on required keys /// - returns: something /// -public func => (json: AnyObject, keyPath: KeyPath) throws -> [[A: [B: C]?]] { +public func => (json: Any, keyPath: KeyPath) throws -> [[A: [B: C]?]] { return try parse(json, keyPath: keyPath, decoder: Array.decoder(Dictionary.decoder(key: A.decode, value: Optional.decoder(Dictionary.decoder(key: B.decode, value: C.decode))))) } @@ -544,7 +544,7 @@ public func => (json: AnyObject, keyPa /// - throws: `DecodingError.typeMismatchError`,`.other(error, metadata)` or possible `.missingKeyError` on required keys /// - returns: something /// -public func => (json: AnyObject, keyPath: KeyPath) throws -> [[A: B?]] { +public func => (json: Any, keyPath: KeyPath) throws -> [[A: B?]] { return try parse(json, keyPath: keyPath, decoder: Array.decoder(Dictionary.decoder(key: A.decode, value: Optional.decoder(B.decode)))) } @@ -555,7 +555,7 @@ public func => (json: AnyObject, keyPath: KeyPath) t /// - throws: `DecodingError.typeMismatchError`,`.other(error, metadata)` or possible `.missingKeyError` on required keys /// - returns: something /// -public func => (json: AnyObject, keyPath: KeyPath) throws -> [[A: [B?]]] { +public func => (json: Any, keyPath: KeyPath) throws -> [[A: [B?]]] { return try parse(json, keyPath: keyPath, decoder: Array.decoder(Dictionary.decoder(key: A.decode, value: Array.decoder(Optional.decoder(B.decode))))) } @@ -566,7 +566,7 @@ public func => (json: AnyObject, keyPath: KeyPath) t /// - throws: `DecodingError.typeMismatchError`,`.other(error, metadata)` or possible `.missingKeyError` on required keys /// - returns: something /// -public func => (json: AnyObject, keyPath: KeyPath) throws -> [[A: [[B]]]] { +public func => (json: Any, keyPath: KeyPath) throws -> [[A: [[B]]]] { return try parse(json, keyPath: keyPath, decoder: Array.decoder(Dictionary.decoder(key: A.decode, value: Array.decoder(Array.decoder(B.decode))))) } @@ -577,7 +577,7 @@ public func => (json: AnyObject, keyPath: KeyPath) t /// - throws: `DecodingError.typeMismatchError`,`.other(error, metadata)` or possible `.missingKeyError` on required keys /// - returns: something /// -public func => (json: AnyObject, keyPath: KeyPath) throws -> [[A: [[B: C]]]] { +public func => (json: Any, keyPath: KeyPath) throws -> [[A: [[B: C]]]] { return try parse(json, keyPath: keyPath, decoder: Array.decoder(Dictionary.decoder(key: A.decode, value: Array.decoder(Dictionary.decoder(key: B.decode, value: C.decode))))) } @@ -588,7 +588,7 @@ public func => (json: AnyObject, keyPa /// - throws: `DecodingError.typeMismatchError`,`.other(error, metadata)` or possible `.missingKeyError` on required keys /// - returns: something /// -public func => (json: AnyObject, keyPath: KeyPath) throws -> [[A: [B]]] { +public func => (json: Any, keyPath: KeyPath) throws -> [[A: [B]]] { return try parse(json, keyPath: keyPath, decoder: Array.decoder(Dictionary.decoder(key: A.decode, value: Array.decoder(B.decode)))) } @@ -599,7 +599,7 @@ public func => (json: AnyObject, keyPath: KeyPath) t /// - throws: `DecodingError.typeMismatchError`,`.other(error, metadata)` or possible `.missingKeyError` on required keys /// - returns: something /// -public func => (json: AnyObject, keyPath: KeyPath) throws -> [[A: [B: C?]]] { +public func => (json: Any, keyPath: KeyPath) throws -> [[A: [B: C?]]] { return try parse(json, keyPath: keyPath, decoder: Array.decoder(Dictionary.decoder(key: A.decode, value: Dictionary.decoder(key: B.decode, value: Optional.decoder(C.decode))))) } @@ -610,7 +610,7 @@ public func => (json: AnyObject, keyPa /// - throws: `DecodingError.typeMismatchError`,`.other(error, metadata)` or possible `.missingKeyError` on required keys /// - returns: something /// -public func => (json: AnyObject, keyPath: KeyPath) throws -> [[A: [B: [C]]]] { +public func => (json: Any, keyPath: KeyPath) throws -> [[A: [B: [C]]]] { return try parse(json, keyPath: keyPath, decoder: Array.decoder(Dictionary.decoder(key: A.decode, value: Dictionary.decoder(key: B.decode, value: Array.decoder(C.decode))))) } @@ -621,7 +621,7 @@ public func => (json: AnyObject, keyPa /// - throws: `DecodingError.typeMismatchError`,`.other(error, metadata)` or possible `.missingKeyError` on required keys /// - returns: something /// -public func => (json: AnyObject, keyPath: KeyPath) throws -> [[A: [B: [C: D]]]] { +public func => (json: Any, keyPath: KeyPath) throws -> [[A: [B: [C: D]]]] { return try parse(json, keyPath: keyPath, decoder: Array.decoder(Dictionary.decoder(key: A.decode, value: Dictionary.decoder(key: B.decode, value: Dictionary.decoder(key: C.decode, value: D.decode))))) } @@ -632,7 +632,7 @@ public func => (json: An /// - throws: `DecodingError.typeMismatchError`,`.other(error, metadata)` or possible `.missingKeyError` on required keys /// - returns: something /// -public func => (json: AnyObject, keyPath: KeyPath) throws -> [[A: [B: C]]] { +public func => (json: Any, keyPath: KeyPath) throws -> [[A: [B: C]]] { return try parse(json, keyPath: keyPath, decoder: Array.decoder(Dictionary.decoder(key: A.decode, value: Dictionary.decoder(key: B.decode, value: C.decode)))) } @@ -643,7 +643,7 @@ public func => (json: AnyObject, keyPa /// - throws: `DecodingError.typeMismatchError`,`.other(error, metadata)` or possible `.missingKeyError` on required keys /// - returns: something /// -public func => (json: AnyObject, keyPath: KeyPath) throws -> [[A: B]] { +public func => (json: Any, keyPath: KeyPath) throws -> [[A: B]] { return try parse(json, keyPath: keyPath, decoder: Array.decoder(Dictionary.decoder(key: A.decode, value: B.decode))) } @@ -654,7 +654,7 @@ public func => (json: AnyObject, keyPath: KeyPath) t /// - throws: `DecodingError.typeMismatchError`,`.other(error, metadata)` or possible `.missingKeyError` on required keys /// - returns: something /// -public func => (json: AnyObject, keyPath: KeyPath) throws -> [A] { +public func => (json: Any, keyPath: KeyPath) throws -> [A] { return try parse(json, keyPath: keyPath, decoder: Array.decoder(A.decode)) } @@ -665,7 +665,7 @@ public func => (json: AnyObject, keyPath: KeyPath) throws -> [A] { /// - throws: `DecodingError.typeMismatchError`,`.other(error, metadata)` or possible `.missingKeyError` on required keys /// - returns: something /// -public func => (json: AnyObject, keyPath: KeyPath) throws -> [A: [B?]?] { +public func => (json: Any, keyPath: KeyPath) throws -> [A: [B?]?] { return try parse(json, keyPath: keyPath, decoder: Dictionary.decoder(key: A.decode, value: Optional.decoder(Array.decoder(Optional.decoder(B.decode))))) } @@ -676,7 +676,7 @@ public func => (json: AnyObject, keyPath: KeyPath) t /// - throws: `DecodingError.typeMismatchError`,`.other(error, metadata)` or possible `.missingKeyError` on required keys /// - returns: something /// -public func => (json: AnyObject, keyPath: KeyPath) throws -> [A: [[B]]?] { +public func => (json: Any, keyPath: KeyPath) throws -> [A: [[B]]?] { return try parse(json, keyPath: keyPath, decoder: Dictionary.decoder(key: A.decode, value: Optional.decoder(Array.decoder(Array.decoder(B.decode))))) } @@ -687,7 +687,7 @@ public func => (json: AnyObject, keyPath: KeyPath) t /// - throws: `DecodingError.typeMismatchError`,`.other(error, metadata)` or possible `.missingKeyError` on required keys /// - returns: something /// -public func => (json: AnyObject, keyPath: KeyPath) throws -> [A: [[B: C]]?] { +public func => (json: Any, keyPath: KeyPath) throws -> [A: [[B: C]]?] { return try parse(json, keyPath: keyPath, decoder: Dictionary.decoder(key: A.decode, value: Optional.decoder(Array.decoder(Dictionary.decoder(key: B.decode, value: C.decode))))) } @@ -698,7 +698,7 @@ public func => (json: AnyObject, keyPa /// - throws: `DecodingError.typeMismatchError`,`.other(error, metadata)` or possible `.missingKeyError` on required keys /// - returns: something /// -public func => (json: AnyObject, keyPath: KeyPath) throws -> [A: [B]?] { +public func => (json: Any, keyPath: KeyPath) throws -> [A: [B]?] { return try parse(json, keyPath: keyPath, decoder: Dictionary.decoder(key: A.decode, value: Optional.decoder(Array.decoder(B.decode)))) } @@ -709,7 +709,7 @@ public func => (json: AnyObject, keyPath: KeyPath) t /// - throws: `DecodingError.typeMismatchError`,`.other(error, metadata)` or possible `.missingKeyError` on required keys /// - returns: something /// -public func => (json: AnyObject, keyPath: KeyPath) throws -> [A: [B: C?]?] { +public func => (json: Any, keyPath: KeyPath) throws -> [A: [B: C?]?] { return try parse(json, keyPath: keyPath, decoder: Dictionary.decoder(key: A.decode, value: Optional.decoder(Dictionary.decoder(key: B.decode, value: Optional.decoder(C.decode))))) } @@ -720,7 +720,7 @@ public func => (json: AnyObject, keyPa /// - throws: `DecodingError.typeMismatchError`,`.other(error, metadata)` or possible `.missingKeyError` on required keys /// - returns: something /// -public func => (json: AnyObject, keyPath: KeyPath) throws -> [A: [B: [C]]?] { +public func => (json: Any, keyPath: KeyPath) throws -> [A: [B: [C]]?] { return try parse(json, keyPath: keyPath, decoder: Dictionary.decoder(key: A.decode, value: Optional.decoder(Dictionary.decoder(key: B.decode, value: Array.decoder(C.decode))))) } @@ -731,7 +731,7 @@ public func => (json: AnyObject, keyPa /// - throws: `DecodingError.typeMismatchError`,`.other(error, metadata)` or possible `.missingKeyError` on required keys /// - returns: something /// -public func => (json: AnyObject, keyPath: KeyPath) throws -> [A: [B: [C: D]]?] { +public func => (json: Any, keyPath: KeyPath) throws -> [A: [B: [C: D]]?] { return try parse(json, keyPath: keyPath, decoder: Dictionary.decoder(key: A.decode, value: Optional.decoder(Dictionary.decoder(key: B.decode, value: Dictionary.decoder(key: C.decode, value: D.decode))))) } @@ -742,7 +742,7 @@ public func => (json: An /// - throws: `DecodingError.typeMismatchError`,`.other(error, metadata)` or possible `.missingKeyError` on required keys /// - returns: something /// -public func => (json: AnyObject, keyPath: KeyPath) throws -> [A: [B: C]?] { +public func => (json: Any, keyPath: KeyPath) throws -> [A: [B: C]?] { return try parse(json, keyPath: keyPath, decoder: Dictionary.decoder(key: A.decode, value: Optional.decoder(Dictionary.decoder(key: B.decode, value: C.decode)))) } @@ -753,7 +753,7 @@ public func => (json: AnyObject, keyPa /// - throws: `DecodingError.typeMismatchError`,`.other(error, metadata)` or possible `.missingKeyError` on required keys /// - returns: something /// -public func => (json: AnyObject, keyPath: KeyPath) throws -> [A: B?] { +public func => (json: Any, keyPath: KeyPath) throws -> [A: B?] { return try parse(json, keyPath: keyPath, decoder: Dictionary.decoder(key: A.decode, value: Optional.decoder(B.decode))) } @@ -764,7 +764,7 @@ public func => (json: AnyObject, keyPath: KeyPath) t /// - throws: `DecodingError.typeMismatchError`,`.other(error, metadata)` or possible `.missingKeyError` on required keys /// - returns: something /// -public func => (json: AnyObject, keyPath: KeyPath) throws -> [A: [[B]?]] { +public func => (json: Any, keyPath: KeyPath) throws -> [A: [[B]?]] { return try parse(json, keyPath: keyPath, decoder: Dictionary.decoder(key: A.decode, value: Array.decoder(Optional.decoder(Array.decoder(B.decode))))) } @@ -775,7 +775,7 @@ public func => (json: AnyObject, keyPath: KeyPath) t /// - throws: `DecodingError.typeMismatchError`,`.other(error, metadata)` or possible `.missingKeyError` on required keys /// - returns: something /// -public func => (json: AnyObject, keyPath: KeyPath) throws -> [A: [[B: C]?]] { +public func => (json: Any, keyPath: KeyPath) throws -> [A: [[B: C]?]] { return try parse(json, keyPath: keyPath, decoder: Dictionary.decoder(key: A.decode, value: Array.decoder(Optional.decoder(Dictionary.decoder(key: B.decode, value: C.decode))))) } @@ -786,7 +786,7 @@ public func => (json: AnyObject, keyPa /// - throws: `DecodingError.typeMismatchError`,`.other(error, metadata)` or possible `.missingKeyError` on required keys /// - returns: something /// -public func => (json: AnyObject, keyPath: KeyPath) throws -> [A: [B?]] { +public func => (json: Any, keyPath: KeyPath) throws -> [A: [B?]] { return try parse(json, keyPath: keyPath, decoder: Dictionary.decoder(key: A.decode, value: Array.decoder(Optional.decoder(B.decode)))) } @@ -797,7 +797,7 @@ public func => (json: AnyObject, keyPath: KeyPath) t /// - throws: `DecodingError.typeMismatchError`,`.other(error, metadata)` or possible `.missingKeyError` on required keys /// - returns: something /// -public func => (json: AnyObject, keyPath: KeyPath) throws -> [A: [[B?]]] { +public func => (json: Any, keyPath: KeyPath) throws -> [A: [[B?]]] { return try parse(json, keyPath: keyPath, decoder: Dictionary.decoder(key: A.decode, value: Array.decoder(Array.decoder(Optional.decoder(B.decode))))) } @@ -808,7 +808,7 @@ public func => (json: AnyObject, keyPath: KeyPath) t /// - throws: `DecodingError.typeMismatchError`,`.other(error, metadata)` or possible `.missingKeyError` on required keys /// - returns: something /// -public func => (json: AnyObject, keyPath: KeyPath) throws -> [A: [[[B]]]] { +public func => (json: Any, keyPath: KeyPath) throws -> [A: [[[B]]]] { return try parse(json, keyPath: keyPath, decoder: Dictionary.decoder(key: A.decode, value: Array.decoder(Array.decoder(Array.decoder(B.decode))))) } @@ -819,7 +819,7 @@ public func => (json: AnyObject, keyPath: KeyPath) t /// - throws: `DecodingError.typeMismatchError`,`.other(error, metadata)` or possible `.missingKeyError` on required keys /// - returns: something /// -public func => (json: AnyObject, keyPath: KeyPath) throws -> [A: [[[B: C]]]] { +public func => (json: Any, keyPath: KeyPath) throws -> [A: [[[B: C]]]] { return try parse(json, keyPath: keyPath, decoder: Dictionary.decoder(key: A.decode, value: Array.decoder(Array.decoder(Dictionary.decoder(key: B.decode, value: C.decode))))) } @@ -830,7 +830,7 @@ public func => (json: AnyObject, keyPa /// - throws: `DecodingError.typeMismatchError`,`.other(error, metadata)` or possible `.missingKeyError` on required keys /// - returns: something /// -public func => (json: AnyObject, keyPath: KeyPath) throws -> [A: [[B]]] { +public func => (json: Any, keyPath: KeyPath) throws -> [A: [[B]]] { return try parse(json, keyPath: keyPath, decoder: Dictionary.decoder(key: A.decode, value: Array.decoder(Array.decoder(B.decode)))) } @@ -841,7 +841,7 @@ public func => (json: AnyObject, keyPath: KeyPath) t /// - throws: `DecodingError.typeMismatchError`,`.other(error, metadata)` or possible `.missingKeyError` on required keys /// - returns: something /// -public func => (json: AnyObject, keyPath: KeyPath) throws -> [A: [[B: C?]]] { +public func => (json: Any, keyPath: KeyPath) throws -> [A: [[B: C?]]] { return try parse(json, keyPath: keyPath, decoder: Dictionary.decoder(key: A.decode, value: Array.decoder(Dictionary.decoder(key: B.decode, value: Optional.decoder(C.decode))))) } @@ -852,7 +852,7 @@ public func => (json: AnyObject, keyPa /// - throws: `DecodingError.typeMismatchError`,`.other(error, metadata)` or possible `.missingKeyError` on required keys /// - returns: something /// -public func => (json: AnyObject, keyPath: KeyPath) throws -> [A: [[B: [C]]]] { +public func => (json: Any, keyPath: KeyPath) throws -> [A: [[B: [C]]]] { return try parse(json, keyPath: keyPath, decoder: Dictionary.decoder(key: A.decode, value: Array.decoder(Dictionary.decoder(key: B.decode, value: Array.decoder(C.decode))))) } @@ -863,7 +863,7 @@ public func => (json: AnyObject, keyPa /// - throws: `DecodingError.typeMismatchError`,`.other(error, metadata)` or possible `.missingKeyError` on required keys /// - returns: something /// -public func => (json: AnyObject, keyPath: KeyPath) throws -> [A: [[B: [C: D]]]] { +public func => (json: Any, keyPath: KeyPath) throws -> [A: [[B: [C: D]]]] { return try parse(json, keyPath: keyPath, decoder: Dictionary.decoder(key: A.decode, value: Array.decoder(Dictionary.decoder(key: B.decode, value: Dictionary.decoder(key: C.decode, value: D.decode))))) } @@ -874,7 +874,7 @@ public func => (json: An /// - throws: `DecodingError.typeMismatchError`,`.other(error, metadata)` or possible `.missingKeyError` on required keys /// - returns: something /// -public func => (json: AnyObject, keyPath: KeyPath) throws -> [A: [[B: C]]] { +public func => (json: Any, keyPath: KeyPath) throws -> [A: [[B: C]]] { return try parse(json, keyPath: keyPath, decoder: Dictionary.decoder(key: A.decode, value: Array.decoder(Dictionary.decoder(key: B.decode, value: C.decode)))) } @@ -885,7 +885,7 @@ public func => (json: AnyObject, keyPa /// - throws: `DecodingError.typeMismatchError`,`.other(error, metadata)` or possible `.missingKeyError` on required keys /// - returns: something /// -public func => (json: AnyObject, keyPath: KeyPath) throws -> [A: [B]] { +public func => (json: Any, keyPath: KeyPath) throws -> [A: [B]] { return try parse(json, keyPath: keyPath, decoder: Dictionary.decoder(key: A.decode, value: Array.decoder(B.decode))) } @@ -896,7 +896,7 @@ public func => (json: AnyObject, keyPath: KeyPath) t /// - throws: `DecodingError.typeMismatchError`,`.other(error, metadata)` or possible `.missingKeyError` on required keys /// - returns: something /// -public func => (json: AnyObject, keyPath: KeyPath) throws -> [A: [B: [C]?]] { +public func => (json: Any, keyPath: KeyPath) throws -> [A: [B: [C]?]] { return try parse(json, keyPath: keyPath, decoder: Dictionary.decoder(key: A.decode, value: Dictionary.decoder(key: B.decode, value: Optional.decoder(Array.decoder(C.decode))))) } @@ -907,7 +907,7 @@ public func => (json: AnyObject, keyPa /// - throws: `DecodingError.typeMismatchError`,`.other(error, metadata)` or possible `.missingKeyError` on required keys /// - returns: something /// -public func => (json: AnyObject, keyPath: KeyPath) throws -> [A: [B: [C: D]?]] { +public func => (json: Any, keyPath: KeyPath) throws -> [A: [B: [C: D]?]] { return try parse(json, keyPath: keyPath, decoder: Dictionary.decoder(key: A.decode, value: Dictionary.decoder(key: B.decode, value: Optional.decoder(Dictionary.decoder(key: C.decode, value: D.decode))))) } @@ -918,7 +918,7 @@ public func => (json: An /// - throws: `DecodingError.typeMismatchError`,`.other(error, metadata)` or possible `.missingKeyError` on required keys /// - returns: something /// -public func => (json: AnyObject, keyPath: KeyPath) throws -> [A: [B: C?]] { +public func => (json: Any, keyPath: KeyPath) throws -> [A: [B: C?]] { return try parse(json, keyPath: keyPath, decoder: Dictionary.decoder(key: A.decode, value: Dictionary.decoder(key: B.decode, value: Optional.decoder(C.decode)))) } @@ -929,7 +929,7 @@ public func => (json: AnyObject, keyPa /// - throws: `DecodingError.typeMismatchError`,`.other(error, metadata)` or possible `.missingKeyError` on required keys /// - returns: something /// -public func => (json: AnyObject, keyPath: KeyPath) throws -> [A: [B: [C?]]] { +public func => (json: Any, keyPath: KeyPath) throws -> [A: [B: [C?]]] { return try parse(json, keyPath: keyPath, decoder: Dictionary.decoder(key: A.decode, value: Dictionary.decoder(key: B.decode, value: Array.decoder(Optional.decoder(C.decode))))) } @@ -940,7 +940,7 @@ public func => (json: AnyObject, keyPa /// - throws: `DecodingError.typeMismatchError`,`.other(error, metadata)` or possible `.missingKeyError` on required keys /// - returns: something /// -public func => (json: AnyObject, keyPath: KeyPath) throws -> [A: [B: [[C]]]] { +public func => (json: Any, keyPath: KeyPath) throws -> [A: [B: [[C]]]] { return try parse(json, keyPath: keyPath, decoder: Dictionary.decoder(key: A.decode, value: Dictionary.decoder(key: B.decode, value: Array.decoder(Array.decoder(C.decode))))) } @@ -951,7 +951,7 @@ public func => (json: AnyObject, keyPa /// - throws: `DecodingError.typeMismatchError`,`.other(error, metadata)` or possible `.missingKeyError` on required keys /// - returns: something /// -public func => (json: AnyObject, keyPath: KeyPath) throws -> [A: [B: [[C: D]]]] { +public func => (json: Any, keyPath: KeyPath) throws -> [A: [B: [[C: D]]]] { return try parse(json, keyPath: keyPath, decoder: Dictionary.decoder(key: A.decode, value: Dictionary.decoder(key: B.decode, value: Array.decoder(Dictionary.decoder(key: C.decode, value: D.decode))))) } @@ -962,7 +962,7 @@ public func => (json: An /// - throws: `DecodingError.typeMismatchError`,`.other(error, metadata)` or possible `.missingKeyError` on required keys /// - returns: something /// -public func => (json: AnyObject, keyPath: KeyPath) throws -> [A: [B: [C]]] { +public func => (json: Any, keyPath: KeyPath) throws -> [A: [B: [C]]] { return try parse(json, keyPath: keyPath, decoder: Dictionary.decoder(key: A.decode, value: Dictionary.decoder(key: B.decode, value: Array.decoder(C.decode)))) } @@ -973,7 +973,7 @@ public func => (json: AnyObject, keyPa /// - throws: `DecodingError.typeMismatchError`,`.other(error, metadata)` or possible `.missingKeyError` on required keys /// - returns: something /// -public func => (json: AnyObject, keyPath: KeyPath) throws -> [A: [B: [C: D?]]] { +public func => (json: Any, keyPath: KeyPath) throws -> [A: [B: [C: D?]]] { return try parse(json, keyPath: keyPath, decoder: Dictionary.decoder(key: A.decode, value: Dictionary.decoder(key: B.decode, value: Dictionary.decoder(key: C.decode, value: Optional.decoder(D.decode))))) } @@ -984,7 +984,7 @@ public func => (json: An /// - throws: `DecodingError.typeMismatchError`,`.other(error, metadata)` or possible `.missingKeyError` on required keys /// - returns: something /// -public func => (json: AnyObject, keyPath: KeyPath) throws -> [A: [B: [C: [D]]]] { +public func => (json: Any, keyPath: KeyPath) throws -> [A: [B: [C: [D]]]] { return try parse(json, keyPath: keyPath, decoder: Dictionary.decoder(key: A.decode, value: Dictionary.decoder(key: B.decode, value: Dictionary.decoder(key: C.decode, value: Array.decoder(D.decode))))) } @@ -995,7 +995,7 @@ public func => (json: An /// - throws: `DecodingError.typeMismatchError`,`.other(error, metadata)` or possible `.missingKeyError` on required keys /// - returns: something /// -public func => (json: AnyObject, keyPath: KeyPath) throws -> [A: [B: [C: [D: E]]]] { +public func => (json: Any, keyPath: KeyPath) throws -> [A: [B: [C: [D: E]]]] { return try parse(json, keyPath: keyPath, decoder: Dictionary.decoder(key: A.decode, value: Dictionary.decoder(key: B.decode, value: Dictionary.decoder(key: C.decode, value: Dictionary.decoder(key: D.decode, value: E.decode))))) } @@ -1006,7 +1006,7 @@ public func => (json: AnyObject, keyPath: KeyPath) throws -> [A: [B: [C: D]]] { +public func => (json: Any, keyPath: KeyPath) throws -> [A: [B: [C: D]]] { return try parse(json, keyPath: keyPath, decoder: Dictionary.decoder(key: A.decode, value: Dictionary.decoder(key: B.decode, value: Dictionary.decoder(key: C.decode, value: D.decode)))) } @@ -1017,7 +1017,7 @@ public func => (json: An /// - throws: `DecodingError.typeMismatchError`,`.other(error, metadata)` or possible `.missingKeyError` on required keys /// - returns: something /// -public func => (json: AnyObject, keyPath: KeyPath) throws -> [A: [B: C]] { +public func => (json: Any, keyPath: KeyPath) throws -> [A: [B: C]] { return try parse(json, keyPath: keyPath, decoder: Dictionary.decoder(key: A.decode, value: Dictionary.decoder(key: B.decode, value: C.decode))) } @@ -1028,7 +1028,7 @@ public func => (json: AnyObject, keyPa /// - throws: `DecodingError.typeMismatchError`,`.other(error, metadata)` or possible `.missingKeyError` on required keys /// - returns: something /// -public func => (json: AnyObject, keyPath: KeyPath) throws -> [A: B] { +public func => (json: Any, keyPath: KeyPath) throws -> [A: B] { return try parse(json, keyPath: keyPath, decoder: Dictionary.decoder(key: A.decode, value: B.decode)) } @@ -1039,7 +1039,7 @@ public func => (json: AnyObject, keyPath: KeyPath) t /// - throws: `DecodingError.typeMismatchError`,`.other(error, metadata)` or possible `.missingKeyError` on required keys /// - returns: something /// -public func => (json: AnyObject, keyPath: KeyPath) throws -> A { +public func => (json: Any, keyPath: KeyPath) throws -> A { return try parse(json, keyPath: keyPath, decoder: A.decode) } @@ -1050,7 +1050,7 @@ public func => (json: AnyObject, keyPath: KeyPath) throws -> A { /// - throws: `DecodingError.typeMismatch, `.other(error, metadata)` or possible `.missingKeyError` on required keys /// - returns: `nil` if the object at `path` is `NSNull` or if any optional key is missing. /// -public func =>? (json: AnyObject, keyPath: OptionalKeyPath) throws -> [[A?]?]? { +public func =>? (json: Any, keyPath: OptionalKeyPath) throws -> [[A?]?]? { return try parse(json, keyPath: keyPath, decoder: Optional.decoder(Array.decoder(Optional.decoder(Array.decoder(Optional.decoder(A.decode)))))) } @@ -1061,7 +1061,7 @@ public func =>? (json: AnyObject, keyPath: OptionalKeyPath) throws /// - throws: `DecodingError.typeMismatch, `.other(error, metadata)` or possible `.missingKeyError` on required keys /// - returns: `nil` if the object at `path` is `NSNull` or if any optional key is missing. /// -public func =>? (json: AnyObject, keyPath: OptionalKeyPath) throws -> [[[A]]?]? { +public func =>? (json: Any, keyPath: OptionalKeyPath) throws -> [[[A]]?]? { return try parse(json, keyPath: keyPath, decoder: Optional.decoder(Array.decoder(Optional.decoder(Array.decoder(Array.decoder(A.decode)))))) } @@ -1072,7 +1072,7 @@ public func =>? (json: AnyObject, keyPath: OptionalKeyPath) throws /// - throws: `DecodingError.typeMismatch, `.other(error, metadata)` or possible `.missingKeyError` on required keys /// - returns: `nil` if the object at `path` is `NSNull` or if any optional key is missing. /// -public func =>? (json: AnyObject, keyPath: OptionalKeyPath) throws -> [[[A: B]]?]? { +public func =>? (json: Any, keyPath: OptionalKeyPath) throws -> [[[A: B]]?]? { return try parse(json, keyPath: keyPath, decoder: Optional.decoder(Array.decoder(Optional.decoder(Array.decoder(Dictionary.decoder(key: A.decode, value: B.decode)))))) } @@ -1083,7 +1083,7 @@ public func =>? (json: AnyObject, keyPath: OptionalK /// - throws: `DecodingError.typeMismatch, `.other(error, metadata)` or possible `.missingKeyError` on required keys /// - returns: `nil` if the object at `path` is `NSNull` or if any optional key is missing. /// -public func =>? (json: AnyObject, keyPath: OptionalKeyPath) throws -> [[A]?]? { +public func =>? (json: Any, keyPath: OptionalKeyPath) throws -> [[A]?]? { return try parse(json, keyPath: keyPath, decoder: Optional.decoder(Array.decoder(Optional.decoder(Array.decoder(A.decode))))) } @@ -1094,7 +1094,7 @@ public func =>? (json: AnyObject, keyPath: OptionalKeyPath) throws /// - throws: `DecodingError.typeMismatch, `.other(error, metadata)` or possible `.missingKeyError` on required keys /// - returns: `nil` if the object at `path` is `NSNull` or if any optional key is missing. /// -public func =>? (json: AnyObject, keyPath: OptionalKeyPath) throws -> [[A: B?]?]? { +public func =>? (json: Any, keyPath: OptionalKeyPath) throws -> [[A: B?]?]? { return try parse(json, keyPath: keyPath, decoder: Optional.decoder(Array.decoder(Optional.decoder(Dictionary.decoder(key: A.decode, value: Optional.decoder(B.decode)))))) } @@ -1105,7 +1105,7 @@ public func =>? (json: AnyObject, keyPath: OptionalK /// - throws: `DecodingError.typeMismatch, `.other(error, metadata)` or possible `.missingKeyError` on required keys /// - returns: `nil` if the object at `path` is `NSNull` or if any optional key is missing. /// -public func =>? (json: AnyObject, keyPath: OptionalKeyPath) throws -> [[A: [B]]?]? { +public func =>? (json: Any, keyPath: OptionalKeyPath) throws -> [[A: [B]]?]? { return try parse(json, keyPath: keyPath, decoder: Optional.decoder(Array.decoder(Optional.decoder(Dictionary.decoder(key: A.decode, value: Array.decoder(B.decode)))))) } @@ -1116,7 +1116,7 @@ public func =>? (json: AnyObject, keyPath: OptionalK /// - throws: `DecodingError.typeMismatch, `.other(error, metadata)` or possible `.missingKeyError` on required keys /// - returns: `nil` if the object at `path` is `NSNull` or if any optional key is missing. /// -public func =>? (json: AnyObject, keyPath: OptionalKeyPath) throws -> [[A: [B: C]]?]? { +public func =>? (json: Any, keyPath: OptionalKeyPath) throws -> [[A: [B: C]]?]? { return try parse(json, keyPath: keyPath, decoder: Optional.decoder(Array.decoder(Optional.decoder(Dictionary.decoder(key: A.decode, value: Dictionary.decoder(key: B.decode, value: C.decode)))))) } @@ -1127,7 +1127,7 @@ public func =>? (json: AnyObject, keyP /// - throws: `DecodingError.typeMismatch, `.other(error, metadata)` or possible `.missingKeyError` on required keys /// - returns: `nil` if the object at `path` is `NSNull` or if any optional key is missing. /// -public func =>? (json: AnyObject, keyPath: OptionalKeyPath) throws -> [[A: B]?]? { +public func =>? (json: Any, keyPath: OptionalKeyPath) throws -> [[A: B]?]? { return try parse(json, keyPath: keyPath, decoder: Optional.decoder(Array.decoder(Optional.decoder(Dictionary.decoder(key: A.decode, value: B.decode))))) } @@ -1138,7 +1138,7 @@ public func =>? (json: AnyObject, keyPath: OptionalK /// - throws: `DecodingError.typeMismatch, `.other(error, metadata)` or possible `.missingKeyError` on required keys /// - returns: `nil` if the object at `path` is `NSNull` or if any optional key is missing. /// -public func =>? (json: AnyObject, keyPath: OptionalKeyPath) throws -> [A?]? { +public func =>? (json: Any, keyPath: OptionalKeyPath) throws -> [A?]? { return try parse(json, keyPath: keyPath, decoder: Optional.decoder(Array.decoder(Optional.decoder(A.decode)))) } @@ -1149,7 +1149,7 @@ public func =>? (json: AnyObject, keyPath: OptionalKeyPath) throws /// - throws: `DecodingError.typeMismatch, `.other(error, metadata)` or possible `.missingKeyError` on required keys /// - returns: `nil` if the object at `path` is `NSNull` or if any optional key is missing. /// -public func =>? (json: AnyObject, keyPath: OptionalKeyPath) throws -> [[[A]?]]? { +public func =>? (json: Any, keyPath: OptionalKeyPath) throws -> [[[A]?]]? { return try parse(json, keyPath: keyPath, decoder: Optional.decoder(Array.decoder(Array.decoder(Optional.decoder(Array.decoder(A.decode)))))) } @@ -1160,7 +1160,7 @@ public func =>? (json: AnyObject, keyPath: OptionalKeyPath) throws /// - throws: `DecodingError.typeMismatch, `.other(error, metadata)` or possible `.missingKeyError` on required keys /// - returns: `nil` if the object at `path` is `NSNull` or if any optional key is missing. /// -public func =>? (json: AnyObject, keyPath: OptionalKeyPath) throws -> [[[A: B]?]]? { +public func =>? (json: Any, keyPath: OptionalKeyPath) throws -> [[[A: B]?]]? { return try parse(json, keyPath: keyPath, decoder: Optional.decoder(Array.decoder(Array.decoder(Optional.decoder(Dictionary.decoder(key: A.decode, value: B.decode)))))) } @@ -1171,7 +1171,7 @@ public func =>? (json: AnyObject, keyPath: OptionalK /// - throws: `DecodingError.typeMismatch, `.other(error, metadata)` or possible `.missingKeyError` on required keys /// - returns: `nil` if the object at `path` is `NSNull` or if any optional key is missing. /// -public func =>? (json: AnyObject, keyPath: OptionalKeyPath) throws -> [[A?]]? { +public func =>? (json: Any, keyPath: OptionalKeyPath) throws -> [[A?]]? { return try parse(json, keyPath: keyPath, decoder: Optional.decoder(Array.decoder(Array.decoder(Optional.decoder(A.decode))))) } @@ -1182,7 +1182,7 @@ public func =>? (json: AnyObject, keyPath: OptionalKeyPath) throws /// - throws: `DecodingError.typeMismatch, `.other(error, metadata)` or possible `.missingKeyError` on required keys /// - returns: `nil` if the object at `path` is `NSNull` or if any optional key is missing. /// -public func =>? (json: AnyObject, keyPath: OptionalKeyPath) throws -> [[[A?]]]? { +public func =>? (json: Any, keyPath: OptionalKeyPath) throws -> [[[A?]]]? { return try parse(json, keyPath: keyPath, decoder: Optional.decoder(Array.decoder(Array.decoder(Array.decoder(Optional.decoder(A.decode)))))) } @@ -1193,7 +1193,7 @@ public func =>? (json: AnyObject, keyPath: OptionalKeyPath) throws /// - throws: `DecodingError.typeMismatch, `.other(error, metadata)` or possible `.missingKeyError` on required keys /// - returns: `nil` if the object at `path` is `NSNull` or if any optional key is missing. /// -public func =>? (json: AnyObject, keyPath: OptionalKeyPath) throws -> [[[[A]]]]? { +public func =>? (json: Any, keyPath: OptionalKeyPath) throws -> [[[[A]]]]? { return try parse(json, keyPath: keyPath, decoder: Optional.decoder(Array.decoder(Array.decoder(Array.decoder(Array.decoder(A.decode)))))) } @@ -1204,7 +1204,7 @@ public func =>? (json: AnyObject, keyPath: OptionalKeyPath) throws /// - throws: `DecodingError.typeMismatch, `.other(error, metadata)` or possible `.missingKeyError` on required keys /// - returns: `nil` if the object at `path` is `NSNull` or if any optional key is missing. /// -public func =>? (json: AnyObject, keyPath: OptionalKeyPath) throws -> [[[[A: B]]]]? { +public func =>? (json: Any, keyPath: OptionalKeyPath) throws -> [[[[A: B]]]]? { return try parse(json, keyPath: keyPath, decoder: Optional.decoder(Array.decoder(Array.decoder(Array.decoder(Dictionary.decoder(key: A.decode, value: B.decode)))))) } @@ -1215,7 +1215,7 @@ public func =>? (json: AnyObject, keyPath: OptionalK /// - throws: `DecodingError.typeMismatch, `.other(error, metadata)` or possible `.missingKeyError` on required keys /// - returns: `nil` if the object at `path` is `NSNull` or if any optional key is missing. /// -public func =>? (json: AnyObject, keyPath: OptionalKeyPath) throws -> [[[A]]]? { +public func =>? (json: Any, keyPath: OptionalKeyPath) throws -> [[[A]]]? { return try parse(json, keyPath: keyPath, decoder: Optional.decoder(Array.decoder(Array.decoder(Array.decoder(A.decode))))) } @@ -1226,7 +1226,7 @@ public func =>? (json: AnyObject, keyPath: OptionalKeyPath) throws /// - throws: `DecodingError.typeMismatch, `.other(error, metadata)` or possible `.missingKeyError` on required keys /// - returns: `nil` if the object at `path` is `NSNull` or if any optional key is missing. /// -public func =>? (json: AnyObject, keyPath: OptionalKeyPath) throws -> [[[A: B?]]]? { +public func =>? (json: Any, keyPath: OptionalKeyPath) throws -> [[[A: B?]]]? { return try parse(json, keyPath: keyPath, decoder: Optional.decoder(Array.decoder(Array.decoder(Dictionary.decoder(key: A.decode, value: Optional.decoder(B.decode)))))) } @@ -1237,7 +1237,7 @@ public func =>? (json: AnyObject, keyPath: OptionalK /// - throws: `DecodingError.typeMismatch, `.other(error, metadata)` or possible `.missingKeyError` on required keys /// - returns: `nil` if the object at `path` is `NSNull` or if any optional key is missing. /// -public func =>? (json: AnyObject, keyPath: OptionalKeyPath) throws -> [[[A: [B]]]]? { +public func =>? (json: Any, keyPath: OptionalKeyPath) throws -> [[[A: [B]]]]? { return try parse(json, keyPath: keyPath, decoder: Optional.decoder(Array.decoder(Array.decoder(Dictionary.decoder(key: A.decode, value: Array.decoder(B.decode)))))) } @@ -1248,7 +1248,7 @@ public func =>? (json: AnyObject, keyPath: OptionalK /// - throws: `DecodingError.typeMismatch, `.other(error, metadata)` or possible `.missingKeyError` on required keys /// - returns: `nil` if the object at `path` is `NSNull` or if any optional key is missing. /// -public func =>? (json: AnyObject, keyPath: OptionalKeyPath) throws -> [[[A: [B: C]]]]? { +public func =>? (json: Any, keyPath: OptionalKeyPath) throws -> [[[A: [B: C]]]]? { return try parse(json, keyPath: keyPath, decoder: Optional.decoder(Array.decoder(Array.decoder(Dictionary.decoder(key: A.decode, value: Dictionary.decoder(key: B.decode, value: C.decode)))))) } @@ -1259,7 +1259,7 @@ public func =>? (json: AnyObject, keyP /// - throws: `DecodingError.typeMismatch, `.other(error, metadata)` or possible `.missingKeyError` on required keys /// - returns: `nil` if the object at `path` is `NSNull` or if any optional key is missing. /// -public func =>? (json: AnyObject, keyPath: OptionalKeyPath) throws -> [[[A: B]]]? { +public func =>? (json: Any, keyPath: OptionalKeyPath) throws -> [[[A: B]]]? { return try parse(json, keyPath: keyPath, decoder: Optional.decoder(Array.decoder(Array.decoder(Dictionary.decoder(key: A.decode, value: B.decode))))) } @@ -1270,7 +1270,7 @@ public func =>? (json: AnyObject, keyPath: OptionalK /// - throws: `DecodingError.typeMismatch, `.other(error, metadata)` or possible `.missingKeyError` on required keys /// - returns: `nil` if the object at `path` is `NSNull` or if any optional key is missing. /// -public func =>? (json: AnyObject, keyPath: OptionalKeyPath) throws -> [[A]]? { +public func =>? (json: Any, keyPath: OptionalKeyPath) throws -> [[A]]? { return try parse(json, keyPath: keyPath, decoder: Optional.decoder(Array.decoder(Array.decoder(A.decode)))) } @@ -1281,7 +1281,7 @@ public func =>? (json: AnyObject, keyPath: OptionalKeyPath) throws /// - throws: `DecodingError.typeMismatch, `.other(error, metadata)` or possible `.missingKeyError` on required keys /// - returns: `nil` if the object at `path` is `NSNull` or if any optional key is missing. /// -public func =>? (json: AnyObject, keyPath: OptionalKeyPath) throws -> [[A: [B]?]]? { +public func =>? (json: Any, keyPath: OptionalKeyPath) throws -> [[A: [B]?]]? { return try parse(json, keyPath: keyPath, decoder: Optional.decoder(Array.decoder(Dictionary.decoder(key: A.decode, value: Optional.decoder(Array.decoder(B.decode)))))) } @@ -1292,7 +1292,7 @@ public func =>? (json: AnyObject, keyPath: OptionalK /// - throws: `DecodingError.typeMismatch, `.other(error, metadata)` or possible `.missingKeyError` on required keys /// - returns: `nil` if the object at `path` is `NSNull` or if any optional key is missing. /// -public func =>? (json: AnyObject, keyPath: OptionalKeyPath) throws -> [[A: [B: C]?]]? { +public func =>? (json: Any, keyPath: OptionalKeyPath) throws -> [[A: [B: C]?]]? { return try parse(json, keyPath: keyPath, decoder: Optional.decoder(Array.decoder(Dictionary.decoder(key: A.decode, value: Optional.decoder(Dictionary.decoder(key: B.decode, value: C.decode)))))) } @@ -1303,7 +1303,7 @@ public func =>? (json: AnyObject, keyP /// - throws: `DecodingError.typeMismatch, `.other(error, metadata)` or possible `.missingKeyError` on required keys /// - returns: `nil` if the object at `path` is `NSNull` or if any optional key is missing. /// -public func =>? (json: AnyObject, keyPath: OptionalKeyPath) throws -> [[A: B?]]? { +public func =>? (json: Any, keyPath: OptionalKeyPath) throws -> [[A: B?]]? { return try parse(json, keyPath: keyPath, decoder: Optional.decoder(Array.decoder(Dictionary.decoder(key: A.decode, value: Optional.decoder(B.decode))))) } @@ -1314,7 +1314,7 @@ public func =>? (json: AnyObject, keyPath: OptionalK /// - throws: `DecodingError.typeMismatch, `.other(error, metadata)` or possible `.missingKeyError` on required keys /// - returns: `nil` if the object at `path` is `NSNull` or if any optional key is missing. /// -public func =>? (json: AnyObject, keyPath: OptionalKeyPath) throws -> [[A: [B?]]]? { +public func =>? (json: Any, keyPath: OptionalKeyPath) throws -> [[A: [B?]]]? { return try parse(json, keyPath: keyPath, decoder: Optional.decoder(Array.decoder(Dictionary.decoder(key: A.decode, value: Array.decoder(Optional.decoder(B.decode)))))) } @@ -1325,7 +1325,7 @@ public func =>? (json: AnyObject, keyPath: OptionalK /// - throws: `DecodingError.typeMismatch, `.other(error, metadata)` or possible `.missingKeyError` on required keys /// - returns: `nil` if the object at `path` is `NSNull` or if any optional key is missing. /// -public func =>? (json: AnyObject, keyPath: OptionalKeyPath) throws -> [[A: [[B]]]]? { +public func =>? (json: Any, keyPath: OptionalKeyPath) throws -> [[A: [[B]]]]? { return try parse(json, keyPath: keyPath, decoder: Optional.decoder(Array.decoder(Dictionary.decoder(key: A.decode, value: Array.decoder(Array.decoder(B.decode)))))) } @@ -1336,7 +1336,7 @@ public func =>? (json: AnyObject, keyPath: OptionalK /// - throws: `DecodingError.typeMismatch, `.other(error, metadata)` or possible `.missingKeyError` on required keys /// - returns: `nil` if the object at `path` is `NSNull` or if any optional key is missing. /// -public func =>? (json: AnyObject, keyPath: OptionalKeyPath) throws -> [[A: [[B: C]]]]? { +public func =>? (json: Any, keyPath: OptionalKeyPath) throws -> [[A: [[B: C]]]]? { return try parse(json, keyPath: keyPath, decoder: Optional.decoder(Array.decoder(Dictionary.decoder(key: A.decode, value: Array.decoder(Dictionary.decoder(key: B.decode, value: C.decode)))))) } @@ -1347,7 +1347,7 @@ public func =>? (json: AnyObject, keyP /// - throws: `DecodingError.typeMismatch, `.other(error, metadata)` or possible `.missingKeyError` on required keys /// - returns: `nil` if the object at `path` is `NSNull` or if any optional key is missing. /// -public func =>? (json: AnyObject, keyPath: OptionalKeyPath) throws -> [[A: [B]]]? { +public func =>? (json: Any, keyPath: OptionalKeyPath) throws -> [[A: [B]]]? { return try parse(json, keyPath: keyPath, decoder: Optional.decoder(Array.decoder(Dictionary.decoder(key: A.decode, value: Array.decoder(B.decode))))) } @@ -1358,7 +1358,7 @@ public func =>? (json: AnyObject, keyPath: OptionalK /// - throws: `DecodingError.typeMismatch, `.other(error, metadata)` or possible `.missingKeyError` on required keys /// - returns: `nil` if the object at `path` is `NSNull` or if any optional key is missing. /// -public func =>? (json: AnyObject, keyPath: OptionalKeyPath) throws -> [[A: [B: C?]]]? { +public func =>? (json: Any, keyPath: OptionalKeyPath) throws -> [[A: [B: C?]]]? { return try parse(json, keyPath: keyPath, decoder: Optional.decoder(Array.decoder(Dictionary.decoder(key: A.decode, value: Dictionary.decoder(key: B.decode, value: Optional.decoder(C.decode)))))) } @@ -1369,7 +1369,7 @@ public func =>? (json: AnyObject, keyP /// - throws: `DecodingError.typeMismatch, `.other(error, metadata)` or possible `.missingKeyError` on required keys /// - returns: `nil` if the object at `path` is `NSNull` or if any optional key is missing. /// -public func =>? (json: AnyObject, keyPath: OptionalKeyPath) throws -> [[A: [B: [C]]]]? { +public func =>? (json: Any, keyPath: OptionalKeyPath) throws -> [[A: [B: [C]]]]? { return try parse(json, keyPath: keyPath, decoder: Optional.decoder(Array.decoder(Dictionary.decoder(key: A.decode, value: Dictionary.decoder(key: B.decode, value: Array.decoder(C.decode)))))) } @@ -1380,7 +1380,7 @@ public func =>? (json: AnyObject, keyP /// - throws: `DecodingError.typeMismatch, `.other(error, metadata)` or possible `.missingKeyError` on required keys /// - returns: `nil` if the object at `path` is `NSNull` or if any optional key is missing. /// -public func =>? (json: AnyObject, keyPath: OptionalKeyPath) throws -> [[A: [B: [C: D]]]]? { +public func =>? (json: Any, keyPath: OptionalKeyPath) throws -> [[A: [B: [C: D]]]]? { return try parse(json, keyPath: keyPath, decoder: Optional.decoder(Array.decoder(Dictionary.decoder(key: A.decode, value: Dictionary.decoder(key: B.decode, value: Dictionary.decoder(key: C.decode, value: D.decode)))))) } @@ -1391,7 +1391,7 @@ public func =>? (json: A /// - throws: `DecodingError.typeMismatch, `.other(error, metadata)` or possible `.missingKeyError` on required keys /// - returns: `nil` if the object at `path` is `NSNull` or if any optional key is missing. /// -public func =>? (json: AnyObject, keyPath: OptionalKeyPath) throws -> [[A: [B: C]]]? { +public func =>? (json: Any, keyPath: OptionalKeyPath) throws -> [[A: [B: C]]]? { return try parse(json, keyPath: keyPath, decoder: Optional.decoder(Array.decoder(Dictionary.decoder(key: A.decode, value: Dictionary.decoder(key: B.decode, value: C.decode))))) } @@ -1402,7 +1402,7 @@ public func =>? (json: AnyObject, keyP /// - throws: `DecodingError.typeMismatch, `.other(error, metadata)` or possible `.missingKeyError` on required keys /// - returns: `nil` if the object at `path` is `NSNull` or if any optional key is missing. /// -public func =>? (json: AnyObject, keyPath: OptionalKeyPath) throws -> [[A: B]]? { +public func =>? (json: Any, keyPath: OptionalKeyPath) throws -> [[A: B]]? { return try parse(json, keyPath: keyPath, decoder: Optional.decoder(Array.decoder(Dictionary.decoder(key: A.decode, value: B.decode)))) } @@ -1413,7 +1413,7 @@ public func =>? (json: AnyObject, keyPath: OptionalK /// - throws: `DecodingError.typeMismatch, `.other(error, metadata)` or possible `.missingKeyError` on required keys /// - returns: `nil` if the object at `path` is `NSNull` or if any optional key is missing. /// -public func =>? (json: AnyObject, keyPath: OptionalKeyPath) throws -> [A]? { +public func =>? (json: Any, keyPath: OptionalKeyPath) throws -> [A]? { return try parse(json, keyPath: keyPath, decoder: Optional.decoder(Array.decoder(A.decode))) } @@ -1424,7 +1424,7 @@ public func =>? (json: AnyObject, keyPath: OptionalKeyPath) throws /// - throws: `DecodingError.typeMismatch, `.other(error, metadata)` or possible `.missingKeyError` on required keys /// - returns: `nil` if the object at `path` is `NSNull` or if any optional key is missing. /// -public func =>? (json: AnyObject, keyPath: OptionalKeyPath) throws -> [A: [B?]?]? { +public func =>? (json: Any, keyPath: OptionalKeyPath) throws -> [A: [B?]?]? { return try parse(json, keyPath: keyPath, decoder: Optional.decoder(Dictionary.decoder(key: A.decode, value: Optional.decoder(Array.decoder(Optional.decoder(B.decode)))))) } @@ -1435,7 +1435,7 @@ public func =>? (json: AnyObject, keyPath: OptionalK /// - throws: `DecodingError.typeMismatch, `.other(error, metadata)` or possible `.missingKeyError` on required keys /// - returns: `nil` if the object at `path` is `NSNull` or if any optional key is missing. /// -public func =>? (json: AnyObject, keyPath: OptionalKeyPath) throws -> [A: [[B]]?]? { +public func =>? (json: Any, keyPath: OptionalKeyPath) throws -> [A: [[B]]?]? { return try parse(json, keyPath: keyPath, decoder: Optional.decoder(Dictionary.decoder(key: A.decode, value: Optional.decoder(Array.decoder(Array.decoder(B.decode)))))) } @@ -1446,7 +1446,7 @@ public func =>? (json: AnyObject, keyPath: OptionalK /// - throws: `DecodingError.typeMismatch, `.other(error, metadata)` or possible `.missingKeyError` on required keys /// - returns: `nil` if the object at `path` is `NSNull` or if any optional key is missing. /// -public func =>? (json: AnyObject, keyPath: OptionalKeyPath) throws -> [A: [[B: C]]?]? { +public func =>? (json: Any, keyPath: OptionalKeyPath) throws -> [A: [[B: C]]?]? { return try parse(json, keyPath: keyPath, decoder: Optional.decoder(Dictionary.decoder(key: A.decode, value: Optional.decoder(Array.decoder(Dictionary.decoder(key: B.decode, value: C.decode)))))) } @@ -1457,7 +1457,7 @@ public func =>? (json: AnyObject, keyP /// - throws: `DecodingError.typeMismatch, `.other(error, metadata)` or possible `.missingKeyError` on required keys /// - returns: `nil` if the object at `path` is `NSNull` or if any optional key is missing. /// -public func =>? (json: AnyObject, keyPath: OptionalKeyPath) throws -> [A: [B]?]? { +public func =>? (json: Any, keyPath: OptionalKeyPath) throws -> [A: [B]?]? { return try parse(json, keyPath: keyPath, decoder: Optional.decoder(Dictionary.decoder(key: A.decode, value: Optional.decoder(Array.decoder(B.decode))))) } @@ -1468,7 +1468,7 @@ public func =>? (json: AnyObject, keyPath: OptionalK /// - throws: `DecodingError.typeMismatch, `.other(error, metadata)` or possible `.missingKeyError` on required keys /// - returns: `nil` if the object at `path` is `NSNull` or if any optional key is missing. /// -public func =>? (json: AnyObject, keyPath: OptionalKeyPath) throws -> [A: [B: C?]?]? { +public func =>? (json: Any, keyPath: OptionalKeyPath) throws -> [A: [B: C?]?]? { return try parse(json, keyPath: keyPath, decoder: Optional.decoder(Dictionary.decoder(key: A.decode, value: Optional.decoder(Dictionary.decoder(key: B.decode, value: Optional.decoder(C.decode)))))) } @@ -1479,7 +1479,7 @@ public func =>? (json: AnyObject, keyP /// - throws: `DecodingError.typeMismatch, `.other(error, metadata)` or possible `.missingKeyError` on required keys /// - returns: `nil` if the object at `path` is `NSNull` or if any optional key is missing. /// -public func =>? (json: AnyObject, keyPath: OptionalKeyPath) throws -> [A: [B: [C]]?]? { +public func =>? (json: Any, keyPath: OptionalKeyPath) throws -> [A: [B: [C]]?]? { return try parse(json, keyPath: keyPath, decoder: Optional.decoder(Dictionary.decoder(key: A.decode, value: Optional.decoder(Dictionary.decoder(key: B.decode, value: Array.decoder(C.decode)))))) } @@ -1490,7 +1490,7 @@ public func =>? (json: AnyObject, keyP /// - throws: `DecodingError.typeMismatch, `.other(error, metadata)` or possible `.missingKeyError` on required keys /// - returns: `nil` if the object at `path` is `NSNull` or if any optional key is missing. /// -public func =>? (json: AnyObject, keyPath: OptionalKeyPath) throws -> [A: [B: [C: D]]?]? { +public func =>? (json: Any, keyPath: OptionalKeyPath) throws -> [A: [B: [C: D]]?]? { return try parse(json, keyPath: keyPath, decoder: Optional.decoder(Dictionary.decoder(key: A.decode, value: Optional.decoder(Dictionary.decoder(key: B.decode, value: Dictionary.decoder(key: C.decode, value: D.decode)))))) } @@ -1501,7 +1501,7 @@ public func =>? (json: A /// - throws: `DecodingError.typeMismatch, `.other(error, metadata)` or possible `.missingKeyError` on required keys /// - returns: `nil` if the object at `path` is `NSNull` or if any optional key is missing. /// -public func =>? (json: AnyObject, keyPath: OptionalKeyPath) throws -> [A: [B: C]?]? { +public func =>? (json: Any, keyPath: OptionalKeyPath) throws -> [A: [B: C]?]? { return try parse(json, keyPath: keyPath, decoder: Optional.decoder(Dictionary.decoder(key: A.decode, value: Optional.decoder(Dictionary.decoder(key: B.decode, value: C.decode))))) } @@ -1512,7 +1512,7 @@ public func =>? (json: AnyObject, keyP /// - throws: `DecodingError.typeMismatch, `.other(error, metadata)` or possible `.missingKeyError` on required keys /// - returns: `nil` if the object at `path` is `NSNull` or if any optional key is missing. /// -public func =>? (json: AnyObject, keyPath: OptionalKeyPath) throws -> [A: B?]? { +public func =>? (json: Any, keyPath: OptionalKeyPath) throws -> [A: B?]? { return try parse(json, keyPath: keyPath, decoder: Optional.decoder(Dictionary.decoder(key: A.decode, value: Optional.decoder(B.decode)))) } @@ -1523,7 +1523,7 @@ public func =>? (json: AnyObject, keyPath: OptionalK /// - throws: `DecodingError.typeMismatch, `.other(error, metadata)` or possible `.missingKeyError` on required keys /// - returns: `nil` if the object at `path` is `NSNull` or if any optional key is missing. /// -public func =>? (json: AnyObject, keyPath: OptionalKeyPath) throws -> [A: [[B]?]]? { +public func =>? (json: Any, keyPath: OptionalKeyPath) throws -> [A: [[B]?]]? { return try parse(json, keyPath: keyPath, decoder: Optional.decoder(Dictionary.decoder(key: A.decode, value: Array.decoder(Optional.decoder(Array.decoder(B.decode)))))) } @@ -1534,7 +1534,7 @@ public func =>? (json: AnyObject, keyPath: OptionalK /// - throws: `DecodingError.typeMismatch, `.other(error, metadata)` or possible `.missingKeyError` on required keys /// - returns: `nil` if the object at `path` is `NSNull` or if any optional key is missing. /// -public func =>? (json: AnyObject, keyPath: OptionalKeyPath) throws -> [A: [[B: C]?]]? { +public func =>? (json: Any, keyPath: OptionalKeyPath) throws -> [A: [[B: C]?]]? { return try parse(json, keyPath: keyPath, decoder: Optional.decoder(Dictionary.decoder(key: A.decode, value: Array.decoder(Optional.decoder(Dictionary.decoder(key: B.decode, value: C.decode)))))) } @@ -1545,7 +1545,7 @@ public func =>? (json: AnyObject, keyP /// - throws: `DecodingError.typeMismatch, `.other(error, metadata)` or possible `.missingKeyError` on required keys /// - returns: `nil` if the object at `path` is `NSNull` or if any optional key is missing. /// -public func =>? (json: AnyObject, keyPath: OptionalKeyPath) throws -> [A: [B?]]? { +public func =>? (json: Any, keyPath: OptionalKeyPath) throws -> [A: [B?]]? { return try parse(json, keyPath: keyPath, decoder: Optional.decoder(Dictionary.decoder(key: A.decode, value: Array.decoder(Optional.decoder(B.decode))))) } @@ -1556,7 +1556,7 @@ public func =>? (json: AnyObject, keyPath: OptionalK /// - throws: `DecodingError.typeMismatch, `.other(error, metadata)` or possible `.missingKeyError` on required keys /// - returns: `nil` if the object at `path` is `NSNull` or if any optional key is missing. /// -public func =>? (json: AnyObject, keyPath: OptionalKeyPath) throws -> [A: [[B?]]]? { +public func =>? (json: Any, keyPath: OptionalKeyPath) throws -> [A: [[B?]]]? { return try parse(json, keyPath: keyPath, decoder: Optional.decoder(Dictionary.decoder(key: A.decode, value: Array.decoder(Array.decoder(Optional.decoder(B.decode)))))) } @@ -1567,7 +1567,7 @@ public func =>? (json: AnyObject, keyPath: OptionalK /// - throws: `DecodingError.typeMismatch, `.other(error, metadata)` or possible `.missingKeyError` on required keys /// - returns: `nil` if the object at `path` is `NSNull` or if any optional key is missing. /// -public func =>? (json: AnyObject, keyPath: OptionalKeyPath) throws -> [A: [[[B]]]]? { +public func =>? (json: Any, keyPath: OptionalKeyPath) throws -> [A: [[[B]]]]? { return try parse(json, keyPath: keyPath, decoder: Optional.decoder(Dictionary.decoder(key: A.decode, value: Array.decoder(Array.decoder(Array.decoder(B.decode)))))) } @@ -1578,7 +1578,7 @@ public func =>? (json: AnyObject, keyPath: OptionalK /// - throws: `DecodingError.typeMismatch, `.other(error, metadata)` or possible `.missingKeyError` on required keys /// - returns: `nil` if the object at `path` is `NSNull` or if any optional key is missing. /// -public func =>? (json: AnyObject, keyPath: OptionalKeyPath) throws -> [A: [[[B: C]]]]? { +public func =>? (json: Any, keyPath: OptionalKeyPath) throws -> [A: [[[B: C]]]]? { return try parse(json, keyPath: keyPath, decoder: Optional.decoder(Dictionary.decoder(key: A.decode, value: Array.decoder(Array.decoder(Dictionary.decoder(key: B.decode, value: C.decode)))))) } @@ -1589,7 +1589,7 @@ public func =>? (json: AnyObject, keyP /// - throws: `DecodingError.typeMismatch, `.other(error, metadata)` or possible `.missingKeyError` on required keys /// - returns: `nil` if the object at `path` is `NSNull` or if any optional key is missing. /// -public func =>? (json: AnyObject, keyPath: OptionalKeyPath) throws -> [A: [[B]]]? { +public func =>? (json: Any, keyPath: OptionalKeyPath) throws -> [A: [[B]]]? { return try parse(json, keyPath: keyPath, decoder: Optional.decoder(Dictionary.decoder(key: A.decode, value: Array.decoder(Array.decoder(B.decode))))) } @@ -1600,7 +1600,7 @@ public func =>? (json: AnyObject, keyPath: OptionalK /// - throws: `DecodingError.typeMismatch, `.other(error, metadata)` or possible `.missingKeyError` on required keys /// - returns: `nil` if the object at `path` is `NSNull` or if any optional key is missing. /// -public func =>? (json: AnyObject, keyPath: OptionalKeyPath) throws -> [A: [[B: C?]]]? { +public func =>? (json: Any, keyPath: OptionalKeyPath) throws -> [A: [[B: C?]]]? { return try parse(json, keyPath: keyPath, decoder: Optional.decoder(Dictionary.decoder(key: A.decode, value: Array.decoder(Dictionary.decoder(key: B.decode, value: Optional.decoder(C.decode)))))) } @@ -1611,7 +1611,7 @@ public func =>? (json: AnyObject, keyP /// - throws: `DecodingError.typeMismatch, `.other(error, metadata)` or possible `.missingKeyError` on required keys /// - returns: `nil` if the object at `path` is `NSNull` or if any optional key is missing. /// -public func =>? (json: AnyObject, keyPath: OptionalKeyPath) throws -> [A: [[B: [C]]]]? { +public func =>? (json: Any, keyPath: OptionalKeyPath) throws -> [A: [[B: [C]]]]? { return try parse(json, keyPath: keyPath, decoder: Optional.decoder(Dictionary.decoder(key: A.decode, value: Array.decoder(Dictionary.decoder(key: B.decode, value: Array.decoder(C.decode)))))) } @@ -1622,7 +1622,7 @@ public func =>? (json: AnyObject, keyP /// - throws: `DecodingError.typeMismatch, `.other(error, metadata)` or possible `.missingKeyError` on required keys /// - returns: `nil` if the object at `path` is `NSNull` or if any optional key is missing. /// -public func =>? (json: AnyObject, keyPath: OptionalKeyPath) throws -> [A: [[B: [C: D]]]]? { +public func =>? (json: Any, keyPath: OptionalKeyPath) throws -> [A: [[B: [C: D]]]]? { return try parse(json, keyPath: keyPath, decoder: Optional.decoder(Dictionary.decoder(key: A.decode, value: Array.decoder(Dictionary.decoder(key: B.decode, value: Dictionary.decoder(key: C.decode, value: D.decode)))))) } @@ -1633,7 +1633,7 @@ public func =>? (json: A /// - throws: `DecodingError.typeMismatch, `.other(error, metadata)` or possible `.missingKeyError` on required keys /// - returns: `nil` if the object at `path` is `NSNull` or if any optional key is missing. /// -public func =>? (json: AnyObject, keyPath: OptionalKeyPath) throws -> [A: [[B: C]]]? { +public func =>? (json: Any, keyPath: OptionalKeyPath) throws -> [A: [[B: C]]]? { return try parse(json, keyPath: keyPath, decoder: Optional.decoder(Dictionary.decoder(key: A.decode, value: Array.decoder(Dictionary.decoder(key: B.decode, value: C.decode))))) } @@ -1644,7 +1644,7 @@ public func =>? (json: AnyObject, keyP /// - throws: `DecodingError.typeMismatch, `.other(error, metadata)` or possible `.missingKeyError` on required keys /// - returns: `nil` if the object at `path` is `NSNull` or if any optional key is missing. /// -public func =>? (json: AnyObject, keyPath: OptionalKeyPath) throws -> [A: [B]]? { +public func =>? (json: Any, keyPath: OptionalKeyPath) throws -> [A: [B]]? { return try parse(json, keyPath: keyPath, decoder: Optional.decoder(Dictionary.decoder(key: A.decode, value: Array.decoder(B.decode)))) } @@ -1655,7 +1655,7 @@ public func =>? (json: AnyObject, keyPath: OptionalK /// - throws: `DecodingError.typeMismatch, `.other(error, metadata)` or possible `.missingKeyError` on required keys /// - returns: `nil` if the object at `path` is `NSNull` or if any optional key is missing. /// -public func =>? (json: AnyObject, keyPath: OptionalKeyPath) throws -> [A: [B: [C]?]]? { +public func =>? (json: Any, keyPath: OptionalKeyPath) throws -> [A: [B: [C]?]]? { return try parse(json, keyPath: keyPath, decoder: Optional.decoder(Dictionary.decoder(key: A.decode, value: Dictionary.decoder(key: B.decode, value: Optional.decoder(Array.decoder(C.decode)))))) } @@ -1666,7 +1666,7 @@ public func =>? (json: AnyObject, keyP /// - throws: `DecodingError.typeMismatch, `.other(error, metadata)` or possible `.missingKeyError` on required keys /// - returns: `nil` if the object at `path` is `NSNull` or if any optional key is missing. /// -public func =>? (json: AnyObject, keyPath: OptionalKeyPath) throws -> [A: [B: [C: D]?]]? { +public func =>? (json: Any, keyPath: OptionalKeyPath) throws -> [A: [B: [C: D]?]]? { return try parse(json, keyPath: keyPath, decoder: Optional.decoder(Dictionary.decoder(key: A.decode, value: Dictionary.decoder(key: B.decode, value: Optional.decoder(Dictionary.decoder(key: C.decode, value: D.decode)))))) } @@ -1677,7 +1677,7 @@ public func =>? (json: A /// - throws: `DecodingError.typeMismatch, `.other(error, metadata)` or possible `.missingKeyError` on required keys /// - returns: `nil` if the object at `path` is `NSNull` or if any optional key is missing. /// -public func =>? (json: AnyObject, keyPath: OptionalKeyPath) throws -> [A: [B: C?]]? { +public func =>? (json: Any, keyPath: OptionalKeyPath) throws -> [A: [B: C?]]? { return try parse(json, keyPath: keyPath, decoder: Optional.decoder(Dictionary.decoder(key: A.decode, value: Dictionary.decoder(key: B.decode, value: Optional.decoder(C.decode))))) } @@ -1688,7 +1688,7 @@ public func =>? (json: AnyObject, keyP /// - throws: `DecodingError.typeMismatch, `.other(error, metadata)` or possible `.missingKeyError` on required keys /// - returns: `nil` if the object at `path` is `NSNull` or if any optional key is missing. /// -public func =>? (json: AnyObject, keyPath: OptionalKeyPath) throws -> [A: [B: [C?]]]? { +public func =>? (json: Any, keyPath: OptionalKeyPath) throws -> [A: [B: [C?]]]? { return try parse(json, keyPath: keyPath, decoder: Optional.decoder(Dictionary.decoder(key: A.decode, value: Dictionary.decoder(key: B.decode, value: Array.decoder(Optional.decoder(C.decode)))))) } @@ -1699,7 +1699,7 @@ public func =>? (json: AnyObject, keyP /// - throws: `DecodingError.typeMismatch, `.other(error, metadata)` or possible `.missingKeyError` on required keys /// - returns: `nil` if the object at `path` is `NSNull` or if any optional key is missing. /// -public func =>? (json: AnyObject, keyPath: OptionalKeyPath) throws -> [A: [B: [[C]]]]? { +public func =>? (json: Any, keyPath: OptionalKeyPath) throws -> [A: [B: [[C]]]]? { return try parse(json, keyPath: keyPath, decoder: Optional.decoder(Dictionary.decoder(key: A.decode, value: Dictionary.decoder(key: B.decode, value: Array.decoder(Array.decoder(C.decode)))))) } @@ -1710,7 +1710,7 @@ public func =>? (json: AnyObject, keyP /// - throws: `DecodingError.typeMismatch, `.other(error, metadata)` or possible `.missingKeyError` on required keys /// - returns: `nil` if the object at `path` is `NSNull` or if any optional key is missing. /// -public func =>? (json: AnyObject, keyPath: OptionalKeyPath) throws -> [A: [B: [[C: D]]]]? { +public func =>? (json: Any, keyPath: OptionalKeyPath) throws -> [A: [B: [[C: D]]]]? { return try parse(json, keyPath: keyPath, decoder: Optional.decoder(Dictionary.decoder(key: A.decode, value: Dictionary.decoder(key: B.decode, value: Array.decoder(Dictionary.decoder(key: C.decode, value: D.decode)))))) } @@ -1721,7 +1721,7 @@ public func =>? (json: A /// - throws: `DecodingError.typeMismatch, `.other(error, metadata)` or possible `.missingKeyError` on required keys /// - returns: `nil` if the object at `path` is `NSNull` or if any optional key is missing. /// -public func =>? (json: AnyObject, keyPath: OptionalKeyPath) throws -> [A: [B: [C]]]? { +public func =>? (json: Any, keyPath: OptionalKeyPath) throws -> [A: [B: [C]]]? { return try parse(json, keyPath: keyPath, decoder: Optional.decoder(Dictionary.decoder(key: A.decode, value: Dictionary.decoder(key: B.decode, value: Array.decoder(C.decode))))) } @@ -1732,7 +1732,7 @@ public func =>? (json: AnyObject, keyP /// - throws: `DecodingError.typeMismatch, `.other(error, metadata)` or possible `.missingKeyError` on required keys /// - returns: `nil` if the object at `path` is `NSNull` or if any optional key is missing. /// -public func =>? (json: AnyObject, keyPath: OptionalKeyPath) throws -> [A: [B: [C: D?]]]? { +public func =>? (json: Any, keyPath: OptionalKeyPath) throws -> [A: [B: [C: D?]]]? { return try parse(json, keyPath: keyPath, decoder: Optional.decoder(Dictionary.decoder(key: A.decode, value: Dictionary.decoder(key: B.decode, value: Dictionary.decoder(key: C.decode, value: Optional.decoder(D.decode)))))) } @@ -1743,7 +1743,7 @@ public func =>? (json: A /// - throws: `DecodingError.typeMismatch, `.other(error, metadata)` or possible `.missingKeyError` on required keys /// - returns: `nil` if the object at `path` is `NSNull` or if any optional key is missing. /// -public func =>? (json: AnyObject, keyPath: OptionalKeyPath) throws -> [A: [B: [C: [D]]]]? { +public func =>? (json: Any, keyPath: OptionalKeyPath) throws -> [A: [B: [C: [D]]]]? { return try parse(json, keyPath: keyPath, decoder: Optional.decoder(Dictionary.decoder(key: A.decode, value: Dictionary.decoder(key: B.decode, value: Dictionary.decoder(key: C.decode, value: Array.decoder(D.decode)))))) } @@ -1754,7 +1754,7 @@ public func =>? (json: A /// - throws: `DecodingError.typeMismatch, `.other(error, metadata)` or possible `.missingKeyError` on required keys /// - returns: `nil` if the object at `path` is `NSNull` or if any optional key is missing. /// -public func =>? (json: AnyObject, keyPath: OptionalKeyPath) throws -> [A: [B: [C: [D: E]]]]? { +public func =>? (json: Any, keyPath: OptionalKeyPath) throws -> [A: [B: [C: [D: E]]]]? { return try parse(json, keyPath: keyPath, decoder: Optional.decoder(Dictionary.decoder(key: A.decode, value: Dictionary.decoder(key: B.decode, value: Dictionary.decoder(key: C.decode, value: Dictionary.decoder(key: D.decode, value: E.decode)))))) } @@ -1765,7 +1765,7 @@ public func =>? ? (json: AnyObject, keyPath: OptionalKeyPath) throws -> [A: [B: [C: D]]]? { +public func =>? (json: Any, keyPath: OptionalKeyPath) throws -> [A: [B: [C: D]]]? { return try parse(json, keyPath: keyPath, decoder: Optional.decoder(Dictionary.decoder(key: A.decode, value: Dictionary.decoder(key: B.decode, value: Dictionary.decoder(key: C.decode, value: D.decode))))) } @@ -1776,7 +1776,7 @@ public func =>? (json: A /// - throws: `DecodingError.typeMismatch, `.other(error, metadata)` or possible `.missingKeyError` on required keys /// - returns: `nil` if the object at `path` is `NSNull` or if any optional key is missing. /// -public func =>? (json: AnyObject, keyPath: OptionalKeyPath) throws -> [A: [B: C]]? { +public func =>? (json: Any, keyPath: OptionalKeyPath) throws -> [A: [B: C]]? { return try parse(json, keyPath: keyPath, decoder: Optional.decoder(Dictionary.decoder(key: A.decode, value: Dictionary.decoder(key: B.decode, value: C.decode)))) } @@ -1787,7 +1787,7 @@ public func =>? (json: AnyObject, keyP /// - throws: `DecodingError.typeMismatch, `.other(error, metadata)` or possible `.missingKeyError` on required keys /// - returns: `nil` if the object at `path` is `NSNull` or if any optional key is missing. /// -public func =>? (json: AnyObject, keyPath: OptionalKeyPath) throws -> [A: B]? { +public func =>? (json: Any, keyPath: OptionalKeyPath) throws -> [A: B]? { return try parse(json, keyPath: keyPath, decoder: Optional.decoder(Dictionary.decoder(key: A.decode, value: B.decode))) } @@ -1798,6 +1798,6 @@ public func =>? (json: AnyObject, keyPath: OptionalK /// - throws: `DecodingError.typeMismatch, `.other(error, metadata)` or possible `.missingKeyError` on required keys /// - returns: `nil` if the object at `path` is `NSNull` or if any optional key is missing. /// -public func =>? (json: AnyObject, keyPath: OptionalKeyPath) throws -> A? { +public func =>? (json: Any, keyPath: OptionalKeyPath) throws -> A? { return try parse(json, keyPath: keyPath, decoder: Optional.decoder(A.decode)) } \ No newline at end of file diff --git a/Sources/Parse.swift b/Sources/Parse.swift index 4b00cf4..3ac05d3 100644 --- a/Sources/Parse.swift +++ b/Sources/Parse.swift @@ -8,7 +8,7 @@ import Foundation -func parse(_ json: AnyObject, _ keyPath: KeyPath) throws -> AnyObject { +func parse(_ json: Any, _ keyPath: KeyPath) throws -> Any { var currentDict = json for (index, key) in keyPath.keys.enumerated() { @@ -24,7 +24,7 @@ func parse(_ json: AnyObject, _ keyPath: KeyPath) throws -> AnyObject { return currentDict } -func parse(_ json: AnyObject, _ path: OptionalKeyPath) throws -> AnyObject? { +func parse(_ json: Any, _ path: OptionalKeyPath) throws -> Any? { var currentDict = json for (index, key) in path.keys.enumerated() { @@ -42,13 +42,13 @@ func parse(_ json: AnyObject, _ path: OptionalKeyPath) throws -> AnyObject? { return currentDict } -public func parse(_ json: AnyObject, keyPath: KeyPath, decoder: ((AnyObject) throws -> T)) throws -> T { +public func parse(_ json: Any, keyPath: KeyPath, decoder: ((Any) throws -> T)) throws -> T { let object = try parse(json, keyPath) return try catchAndRethrow(json, keyPath) { try decoder(object) } } // FIXME: Should perhaps not return T?, but this way we don't have to flatMap in certain overloads -public func parse(_ json: AnyObject, keyPath: OptionalKeyPath, decoder: ((AnyObject) throws -> T?)) throws -> T? { +public func parse(_ json: Any, keyPath: OptionalKeyPath, decoder: ((Any) throws -> T?)) throws -> T? { guard let object = try parse(json, keyPath) else { return nil } return try catchAndRethrow(json, keyPath) { try decoder(object) } } @@ -64,7 +64,7 @@ func catchMissingKeyAndReturnNil(_ closure: (Void) throws -> T) throws -> T? } } -func catchAndRethrow(_ json: AnyObject, _ keyPath: KeyPath, block: (Void) throws -> T) throws -> T { +func catchAndRethrow(_ json: Any, _ keyPath: KeyPath, block: (Void) throws -> T) throws -> T { do { return try block() } catch let error as DecodingError { @@ -77,7 +77,7 @@ func catchAndRethrow(_ json: AnyObject, _ keyPath: KeyPath, block: (Void) thr } } -func catchAndRethrow(_ json: AnyObject, _ keyPath: OptionalKeyPath, block: (Void) throws -> T) throws -> T { +func catchAndRethrow(_ json: Any, _ keyPath: OptionalKeyPath, block: (Void) throws -> T) throws -> T { do { return try block() } catch let error as DecodingError { diff --git a/Sources/RawRepresentableDecodable.swift b/Sources/RawRepresentableDecodable.swift index ed271ac..d8ae331 100644 --- a/Sources/RawRepresentableDecodable.swift +++ b/Sources/RawRepresentableDecodable.swift @@ -14,7 +14,7 @@ */ public extension RawRepresentable where RawValue: Decodable, Self: Decodable { - static func decode(_ json: AnyObject) throws -> Self { + static func decode(_ json: Any) throws -> Self { let rawValue = try RawValue.decode(json) guard let rawRepresentable = Self(rawValue: rawValue) else { let metadata = DecodingError.Metadata(object: json) diff --git a/Tests/ArrayTests.swift b/Tests/ArrayTests.swift index 816d709..02493f1 100644 --- a/Tests/ArrayTests.swift +++ b/Tests/ArrayTests.swift @@ -19,7 +19,7 @@ class DecodableArrayTests: XCTestCase { // when let result = try! dictionary => KeyPath(key) as Array // then - XCTAssertEqual(result, value) + XCTAssertEqual(result, value as! [String]) } func testDecodeOptionalDecodableArraySuccess() { @@ -60,7 +60,7 @@ class DecodableArrayTests: XCTestCase { // when let result = try! dictionary => "key" => "key" as Array // then - XCTAssertEqual(result, value) + XCTAssertEqual(result, value as! [String]) } func testDecodeAnyDecodableOptionalArraySuccess() { @@ -126,7 +126,7 @@ class DecodableArrayTests: XCTestCase { func testDecodeSafeArrayCatchTypeExceptionMismatch() { // given let key = "key" - let value = ["A", 2, "B"] + let value = ["A", 2, "B"] as [Any] let dictionary: NSDictionary = [key: value] // when let array = try! [String].decode(dictionary => "key", ignoreInvalidObjects: true) @@ -148,7 +148,7 @@ class DecodableArrayTests: XCTestCase { func testDecodeSafeArrayCatchJSONNotObjectException() { // given let key = "key" - let value = [["id": 7, "login": "mradams"], 2] + let value = [["id": 7, "login": "mradams"], 2] as [Any] let dictionary: NSDictionary = [key: value] // when let array = try! [Owner].decode(dictionary => "key", ignoreInvalidObjects: true) diff --git a/Tests/DecodableOperatorsTests.swift b/Tests/DecodableOperatorsTests.swift index e509ecc..ab1ee56 100644 --- a/Tests/DecodableOperatorsTests.swift +++ b/Tests/DecodableOperatorsTests.swift @@ -43,7 +43,7 @@ class DecodableOperatorsTests: XCTestCase { // when let result: [String: [Int]] = try! dictionary => KeyPath(key) // then - XCTAssertEqual(result, value) + XCTAssertEqual(result as NSDictionary, value) } // MARK: - Nested keys @@ -63,9 +63,9 @@ class DecodableOperatorsTests: XCTestCase { let value: NSDictionary = ["aKey" : "value"] let dictionary: NSDictionary = ["key": ["key": value]] // when - let result: [String: AnyObject]? = try! dictionary => "key" => "key" as! [String : AnyObject] + let result = try! dictionary => "key" => "key" as! [String : Any] // then - XCTAssertEqual(result, value) + XCTAssertEqual(result as NSDictionary, value) } // TODO: this does not compile with Swift 3 @@ -87,7 +87,7 @@ class DecodableOperatorsTests: XCTestCase { // when let result = try! dictionary => "key" => "key" as! [String: String] // then - XCTAssertEqual(result, value) + XCTAssertEqual(result, value as! [String : String]) } func testDecodeAnyDecodableOptionalSuccess() { @@ -121,7 +121,7 @@ class DecodableOperatorsTests: XCTestCase { print(a) XCTFail() } catch let DecodingError.typeMismatch(_, actual, _) { - XCTAssertEqual(String(actual), "__NSCFNumber") + XCTAssertEqual(String(describing: actual), "_SwiftTypePreservingNSNumber") } catch let error { XCTFail("should not throw \(error)") } @@ -205,7 +205,7 @@ class DecodableOperatorsTests: XCTestCase { } catch let DecodingError.typeMismatch(expected, actual, metadata) where expected == NSDictionary.self { // then XCTAssertTrue(true) - XCTAssertEqual(String(actual), "__NSCFString") + XCTAssertEqual(String(describing: actual), "__NSCFString") XCTAssertEqual(metadata.formattedPath, "") XCTAssertEqual(metadata.object as? NSString, (noDictionary)) } catch let error { @@ -242,7 +242,7 @@ class DecodableOperatorsTests: XCTestCase { } catch let DecodingError.typeMismatch(expected, actual, metadata) where expected == NSDictionary.self { // then XCTAssertTrue(true) - XCTAssertEqual(String(actual), "__NSCFString") + XCTAssertEqual(String(describing: actual), "__NSCFString") XCTAssertEqual(metadata.formattedPath, "") XCTAssertEqual(metadata.object as? NSString, noDictionary) } catch let error { diff --git a/Tests/DecodableTests.swift b/Tests/DecodableTests.swift index 6b2653f..dda8abd 100644 --- a/Tests/DecodableTests.swift +++ b/Tests/DecodableTests.swift @@ -84,7 +84,7 @@ class DecodableTests: XCTestCase { } - private func customParseRepository(_ json: AnyObject) throws -> [Repository] { + private func customParseRepository(_ json: Any) throws -> [Repository] { let error = NSError(domain: "test", code: 0, userInfo: nil) guard let array = json as? [NSDictionary] else { throw error diff --git a/Tests/DecodeAsOneOfTests.swift b/Tests/DecodeAsOneOfTests.swift index a6b0f0b..70faf34 100644 --- a/Tests/DecodeAsOneOfTests.swift +++ b/Tests/DecodeAsOneOfTests.swift @@ -26,11 +26,11 @@ class DecodeAsOneOfTests: XCTestCase { // when do { - let vehiclesRaw: AnyObject = try json => "vehicles" + let vehiclesRaw: Any = try json => "vehicles" let vehicles1 = try decodeArrayAsOneOf(vehiclesRaw, objectTypes: Train.self, Truck.self, Car.self) - guard let vehiclesArray = vehiclesRaw as? [AnyObject] else { + guard let vehiclesArray = vehiclesRaw as? [Any] else { let metadata = DecodingError.Metadata(object: vehiclesRaw) throw DecodingError.typeMismatch(expected: NSArray.self, actual: Mirror(reflecting: vehiclesRaw).subjectType, metadata) } diff --git a/Tests/DictionaryTests.swift b/Tests/DictionaryTests.swift index b944425..8eba1e2 100644 --- a/Tests/DictionaryTests.swift +++ b/Tests/DictionaryTests.swift @@ -10,11 +10,11 @@ import XCTest import Decodable private struct AccessibilityInfo: Decodable { - let data: [String: AnyObject] + let data: [String: Any] - private static func decode(_ json: AnyObject) throws -> AccessibilityInfo { + static func decode(_ json: Any) throws -> AccessibilityInfo { return try AccessibilityInfo( - data: [String: AnyObject].decode(json) + data: [String: Any].decode(json) ) } } @@ -47,10 +47,10 @@ class DictionaryTests: XCTestCase { XCTAssertNil(result) } - func testStringAnyObject() { + func testStringAny() { let dict: NSDictionary = ["a": 2] let info = try! AccessibilityInfo.decode(dict) - XCTAssertEqual(info.data, dict) + XCTAssertEqual(info.data as NSDictionary, dict) } diff --git a/Tests/ErrorPathTests.swift b/Tests/ErrorPathTests.swift index 2c989e6..c98b3f1 100644 --- a/Tests/ErrorPathTests.swift +++ b/Tests/ErrorPathTests.swift @@ -12,7 +12,7 @@ import XCTest private struct Color: Decodable { let name: String - private static func decode(_ json: AnyObject) throws -> Color { + static func decode(_ json: Any) throws -> Color { return try Color(name: json => "name") } } @@ -21,7 +21,7 @@ private struct Apple: Decodable { let id: Int let color: Color? - private static func decode(_ json: AnyObject) throws -> Apple { + static func decode(_ json: Any) throws -> Apple { return try Apple(id: json => "id", color: json => "color") } } @@ -29,7 +29,7 @@ private struct Apple: Decodable { private struct Tree: Decodable { let apples: [Apple] - private static func decode(_ json: AnyObject) throws -> Tree { + static func decode(_ json: Any) throws -> Tree { return try Tree(apples: json => "apples") } } @@ -70,7 +70,7 @@ class ErrorPathTests: XCTestCase { do { _ = try dict => "object" => "repo" => "owner" => "login" as String } catch let DecodingError.typeMismatch(_, actual, metadata) { - XCTAssertEqual(String(actual), "__NSCFNumber") + XCTAssertEqual(String(describing: actual), "_SwiftTypePreservingNSNumber") XCTAssertEqual(metadata.formattedPath, "object.repo.owner.login") XCTAssertEqual(metadata.object as? Int, 0) } catch let error { @@ -86,7 +86,7 @@ class ErrorPathTests: XCTestCase { _ = try Tree.decode(dict) XCTFail() } catch let DecodingError.typeMismatch(_, actual, metadata) { - XCTAssertEqual(String(actual), "__NSCFNumber") + XCTAssertEqual(String(describing: actual), "_SwiftTypePreservingNSNumber") XCTAssertEqual(metadata.formattedPath, "apples.color.name") } catch let error { XCTFail("should not throw this exception: \(error)") @@ -96,17 +96,17 @@ class ErrorPathTests: XCTestCase { func testFoo() { let dictionary: NSDictionary = ["key": ["test": 3]] - let a: Int = try! uppercase(dictionary => "key" as! NSDictionary) as AnyObject => "TEST" + let a: Int = try! uppercase(dictionary => "key" as! NSDictionary) as Any => "TEST" XCTAssertEqual(a, 3) } private func uppercase(_ json: NSDictionary) -> NSDictionary { - var result = [String: AnyObject]() + var result = [String: Any]() for (key, value) in json { - result[key.uppercased] = value + result[(key as! String).uppercased()] = value } print(result) - return result + return result as NSDictionary } } diff --git a/Tests/ParseTests.swift b/Tests/ParseTests.swift index 051e1e3..fd98334 100644 --- a/Tests/ParseTests.swift +++ b/Tests/ParseTests.swift @@ -14,7 +14,7 @@ class ParseTests: XCTestCase { func testParseKeyPathSuccess() { let dict: NSDictionary = ["a": ["b": 3]] - let a: AnyObject = try! parse(dict, ["a", "b"]) + let a: Any = try! parse(dict, ["a", "b"]) XCTAssertEqual(a as? Int, 3) } diff --git a/Tests/Repository.swift b/Tests/Repository.swift index a614eec..cd59a38 100644 --- a/Tests/Repository.swift +++ b/Tests/Repository.swift @@ -28,7 +28,7 @@ struct Repository { } extension Owner : Decodable { - static func decode(_ j: AnyObject) throws -> Owner { + static func decode(_ j: Any) throws -> Owner { return try Owner( id: j => "id", login: j => "login" @@ -37,7 +37,7 @@ extension Owner : Decodable { } extension Repository : Decodable { - static func decode(_ j: AnyObject) throws -> Repository { + static func decode(_ j: Any) throws -> Repository { return try Repository( id: j => "id", name: j => "name", diff --git a/Tests/Vehicle.swift b/Tests/Vehicle.swift index 736573e..97b545c 100644 --- a/Tests/Vehicle.swift +++ b/Tests/Vehicle.swift @@ -17,7 +17,7 @@ struct Car: Vehicle { } extension Car: Decodable { - static func decode(_ json: AnyObject) throws -> Car { + static func decode(_ json: Any) throws -> Car { return try Car(driverless: json => "driverless") } } @@ -28,7 +28,7 @@ struct Train: Vehicle { } extension Train: Decodable { - static func decode(_ json: AnyObject) throws -> Train { + static func decode(_ json: Any) throws -> Train { return try Train(driverless: json => "driverless", electric: json => "electric") } @@ -40,7 +40,7 @@ struct Truck: Vehicle { } extension Truck: Decodable { - static func decode(_ json: AnyObject) throws -> Truck { + static func decode(_ json: Any) throws -> Truck { return try Truck(driverless: json => "driverless", wheels: json => "wheels") }