Skip to content
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 provide my own binding? #684

Open
yujonglee opened this issue Dec 20, 2024 · 1 comment
Open

How to provide my own binding? #684

yujonglee opened this issue Dec 20, 2024 · 1 comment
Labels
A-objc2 Affects the `objc2`, `objc2-exception-helper` and/or `objc2-encode` crates documentation Improvements or additions to documentation

Comments

@yujonglee
Copy link

I need addStreamOutput, but we don't have it in the generated bindings.

# Needs `dispatch_queue_t`
class.SCStream.methods."addStreamOutput:type:sampleHandlerQueue:error:".skipped = true

We need #77 to be resolved to get dispatch_queue_t supported.

But since sampleHandlerQueue: dispatch_queue_t? is optional, I wonder if I can get addstreamoutput binding working without waiting for dispatch_queue_t support.

Not sure what is needed to use my own binding alongside objc2. Any input would be appreciated.

@madsmtm madsmtm added documentation Improvements or additions to documentation A-objc2 Affects the `objc2`, `objc2-exception-helper` and/or `objc2-encode` crates labels Dec 20, 2024
@madsmtm
Copy link
Owner

madsmtm commented Dec 20, 2024

You can do something like this:

fn addStreamOutput_type_sampleHandlerQueue_error(
    stream: &SCStream,
    output: &ProtocolObject<dyn SCStreamOutput>,
    r#type: SCStreamOutputType,
    sample_handler_queue: dispatch_queue_t,
) -> Result<(), Retained<NSError>> {
    unsafe { msg_send![stream, addStreamOutput: output, type: r#type, sampleHandlerQueue: sample_handler_queue, error: _] }
}

I'll leave this open to document this better (since it's a common question ;) ).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-objc2 Affects the `objc2`, `objc2-exception-helper` and/or `objc2-encode` crates documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

2 participants