Swift 闭包中 self? 的由来

class UIViewSpringAnimator: SwipeAnimator {

    

    // 动画完成的闭包

    var completion:((Bool) ->Void)?

        

    func addCompletion(completion:@escaping (Bool) ->Void) {

        self.completion = { [weakself] finished in

            

            guardself?.isRunning ==true else {return }

            

            self?.isRunning =false

            self?.animations =nil

            self?.completion =nil

            

            completion(finished)

        }

    }

}

 
[weak self] 的作用
原文地址:https://www.cnblogs.com/feng9exe/p/8717668.html