Closed jassimkm closed 8 years ago
Hi @jassimkm!
The first rule of Core Data is to "never pass objects around threads" so if you're going to use this fetched data in your UI, use the dataStack.mainContext
. If you're using this data for processing it and then saving it back to Core Data use a dataStack.performInNewBackgroundContext
block.
Fetching data in DATAStack is the same as fetching data in Core Data, checkout any tutorials online on how to do this, you'll find tons. In short you'll do it like this:
let fetchRequest = NSFetchRequest(entityName: "Person")
do {
let result = try context.executeFetchRequest(fetchRequest)
// do something with result
} catch let error as NSError {
print("Could not fetch \(error), \(error.userInfo)")
}
Thank You
Hi I am new to swift i have stored my json into coredata using sync . But i don't know how can I retrieve datas using DATAStack . Kindly help