You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Trying to convert some CADisplayLink code to Dart, I realized that it wasn't obvious how to interact with APIs that use the target:selector: pattern (like +[CADisplayLink displayLinkWithTarget:selector:). Since there are no docs for it, I generated it and looked at the output, and saw that the type is ffi.Pointer<objc.ObjCSelector>. Okay, so how do I make one? Jumping to the definition (in pkg:objective_c) just gives me:
Which is not helpful. The only answer I'm aware of to that question is pkg:objective_c's registerName, but:
I only know that is there is because I had previously dug all the way into the generated bindings to make my own manual bindings as workarounds for ffigen bugs (e.g., protocol methods at the time), and
registerName's (only) documentation is /// Only for use by ffigen bindings..
While this isn't a super common pattern in Apple SDKs, especially since newer code generally uses blocks instead, it is around, so we should have a clear support path for it.
The text was updated successfully, but these errors were encountered:
I'll make registerName public and maybe rename it. Might also be convenient to add a string extension method: "foo:bar:".toSelector(). A heavier change would be to add some sort of Selector class to wrap Pointer<ObjCSelector>, but I don't see a need for it, and this would require special casing in ffigen to use the wrapper class in place of the raw pointer.
Trying to convert some
CADisplayLink
code to Dart, I realized that it wasn't obvious how to interact with APIs that use thetarget:selector:
pattern (like+[CADisplayLink displayLinkWithTarget:selector:
). Since there are no docs for it, I generated it and looked at the output, and saw that the type isffi.Pointer<objc.ObjCSelector>
. Okay, so how do I make one? Jumping to the definition (inpkg:objective_c
) just gives me:Which is not helpful. The only answer I'm aware of to that question is
pkg:objective_c
'sregisterName
, but:registerName
's (only) documentation is/// Only for use by ffigen bindings.
.While this isn't a super common pattern in Apple SDKs, especially since newer code generally uses blocks instead, it is around, so we should have a clear support path for it.
The text was updated successfully, but these errors were encountered: