I would like to save data on my app, I used DataCore to save, but it save data in an entity, and an attribute in this entity can save many different values. I need the data is saved only one value for each attribute as preference in Android. How could I do that? Please help me. Thank you. This is my code:
@IBAction func SaveAll(sender: AnyObject) {
let username:String = user_name.text!
let password:String = pass_word.text!
let appDel: AppDelegate = UIApplication.sharedApplication().delegate as! AppDelegate
let context:NSManagedObjectContext = appDel.managedObjectContext
let newStu = NSEntityDescription.insertNewObjectForEntityForName("Student", inManagedObjectContext: context) as NSManagedObject
newStu.setValue(username, forKey: "userName")
newStu.setValue(password, forKey: "passWord")
do {
try context.save()
} catch {}
}