Crate objc [] [src]

Objective-C Runtime bindings and wrapper for Rust.

Messaging objects

Objective-C objects can be messaged using the msg_send! macro:

let cls = Class::get("NSObject").unwrap();
let obj: *mut Object = msg_send![cls, new];
let hash: usize = msg_send![obj, hash];
let is_kind: BOOL = msg_send![obj, isKindOfClass:cls];
// Even void methods must have their return type annotated
let _: () = msg_send![obj, release];

Declaring classes

Objective-C classes can even be declared from Rust using the functionality of the declare module.

Modules

declare

Functionality for declaring Objective-C classes.

runtime

A Rust interface for the functionality of the Objective-C runtime.

Macros

msg_send!

Sends a message to an object.

sel!

Registers a selector, returning a Sel.

Structs

Encoding

An Objective-C type encoding.

Traits

Encode

Types that have an Objective-C type encoding.

Message

Types that may be sent Objective-C messages. For example: objects, classes, and blocks.

MessageArguments

Types that may be used as the arguments of an Objective-C message.