title: How to pass a Swift class in Objective C api expecting the Class type
body: <p>I have following API in Objective C declared in protocol:</p>
  
  <pre><code>-(id)decodeData:(NSData *)data inType:(Class)className error:(NSError **)error;
  </code></pre>
  
  <p>Now, I have implemented a class in Swift that implements ObjC protocol as below: </p>
  
  <pre><code>@objc class XMLDeserializer: NSObject, IDeserializer {
  
      @objc func decodeData(data: NSData!, inType className: AnyClass!) throws -&gt; AnyObject {
  
      }
  }
  </code></pre>
  
  <p>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.</p>
  
  <p>What could be the reason?</p>
  
  <p><strong>Update:</strong></p>
  
  <p>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.</p>
  
  <p>From my communicator class, below is the code how I call my protocol method: </p>
  
  <pre><code>responseObject = [self.responseSerializer decodeData:dataToDeserialize inType:self.responseType error:&amp;err];
  </code></pre>
  
  <p>I have checked and printed the output in console from NSData in Comms Class, to verify that I am getting the successful response.</p>
  
  <p>Only concern is that, my custom serializer is plugged into communicator and then also, my protocol method is not getting called.</p>
  
  <p>I found similar question: <a href="https://stackoverflow.com/questions/24112098/how-do-i-pass-a-swift-class-to-an-objective-c-method-needing-a-class?noredirect=1#comment52704391_24112098">LINK</a> but that didn't solved my problem because passing <code>MyClass.self</code> will append the module name in that argument.</p>
  
  <p>Let me know if more information is needed.</p>