20 releases

new 0.5.0 Dec 3, 2023
0.4.1 Jul 31, 2023
0.4.0 Jun 20, 2023
0.3.0-beta.5 Feb 7, 2023
0.3.0-alpha.4 Nov 22, 2021

#7 in macOS and iOS APIs

Download history 16287/week @ 2023-08-18 16786/week @ 2023-08-25 17228/week @ 2023-09-01 18218/week @ 2023-09-08 18637/week @ 2023-09-15 18576/week @ 2023-09-22 19979/week @ 2023-09-29 21648/week @ 2023-10-06 30380/week @ 2023-10-13 31114/week @ 2023-10-20 31268/week @ 2023-10-27 30001/week @ 2023-11-03 30710/week @ 2023-11-10 36779/week @ 2023-11-17 32209/week @ 2023-11-24 27764/week @ 2023-12-01

131,969 downloads per month
Used in 880 crates (16 directly)

MIT license

1MB
14K SLoC

objc2

Latest version License Documentation CI

Objective-C interface and runtime bindings in Rust.

Most of the core libraries and frameworks that are in use on Apple systems are written in Objective-C; this crate enables you to interract with those.

This crate is part of the objc2 project, see that for related crates, or see the docs for a more thorough overview.

Example

use objc2::ffi::NSUInteger;
use objc2::rc::Id;
use objc2::runtime::NSObject;
use objc2::{msg_send, msg_send_id, ClassType};

let obj: Id<NSObject> = unsafe { msg_send_id![NSObject::class(), new] };

let hash: NSUInteger = unsafe { msg_send![&obj, hash] };
println!("NSObject hash: {}", hash);

More examples are available in the repository.

Dependencies