-
-
Notifications
You must be signed in to change notification settings - Fork 15
iOS
This guide covers setting up an iOS Blinc project — toolchain, build commands, and the platform-specific files (Info.plist, Xcode configuration, debugging).
For the cross-platform Blinc API (native bridge, camera, deep linking, lifecycle, etc.), see the Mobile Development overview.
Install Xcode 15+ from the App Store.
xcode-select -prustup target add aarch64-apple-ios # Device
rustup target add aarch64-apple-ios-sim # Simulator (Apple Silicon)
rustup target add x86_64-apple-ios # Simulator (Intel)Create a build script build-ios.sh:
#!/bin/bash
set -e
MODE=${1:-debug}
PROJECT_NAME="my_app"
[ "$MODE" = "release" ] && CARGO_FLAGS="--release" || CARGO_FLAGS=""
TARGET_DIR=$([ "$MODE" = "release" ] && echo "release" || echo "debug")
cargo build --target aarch64-apple-ios $CARGO_FLAGS
cargo build --target aarch64-apple-ios-sim $CARGO_FLAGS
mkdir -p platforms/ios/libs/{device,simulator}
cp target/aarch64-apple-ios/$TARGET_DIR/lib${PROJECT_NAME}.a \
platforms/ios/libs/device/
cp target/aarch64-apple-ios-sim/$TARGET_DIR/lib${PROJECT_NAME}.a \
platforms/ios/libs/simulator/./build-ios.sh # debug
./build-ios.sh releaseThen open platforms/ios/BlincApp.xcodeproj in Xcode and press Cmd+R.
[lib]
name = "my_app"
crate-type = ["cdylib", "staticlib"]
[target.'cfg(target_os = "ios")'.dependencies]
blinc_app = { version = "0.5", features = ["ios"] }
blinc_platform_ios = "0.5"-
Link static library: Build Phases → Link Binary With Libraries → add
libmy_app.afromlibs/device/orlibs/simulator/ -
Bridging header: Build Settings → Objective-C Bridging Header →
BlincApp/Blinc-Bridging-Header.h -
Frameworks:
Metal.frameworkMetalKit.frameworkQuartzCore.framework-
AVFoundation.framework(camera/audio) -
CoreHaptics.framework(haptics)
<!-- Camera + microphone permissions for native bridge features -->
<key>NSCameraUsageDescription</key>
<string>This app uses the camera for photo capture.</string>
<key>NSMicrophoneUsageDescription</key>
<string>This app records audio.</string>
<!-- Deep link URL scheme -->
<key>CFBundleURLTypes</key>
<array>
<dict>
<key>CFBundleURLSchemes</key>
<array><string>myapp</string></array>
</dict>
</array>The bridging header (Blinc-Bridging-Header.h) declares the C FFI surface Swift uses to call Rust:
// Context lifecycle
IOSRenderContext* blinc_create_context(uint32_t width, uint32_t height, double scale);
void blinc_destroy_context(IOSRenderContext* ctx);
// Rendering
bool blinc_needs_render(IOSRenderContext* ctx);
void blinc_build_frame(IOSRenderContext* ctx);
bool blinc_render_frame(IOSGpuRenderer* gpu);
// Input
void blinc_handle_touch(IOSRenderContext* ctx, uint64_t id, float x, float y, int32_t phase);
// Deep linking + keyboard (see Mobile overview for usage)
void blinc_ios_handle_deep_link(const char* uri);
void blinc_ios_set_keyboard_inset(IOSRenderContext* ctx, float inset);The BlincViewController template manages the CADisplayLink, CAMetalLayer, and touch event forwarding to Rust.
View Rust logs in Xcode's console or Console.app with a filter:
subsystem:com.blinc.my_app
"Library not found: -lmy_app" — run ./build-ios.sh first.
Black screen on simulator —
- Verify the right simulator target (
aarch64-apple-ios-simfor Apple Silicon,x86_64-apple-iosfor Intel) - Verify the static library is in
libs/simulator/ - Check Xcode console for Metal initialization errors
Touch events not working —
- Verify
blinc_create_contextsucceeds (check console) - Ensure
ios_app_init()is called before creating the context - Touch coordinates must be in logical points, not physical pixels
Native call failed — verify Swift handler is registered with matching namespace.name. Check that BlincNativeBridge.shared.connectToRust() was called at app launch.
[profile.release]
lto = "fat"
opt-level = "z"
panic = "abort"
strip = true
codegen-units = 1- Test on real devices — simulators use software rendering for some Metal operations
- Profile with Instruments — use the Metal System Trace template for GPU analysis
- Mobile Development overview — native bridge, camera, deep linking, lifecycle, safe area APIs
- Android Project Setup — build the Android counterpart
- CLI Reference
Getting Started
Mobile Development
Example Gallery
- Example Gallery
- Canvas Element
- Canvas Kit Interactive
- Carousel Demo - Selector API Showcase
- Chrome-Style Tabs
- blinc_cn Components
- Code Element
- Complex SVG
- CSS Debug
- CSS Visual Features
- Layer Effects
- Emoji and HTML Entities
- @flow Shader
- Fluid Surface
- Skeleton animation with glTF +
blinc_canvas_kit. DrawContext::run_gpu_passend-to-end demo.- Image CSS Styling
- Image Layer Test
- Keyframe Animation Canvas
- Markdown Editor
- 3D Mesh Demo — renders the Khronos glTF
DamagedHelmetsample model - Motion Demo
- Music Player Glass Card
- Node-editor demo — pre-wired graph with three node types, typed
- Notch Menu Bar
- Overflow Fade
- Overlay System
- Pointer Query
- Rich Text Element
- Rich Text Editor
- Scroll Container
- Semantic @flow
- Sortable
- Stateful API + Signal-bound modifiers demo.
- End-to-end 3D demo wiring Blinc's SceneKit3D renderer up to
- Unified Styling API
- SVG Animation
- Table Builder
- Tabler Icons
- Minimal text positioning test
- Text Input Widgets
- KHR_texture_transform
- Theme System
- Timeline Animation
- Typography
- Video Player
- Wet Glass
- Windowed Application
Web Development
Core Concepts
- Elements & Layout
- Styling & Materials
- CSS Styling
- Theming
- Event Handling
- State Management
- Element Refs
Animation
Components
Component Library (blinc_cn)
Widgets
- Buttons & Inputs
- Text & Rich Text
- Code Editor
- Scroll Containers
- Virtualized List
- Canvas Drawing
- Images & SVG
- Audio & Video
- Markdown Rendering
Canvas Kit
Advanced
- Routing & Navigation
- Multi-Window
- System Integration
- Element Query API
- Overlay System
- Custom State Machines
- Pointer Query
- Performance Tips
- Flow Shaders
- 3D Rendering
- Custom GPU Passes
- Hot-reload (experimental)
Architecture
Contributing