An example from http://www.sitepoint.com/using-legacy-c-apis-swift/:

Calling the C function "void takesAnObject(void *theObject);" from Swift:

var test = 42
withUnsafePointer(&test, { (ptr: UnsafePointer<Int>) -> Void in
var voidPtr: UnsafePointer<Void> = unsafeBitCast(ptr, UnsafePointer<Void>.self)
    takesAnObject(voidPtr)
})


Maybe it can be done better, but I think it is rather obvious that if interfacing looks like that, one doesn't loose much from implementing the app using Objective-C++ and Swift without bridging much between C++ and Swift.

Reply via email to