0

When I have an ObjC file like "filename.m", I connect it with:

let a = Filename()

but how can I connect if the filename is - "filename+another.m"?

  • 1
    that Filename() isnt actually the filename, its the class name, and the filename+another.m is usally for the extension of the the first file. can you paste the filename+other.m ? – Dejan Skledar Sep 29 '15 at 08:03
  • As Dejan says, you're confusing some concepts here. A "filename+another.m" file would typically be the code for an Objective C "[category](https://developer.apple.com/library/ios/documentation/Cocoa/Conceptual/ProgrammingWithObjectiveC/CustomizingExistingClasses/CustomizingExistingClasses.html)", an extension to an existing class. For Swift you'd [import the Objective C header file for the category](http://stackoverflow.com/a/27591774/300836). – Matt Gibson Sep 29 '15 at 08:06
  • @DejanSkledar https://github.com/robbiehanson/XMPPFramework/blob/master/Extensions/XEP-0012/XMPPIQ%2BLastActivity.m this file –  Sep 29 '15 at 08:11
  • So the class is actually called `XMPPIQ` – Wain Sep 29 '15 at 08:16

1 Answers1

0

As far as I understand, you have the XMPPIQ Framework. And you declare your variable of type XMPPIQ like this:

var test: XMPPIQ = XMPPIQ() 

And then you want to add the XMPPIQ+LastActivity.h which isn't a framework nor a class, its an Extension for the class XMPPIQ.

To access the code/methods from that extension, you connect the Obj-C files as usual in the Bridging header, and then just do:

let lastActivity:NSInteger = test.lastActivityQueryTo... // Method from XMPPIQ+LastActivity.m

And don't forget to add the XMPPIQ+LastActivity .m and .h files.

Dejan Skledar
  • 11,280
  • 7
  • 44
  • 70