ios - Add weak reference to assigned Closure in Swift? -


i have following closure:

class bissettingcontroller : xlformviewcontroller {     class func initializeform() -> xlformdescriptor {     var form : xlformdescriptor     var section : xlformsectiondescriptor     var row : xlformrowdescriptor       form = xlformdescriptor()     row = xlformrowdescriptor(tag: "tag", rowtype: xlformrowdescriptortypebutton, title: "title")     row.action.formblock = {[weak self](sender: xlformrowdescriptor!) -> void in          self?.deselectformrow(sender)     ...     }   }  } 

i want use self weak reference inside closure. when build code following error:

'weak' cannot applied non-class type 'bissettingcontroller.type' 

how can solve make work?

the problem class method (class func). in class method, self means the class. there no need memory management on self representing class; class cannot "leak", because persists life of app anyway. thus, cannot describe reference class weak.


Comments

Popular posts from this blog

android - MPAndroidChart - How to add Annotations or images to the chart -

javascript - Add class to another page attribute using URL id - Jquery -

firefox - Where is 'webgl.osmesalib' parameter? -