I am making a list app, to lea CoreData using Swift, and everything is fine until i load the data on app launch. I have two attributes (one for main item and second for details) then in the cell i have a title (Main Item) and a Detailed Title (details)
when i save to core data every is displayed correctly, but when i close the app and relaunch it everything has it's own cell. I have put my code below
any help would be appreciated.
override func viewWillAppear(animated: Bool) {
let appDelegate = UIApplication.sharedApplication().delegate as! AppDelegate
let managedContext = appDelegate.managedObjectContext
let fetchrequest = NSFetchRequest(entityName: "ListEnt")
do{
let results = try managedContext.executeFetchRequest(fetchrequest)
listItems = results as! [NSManagedObject]
detailedItems = results as! [NSManagedObject]
}catch{
print("Error")
}
}
