I'm trying to send some data from a swift file to an objective-c file. I have all the bridging headers and whatnot configured, such that when I pass a string, it can be used by the objective-c file. However, I would really like to pass an NSArray, and when I do this, I get a whole slew of errors starting with
[Swift._NSSwiftArrayImpl length]: unrecognized selector sent to instance 0x6000000363a0
I saw Array element cannot be bridged to Objective-C but solutions on that page, which were switching the Array to an NSArray in swift, and making all the objects in the array AnyObjects, did not work; besides, the error I got is different from the error on the aforementioned question. This is my condensed code:
Swift:
var myNSArray = ["foo","bar"]
objectiveCClassInstance.arrayPassFunction(myNSArray)
.h:
- (void)arrayPassFunction:(NSArray*)myObjectiveCNSArray;
.m:
- (void)arrayPassFunction:(NSArray*)myObjectiveCNSArray{
NSLog(myObjectiveCNSArray);
}