I have following API in Objective C declared in protocol:
-(id)decodeData:(NSData *)data inType:(Class)className error:(NSError **)error; Now, I have implemented a class in Swift that implements ObjC protocol as below:
@objc class XMLDeserializer: NSObject, IDeserializer { @objc func decodeData(data: NSData!, inType className: AnyClass!) throws -> AnyObject { } } Now, my Swift class method is called from within the Objective C class as a part of protocol method calling. But, it is NOT Called.
What could be the reason?
Update:
I have my Communicator class where I have the serializer property in it. When I give my custom serializer object to that property, it is expected that it will call the protocol method (when the success response will come) as described above.
From my communicator class, below is the code how I call my protocol method:
responseObject = [self.responseSerializer decodeData:dataToDeserialize inType:self.responseType error:&err]; I have checked and printed the output in console from NSData in Comms Class, to verify that I am getting the successful response.
Only concern is that, my custom serializer is plugged into communicator and then also, my protocol method is not getting called.
I found similar question: LINK but that didn't solved my problem because passing MyClass.self will append the module name in that argument.
Let me know if more information is needed.