• This repository has been archived on 11/Nov/2023
  • Stars
    star
    262
  • Rank 156,136 (Top 4 %)
  • Language
    Rust
  • License
    BSD 2-Clause "Sim...
  • Created almost 8 years ago
  • Updated over 3 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Examples of and templates for running Rust in Cocoa apps on the Mac

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.

More Repositories

1

cocoapods-xcode-plugin

[deprecated] Dependency management helper for your CocoaPods, right in Xcode 6 and 7
Objective-C
2,328
star
2

Xcode-Plugin-Template

[deprecated] Plugin base for Xcode 6 and 7
920
star
3

deriveddata-exterminator

A magic button in Xcode to exterminate the current project's DerivedData directories
Objective-C
592
star
4

xcpretty-travis-formatter

xcpretty custom formatter for TravisCI
Ruby
59
star
5

clamshell

A tidy Cocoa documentation viewer
Objective-C
45
star
6

ovaltine

The chocolatey treat which makes your Cocoa UI code clean!
Ruby
43
star
7

webkitten

A command-driven web browser toolkit inspired by luakit and Vim.
Rust
40
star
8

xcode-devtools

Some scripts helpful for xcode plugin development
Ruby
33
star
9

redcar-rubymotion

RubyMotion workflow support in Redcar Editor
Ruby
32
star
10

weemoji

Weechat plugin to replace emoji in the 'colon' format with unicode equivalents! 👍
Python
29
star
11

docstat

Documentation metrics generator for Cocoa libraries
Ruby
22
star
12

cocoadex

CLI for Cocoa Documentation Reference
Ruby
21
star
13

regexpress

CLI Go regular expression tester
Go
19
star
14

SimpleSyncService

A simple, customizable service for updating Core Data models
Objective-C
14
star
15

unity-native-plugin-example

An example of a native Unity plugin, wrapping a C library in a C# interface
C
7
star
16

thyme

Command-line interface implementation of Sage Solitaire
Rust
6
star
17

dotfiles

system configuration and initialization files
Vim Script
5
star
18

tracker-keeper

View your assigned pivotal tracker stories with minimalism
Ruby
4
star
19

pbhistory

List text items on the OS X pasteboard
Swift
3
star