Answers for "fetch an item from core data"

0

fetch request core data

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
            }
    }
}
Posted by: Guest on April-15-2020
0

fetch request core data

// 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] {
                
            }
            
        }
    }
Posted by: Guest on April-15-2020

Code answers related to "Swift"

Browse Popular Code Answers by Language