title: Pass a closure to replace delegation in swift
body: <p>I have used blocks to get callbacks from other classes. I am a beginner in swift. So I need to find a way to define a closure in one class and assign it to a closure variable in another class. I will be calling this closure to get callback of second class in first class.</p>
  
  <p>What I want is something like this,</p>
  
  <pre><code>Class A {
  
       func viewdidload() {
         let b:B = B()
         b.closure(string:NSString) = {
              print string
           }
       }
  
  }
  
  
  
  class B {
         var closure(NSString);
  
         func () {
            closure(string)
         }
  
  }
  </code></pre>