Ah! Well, if your goal is for newMessageHandler
to capture context, then you will have to put it in a Swift type, rather than a C type. Go back to your old version with the UserData
class and Unmanaged
, and make sure to annotate cHandler
with @convention(c)
.