Initial transition to objc2 (#2452)

* Use objc2

* Use objc2's NSInteger/NSUInteger/NSRange
This commit is contained in:
Mads Marquart 2022-09-02 15:48:02 +02:00 committed by GitHub
parent e0018d0710
commit 112965b4ff
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
23 changed files with 394 additions and 480 deletions

View file

@ -5,7 +5,7 @@ use cocoa::{
base::id,
};
use objc::{
declare::ClassDecl,
declare::ClassBuilder,
runtime::{Class, Object, Sel},
};
use once_cell::sync::Lazy;
@ -19,12 +19,9 @@ unsafe impl Sync for AppClass {}
pub static APP_CLASS: Lazy<AppClass> = Lazy::new(|| unsafe {
let superclass = class!(NSApplication);
let mut decl = ClassDecl::new("WinitApp", superclass).unwrap();
let mut decl = ClassBuilder::new("WinitApp", superclass).unwrap();
decl.add_method(
sel!(sendEvent:),
send_event as extern "C" fn(&Object, Sel, id),
);
decl.add_method(sel!(sendEvent:), send_event as extern "C" fn(_, _, _));
AppClass(decl.register())
});