【发布时间】:2015-02-17 04:10:44
【问题描述】:
在此页面http://www.raywenderlich.com/85578/first-core-data-app-using-swift 上,许多示例使用 let 而不是 var。
func tableView(tableView: UITableView,
cellForRowAtIndexPath
indexPath: NSIndexPath) -> UITableViewCell {
let cell =
tableView.dequeueReusableCellWithIdentifier("Cell")
as UITableViewCell
let person = people[indexPath.row]
cell.textLabel!.text = person.valueForKey("name") as String?
return cell
}
我在很多教程中都看到了这一点。是否有理由在上述 sn-p 中使用 let 而不是 var?
【问题讨论】: