9 releases

Uses new Rust 2021

0.3.0-beta.0 Jun 13, 2022
0.3.0-alpha.6 Jan 3, 2022
0.3.0-alpha.5 Dec 22, 2021
0.3.0-alpha.4 Nov 22, 2021
0.2.7 Nov 19, 2021

#20 in macOS and iOS APIs

Download history 33/week @ 2022-03-15 29/week @ 2022-03-22 7/week @ 2022-03-29 15/week @ 2022-04-05 5/week @ 2022-04-12 8/week @ 2022-04-19 63/week @ 2022-04-26 60/week @ 2022-05-03 126/week @ 2022-05-10 29/week @ 2022-05-17 63/week @ 2022-05-24 78/week @ 2022-05-31 34/week @ 2022-06-07 39/week @ 2022-06-14 19/week @ 2022-06-21 6/week @ 2022-06-28

108 downloads per month
Used in menubar

MIT license

165KB
3K SLoC

objc2

Latest version License Documentation CI

Objective-C interface and runtime bindings for 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.

Example

use objc2::{class, msg_send};
use objc2::rc::{Id, Owned};
use objc2::runtime::{Class, Object};

let cls = class!(NSObject);
let obj: *mut Object = unsafe { msg_send![cls, new] };
let obj: Id<Object, Owned> = unsafe { Id::new(obj).unwrap() };

// TODO
// let isa = unsafe { obj.ivar::<Class>("isa") };
// assert_eq!(cls, isa);

See the docs for a more thorough overview, or jump right into the examples.

This crate is part of the objc2 project, see that for related crates.

Dependencies