📜  获取请求核心数据 - Swift 代码示例

📅  最后修改于: 2022-03-11 15:00:58.254000             🧑  作者: Mango

代码示例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
            }
    }
}