I always using [weak self] in swift closure to prevent reference cycle. Here is the code below, is it the correct way?
[weak self]
someTask(completion: {[w
You can use it like this from Swift 4.2
someTask(completion: {[weak self] (result) in guard let self = self { return } //it safe when reach here always self.xxx = yyy self.doLongTermWork() self.finish() })