We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent fbc0c91 commit 7d74bf1Copy full SHA for 7d74bf1
derive/src/lib.rs
@@ -17,15 +17,19 @@ pub fn impl_object(input: TokenStream) -> TokenStream {
17
18
// Build the impl
19
let name = &ast.ident;
20
+ let link_name = format!("OBJC_CLASS_$_{}", name);
21
+
22
let gen = quote! {
23
unsafe impl ::objc::Message for #name { }
24
25
impl ::objc_foundation::INSObject for #name {
26
fn class() -> &'static ::objc::runtime::Class {
- let name = stringify!(#name);
- match ::objc::runtime::Class::get(name) {
27
- Some(cls) => cls,
28
- None => panic!("Class {} not found", name),
+ extern {
+ #[link_name = #link_name]
29
+ static OBJC_CLASS: ::objc::runtime::Class;
30
+ }
31
+ unsafe {
32
+ &OBJC_CLASS
33
}
34
35
0 commit comments