Swift Function as a callback to a C Function

One pattern that's common in C APIs like this is to take a void *context argument that is passed through to the callback function. You can then use Unmanaged and friends to pass your Car instance through that context into your completion handler. It's a bit fiddly and you'll need to be mindful of memory management, but it'd do the job.

3 Likes