How madsmtm/objc2 works
This workspace provides Rust interoperability with Objective-C: the core objc2 crate models Objective-C objects and runtime operations, while framework crates expose Apple APIs in Rust. A typical user writes Rust code against those bindings; objc2 performs typed message sending and object-management operations through the Objective-C runtime, and framework calls reach Apple frameworks. block2 and dispatch2 provide callback and concurrency APIs. The tree and README establish these product areas, but sampled source is limited, so detailed call wiring is shown only where supported.
Main entry points: src/lib.rs objc2 API · src/lib.rs Framework bindings · src/application.rs AppKit APIs · src/application.rs UIKit APIs
Components 15
Objective-C interop
- objc2 API
crates/objc2/src/lib.rs - Interop macros
crates/objc2/src/__macros/mod.rs - Runtime FFI
crates/objc2/src/ffi/mod.rs - Type encoding
crates/objc2-encode/src/lib.rs - Object ownership
crates/objc2/src/rc/mod.rs
Interop support
- Objective-C blocks
crates/block2/src/lib.rs - Dispatch APIs
crates/dispatch2/src/lib.rs
Apple bindings
- Framework bindings
framework-crates/objc2-app-kit/src/lib.rs - AppKit APIs
framework-crates/objc2-app-kit/src/application.rs - UIKit APIs
framework-crates/objc2-ui-kit/src/application.rs - Core Audio Kit
framework-crates/objc2-core-audio-kit/src/view_controller.rs - Core Graphics
framework-crates/objc2-core-graphics/src/pdf_context.rs
Apple platform
- Objective-C runtime
- Apple frameworks
Other components
- Rust application
Connections 18
- Rust application → objc2 API: uses APIs
- Rust application → Framework bindings: uses bindings
- objc2 API → Interop macros: exposes macros
- objc2 API → Runtime FFI: invokes FFI
- objc2 API → Object ownership: manages objects
- objc2 API → Type encoding: encodes types
- objc2 API → Objective-C runtime: sends messages
- Framework bindings → objc2 API: uses interop
- Framework bindings → AppKit APIs: includes APIs
- Framework bindings → UIKit APIs: includes APIs
- Framework bindings → Core Audio Kit: includes APIs
- Framework bindings → Core Graphics: includes APIs
- AppKit APIs → Apple frameworks: calls APIs
- UIKit APIs → Apple frameworks: starts app
- Core Audio Kit → Apple frameworks: binds APIs
- Core Graphics → Apple frameworks: binds APIs
- Rust application → Objective-C blocks: uses callbacks
- Rust application → Dispatch APIs: uses concurrency