Check out example codes for "fetch request core data". It will help you in understanding the concepts better.
Code Example 1
// entire usable func for fetching data
func loadData() {
if let context = (UIApplication.shared.delegate as? AppDelegate)?.persistentContainer.viewContext {
if let hellos = try? context.fetch(Hello.fetchRequest()) as? [Hello] {
}
}
}
Code Example 2
override func viewWillAppear(_ animated: Bool) {
if let context = (UIApplication.shared.delegate as? AppDelegate)?.persistentContainer.viewContext {
if let coreDataToDoItems = try? context.fetch(ToDoItem.fetchRequest()) as? [ToDoItem] {
toDo = coreDataToDoItems
}
}
}
Learn ReactJs, React Native from akashmittal.com