0

I need to pass a callback parameter from a swift class to an Objective-C one. I have searched for the way to do it, but I am struggling, I got this:

public typealias RequestCallBackObject = (gbRequest: AnyObject!, status: ServiceStatus, response: AnyObject?) -> ()

But how would it be in Objective-C ?

danywarner
  • 928
  • 2
  • 15
  • 28
  • Where did you get stuck? At a first glance it seems trivial to translate it. – Cristik Jul 01 '16 at 16:36
  • Have you googled the title of this question? This looks promising http://stackoverflow.com/questions/24586293/cast-closures-blocks – danh Jul 01 '16 at 16:37
  • This is what I achieved: I know it's wrong but I'm doing it a close as I think it is. `(void(^)((NSObject *gbRequest) ,(ServiceStatus *status, (NSObject *response))))` – danywarner Jul 01 '16 at 16:58

1 Answers1

0

It should be something like this:

-(void) testMethod:(void(^) (id gbRequest, ServiceStatus *serviceStatus, id response) ) blockName {

}

Swift's AnyObject equivalent is id in Objective-C.

nihilvex
  • 221
  • 3
  • 9