Share view models and controls, then supply a mobile entry point and a single-view lifetime. Desktop Window behavior is not the hosting contract for mobile content.
Start with an existing host
Section titled “Start with an existing host”Use the iOS catalog or Android catalog before adapting your own application. These supply the platform entry points and build setup that a shared view does not include.
From the repository root, the supplied smoke scripts can build and exercise the hosts:
# Replace the simulator argument with an installed device name or UDID.scripts/ios/sim-catalog.sh 'YOUR_SIMULATOR_UDID' --pages Home,TextBox,ListBox# Uses the configured Android SDK, NDK, and emulator.scripts/android/emu-catalog.sh --build --pages 'Home;TextBox;ListBox'These scripts manage a simulator/emulator run and capture the requested pages. Follow their --help output for keeping the device running and selecting output paths. Device signing and store distribution remain separate steps.
For a shared profile view, keep the form in a component or a UserControl; each platform host installs that view using its own lifetime. A component is shown there through ComponentHost::with_view(|| rsx! { ProfileForm {} }), a control the single-view lifetime can hold. Put saved profile data in a service so a recreated surface can rebuild the form from state.
Use Xcode, the iOS SDK, and a Rust target appropriate to the simulator or device. The repository includes bundling scripts and a catalog entry point. Simulator success does not verify signing, device GPU behavior, safe areas, or VoiceOver on physical hardware.
Android
Section titled “Android”Use the Android SDK and NDK with the framework’s supported minimum API level. The repository’s packaging scripts build without requiring a Gradle application project. Keep the native activity lifecycle, input method, and surface lifecycle in mind when retaining application state.
Design for interruption
Section titled “Design for interruption”A mobile app can lose focus, pause, change orientation, or have its surface recreated. Persist important state in services or models with an appropriate lifetime. Cancel transient work and avoid assuming every control attachment lasts for the whole process.
Verify interaction
Section titled “Verify interaction”Test touch target size, software keyboard occlusion, scrolling while text is focused, safe-area insets, back navigation, accessibility, and suspend/resume. Use actual devices for release confidence; emulators and simulators cover only part of the platform behavior.
Public controls and next steps
Section titled “Public controls and next steps”- UserControl — reusable content without desktop window assumptions.
- ScrollViewer, TextBox, and Button — a form that remains usable with the software keyboard open.
- Adaptive layout, accessibility, and async lifetimes.
- Public API index — check each entry’s extracted platform availability before using a platform-specific method.