谁能分享一些关于在嵌套闭包中处理 weak self 的最传统编码风格的智慧?例如:
parentClosure { [unowned self] in
// ... assuming there is no use of self here
nestedClosure { [unowned self] in
// ...
self.doSomething()
}
}
我认为以上肯定有效。我的问题是我是否必须在父闭包和嵌套闭包中声明 unowned 或 weak?可以只在父母或孩子中做吗,只有其中一个?