blinc_platform_ios

Crates.ioblinc_platform_ios
lib.rsblinc_platform_ios
version0.1.12
created_at2026-01-14 19:07:28.762625+00
updated_at2026-01-19 01:07:54.790562+00
descriptionBlinc iOS platform - UIKit integration, Metal rendering, and touch input
homepage
repositoryhttps://github.com/project-blinc/Blinc
max_upload_size
id2043476
size118,450
'Damilare Darmie Akinlaja (darmie)

documentation

https://docs.rs/blinc_platform_ios

README

blinc_platform_ios

Part of the Blinc UI Framework

This crate is a component of Blinc, a GPU-accelerated UI framework for Rust. For full documentation and guides, visit the Blinc documentation.

iOS platform implementation for Blinc UI.

Overview

blinc_platform_ios provides UIKit integration, Metal rendering, and touch input handling for iOS and iPadOS applications.

Supported Platforms

  • iOS 14.0+
  • iPadOS 14.0+

Features

  • UIKit Integration: Native iOS view hierarchy
  • Metal Rendering: Hardware-accelerated graphics
  • Touch Input: Full multi-touch support
  • iOS Lifecycle: Proper app state handling
  • Safe Area: Automatic safe area inset handling

Quick Start

use blinc_platform_ios::ios_main;

#[no_mangle]
pub extern "C" fn main() {
    ios_main(|ctx| {
        // Build your UI
        div()
            .w_full()
            .h_full()
            .child(text("Hello iOS!"))
    });
}

Project Setup

Cargo.toml

[lib]
crate-type = ["staticlib"]

[dependencies]
blinc_platform_ios = "0.1"

Xcode Project

  1. Create a new iOS project in Xcode
  2. Add your Rust library as a dependency
  3. Configure the bridging header
  4. Set up the Metal view

Info.plist

<key>UILaunchStoryboardName</key>
<string>LaunchScreen</string>
<key>UISupportedInterfaceOrientations</key>
<array>
    <string>UIInterfaceOrientationPortrait</string>
    <string>UIInterfaceOrientationLandscapeLeft</string>
    <string>UIInterfaceOrientationLandscapeRight</string>
</array>

Touch Handling

fn handle_touch(event: TouchEvent) {
    match event.phase {
        TouchPhase::Began => {
            // Touch started
        }
        TouchPhase::Moved => {
            // Touch moved
        }
        TouchPhase::Ended => {
            // Touch ended
        }
        TouchPhase::Cancelled => {
            // Touch cancelled
        }
    }
}

Safe Area

// Get safe area insets
let insets = ctx.safe_area_insets();

// Build UI respecting safe area
div()
    .pt(insets.top)
    .pb(insets.bottom)
    .pl(insets.left)
    .pr(insets.right)
    .child(/* content */)

Lifecycle

ios_main(|ctx| {
    // App became active
    ctx.on_did_become_active(|| {
        // Resume animations, etc.
    });

    // App will resign active
    ctx.on_will_resign_active(|| {
        // Pause animations, save state
    });

    // App entered background
    ctx.on_did_enter_background(|| {
        // Save data
    });

    build_ui()
});

Building

# Build for iOS Simulator
cargo build --target aarch64-apple-ios-sim

# Build for iOS Device
cargo build --target aarch64-apple-ios --release

# Build universal binary
cargo lipo --release

Requirements

  • Xcode 14+
  • iOS SDK 14.0+
  • Rust with iOS targets:
    rustup target add aarch64-apple-ios
    rustup target add aarch64-apple-ios-sim
    

License

MIT OR Apache-2.0

Commit count: 444

cargo fmt