#ios #objective-c #cross-platform #polyhorn #source #compile #projects

polyhorn-build-ios

Automatically finds, compiles and links Objective-C source files

6 releases (3 breaking)

0.4.0 Dec 2, 2020
0.3.2 Oct 20, 2020
0.2.0 Oct 10, 2020
0.1.0 Sep 25, 2020

#4 in #polyhorn

Download history 5/week @ 2023-11-27 2/week @ 2023-12-04 5/week @ 2023-12-11 8/week @ 2023-12-18 8/week @ 2023-12-25 13/week @ 2024-01-08 3/week @ 2024-01-15 10/week @ 2024-02-05 13/week @ 2024-02-12 4/week @ 2024-02-19 28/week @ 2024-02-26 34/week @ 2024-03-04 24/week @ 2024-03-11

93 downloads per month
Used in 9 crates (via polyhorn-build)

MIT license

3KB

Polyhorn

A library for rapidly building cross-platform apps in Rust 🦀.

Polyhorn is a Rust library for building user interfaces. For users familiar with React or React Native, this library will be very similar in purpose.

It also comes with its own command line interface that makes it easy to start a new project and to build and run existing projects.

Colloquially, both are called Polyhorn.


🚧 Warning: Polyhorn is still very much a work-in-progress, which means that there will probably be many breaking changes and missing features before its official launch (sorry for this).


Get Started

Installation

Installation of Polyhorn is easy and takes just a few seconds. If you're new to Rust, you also need to install Rust first with step 1 below. If you're already using Rust, you can skip step 1 and install Polyhorn with step 2.

  1. If you don't already have Rust installed, install Rust with rustup.

    $ curl -sSf https://sh.rustup.rs | sh
    
  2. Now, install Polyhorn with cargo, the Rust-provided package manager.

    $ cargo install polyhorn
    

Start a Project

Starting a new project from one of our built-in templates is easy. For an almost blank project, run:

$ polyhorn new hello-world

You can replace hello-world with the name of your app. Make sure it contains only alphanumerical characters and dashes.

This will generate a directory with the following structure:

hello-world/
├── .gitignore
├── assets
│   └── .gitkeep
└── src
    └── lib.rs

This is the content of src/lib.rs:

use polyhorn::prelude::*;

#[derive(Default)]
pub struct App {}

impl Component for App {
    fn render(&self, _manager: &mut Manager) -> Element {
        poly!(<Window>
            <View style=!{
                align-items: center;
                justify-content: center;
                background-color: red;
                height: 100%;
            }>
                <Text style=!{ color: white; }>
                    "Welcome to your Polyhorn app!"
                </Text>
            </View>
        </Window>)
    }
}

polyhorn::render!(<App />);

Run a Project

In your command line, navigate to your project. For example, if you followed the instructions above, you should now be in hello-world/. Then, decide on which platform you want to run. Note that all platforms share the same codebase, so you don't need to plan ahead.

Running on iOS

If you want to run your app on an iOS simulator, run this command:

$ polyhorn run ios

It will ask you to select an available simulator.

Dependencies

~170KB