if let/
ifvar可选绑定仅在表达式右侧的结果为可选时有效。如果右侧的结果不是可选的,则不能使用此可选绑定。此可选绑定的目的是检查
nil变量,并且如果不是,则仅使用该变量
nil。
在您的情况下,
tableView参数被声明为非可选类型
UITableView。保证永远不会
nil。因此,这里不需要进行可选的绑定。
func tableView(tableView: UITableView, commitEditingStyle editingStyle:UITableViewCellEditingStyle, forRowAtIndexPath indexPath: NSIndexPath) { if editingStyle == .Delete { // Delete the row from the data source myData.removeAtIndex(indexPath.row) tableView.deleteRowsAtIndexPaths([indexPath], withRowAnimation: .Fade)我们要做的就是摆脱
if let并将其中出现的任何内容更改
tv为just
tableView。



