Repository navigation
feat(ios): add UIKit RuneView shell, CADisplayLink pacing, and rune::run entry (#803) - #3239
Merged
Merged
Conversation
There was a problem hiding this comment.
Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota.
An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.
pascalandr
added a commit
to NeuralNomadsAI/rune
that referenced
this pull request
Dec 2, 2026
…eyboard (anomalyco#803) Slice 1 (anomalyco#3239) draws and takes touches, but a focused text field gets no keyboard on iOS. A RuneView now carries a hidden RuneTextInput subview that becomes first responder while a field (or an El::ime_cursor surface) takes text and resigns when focus leaves it. The keyboard edits a copy of the field (text/doc.rs): the runtime's ime_text window plus marked text, in UTF-16 at the UIKit edge, so UIKit sees each edit at once. Edits reach the runtime as Key::Text/Backspace/Enter and Ime::Preedit/Commit/Select; after each frame the copy is reconciled with the runtime and the input delegate hears when text or caret moved under it. Passwords show the keyboard nothing and take commits as typed text. text/traits.rs maps InputMode, single_line and secure to UIKeyboardType, UIReturnKeyType, autocorrection and capitalization, and reloads an attached keyboard when they change, after any composition ends. Geometry questions answer with the field's caret rect; per-character geometry is a later slice. keyboard.rs observes UIKeyboardWillChangeFrame/WillHide and turns the keyboard's overlap of the view's bottom edge into Cx::keyboard_inset(), so a standalone rune::run app no longer needs rune_ios_view_set_keyboard_inset. The responder syncs after the view's RefCell is released, since taking or giving up the keyboard can post those notifications synchronously. focused_editable_input and commit_secure_text, used by Android, now compile for iOS too. examples/ios-hello gains a note field (RUNE_IOS_HELLO_FOCUS=1 focuses it at launch). Tests: host tests for the document, the traits and their reload, the keyboard overlap, and TextState/apply against a real Runtime (typing, composition, autocorrection, passwords, InputMode::None). Co-authored-by: Abraham Gonzalez <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds the first M6 iOS shell slice so Rune apps start with
rune::run/App::runon iOS or embed aRuneView(UIView+CAMetalLayer) inside UIKit / SwiftUI hosts.crates/rune/src/platform/ios/):RuneView(UIViewsubclass whose+layerClassreturnsCAMetalLayer) driven byrune::embed::LayerHostand a main-run-loopCADisplayLink(requesting 120 Hz viaCAFrameRateRangeon iOS 15+).rune::machinelifecycle and pacing state machine (machine.rs) that pausesCADisplayLinkat rest (0% CPU) and immediately pauses + cancels active touches when entering the background or detaching from a window so Metal never acquires drawables in the background.UITouchforwarding (touch.rs),UIEdgeInsets->Cx::safe_area()CSS-order mapping (insets.rs),Cx::keyboard_inset()hook, andUITraitCollectiondark/light mode ->Cx::system_dark().rune::run/App::runentry viaUIApplicationMain+RuneIosAppDelegate(host.rs), plusrune::ios::view/rune::ios::view_appandrune_ios_view_*C FFI helpers (ffi.rs) for SwiftUI / UIKit embedding.rune_core::main_queue::on_main_after(dispatch_after_f) for timed wakes on macOS and iOS.CFStringCompareWithOptionsAndLocale) and Apple system font fallback tables across macOS and iOS inrune-text, and exposedrune_gpu::with_layer/nativeon iOS.LayerHost::from_core_animation_layer_configured(iOS) andLayerHost::attach_core_animation_layer(Apple) soApp<S>configuration andRuntime<S>survive view re-attachment.examples/ios-hello(withinclude/RuneView.hand SwiftUIUIViewRepresentablesnippet),IOS.md, and a changelog entry.Verification
cargo test -j 1 -p rune --lib ios: 23 passed, 0 failed (state machine, touch tracker, inset/scale/dark-mode conversions, Dynamic Type).cargo test -j 1 -p ios-hello: 1 passed, 0 failed.cargo check -j 1 -p rune --lib(Windows) andcargo check -j 1 -p rune --target wasm32-unknown-unknown: passed.cargo check -j 1 --target aarch64-apple-ios -p rune --lib -p ios-hello(with temporary localblake3/pureoverride to bypass missing Applexcrunon Windows, reverted before commit): 0 errors, 0 warnings.scripts/file-size.sh: 0 errors, 0 new warnings.Fixes #803