# appkit

Typed Cocoa / AppKit bindings for building native macOS desktop apps. 15 sub-modules cover the framework: `runtime`, `application`, `window`, `view`, `controls`, `text`, `containers`, `data`, `graphics`, `menu`, `dialogs`, `panels`, `toolbar`, `controllers`, and `convert`.

Callbacks are closure-free: `Button::set_on_click(fn(*u8))` stashes a named function on the sender via `objc_setAssociatedObject`, in keeping with C+ having no closures. The `appkit/convert` module is the C+ to Objective-C data bridge for `string`, `Vec[T]`, and `NSData`; primitives and `#[repr(C)]` structs (`NSPoint`, `NSSize`, `NSRect`) cross the boundary verbatim.

```cplus
import "appkit/application" as application;
import "appkit/window" as window;

fn main() -> i32 {
    let pool = application::AutoreleasePool::new();
    let app  = application::Application::shared();
    app.set_activation_policy(0 as i64);
    // ... build window + controls ...
    app.run();
    pool.drain();
    return 0;
}
```

A runnable reference app lives in the compiler repo at `docs/examples/recipes/appkit_hello/`. For the underlying Objective-C message-send mechanics, see [FFI](/docs/ffi).
