【发布时间】:2018-07-27 22:37:53
【问题描述】:
我们可能都使用过以下模式。这可能无关紧要,我只是好奇当self 不再存在时,我是否还应该调用完成处理程序?
var uid: String
func asyncTask(completion: @escaping(Result)->()) {
anotherAsyncTask() { [weak self] (result) in
guard let uid = self?.uid else {
completion(.error) // Should I call this???
return
}
// consume result
}
}
【问题讨论】: