0001 // 0002 // Castable.swift 0003 // Decodable 0004 // 0005 // Created by Johannes Lund on 2015-09-25. 0006 // Copyright © 2015 anviking. All rights reserved. 0007 // 0008 0009 import Foundation 0010 0011 public protocol Castable: Decodable {} 0012 0013 extension Castable { 0014 public static func decode
Castable.swift:13 extension Castable {Castable.swift:22 extension String: Castable {}Castable.swift:23 extension Int: Castable {}Castable.swift:24 extension Double: Castable {}Castable.swift:25 extension Bool: Castable {}(j: AnyObject) throws -> Self { 0015 guard let result = j as? Self else { 0016 throw TypeMismatchError(expectedType: self, receivedType: j.dynamicType, object: j) 0017 } 0018 return result 0019 } 0020 } 0021 0022 extension String: Castable {} 0023 extension Int: Castable {} 0024 extension Double: Castable {} 0025 extension Bool: Castable {} 0026 0027
Operators.swift:57 return try parse(lhs, path: rhs, decode: decodeDictionary(String.decode, elementDecodeClosure: T.decode))Operators.swift:62 return try parse(lhs, path: rhs, decode: catchNull(decodeDictionary(String.decode, elementDecodeClosure: T.decode)))Operators.swift:98 return try parseAndAcceptMissingKey(lhs, path: rhs, decode: decodeDictionary(String.decode, elementDecodeClosure: T.decode) )