[英]break strong reference cycle between Managed Object and Collectionview Cell
[英]Is this making a strong reference cycle when creating cell?
我有一个Task
类型的数组,它是一个类。 在cellForRowAt
,创建我的单元格。 我要做的第一件事是通过使用indexPath
访问数组来查看要使用的任务。 那是一个强大的参考周期的结果吗?
override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let currentBudgetTask = currentBudgetTaskForRowAtIndexPath(indexPath)
guard let cell = tableView.dequeueReusableCell(withIdentifier: cellIdentifier, for: indexPath) as? BudgetCell else {
return BudgetCell()
}
configureCell(cell, for: currentBudgetTask)
return cell
}
不,因为您只是将一个包含两个整数的索引路径传递给一个函数。
该指数路径并不适用于类(或细胞本身)的任何方法的引用,所以这是安全的。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.