I'm trying to run a method from an Objective-C class with a completion block in a Swift class but I'm having some troubles.
Obj-C code:
typedef void(^completionBlock)(NSDictionary *);
+ (void)getVersionsFromAPI:(completionBlock)sendData
{
NSDictionary *dict = [[NSDictionary alloc] init];
// Do stuff
sendData(dict);
}
Swift code:
API.getVersionsFromAPI { (ver : NSDictionary) -> Void in
self.version = ver.mutableCopy() as NSMutableDictionary;
}
I'm getting an error that says '[NSObject : AnyObject]!' is not a subtype of 'NSDictionary' on the first line.
ver : NSDictionary!orver : NSDictionary??'[NSObject : AnyObject]!' is not identical to 'NSDictionary'when using!or the first error with?.