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
4,959 downloads per month
Used in 7 crates
(3 directly)
450KB
8K
SLoC
objc2
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.