mobiler-core
Mobiler's runtime — the developer-facing API.
Implement MobilerApp with your typed events, model, and a view built from the
widget builders. Mobiler wraps it in MobilerShell,
a Crux app speaking the fixed UI ABI
(mobiler-ui) — so the native shell stays
generic and you never touch the wire protocol.
pub type App = ;
- Capabilities via
Cx— device APIs as async effects, reached through typed helpers inupdate/input. Built in: HTTP, storage, clipboard, share, browser, toast, snackbar, device info, the app's version/build, the OS light/dark setting, haptics, a confirm dialog, the photo picker, camera capture, the date picker, and the time picker. Each is an opaque{plugin, op, input}effect, so adding one never changes the wire ABI; the generic shell fulfils them natively on Android, iOS, and the web. - Navigation — a core-owned
Nav<Route>stack +nav_scaffold. - Theme-as-data — dark mode, brand color, corner radius, and a
Density(Compact/Comfortable/Large —Largescales up control sizing and spacing for touch) all flow through theWidgettree, plus a design system's tokens: a light/darkPaletteof colour roles,with_appearance(Light/Dark/System), custom fonts (FontFamily::Custom+mobiler fonts sync), a per-styleTypeScale, and per-component cornerShapes. To open in the app's own appearance choice from the first frame, keep it incx.savestate:Restorearrives beforeStart, while asecurestoreread arrives after the first frame. - Feedback & actions —
cx.snackbar(with an optional Undo), an extended FAB (with_extended_fab), a pinned bottom bar for a screen's main actions (with_bottom_bar), an iOS-only floating Liquid Glass tab bar and glass FAB (with_ios_glass_tabs; Android and the web keep the standard bar, ADR-0059), a step indicator (steps/with_step_caption), status badges with icons (with_icon), initials avatars (with_initials), fixed grid columns (with_columns), dashed cards, andcx.open_url_then(did the link open?). - Charts — typed builders for data viz:
bar_chart/line_chart, multi-serieschart/stacked_bar_chart/pct_stacked_bar_chart,pie_chart/donut_chart, fitness-stylerings_chart, agauge_chart, andregion_chart(variable-width coverage-gap bands). - Live native views — builders for native-engine widgets the shell hosts:
video_player(AVPlayer / ExoPlayer /<video>),web_view,pdf_view, andmap(MapKit / MapLibre — markers + tap events, no API key). - Accessibility —
a11y(child, label)(+with_a11y_hint/with_a11y_role) names any widget for VoiceOver / TalkBack. - Localization —
format(synchronous, ICU-free locale-aware currency / number / date formatting viaLocale+Currency, plusweekday_short/month_yearandLocale::week_startfor a localizedcalendar_in) andi18n(negotiatea device language + a tiny fallback-awareCatalogfor translating UI strings inview). - Tab badges —
with_tab_dot(tab, label)andwith_tab_count(tab, count, label)put a dot or an unread count (0= none, above 99 =99+) on a tab;labelis spoken after the tab's name (empty: the screen reader reads the number):with_tab_count(tab_icon("Inbox", Icon::Mail, sel, Msg::Inbox), unread, format!("{unread} unread")). - Copy with options —
cx.copy_with(text, CopyOptions, then)marks a copy sensitive, expires it, or keeps it on the device;cx.copy_sensitive(secret, then)is the preset for a password, a recovery code or a TOTP secret (sensitive, 2 minutes, kept off other devices on iOS). Android 13+ hides it in the clipboard preview; its expiry is best effort: Android 10+ lets only the app in front read the clipboard, so once the user switches away it clears within seconds of the app coming back, gives up an hour after the deadline, and never clears if the process dies first. iOS keeps it out of Universal Clipboard and lets the system remove it (it also marks it concealed, a convention only some Mac clipboard managers honour, and only if the copy reaches a Mac); the web copies it plainly.thengetsok: falsefrom a shell that predates it (don't fall back tocx.copy).cx.copyis unchanged. Onok: true,CopyApplied::from_response(&resp)says what this platform applied (sensitive marker, who expires it, kept off other devices; ADR-0053);Nonemeans unknown, e.g. a shell from CLI 0.68, and a marker is not proof the text is hidden.
Most users go through the mobiler CLI, which
scaffolds a project wired to this crate and a generic native shell.
Upgrading
Breaking in mobiler-ui 0.32 / mobiler-core 0.47: requires crux_core 0.20 (and facet =0.46.5, which
crux 0.20 pins). Your workspace's crux_core pin must move with it, or the build pulls in two crux copies and fails
with a type mismatch. CLI 0.70's mobiler upgrade --apply moves the pin and your codegen's bindgen for you. The wire
is unchanged; the gain is crux 0.20's bridge fixes (no registry slot leaked per render, effect ids never reused).
Breaking in mobiler-ui 0.33 / mobiler-core 0.48: Scaffold gained ios_glass_tabs, Icon gained
Ledger, Chart, Wallet, CreditCard, Lock, Download, Upload and Globe, and ColorRoles gained
outlined_fill, outlined_border, segment_selected and on_segment_selected. Full literals and exhaustive matches
need them; custom native shells should draw them (mobiler upgrade --apply updates generated ones).
Breaking in mobiler-ui 0.31 / mobiler-core 0.44: Tab gained badge: Option<TabBadge>. A
Tab { … } literal needs badge: None; tab / tab_icon are unaffected. Custom native shells
should draw the badge (mobiler upgrade --apply updates generated ones once the CLI templates ship it).
Breaking in mobiler-ui 0.30 / mobiler-core 0.41: ColorRoles gained selection, error,
error_fill and on_error_fill. A full ColorRoles { … } literal needs ..Default::default().
Breaking in mobiler-ui 0.29 / mobiler-core 0.40 (the design release — additive in spirit, but new fields on existing types):
Themegainedpalette,type_scaleandshapes: writeTheme { seed, ..Default::default() }instead of listing every field.- New fields on existing widgets break full literals and exhaustive patterns:
Scaffold(appearance,bottom_bar),Fab.label,Badge.icon,Avatar.{initials, size},Grid.columns; new variantsTextStyle::{Display, Headline},FontFamily::Custom,CardStyle::Dashed,Icon::DoneAll,Widget::Steps. Build widgets through the builders (scaffold,with_fab,badge,avatar,grid, …) and match with... - Custom native shells must handle the new cases;
mobiler upgrade --applyupdates generated ones.
License
Dual-licensed under either MIT or Apache-2.0, at your option.