[Swift] Add support for NSUUID

This commit is contained in:
Jason Gavris
2016-07-01 10:25:36 -04:00
parent 3659767e0a
commit cd79ae1ab4
6 changed files with 33 additions and 2 deletions

View File

@@ -73,6 +73,12 @@ extension NSDate: JSONEncodable {
}
}
extension NSUUID: JSONEncodable {
func encodeToJSON() -> AnyObject {
return self.UUIDString
}
}
{{#usePromiseKit}}extension RequestBuilder {
public func execute() -> Promise<Response<T>> {
let deferred = Promise<Response<T>>.pendingPromise()

View File

@@ -62,6 +62,9 @@ class Decoders {
if T.self is Int64.Type && source is NSNumber {
return source.longLongValue as! T;
}
if T.self is NSUUID.Type && source is String {
return NSUUID(UUIDString: source as! String) as! T
}
if source is T {
return source as! T
}