docs.rs failed to build cocoanut-0.2.0
Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.
Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.
🥥 Cocoanut
A minimal, declarative macOS GUI framework for Rust.
Why Cocoanut?
| Crate | Level | Safety | Learning Curve | Best For |
|---|---|---|---|---|
| objc | Low | Unsafe | Steep | Raw FFI |
| cocoa | Low | Unsafe | Steep | Raw AppKit |
| cacao | Mid | Safe | Medium | Cross-platform |
| cocoanut | High | Safe | Gentle | macOS native |
Quick Start
use *;
Architecture
7 source files. ~2000 lines. 26 view types. 29 tests.
view.rs → View + ViewKind enum (the ONE core type)
renderer.rs → View tree → AppKit NSViews (single pass)
app.rs → App lifecycle + Appearance (dark mode)
event.rs → Callback registry + ObjC action handler
state.rs → Reactive State<T> + bind_label
menu.rs → Menu bar with action dispatch
error.rs → Error types
26 View Types
- Layout: VStack, HStack, ZStack, Spacer
- Text: Text, Label
- Controls: Button, TextField, SecureField, Checkbox, Radio, Slider, Toggle, Dropdown
- Extended: TextArea, DatePicker, ColorPicker
- Containers: ScrollView, TabView, SplitView, GroupBox, WebView, TableView
- Data: ProgressBar, Image
- Extensible: Custom
Features
- Reactive State —
State<T>withon_changelisteners - Event System —
event::register(id, closure)+ ObjC target/action dispatch - Dark Mode —
.dark()/.light()/set_appearance()at runtime - Accessibility —
.accessibility("label")on any view - Menu Actions —
MenuItem::on_action(id)wires to callbacks - Style Modifiers —
.width(),.bold(),.background(),.on_click() - JSON Serializable —
ViewDescfor debugging/bridging
Examples
License
Apache-2.0