Giter Club home page Giter Club logo

rust-mac-app-examples's Introduction

Using Rust in Cocoa apps

Examples for working with the Objective-C runtime from Rust, with a companion blog post about the rationale behind the setup.

Each example is annotated and can be run using cargo run or using the specialized instructions below, if any.

Examples

  1. Creating Objective-C objects from Rust: Creates an object and sends it a message

  2. Displaying a Cocoa Window: Creates and presents a Cocoa app with a single window, leveraging the cocoa crate

  3. Packaging a macOS app: Compiles and runs a Rust binary as a part of a macOS app. The Rust binary is launched as the primary process and handles presenting the user interface. Run the application by opening the Xcode project in the app/ directory of the example and using the Run button.

  4. Wrapping Cocoa APIs: Creates a custom interface in Rust to accessing Cocoa classes (somewhat) safely, or at least without unsafe blocks

  5. Declaring a new Objective-C class from Rust: Creates and registers an Objective-C class with the runtime from Rust, as well as sending messages to an instance from both Rust and Objective-C

  6. Include a Rust library in a Cocoa app: Create a static library in Rust, and bundles/links it with a mac app. The mac app target in Xcode depends on an external target which is the Rust library, and the C header for the Rust library is used to invoke Rust functions from Swift. Run the application by opening the Xcode project and using the Run button.

rust-mac-app-examples's People

Contributors

kattrali avatar sophiajt avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.