13 releases

Uses new Rust 2021

0.3.0-beta.4 Dec 24, 2022
0.3.0-beta.3 Sep 1, 2022
0.3.0-beta.2 Aug 28, 2022
0.3.0-beta.1 Jul 19, 2022
0.3.0-alpha.4 Nov 22, 2021

#14 in macOS and iOS APIs

Download history 251/week @ 2022-10-07 204/week @ 2022-10-14 285/week @ 2022-10-21 458/week @ 2022-10-28 433/week @ 2022-11-04 268/week @ 2022-11-11 305/week @ 2022-11-18 202/week @ 2022-11-25 547/week @ 2022-12-02 1210/week @ 2022-12-09 1170/week @ 2022-12-16 999/week @ 2022-12-23 1137/week @ 2022-12-30 1071/week @ 2023-01-06 1052/week @ 2023-01-13 1518/week @ 2023-01-20

4,959 downloads per month
Used in 7 crates (3 directly)

MIT license

450KB
8K SLoC

objc2

Latest version License Documentation CI

Objective-C interface and bindings to the Foundation framework 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, and provides ready-made bindings for the Foundation framework in particular.

Example

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

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

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

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