objc2
objc2 copied to clipboard
Allow returning `Id` from `extern_methods!`
WIP.
Example syntax:
extern_methods!(
unsafe impl MyObject {
#[sel_id(init)]
fn new() -> Id<Self, Owned>;
#[sel_id(description)]
fn get(&self) -> Id<NSString, Owned>;
}
);
// Becomes
impl MyObject {
#[sel_id(init)]
fn new() -> Id<Self, Owned> {
// Automatic allocation?
unsafe { msg_send_id![msg_send_id![Self::class(), alloc], init] }
}
#[sel_id(description)]
fn get(&self) -> Id<NSString, Owned> {
unsafe { msg_send_id![self, description] }
}
}