Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR SWIFT

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
            }
    }
}
 
PREVIOUS NEXT
Tagged: #fetch #request #core #data
ADD COMMENT
Topic
Name
6+4 =