I have a project where I write the production code in Swift and my unit tests in Objective-C (because I'm using OCMock I write my tests in Objective-C).
What I'm trying to do is to write a Buffer object where the writeBytes method takes a Byte array and a length, like this:
func writeBytes(data: [Byte], length: Int)
In my unit test target I want to test this method, but the problem is that it won't convert this method to Objective-C.
By looking in my -Swift.h file I see the following:
@interface Buffer : Object
@property (nonatomic) NSInteger capacity;
@property (nonatomic) NSInteger size;
- (instancetype)initWithCapacity:(NSInteger)capacity OBJC_DESIGNATED_INITIALIZER;
- (void)reset;
- (NSInteger)size;
- (BOOL)isFilled;
- (BOOL)isEmpty;
@end
As you can see the writeBytes method is missing. I've tried different data types to see if it appears: UInt8, UnsafePointer<UInt8>, but none of them work.
For the sake of debugging I tried using a String array and that gets converted to Objective-C without any problems.
What data type should I use for my Byte array to make the writeBytes method available in Objective-C?