Friday, February 6, 2015

Building Swift Bindings to libgit2

Brian Gesiak:

The str parameter is of type UnsafePointer<Int8>, but thanks to Swift’s ability to interoperate with C, we can just pass this function a Swift String. Read the Apple blog article linked above for details.

[…]

Unfortunately, in Interacting with C Pointers in Swift, @develtima explains that we can’t get a usable CFunctionPointer to a function defined in Swift.

So instead, Gift defines Objective-C helper functions that take a Swift closure, and execute that closure from within a C callback function.

Comments RSS · Twitter

Leave a Comment