title: Using block in swift
body: <p>I'm recently started working on swift. Here i'm facing the problem with blocks so please help to do this.</p>
  
  <p><strong>Class 1:</strong></p>
  
  <p>I'm using block in Objective-C like this:</p>
  
  <pre><code>typedef void (^AHServicesCallsWrapperBlock)(id, NSError *);
  </code></pre>
  
  <p>declaration of block variable:</p>
  
  <pre><code>@property (nonatomic, copy) AHServicesCallsWrapperBlock webServiceWrapperBlockHandler;
  </code></pre>
  
  <p>and passing block a value</p>
  
  <pre><code>self.webServiceWrapperBlockHandler([graphData objectForKey:@"data"], nil);
  </code></pre>
  
  <p><strong>In Class 2:</strong>
  And i'm using this block in another view controller like:</p>
  
  <pre><code>AHServiceCallWrapper *webServicesCallsWrapper = [[AHServiceCallWrapper alloc] init];
  webServicesCallsWrapper.webServiceWrapperBlockHandler = ^(id response, NSError *error)
  {
       // do stuff
  }
  </code></pre>
  
  <p>so how can we do this in swift...</p>