snapKit中的block为什么没有造成循环引用
2021-08-02 本文已影响0人
梁森的简书
iOS开发中使用block也不一定要进行弱引用(使用weakSelf)
原因:当前view对block没有进行强引用。
源码:
public func makeConstraints(_ closure: (_ make: ConstraintMaker) -> Void) {
ConstraintMaker.makeConstraints(item: self.view, closure: closure)
}