I have a function in objective-C as shown below
- (void) fetchChannelListForWatch:(void (^)(NSDictionary *))callback
I want to pass a quick callback closure like this:
fetchChannelListForWatch(replyHandler)
where responseHandler is a type closure
replyHandler: ([String : AnyObject]) -> Void)
and I get the error:
Cannot invoke 'fetchChannelListForWatch' with an argument list of type '(([String : AnyObject]) -> Void)'
Handler comes from WatchConnectivity delegate
func session(session: WCSession, didReceiveMessage message: [String : AnyObject], replyHandler: ([String : AnyObject]) -> Void)
therefore, I cannot change the type of responseHandler.
How to skip my quick close with option
replyHandler: [String: AnyObject] -> ()
to objective-C function, which takes a block with parameter
- (void) fetchChannelListForWatch:(void (^)(NSDictionary *))callback
Your help is much appreciated!
source
share