📜  点击删除 xcode - Swift 代码示例

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

代码示例1
override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
        
        let hello = hellos[indexPath.row]
        if let context = (UIApplication.shared.delegate as? AppDelegate)?.persistentContainer.viewContext {
            context.delete(hello)
            (UIApplication.shared.delegate as? AppDelegate)?.saveContext()
            loadData()
        }
        
    }