Is self captured within a nested function

前端 未结 3 1809
攒了一身酷
攒了一身酷 2021-02-03 23:16

With closures I usually append [weak self] onto my capture list and then do a null check on self:

func myInstanceMethod()
{
    let myClosure =
            


        
3条回答
  •  广开言路
    2021-02-04 00:14

    I use this template

    class A{
    
      func foo(){
    
         func bar(_ this:A){
           this.some();
         }
    
         bar(self);
      }
    
      func some(){
    
      }
    
    }
    

提交回复
热议问题