> 
> I can write in-line handlers for this, but I'm trying to write a separate 
> method, and just assign the method as a handler, and I can't seem to get the 
> signature right.


It gets interesting when you want to also specify that the handler uses the
C calling convention to pass as a callback to legacy code.  AFAICT you can’t
do that using a function, but you can when assigning a closure to a variable.
The handler winds up looking something like

let handler: @convention(c) UnsafeMutablePointer<Void> -> Void = {
    arg in
    // ...
}


_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to