-
Notifications
You must be signed in to change notification settings - Fork 35
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to pass a Rust function as a selector? #614
Comments
This is a common pattern used in Apple's frameworks, see the documentation on Target-Action, and it's a bit of a pain to handle when you're used to Rust's closures. There's a similar issue here: #585 Try to have a look at that, in short you have to make a method on your delegate with a selector like I know that's not a real explanation, but I don't have time to write up a full example right now, will do so later. |
No, you have explained it very clearly. Thank you! I got how to make. |
Hello!
I use a little modified code that's based on examples from objc2-app-kit crate sources:
Just a trivial
AppDelegate
with menu builder. However, I hit troubles at this step:The
on_click: fn()
is a typical Rust function but I can't get how to pass it as a selector, toNSMenuItem
called it on click.Unfortunately, I couldn't find any examples. Could you explain, please, how I can make it?
The text was updated successfully, but these errors were encountered: