There's a method in an obj-c/c++ framework that takes a uint8_t and a regular int:
- (bool)push:(uint8_t *)buf length:(int)len;
I used a bridger file to have access to this method, but when I call it in swift using UInt8 and Int I get the following error:
Cannot invoke 'push' with an argument list of type '(UInt8, length: Int)'
How can I make it work?
The method expects a pointer to an array of elements of UInt8 type and an Int32 value. You can do something like this:
var buffer: [UInt8] = [0, 1, 2]
yourObject.push(UnsafeMutablePointer<UInt8>(buffer), length: Int32(buffer.count))
Check out here how pointers should be handled: https://developer.apple.com/library/ios/documentation/Swift/Conceptual/BuildingCocoaApps/InteractingWithCAPIs.html
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With