Friday, February 6, 2015 [Tweets] [Favorites]

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

Stay up-to-date by subscribing to the Comments RSS Feed for this post.

Leave a Comment