14 releases (8 breaking)

Uses old Rust 2015

0.10.0 Jan 8, 2022
0.9.1 Sep 30, 2020
0.9.0 Aug 26, 2020
0.8.1 Jul 9, 2020
0.4.0 Jul 30, 2017

#57 in macOS and iOS APIs

Download history 1925/week @ 2024-07-22 3095/week @ 2024-07-29 3483/week @ 2024-08-05 2068/week @ 2024-08-12 5642/week @ 2024-08-19 5645/week @ 2024-08-26 5981/week @ 2024-09-02 4444/week @ 2024-09-09 3776/week @ 2024-09-16 4511/week @ 2024-09-23 5426/week @ 2024-09-30 5415/week @ 2024-10-07 5272/week @ 2024-10-14 4925/week @ 2024-10-21 6171/week @ 2024-10-28 6357/week @ 2024-11-04

23,372 downloads per month
Used in 6 crates

Apache-2.0

66KB
722 lines

fruitbasket - Mac app Framework for Rust

Build Status Crates.io Version

fruitbasket provides two different (but related) services for helping you run your Rust binaries as native AppKit/Cocoa applications on Mac OS X:

  • App lifecycle and environment API - fruitbasket provides an API to initialize the AppKit application environment (NSApplication), to pump the main application loop and dispatch Apple events in a non-blocking way, to terminate the application, to access resources in the app bundle, and various other tasks frequently needed by Mac applications.

  • Self-bundling app 'trampoline' - fruitbasket provides a 'trampoline' to automatically bundle a standalone binary as a Mac application in a .app bundle at runtime. This allows access to features that require running from a bundle ( such as XPC services), self-installing into the Applications folder, registering your app with the system as a document type or URL handler, and various other features that are only available to bundled apps with unique identifiers. Self-bundling and relaunching itself (the "trampoline" behavior) allows your app to get the features of app bundles, but still be launched in the standard Rust ways (such as cargo run).

The primary goal of fruitbasket is to make it reasonably easy to develop native Mac GUI applications with the standard Apple AppKit/Cocoa/Foundation frameworks in pure Rust by pushing all of the Apple and Objective-C runtime logic into dedicated libraries, isolating the logic of a Rust binary application from the unsafe platform code. As the ecosystem of Mac libraries for Rust grows, you should be able to mix-and-match the libraries your application needs, pump the event loop with fruitbasket, and never worry about Objective-C in your application.

See the examples/ dir for demo usage.

Documentation

API documentation

Dependencies

~0.7–1.3MB
~21K SLoC