📜  视图将出现 - Swift 代码示例

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

代码示例1
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
                tableView.reloadData()
            }
    }
}