-
Notifications
You must be signed in to change notification settings - Fork 0
/
UserData.swift
29 lines (27 loc) · 896 Bytes
/
UserData.swift
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
//
// UserData.swift
// chakula
//
// Created by Agree Ahmed on 7/27/15.
// Copyright © 2015 org.rhye. All rights reserved.
//
import Foundation
import CoreData
class UserData: NSManagedObject {
class func newEntry(managedObjectContext: NSManagedObjectContext, firstName: String, lastName: String, sessionToken: String, id: Int) -> UserData{
let newItem = NSEntityDescription.insertNewObjectForEntityForName("UserData", inManagedObjectContext: managedObjectContext) as! UserData
newItem.firstName = firstName
newItem.lastName = lastName
newItem.sessionToken = sessionToken
newItem.id = id
return newItem
}
class func save(managedObjectContext: NSManagedObjectContext){
do {
try managedObjectContext.save()
} catch {
NSLog("Unresolved error: \(error)")
abort()
}
}
}