Uwes Blog

Example project for Swift C Interop

I started to learn Swift 2.0, an how to integrate with C. Therefore i have created a small Swift-C Interoperabilty project, which can be found on github.

As soon as i will start to wrap some C/C++ Libs, more examples will be added.

There was also a nice Swift compiler crash, which you can test with your environment too, just clone my github project, uncomment the line leading to the compiler crash and comment the correct line.

// This crashes the compiler:
//   Version 7.0 beta 6 (7A192o)
//   Version 7.1 beta (7B60)
//let myCallback : @convention(c) (i: Int) -> Int = {
// works
let myCallback : @convention(c) (Int) -> Int = {

If it crashes in your environment too, send Apple a bug report.

Thanks for reading. Comment on this post!

Back to index