Last active
December 16, 2015 12:25
-
-
Save sergdort/f3a4442f4138935d749a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class SwiftImport<Element:NSManagedObject> { | |
public class func importObject(context:NSManagedObjectContext) | |
-> (dict:JSONDictionary) throws -> Element { | |
// TODO | |
} | |
} | |
// Which will look like this in caller | |
let data:NSData = .. // some data probably from responce | |
if let json:AnyObject? = try? NSJSONSerialization.JSONObjectWithData(data, options: []) } { | |
let users = try? SwiftImport<User>.importObject(context:context)(dict:jsonDict) | |
... | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment