title: Capture List and Function passed as argument in swift
body: <p>I have a function with this prototype: </p>
  
  <p><code>func myFunction(completionHandler:((response:[NSString:AnyObject])-&gt;Void)?))
  </code></p>
  
  <p>The <code>completionHandler</code> prototype can be passed as closure or as a function... passing it as closure I know how to define a capture list with this syntax <code>[weak self]</code>, but how can I define a capture list if instead of defining the closure directly in the function argument I want to pass a function name? </p>
  
  <p><code>myFunction(anotherFunction) // how to set capture list from here?</code></p>
  
  <p>VS </p>
  
  <pre><code>myFunction{ 
       [weak self] (response) in
  
  }
  </code></pre>
  
  <p>```</p>
  
  <p>EDIT----- </p>
  
  <p>A possible solution is to wrap the function code into a block, set the capture list and execute the block... but it sounds so strange :/ </p>
  
  <pre><code>myFunction(anotherFunction) // how to set capture list from here?
  .
  .
  .
  func anotherFunction(response:[NSString:AnyObject]) { 
      let safeBlock = { 
         [weak self] in { 
           self?.callSomethingSafely()
         }
      }
  
      safeBlock()
  }
  </code></pre>