Is it possible to pass a closure from a Swift program into an API where the corresponding argument has been marked as CFunctionPointer?
I've come across indications (e.g. here) that this was not possible with (by now obsolete) beta versions of Xcode 6.
However, you cannot call a C function pointer or convert a closure to C function pointer type.
Is it possible by now and if so how?
For instance, how could one define a closure in Swift that would be accepted as AudioServicesSystemSoundCompletionProc in a call to AudioServicesAddSystemSoundCompletion ?
This answer claims claims to have a recipe, but I could not make it work in Xcode 6.1.1, etc.
Aucun commentaire:
Enregistrer un commentaire