All Projects → wojteklu → rust-to-ios

wojteklu / rust-to-ios

Licence: MIT license
Example project for building a library for iOS in Rust.

Programming Languages

swift
15916 projects
rust
11053 projects
c
50402 projects - #5 most used programming language
objective c
16641 projects - #2 most used programming language

Projects that are alternatives of or similar to rust-to-ios

Rxkotlinfx
Kotlin extensions to the RxJavaFX framework
Stars: ✭ 177 (+168.18%)
Mutual labels:  interoperability
speckle-blender
speckle.systems/tag/blender/
Stars: ✭ 38 (-42.42%)
Mutual labels:  interoperability
cordage
Cordage: the blockchain interoperability project!
Stars: ✭ 52 (-21.21%)
Mutual labels:  interoperability
Inline Java
Haskell/Java interop via inline Java code in Haskell modules.
Stars: ✭ 197 (+198.48%)
Mutual labels:  interoperability
Webcompat.com
Source code for webcompat.com
Stars: ✭ 220 (+233.33%)
Mutual labels:  interoperability
CommonCoreOntologies
The Common Core Ontology Repository holds the current released version of the Common Core Ontology suite.
Stars: ✭ 109 (+65.15%)
Mutual labels:  interoperability
Interledger Rs
An easy-to-use, high-performance Interledger implementation written in Rust
Stars: ✭ 155 (+134.85%)
Mutual labels:  interoperability
hashport-validator
Official repository containing the source code of the Hashport validators
Stars: ✭ 19 (-71.21%)
Mutual labels:  interoperability
seamless
Seamless is a framework to set up reproducible computations (and visualizations) that respond to changes in cells. Cells contain the input data as well as the source code of the computations, and all cells can be edited interactively.
Stars: ✭ 19 (-71.21%)
Mutual labels:  interoperability
speckle-sharp
.NET SDK, Schema and Connectors: Revit, Rhino, Grasshopper, Dynamo, ETABS, AutoCAD, Civil3D & more.
Stars: ✭ 214 (+224.24%)
Mutual labels:  interoperability
Lale
Library for Semi-Automated Data Science
Stars: ✭ 198 (+200%)
Mutual labels:  interoperability
Quilt
Hyperledger Quilt - An implementation of the Interledger Protocol
Stars: ✭ 212 (+221.21%)
Mutual labels:  interoperability
crosscloudci
Integrating, testing, and deploying projects within the CNCF ecosystem. Results published daily to the CNCF CI Dashboard.
Stars: ✭ 83 (+25.76%)
Mutual labels:  interoperability
Blocknet
Official Blocknet cryptocurrency wallet
Stars: ✭ 179 (+171.21%)
Mutual labels:  interoperability
datasacks
Tools to make Unity3D UI connections better.
Stars: ✭ 24 (-63.64%)
Mutual labels:  interoperability
Event Loop
An event loop interface for interoperability in PHP.
Stars: ✭ 170 (+157.58%)
Mutual labels:  interoperability
cpptcl
C++ library for interoperability between C++ and TCL
Stars: ✭ 33 (-50%)
Mutual labels:  interoperability
ethrelay
Ethereum smart contracts that enable the verification of transactions of a "target" blockchain on a different "verifying" blockchain in a trustless and decentralized way
Stars: ✭ 34 (-48.48%)
Mutual labels:  interoperability
ccn-lite
CCN-lite, a lightweight implementation of the CCNx protocol and its variations
Stars: ✭ 71 (+7.58%)
Mutual labels:  interoperability
CL-CXX-JIT
Common Lisp and CXX interoperation with JIT
Stars: ✭ 40 (-39.39%)
Mutual labels:  interoperability

rust-to-ios

Swift 5.0 @wojteklu

Example project for building a library for iOS.

  • ✓ sending primitives between Rust and iOS
  • ✓ sending strings between Rust and iOS
  • ✓ giving ownership of a Rust instance to Swift

Setup

  1. Download rustup needed to setup Rust for cross-compiling.

    curl https://sh.rustup.rs -sSf | sh
  2. Download targets for iOS.

    rustup target add aarch64-apple-ios armv7-apple-ios armv7s-apple-ios x86_64-apple-ios i386-apple-ios
  3. Install cargo-lipo to generate the iOS universal library.

    cargo install cargo-lipo

Building the library

  1. Create a new cargo project.

    cargo new message
  2. Update Cargo.toml by adding the [lib] section.

    [lib]
    name = "message"
    crate-type = ["staticlib"]
  3. Write the library and expose its public interface in a C header.

  4. Build the library.

    cd message
    
    cargo lipo --release

Using the library

  1. Create the iOS project.

  2. Add the C header to allow using the Rust functions from C.

  3. Copy target/universal/release/libmessage.a to project.

  4. Add libresolv.tbd to Linked frameworks and libraries.

  5. Note that cargo-lipo does not support bitcode yet. You must set ENABLE_BITCODE to NO.

Author

Wojtek Lukaszuk @wojteklu

License

Available under the MIT license. See the LICENSE file for more info.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].