cacao/examples
Ryan McGrath f24261747c
Merge pull request #79 from MerlinDE/fix_register_class
Fixes possible duplicate objc class registration.
2023-04-25 16:53:44 -07:00
..
browser Merge pull request #67 from ryanmcgrath/feat/change-objc-classdec 2022-11-04 16:03:59 -07:00
calculator fix: run cargo fmt on nightly 2022-08-26 10:40:31 -04:00
ios-beta fix: run cargo fmt on nightly 2022-08-26 10:40:31 -04:00
todos_list Merge pull request #54 from EstebanBorai/trunk 2022-10-12 11:37:02 -07:00
animation.rs fix: run cargo fmt on nightly 2022-08-26 10:40:31 -04:00
autolayout.rs fix: run cargo fmt on nightly 2022-08-26 10:40:31 -04:00
custom_image_drawing.rs fix: run cargo fmt on nightly 2022-08-26 10:40:31 -04:00
defaults.rs fix: run cargo fmt on nightly 2022-08-26 10:40:31 -04:00
frame_layout.rs fix: run cargo fmt on nightly 2022-08-26 10:40:31 -04:00
popover.rs Applies rustfmt.toml rules 2023-04-17 21:35:49 +02:00
readme.md My commit for the repo built in rust called Cacao 2023-04-24 03:31:58 +08:00
safe_area.rs My commit for the repo built in rust called Cacao 2023-04-24 03:31:58 +08:00
text_input.rs fix: run cargo fmt on nightly 2022-08-26 10:40:31 -04:00
webview_custom_protocol.rs Update webview example 2022-11-04 15:54:15 -07:00
window.rs fix: run cargo fmt on nightly 2022-08-26 10:40:31 -04:00
window_controller.rs fix: run cargo fmt on nightly 2022-08-26 10:40:31 -04:00
window_delegate.rs fix: run cargo fmt on nightly 2022-08-26 10:40:31 -04:00

Cacao Examples

This directory contains example code for apps written in cacao. To run an example, check out the list of commands below - some require certain features to be enabled.

AutoLayout

An example that showcases layout out a view with AutoLayout. This requires the feature flag autolayout to be enabled, but it's defaulted for ease of use so doesn't need to be specified here. Platforms where AutoLayout is not supported will likely not work with this example.

cargo run --example autolayout

Frame Layout

An example that showcases laying out with a more old school Frame-based approach. Platforms where AutoLayout are not supported will want to try this instead of the AutoLayout example.

macOS: cargo run --example frame_layout

Platforms lacking AutoLayout: cargo run --example frame_layout --no-default-features --features appkit

Defaults

This example isn't GUI-specific, but showcases accessing NSUserDefaults from Rust for persisting basic data.

cargo run --example defaults

Window

This example showcases creating a basic Window. This should run on all AppKit-supporting platforms.

cargo run --example window

Window Controller

This example showcases creating a basic WindowController. This may run on all AppKit-supporting platforms.

cargo run --example window_controller

Window Delegate

This example showcases creating a basic WindowDelegate to receive and handle events. This may run on all AppKit-supporting platforms.

cargo run --example window_delegate

Text Input

This example showcases text input, and logs it to the underlying console. It's mostly a testbed to ensure that the backing widget for input behaves as expected.

cargo run --example text_input

Safe Area

This example showcases A window containg the text "Hello, world!" while keeping everything in the safearea to keep it visible.

cargo run --example safe_area

Calculator

A Rust-rendition of the macOS Calculator app.

cargo run --example calculator

To-Do List

A "kitchen sink" example that showcases how to do more advanced things, such as cached reusable ListView components.

cargo run --example todos_list

Browser

A very basic web browser. Platforms that don't support WKWebView will likely not work with this example.

cargo run --example browser --features webview

Webview Custom Protocol

This example showcases a custom protocol for the webview feature. Platforms that don't support WKWebView will likely not work with this example.

cargo run --example webview_custom_protocol --features webview

iOS (Beta)

This example showcases how to build and run an iOS app in Rust. See the README in the ios-beta folder for instructions on how to run.