I have a method defined as below in Objective-C
:
- (BOOL)dataHandler:(void*)buffer length:(UInt32)length
In ObjC we call this method as so:
self [self dataHandler:(void*)[myNsString UTF8String] length:[myNsString length]];
When I see the prototype for this for Swift it comes out like this:
self.dataHandler(<#buffer: UnsafeMutablePointer<Void>#>, length: <#UInt32#>)
I'm trying it as per below and not able to make it work:
self.dataHandler(buffer: UnsafeMutablePointer(response!), length: count(response!))
I also tried:
var valueToSend = UnsafeMutablePointer<Void>(Unmanaged<NSString>.passRetained(response!).toOpaque())
self.dataHandler(buffer: valueToSend, length: count(response!))
Is there anything else I haven't tried? I read the below on this: