objc2 0.3.0-beta.0

Objective-C interface and runtime bindings
Documentation

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.