Swizzling With Swift
Another issue I’ve yet to mention is how to call the original implementation. In this case, I had no desire to figure out how to re-implement the function, so we have to call the original implementation, and retain the returning object on top. This is a problem with Swift 1.2: you cannot call C functions just through their pointer. To be clear, you can call C functions from Swift, but you cannot obtain pointers to functions using other tools and call the function through its pointer like you would do in Objective-C.
As a result, this part has to be implemented in Objective-C. I am not proud about it, but that’s what we have to do for now.
Swift 2 does support calling C function pointers.