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