Expand description
A native macOS GUI framework for Rust: every view is a real AppKit control
(NSTableView, NSOutlineView, NSTextView…), built once and updated in
place by fine-grained signals. No virtual DOM, no diffing, no web view.
use ferrokit::*;
let count = Signal::new(0);
App::new("Counter")
.window(Window::new("Counter").size(320.0, 140.0).view(
vstack((
text(move || format!("Clicked {} times", count.get())),
button("Click me", move || count.update(|n| *n += 1)),
))
.padding(20.0),
))
.run();- State:
SignalandMemo(Copyhandles, freed with the window, row or document that made them),Effect,batch,spawnandResourcefor background work and loading,storedfor settings that persist. - Views and layout:
vstack,hstack,grid,spacer,scroll,for_each(keyed lists),dynamic, and theViewExtmodifiers (padding, sizes, context menus, accessibility labels), andViewExt::on_commandfor menuCommands that act on the focus. - Controls:
text_field,toggle,checkbox,picker,slider,stepper,progress,image,button. - Deep widgets:
table(millions of rows, sorting, editing, drag and drop),outlineandsidebar,text_editor. - App shell: menus (
App::menu), toolbars,splitviews andWindow::sidebar/Window::inspector,sheets,alerts, popovers (ViewExt::popover), open and save panels, document apps, a Settings window, window restoration, undo (undoable),on_framefor live data. - Forms and more controls:
form,date_picker,tabs,gauge, token fields, path controls, ratings. - Look: text styles, cards and shadows (
ViewExt::font,ViewExt::background,ViewExt::corner_radius,ViewExt::shadow), materials and Liquid Glass (ViewExt::material,ViewExt::glass), motion (animated,ViewExt::transition,ViewExt::on_hover). - Charts and drawing:
bar_chart,line_chart,area_chart,scatter_chart,pie_chart, and acanvas. - Web, PDF, video and services:
web_view,pdf_view,video_player,share_button,print,notify. - Testing:
testing(self-checks, real input, accessibility audits, window captures, soaks).
Start with the guide, 15 chapters whose examples are compiled as doc
tests. API.md, in the crate’s source and
on GitHub,
lists every public item on one page. macOS 15 or later. Main thread only.
AI coding agents: read AGENTS.md first, in the crate’s source
beside API.md and
on GitHub:
how a Ferrokit app is written, recipes that compile, and the known
limits. cargo ferrokit agents writes it into an app.
Re-exports§
pub use updates::UpdateEvent;pub use view::Align;pub use view::AnyView;pub use view::Axis;pub use view::Dynamic;pub use view::ForEach;pub use view::Grid;pub use view::Identifiable;pub use view::Modified;pub use view::Size;pub use view::Spacer;pub use view::Stack;pub use view::View;pub use view::ViewExt;pub use view::Views;pub use view::dynamic;pub use view::for_each;pub use view::grid;pub use view::hstack;pub use view::zstack;pub use view::Layers;pub use view::spacer;pub use view::vstack;pub use view::watch;pub use view::Watch;
Modules§
- guide
- The guide: how to build an app with Ferrokit, chapter by chapter. Its
examples are compiled as doc tests, so they match the API. Start with
chapter 1;
API.mdlists every public item on one page. - testing
- Helpers for automated checks of apps built with ferrokit: the accessibility tree as VoiceOver sees it, key equivalents through the menu, simulated edits, memory footprint and window snapshots. Used by the checklist and the example apps’ self-checks.
- updates
- Updates through Sparkle 2: when the app’s
bundle holds
Sparkle.frameworkand names a feed (cargo ferrokit bundleputs both in from[package.metadata.ferrokit.updates]), the app starts Sparkle’s updater at launch and gets Check for Updates… in its app menu. Sparkle checks the feed on its schedule (it asks the user first), shows what’s new, downloads, checks the update’s signature, installs and relaunches.
Structs§
- Alert
- An alert shown as a sheet (see
alert). - Animation
- How an animated change moves (see
animated_with). - Answer
- A future for an answer that comes later, from a dialog or a sheet:
alert_async,open_panel_async,save_panel_async,sheet_async. Await it in aspawn_localtask. - AnyView
- A type-erased view (any
Viewconverts into one). - App
- The application: a name, its windows and the AppKit run loop.
- Background
- A future for work on a background thread, from
background. - Button
- A push button.
- Cancel
- Tells a load whether its result is still wanted. A load is cancelled when
a newer one starts (its inputs changed, or
Resource::refetch) or the resource’s owner goes; long work can check and stop early. - Canvas
- A drawing canvas, made by
canvas. - Cell
Style - How a cell’s text looks (see
Column::style): the default for each field is the table’s own look. - Chart
- A chart, made by
bar_chart,stacked_bar_chart,line_chart,area_chart,scatter_chart,pie_chart,histogram,heatmaporsparkline: drawn on a canvas, redrawn when the signals its data function reads change, with values on hover, a legend for more than one series, and a summary for VoiceOver. - Checkbox
- A checkbox (
NSButton) bound two ways tovalue. - Clipboard
- A pasteboard:
Clipboard::generalis the system clipboard (⌘C/⌘V);Clipboard::privateis one of the app’s own (for tests, or data that mustn’t reach the clipboard). - Collection
- A grid of items (see
collection). - Collection
Item - What a collection shows for one item.
- Color
Well - A colour well bound two ways to
value: a click opens the system’s colour picker. - Column
- A column: an id (stable, used for sorting and saved state), a title, and how to get the cell value from a row.
- Column
Browser - A column browser (see
column_browser). - Column
State - A column’s place and width, as the user arranged them (for saving).
- Combo
Box - A text field with a list of suggestions (
NSComboBox). - Command
- A named action that menus, toolbars and code invoke, and views, windows or the app handle. Declare one as a constant:
- Completion
- What a completer offers at the caret: the text it completes (a byte
range ending at the caret, such as the partial word) and the words that
would replace it, best first. See
TextModel::set_completer. - Crash
Report - A report of a crash in an earlier run (see
App::crash_reports). - Date
Picker - A date (and optionally time) picker bound two ways to
value. - Divider
- A thin separator line across its stack: horizontal in a vertical stack, vertical in a horizontal one.
- Document
- An open document: its content and its file. Cloning gives another handle.
- Document
Type - One kind of document: its file extensions, how to make an empty one, read and write it, and the view of its window.
- Dynamic
- A region whose content is rebuilt when the signals
freads change. If the new view has the same.id(..)as the current one, the current node (and its native views) is kept. - Effect
- A side effect that re-runs when the signals it read change. It stops when the handle is dropped.
- Failure
- Something that failed in the app’s code or in AppKit, caught where
AppKit called in (see
App::on_error). - File
Dates - A file’s dates (see
file_dates);Nonewhere the file system doesn’t keep one. - Filter
- Rules, all, any or none of which must hold: what a
filter_editoredits. An empty filter lets everything through, and a number rule whose number isn’t filled in yet (NaN) is left out. - Filter
Editor - A filter builder (see
filter_editor). - Filter
Field - A field a
filter_editoroffers: its key (in theFilter), its title (in the editor) and its kind. - Font
- A font: one of the system’s text styles (sized as the Mac sizes them:
bodyis 13 pt,large_title26 pt), or a custom one. Change its weight, size or slant with the methods. - ForEach
- One view per item. When the items change, items whose id is still present keep their node (and native views); new ones are built; removed ones are torn down. Order follows the items.
- Form
- Settings and inspectors as Mac apps lay them out (see
FormStyle). - FormRow
- A row of a
section: a label and its control (form_row), or content across the row (form_content). - Frame
Loop - Calls a function once per frame of the display a window is on (see
on_frame). Dropping it stops the calls. - Gauge
- A level indicator (see
gaugeandrating). - Grid
- Rows of cells in aligned columns: each column is as wide as its widest cell, each row as tall as its tallest. Columns (rows) with a flexible cell share the extra space.
- Help
Button - See
help_button. - Image
- An image: an SF Symbol (
image), or a picture from a file or bytes (image_file,image_data). - Keyframes
- Values a signal goes through over time, each reached with its own
animation (see
keyframes). - Layers
- Children on top of one another (see
zstack). - Link
- A link to a web page or file (see
link). - Memo
- Derived state: recomputed when its inputs change; readers are notified
only when the value actually changes. A
Copyhandle, owned like aSignal. - Menu
BarExtra - An item in the menu bar (see
App::menu_bar_extra): SwiftUI’sMenuBarExtra. - Menu
Button - See
menu_button. - Menu
Item - An item of a menu: a command, a separator or a submenu. Used for context
menus and the menu bar (see
App::menu). - Modified
- A view with modifiers applied (see
ViewExt). Layout and look modifiers apply in the order written, as SwiftUI’s do:.frame(18.0, 18.0).padding(7.0)is an 18-point view with 7 points around it, and.padding(16.0).background(..)puts the background under the padding too, while.background(..).padding(16.0)doesn’t. - Native
View - An
NSViewof the app’s choosing, wrapped as a Ferrokit view (seenative). - Notification
- A notification (see
notify). - OnRuntime
- A future for a task on a tokio runtime, from
on_runtime. - Open
Options - What the Open panel allows.
- Outline
- A native outline view over a tree (see the module docs).
- Painter
- Draws on a
canvas: shapes and text, in points from the top-left corner. - Path
Control - A path control (see
path_control). - PdfView
- A PDF view (see
pdf_view). - Picker
- A pop-up menu choosing one of several values.
- Progress
- A progress bar or spinner:
Some(fraction)(0–1) orNonefor indeterminate. - Radio
Group - Radio buttons choosing one of several values (see
radio_group). - Related
Files - Access to the files beside a document, held while this lives (see
related_files). - Reply
- The way a sheet from
sheet_asyncanswers:senda value, orcancel. Either closes the sheet. A cheapClonehandle, for the sheet’s buttons. - Reporter
- What a job started by
spawn_with_progressreports its progress through, from its background thread. - Resource
- A value loaded on a background thread from inputs read on the main
thread. When the signals
sourcereads change, a new load starts and the one running is cancelled: only the newest result is ever shown, so search-as-you-type can’t show an older query’s rows. The last value stays readable while a new one loads. - Retained
- The owning pointer to an AppKit object (what the escape hatches, such as
WindowRef::ns’s callers andtesting’s view lookups, hold). A reference counted pointer type for Objective-C objects. - Rule
- A straight line across a chart at a value: a threshold, a target, an
average.
Rule::yruns across at a value (bar, line, area, scatter and histogram charts, and sparklines);Rule::xruns down at an x (line, area and scatter charts, and histograms). The chart’s range takes it in, so a target above every value still shows. - Scroll
- Vertically scrolling content (
NSScrollView). The content is laid out at the visible width and at least the visible height. - Search
Field - A search field (rounded, with a clear button) bound to
value. - Section
- A group of rows in a
form, with a title (""for none). - Segmented
- A segmented control choosing one of several values.
- Sent
Notification - A sent notification’s text, as
testing::sent_notificationsreports it. - Series
- One line of a
line_chart: a name and its points (sorted by x or not; they’re sorted for drawing). - Shadow
- A drop shadow (see
ViewExt::shadow). - Share
Button - A Share button (see
share_button). - Sheet
Handle - A sheet showing a view tree (see
sheet). Closing it tears the tree down. - Signal
- Mutable state: a
Copyhandle (closures capture it as is). It belongs to the owner current when it was made (see the module docs) and is freed with it; afterwards reading it panics and setting it does nothing. - Size
- A size in points.
- Sleep
- A future that’s ready after a time, from
sleep. - Slider
- A slider bound two ways to
value. - Sort
- The table’s sort: a column id and a direction.
- Spacer
- Flexible empty space along its stack’s axis.
- Split
- Side-by-side panes with draggable dividers (
NSSplitView). The first pane keeps its width when the window resizes (a sidebar); the others share the change.stackedputs them top to bottom.collapsiblepanes (a sidebar, an inspector) hide and show with a signal, or when dragged shut. - Stack
- A stack of views along one axis.
- Stepper
- Up/down arrows stepping
valuewithin a range. - Syntax
- How to colour a language. Build one with
Syntax::newand its methods, or start fromSyntax::sqlorSyntax::rust. - Table
- A native
NSTableViewshowing aTableModel: millions of rows, sorting, column resizing, type-select and VoiceOver come from AppKit. - Table
Model - A native table backed by rows of
T. See the module docs. - Tabs
- Panes chosen by tabs (see
tabs). - Task
- A task started by
spawn_local. ACopyhandle; dropping it neither cancels nor detaches the task. - Text
- Text (see
text). - Text
Editor - A native plain-text editor (
NSTextViewin a scroll view) showing aTextModel: input methods, spell checking, find, undo, text services and VoiceOver come from AppKit. - Text
Field - A single-line text field bound to a
Signal<String>. - Text
Model - A native plain-text editor. Cheap to clone (a handle); main thread only.
- Text
Style - How a run of text looks. What it leaves unset stays as the editor’s own (its font and text colour).
- Thumbnail
- A file’s thumbnail (see
thumbnail). - Time
Picker - A time-of-day picker (hour and minute, in the user’s 12- or 24-hour
format) bound two ways to
value. - Token
Field - A token field (see
token_field). - Toolbar
Item - An item of a window’s toolbar: made by
toolbar_button,toolbar_group,toolbar_picker,toolbar_search,toolbar_spaceortoolbar_fixed_space. - Tree
Node - One item of a tree, with its children.
- Video
Player - A video player (see
video_player). - Watch
- Runs a side effect for as long as this place in the tree exists; takes no space. For work that follows signals but shows nothing (applying a setting, saving a value).
- WebPage
- A web page shown by a
web_view: what it loads, and its title, address and loading state as signals. It’s SwiftUI’sWebPage. - WebView
- A web view (see
web_view). - Window
- A window to open when the app starts.
- Window
Ref - One of the app’s windows: what
open,windowsandfocused_windowreturn, and what the dialogs, document functions and checks take.
Enums§
- Align
- Alignment across a stack’s axis.
- AppEvent
- What the app hears about its environment.
- Appearance
- The app’s appearance.
- Axis
- Stack direction.
- Button
Style - How a button is drawn (
Button::style,MenuButton::style). - Canvas
Drag - A drag inside a canvas (see
Canvas::on_drag), in the canvas’s coordinates. - Cell
Image - A small image shown before a cell’s text (see
Column::icon). - Color
- A colour: for text, backgrounds, borders, drawing. The named ones are the system’s colours: they follow Dark Mode, Increase Contrast and the user’s accent colour.
- Control
Size - A control’s size, as in Apple’s apps: small controls in inspectors and dense panels, large ones for a welcome window’s main actions.
- Drag
Item - What a drag carries out of the app (see
Canvas::draggable). - Edge
- Which side of its view a popover appears on (it moves to the other side when there isn’t room).
- Field
Kind - What kind of values a
FilterFieldhas, and so its tests. - Field
Value - A field’s value, for
Filter::matches. - Filter
Rule - A rule of a
Filter: a test of one field, or a group of rules. - Filter
Test - What a rule tests a field for.
- Form
Style - How a
formlays out its rows. - Format
- How a chart prints its values: on the axes, in the hover readout and in what VoiceOver reads.
- Glass
- Liquid Glass behind a view (see
ViewExt::glass). On macOS 15, where there’s no Liquid Glass, a translucent popover material takes its place. - Item
Image - What an item’s image is.
- Load
- A resource’s state, from
Resource::state. - Match
- How a
Filter’s rules combine. - Material
- A system material behind a view (see
ViewExt::material): translucent, blurring what’s behind it, and following Dark Mode, Reduce Transparency and the window’s active state as the system’s own sidebars and panels do. - Modifier
- A modifier key: of a menu item’s shortcut (where Command is always
included), and of the keys and clicks
testing::inputposts. - Panel
Style - A panel’s kind (
Window::panel): a secondary window serving the main ones, which hides while the app is in the background. - Share
Item - Something to share (see
share_button). - Symbol
Effect - An SF Symbol animation (
Image::effect,Image::effect_on), drawn by AppKit (macOS 14; Wiggle, Rotate and Breathe from macOS 15; nothing on older systems). AppKit tones them down under Reduce motion. - TabStyle
- How
tabsshows its tabs. - Tabbing
- Whether a window opens as a tab of its app’s other windows
(
Window::tabbing). - Table
Key - A key a table can take without ⌘ (see
TableModel::set_keys). - Toolbar
Style - How a window’s toolbar sits with its title (see
Window::toolbar_style). - Transition
- How a view comes and goes when it’s added or removed inside
animated(seeViewExt::transition). Outside an animation it appears and disappears at once. - Value
- A value a view shows: fixed, or computed from signals (see the module
docs). Made by
IntoValue. - Video
Controls - The playback controls of a
video_player. - Weight
- How heavy a font’s strokes are.
Constants§
- FULL_
DISK_ ACCESS_ SETTINGS - System Settings ▸ Privacy & Security ▸ Full Disk Access, for
open_url: where the user allows an app to read every folder.
Traits§
- Identifiable
- Items with a stable identity, for
for_each. - Into
Value - What a view or modifier taking a value accepts: the value itself, or a closure computing it from signals.
- Stored
- A value
storedcan keep in user defaults. - View
- Something that can be shown: every view Ferrokit makes (
text,button,table, the stacks…) and anything built from them. Built once: its native views and effects are made the first time it’s shown and updated in place after. - ViewExt
- Modifiers every view has.
- Views
- A list of child views: a tuple of up to 16 views, or a
Vec<AnyView>(vec![AnyView::new(a), AnyView::new(b), ..]) for more. A nested stack also groups children:vstack((header, vstack((a, b, c)), footer)).
Functions§
- after_
batch - Registers
fto run after every outermost batch, once its effects have run (the layout pass hooks in here). - alert
- Shows
alertas a sheet onwindow;on_responsegets the index of the button chosen. - alert_
async - Shows
alertas a sheet onwindow, and returns a future for the index of the button chosen:alertfor aspawn_localtask.Nonewhen the alert ends without a button (its window closed) and it has no Cancel button to answer as; dropping the future (the task was cancelled) closes the alert. - animate
- Animates
valuefrom where it is totowithanimation, setting it every frame (about 120 times a second): views and drawings that read it follow. A spring passestoand comes back; a new animation of the same signal takes over from where it is. With Reduce Motion on, it’s set totoat once. - animated
- Runs
f(as abatch) and animates what it changes: views that move or resize because of it, opacity and colours thatopacityandbackgroundcompute, and views with atransitionthat come or go. Over a quarter of a second, easing in and out. - animated_
with animatedwith your own timing.- area_
chart - A line chart filled down to zero under each line: totals over time.
- asks_
before_ reading - Whether reading the folder at
pathmay stop to ask the user’s consent, so an app walking the disk should stay out of it (show it as “not scanned” instead).full_disk_accessis whathas_full_disk_accesssays; read it once per walk. - background
- Runs
workon a background thread now, and returns a future for its result, to await in aspawn_localtask:spawnfor async code. Call from the main thread. - bar_
chart - A bar chart of labelled values. Hovering a bar shows its value.
- batch
- Runs
f; effects triggered inside run once, when the outermost batch ends. - button
- A push button;
actionruns inside a batch. The title is fixed, or a closure computing it from signals (“Show Sidebar” or “Hide Sidebar”). - can_
perform - Whether
performwould run something now. - can_
perform_ in - Whether
perform_inwould run something. - cancel_
notification - Removes the notification
id: a daily one stops repeating, and one already shown leaves Notification Center. - canvas
- A canvas drawn by
draw, again whenever the signals it reads change or the canvas resizes: - checkbox
- A checkbox titled
title, bound two ways tovalue. - choose_
documents - Shows the Open panel for the app’s document types, as File ▸ Open… does (a button on a welcome window, say), and opens what’s chosen.
- close_
quick_ look - Closes the Quick Look panel, if it’s open.
- close_
window - Closes
windowand tears down its views (its node is dropped: effects stop, native views go). The app no longer lists it inwindows. - collection
- A native grid:
items(reading signals) gives the items,describewhat each shows (seeCollectionItem). - color_
well - A colour well bound two ways to
value. - column_
browser - A column browser, as Finder’s column view:
roots(reading signals) gives the tree,titleeach item’s text; the first column shows the roots, and selecting an item with children shows them in the next. Arrow keys move through it, type-select finds an item, and VoiceOver reads it as a browser. Name it withaccessibility_label. - combo_
box - A text field bound two ways to
value, withsuggestionsin a pop-up list (typing completes from them). - combo_
box_ with - A combo box whose suggestions come from
suggestions, re-read when the signals it reads change (names already used in the app’s data, say). Bound two ways tovalue, likecombo_box. - customize_
toolbar_ item - Customize Toolbar…, for a View menu: opens the main window’s toolbar
customisation sheet; enabled when that toolbar is customisable (see
Window::customizable_toolbar). - date_
picker - A date picker bound two ways to
value(date only; seeDatePicker::with_time). - disclosure
- A title with a disclosure triangle; clicking either shows or hides
content, built when it’s shown (expandedsays whether it is, both ways). For advanced settings and details. - divider
- A separator line across its stack.
- dock_
badge - The Dock icon’s badge, if any.
- document_
edited - Whether the document in
windowhas unsaved changes. - dynamic
- A region rebuilt when the signals
freads change (seeDynamic). - dynamic_
submenu - A submenu whose items
itemsbuilds each time it opens (Open Recent, a list of servers…), so it always shows the current state. - file_
dates - The dates of the file or folder at
path(not following a symbolic link): for “last opened” lists, “date added” columns and the like. Reading them is cheap (no Spotlight query): a few thousand files take a few milliseconds. - filter_
editor - AppKit’s filter builder (
NSPredicateEditor, as Mail’s rules and Finder’s smart folders use), bound two ways tofilter: a line saying whether all, any or none of the rules must hold, then a row per rule (a field, a test, a value), with + and − to add and remove rows; Option with + adds a nested group. It grows as rows are added. Text fields test contains, begins with, ends with, is and is not; numbers compare; choices are, or aren’t, one of theirs. - focused_
value - The value published under
namenearest the focus (seeViewExt::focused_value): what a menu command acts on, such as the selected note of the focused list.Noneif nothing near the focus publishes one of typeT. - focused_
value_ in focused_valueas ifwindowwere focused.- focused_
window - The window commands go to: the window of the toolbar button acting, the key window, else the main window, else the most recently opened visible one (an inactive app has neither). A key window with nothing of the app’s in it, such as the Quick Look panel or the font and colour panels, passes commands to the main window, as the Finder’s menus act on its window while Quick Look shows; a sheet (an Open panel, an alert) keeps them.
- for_
each - One view per item from
items(re-run when the signals it reads change). - form
- A form of
sections(seeForm). - form_
content - A row of content without a label (a checkbox, a note, a button).
- form_
row - A row with
labeland its control. VoiceOver reads the label as the control’s name (unless it has a title of its own, as a checkbox does). - format_
date secondssince 1970 as the user’s locale writes the date formattemplate:"EEEEdMMMM"is “Friday, 31 October” in English and “Freitag, 31. Oktober” in German;"MMMd","yMMM","EEE","jm"(a time, 12 or 24 hours as the user prefers).- format_
menu - TextEdit’s Format menu, for rich text editors
(
TextEditor::rich): Font (Show Fonts, Bold, Italic, Underline, Bigger, Smaller, Show Colors, Copy and Paste Style) and Text (alignment, Show Ruler, Copy and Paste Ruler), with their usual shortcuts. AppKit enables what applies to the focused editor. - format_
number valuewithdecimalsdecimals, grouped and pointed as the user’s region writes numbers (1,234.5 in the US, 1.234,5 in Germany).- format_
number_ for format_numberfor the locale namedidentifier("de_DE").- gauge
- A level indicator showing
value(a closure reading signals, or a fixed value) out ofmax(0 tomax), redrawn when the signals it reads change: storage used, a battery, signal strength. Give it awarningandcriticallevel to colour it. - grid
- A grid from rows of views (rows may be shorter than others).
- group_
box - A titled box:
contenton the system’s fill for grouped content, rounded, its title above (SwiftUI’sGroupBox). - has_
full_ disk_ access - Whether this app has Full Disk Access. It never prompts (it tries to read the privacy database, which only apps with access can). An app gets access after a relaunch, so read it at launch or before a walk.
- has_
liquid_ glass - Whether this Mac has Liquid Glass (macOS 26 and later).
- heatmap
- A grid of cells shaded by their values:
(column, row, value), with rows and columns in the order they first appear. A missing cell stays empty; hovering shows a cell’s value, and a scale from the lowest to the highest is drawn above (unlessno_legend). The shade is the first ofcolors, else blue. - help_
button - The round “?” button that opens help for the window or panel it’s in (put it in the bottom corner of a settings pane or sheet). VoiceOver reads it as “Help”.
- histogram
- How many values fall in each range: bars side by side over round-number
bins (about 10, or
bins). The values print withvalue_format; hovering a bar shows its range and count. - hstack
- Children left to right.
- image
- An SF Symbol by name (e.g.
"star.fill"). A name this macOS doesn’t have (a newer symbol, a typo) shows a placeholder and is reported as a failure (seeApp::on_error). - image_
data - A picture from bytes in a file format (PNG, JPEG…): one built into the
app with
include_bytes!. - image_
file - A picture from a file (PNG, JPEG, HEIC, PDF…), shown at its own size
unless given one (
.frame(..)). An unreadable file shows nothing. - is_dark
- Whether the app currently resolves to a dark appearance (system setting or app override).
- is_
full_ screen - Whether
windowis in full screen. - is_
quick_ look_ open - Whether the Quick Look panel is open.
- keyframes
- Takes
valuethroughframes(SwiftUI’s keyframe animator): a pulse, a shake, a count-up, a bounce; each step reached with its own timing. Reduce Motion skips to the last value (a repeating one stays at its start). - language
- The language the app’s strings are in: a code like
"de"or"pt-BR", or"en"(the keys’ own language). - later
- Runs
fon a later pass of the main run loop. - line_
chart - A line chart of one or more series. Hovering shows each series’ value at that x. Series of any length draw quickly: at most a few points per pixel column are kept.
- link
- A link titled
titlethat opensurl(a web page,mailto:, or afile://URL) in its app when clicked. VoiceOver reads it as a link. - local_
day - The calendar day
secondssince 1970 falls on in the user’s time zone, counted in days from 1 January 1970: a key for “done today”, streaks and calendars that stays right through daylight saving. - local_
day_ start - Local midnight at the start of
day(seelocal_day), in seconds since 1970. - menu_
button - A button showing a menu of actions when clicked (a pull-down button: “Export” with “CSV…”, “JSON…”, “PDF…”). The items are menu items, as in the menu bar: enabled, checked and with key equivalents.
- menu_
command - A menu item that performs
commandon whatever has focus, enabled only while something handles it. Add.key(..)for a shortcut. - menu_
item - A menu command. The title is fixed, or a closure read each time the menu opens (“Show Sidebar” or “Hide Sidebar”).
- menu_
separator - A separator line.
- move_
to_ trash - Moves
path(a file or a folder) to the Trash of its volume, as the Finder’s Move to Trash does, and returns where it is now: keep it to put the item back (undo) withstd::fs::renameto the old path. The name in the Trash can differ from the old one when the Trash already has an item with that name. - native
- Wraps an
NSViewFerrokit doesn’t have:makebuilds it, once, when the view is built (on the main thread;mtmis the marker AppKit’s initialisers take). Any view works: AppKit’s, another framework’s (MKMapView,SCNView), or the app’s own subclass made withdefine_class!. - new_
document - Opens a new, empty document.
Noneif the app has no document type. - notifications_
supported - Whether this app can post notifications: it must run from an app
bundle with a bundle identifier (a plain
cargo runbinary can’t). - notify
- Posts
notificationthrough Notification Center. The first time, macOS asks the user whether to allow the app’s notifications; while the app is in front they show as banners too. Without an app bundle (notifications_supported) it does nothing. - on_
frame - Calls
fonce per frame of the displaywindowis on, in step with its refresh (60 or 120 Hz), with the frame’s target time in seconds. Runs in abatch, so signal updates and layout happen once per frame: the place to apply data that arrived since the last frame. - on_
runtime - Runs
futureon the tokio runtimehandle(your app’s own, for I/O such as reqwest or sqlx), and returns a future for its output, to await in aspawn_localtask. Needs thetokiofeature. - open
- Opens
windownow (while the app runs) and returns it. - open_
document - Opens the document at
path, or brings its window to the front if it’s already open. - open_
panel - Shows the Open panel as a sheet on
window;on_donegets the chosen paths, orNoneif cancelled. - open_
panel_ async - Shows the Open panel as a sheet on
window, and returns a future for the chosen paths (Noneif cancelled):open_panelfor aspawn_localtask. Dropping the future (the task was cancelled) closes the panel. - open_
settings - Opens the app’s Settings window (see
App::settings), or brings it to the front, and returns it.Noneif the app has none. - open_
tab - Opens
windowas a new tab ofbeside(the tab bar’s + and a “New Tab” command use this). - open_
url - Opens
urlin the app that handles it: a web page in the browser, amailto:in Mail, a System Settings pane (such asFULL_DISK_ACCESS_SETTINGS). False if no app handles it. - open_
with - Opens the window
makebuilds, now, and returns it: the signalsmakecreates (a form’s fields, a selection) belong to the window and are freed when it closes. Prefer it toopenin an action: a signal made in an action outside any view lives as long as the app. - outline
- A native outline:
roots(reading signals) gives the tree,titleeach item’s text. - parse_
strings - Parses a
.stringstable:"key" = "value";lines, with/* */and//comments and the escapes\",\\,\n,\tand\Uxxxx. Malformed entries are skipped. - path_
control - The folders down to a file or folder, as the Finder’s path bar shows
them, bound two ways to
path: clicking a folder setspathto it. - pdf_
data viewas a PDF (seesave_pdf).- pdf_
view - A PDF view showing the file at
path(), reloaded when the signals it reads change (Noneshows nothing). It’s Preview’s view: zoom, text selection, copy and find. Its size is flexible. - pdf_
view_ data - A PDF view showing the document in
data()(frompdf_data, a download or a database). - perform
- Runs
commandin the focused window (seefocused_window); false if nothing handles it there or its handler is disabled. - perform_
in - Runs
commandas ifwindowwere focused (None: the app’s handler). - picker
- A pop-up menu bound two ways to
value, offeringoptions(title, value). - pie_
chart - Shares of a whole as slices, with a legend of names, values and
percentages.
donutmakes a ring with the total in its middle. Values of zero or less are left out. - plural_
category - The plural category of
ninlanguage(CLDR’s rules for integers):"one","few","many"or"other". - Prints
viewlaid out at the page’s width, across as many pages as it needs, with the Print sheet onwindow(printer, copies, Save as PDF). - progress
- A progress bar showing
value, a closure reading signals or a fixed value:Some(0.0..=1.0)orNonewhile the amount is unknown.spinnermakes it a spinner. - quick_
look - Opens the Quick Look panel on
paths, atpaths[index], as Space does in Finder (or shows them in the panel if it’s open): the arrow keys move between them, and the panel offers Open With and Share. - quit
- Ends the app (as ⌘Q does), on the next pass of the run loop. Quitting can wait for answers (a document app asks about unsaved changes) inside a nested run loop; starting it outside the caller’s batch keeps the UI updating meanwhile.
- radio_
group - Radio buttons bound two ways to
value, one per option (title, value), one above another (orhorizontal). - rating
- Stars from 0 to
max, bound two ways tovalue: clicking a star sets it, as in Music and Photos. - read_
stored - The user-defaults value under
key, if there is one: for values kept per document or per item (a database’s open tabs, a diagram’s layout), where astoredsignal for each, living as long as the app, would pile up. - recent_
documents - The recently opened or saved documents, newest first (that still exist).
- reduce_
motion - Whether the user asked for less motion (System Settings › Accessibility › Display › Reduce motion). Animated changes respect it on their own.
- regain_
access - Reaches
pathagain in the App Sandbox through the bookmarkremember_accesskept, until the app quits (a folder’s contents too). Whether the app can reach it:trueoutside the sandbox,falsewhen no bookmark was kept or it no longer resolves (the folder was deleted): ask the user to choose it again. - related_
files - Lets the app create, read and write the files beside
documentnamed by appending each ofsuffixesto its name ("-wal"givesdata.sqlite-wal), for as long as the returned value lives. - remember_
access - Keeps the app’s access to
path(a folder or file the user chose in an Open panel, or dropped) for later launches: in the App Sandbox the app reaches it only while it runs, and this keeps a security-scoped bookmark to it in the app’s defaults. Callregain_accessfor it after a relaunch, before reading it. Does nothing outside the sandbox (or for a path the app can’t reach now). Documents opened throughDocumentTypeare kept already. - remove_
stored - Removes the user-defaults value under
key. - reveal_
in_ finder - Shows
pathsselected in the Finder (File ▸ Show in Finder, ⌘R in many apps): one Finder window per folder, the items selected, the Finder brought to the front. - revert_
document - Reads the document in
windowback from its file, dropping its changes. - right_
to_ left - Whether the app lays out right to left: its language is Arabic, Hebrew,
Persian or Urdu (the app’s localisation and the user’s languages), or
the
NSForceRightToLeftWritingDirectiondefault is set. Ferrokit mirrors its layout then, as AppKit mirrors its own. - save_
document - Saves the document in
windowto its file. An error if it has none yet (usesave_document_as, or the Save menu item, which asks). - save_
document_ as - Saves the document in
windowtopath(Save As… without the panel); it then belongs to that file. - save_
panel - Shows the Save panel as a sheet on
window, proposingname(indirectory, if given);on_donegets the chosen path, orNoneif cancelled. Nothing is written: saving is the app’s job. - save_
panel_ async - Shows the Save panel as a sheet on
window, and returns a future for the chosen path (Noneif cancelled):save_panelfor aspawn_localtask. Dropping the future (the task was cancelled) closes the panel. - save_
pdf - Saves
viewas a PDF atpath, on letter or A4 pages (the user’s default paper) asprint()would print it, with no panel. - scatter_
chart - Points without lines: how two values relate. Hovering shows the point nearest the pointer.
- scroll
- Vertically scrolling
content. - search_
field - A search field bound two ways to
value(updated as the user types). - section
- A section of a
form: a title and rows. - secure_
field - A password field (
NSSecureTextField) bound two ways tovalue. - segmented
- A segmented control bound two ways to
value, one segment per option (title, value). VoiceOver reads each segment’s title. - segmented_
with - A segmented control whose segments come from
options(title, value), re-read when the signals it reads change: segments are added, removed and retitled in place (a tab bar of documents or queries). Bound two ways tovalue; no segment is selected whilevaluematches none. - set_
appearance - Sets the app’s appearance; every native view follows, and an
AppEvent::AppearanceChangedis delivered. - set_
dock_ badge - The Dock icon’s badge: a count or a short word (
Some("3")), or none. - set_
language - Uses
language("de","fr"…) instead of the user’s choice, or the user’s again withNone: for tests and in-app language pickers. Strings already shown (menus, labels that don’t read a signal) stay as they are. - set_
recent_ documents - Replaces the recent documents (File ▸ Open Recent), newest first: for an app that opens files of its own it doesn’t want listed (a scratch copy, a capture run’s files). Kept to the menu’s ten; files no longer there are left out when the list is read. In the App Sandbox a file stays listed after a relaunch only if the app can reach it now (it was opened, chosen or dropped in this run, or listed before).
- set_
undoable - Sets
signaltovalueas an undoable change namedtitle(seeundoable). Nothing is recorded if the value is unchanged. - share_
button - A button showing the system’s Share menu (Mail, Messages, AirDrop,
Notes…) for what
items()returns when it’s clicked. - sheet
- Shows
content(aWindowbuilt as usual: size and view) as a sheet onparent.on_closeruns when it closes; the view tree is then dropped. - sheet_
async - Shows the window
makebuilds as a sheet onparent, and returns a future for its answer:makegets aReplyfor the sheet’s buttons to send a value with (or cancel).Noneif it was cancelled or closed another way; dropping the future (the task was cancelled) closes the sheet. As withsheet_with, the signalsmakecreates belong to the sheet. - sheet_
with sheetfor the windowmakebuilds: the signalsmakecreates (the sheet’s fields) belong to the sheet and are freed when it closes, not kept for the app’s life as signals made in an action would be.- show_
welcome - Shows the app’s welcome window (see
App::welcome), opening it again if it was closed. False if the app has none. - sidebar
- A Mac sidebar: an outline in the source-list style whose top-level items are section headers, expanded.
- sleep
- A future that’s ready after
duration, timed on the main run loop (in the common modes, so it fires while a menu is open). The timer starts at the first poll. Call from the main thread; await it in aspawn_localtask. - slider
- A slider over
min..=max, bound two ways tovalue: horizontal and continuous unless giventicks,verticalorcircular. - spacer
- Flexible empty space along its stack’s axis.
- sparkline
- A small line with no axes, its last value marked: a trend beside a
number or in a row. It takes the width it’s given at a fixed height (80
× 24 unless
min_sizesays). ARule::ydraws a faint target line. - spawn
- Runs
workon a background thread, thenthenwith its result on the main thread, inside abatch. Call from the main thread. - spawn_
local - Runs
futureon the main thread, as a task of the main run loop: it can read and set signals and touch views between its.awaits, so it needn’t beSend. Call from the main thread. The first poll is on a later pass of the run loop, not inside this call. - spawn_
with_ progress spawnfor a long job that reports how far it is:progressreadsSome(0.0)at once, the fractionsworkreports through itsReporteras it goes, andNoneonce it’s done (just beforethenruns; also ifworkpanics, whenthendoesn’t run). Show it withprogress:- split
- Panes side by side with draggable dividers (see
Split). - stacked_
bar_ chart - Bars made of several series per category, stacked (or side by side
with
grouped): each category’s values are in the order ofseries_names. - stepper
- A stepper over
min..=maxin steps ofstep, bound two ways tovalue. - stop_
animation - Stops animating
value(where it is now). - stored
- A signal holding the user-defaults value under
key(ordefaultwhen there is none yet); every change is written back. Bind it to a control in a Settings window and read it anywhere: it lives as long as the app, and everystoredwith the same key (and type) gives the same signal. - submenu
- A submenu.
- system_
colors - Resolves the system colours for the app’s appearance.
- t
keytranslated into the app’s language, orkeyitself if there’s no translation.- t_
plural - A count in the app’s language:
t_plural(n, "{n} row", "{n} rows"). The English forms are the keys. A table gives each form as"{n} rows#one","{n} rows#few","{n} rows#many","{n} rows#other"(or just"{n} rows"for the other form).{n}is the number formatted for the user’s region (1,000 or 1.000). - t_with
twith{name}placeholders filled in:t_with("Open “{file}”", &[("file", &name)]). Translations can put them in any order.- table
- A native table showing
model(seeTable). - tabs
- Panes chosen by tabs, bound two ways to
value: one per page (its tab title, the value that selects it, its content). Every pane is built once and keeps its state while hidden. - text
- Text: fixed (
text("Packing list")), or computed from signals and updated in place (text(move || format!("{} left", left.get()))). - text_
editor - A native text editor showing
model(seeTextEditor). - text_
field - A text field bound two ways to
value. - thumbnail
- A file’s thumbnail, as Finder and the Open panel draw it: a page of a
PDF, a frame of a video, a picture, a document’s first page. Its icon
shows until the thumbnail is made (on a worker thread); it follows
path()’s signals, and VoiceOver reads the file’s name. - time_
picker - A time-of-day picker bound two ways to
value, an hour (0–23) and a minute: for a daily reminder or an opening time, which keep their hour and minute whatever the date or time zone. For a moment in time, usedate_pickerwithDatePicker::with_time. - today
- Today, as a
local_day. - toggle
- A labelled switch (
NSSwitch) bound two ways tovalue. With an empty title, the switch alone (aform_rownames it). - toggle_
full_ screen - Puts
windowinto full screen, or takes it out (as the green button and View ▸ Enter Full Screen do). - token_
field - A token field bound two ways to
value: words or names as tokens (tags, recipients), finished with Return or a comma. - toolbar_
button - A toolbar button: identifier, label, SF Symbol, action.
- toolbar_
command - A toolbar button that performs
commandon its window’s focus, disabled while nothing there handles it. - toolbar_
fixed_ space - A fixed space in the toolbar.
- toolbar_
group - Related buttons in one capsule (zoom out and in, back and forward), made
by
toolbar_button; one item to the overflow menu and the customisation sheet, underlabel. - toolbar_
picker - A choice of one in the toolbar, as segments with SF Symbols (Finder’s
view modes):
valueis set to the chosen choice’s value, and the segment follows it. Each choice is a label (for VoiceOver, tooltips and the overflow menu), a symbol and a value. - toolbar_
popover - A toolbar button that shows
contentin a popover pointing at the button, as Safari’s and Mail’s toolbar popovers do; a second press, a click outside or Escape closes it. The content is made each time it opens..disabled(..)and.optional()work as ontoolbar_button. - toolbar_
search - A toolbar search field bound two ways to
query. - toolbar_
space - Flexible space in the toolbar.
- undoable
- Makes a change the user can undo: runs
applynow (in abatch) and recordsrevertin the frontmost window’s undo history undertitle(“Rename”, “Delete Row”…). ⌘Z runsrevert, ⇧⌘Z runsapplyagain. - undoable_
in - As
undoable, inwindow’s undo history. - untrack
- Reads signals inside
fwithout subscribing the running effect to them. - video_
player - A video player for the file at
path(), replaced when the signals it reads change (Noneshows nothing): AVKit’s player, with the system’s controls, Picture in Picture and full screen. Plays sound files too. - video_
stream - A video player streaming from a web address (an HLS
.m3u8playlist or a plain video file on a server). - vstack
- Children top to bottom.
- watch
- A side effect owned by the view tree (see
Watch). - web_
view - A web view showing
page: a realWKWebView, with the system’s scrolling, text selection, find and Look Up. Its size is flexible. - weekday
- The weekday of a
local_day, 0 for Monday to 6 for Sunday. - welcome_
window - The welcome window, while it’s open.
- windows
- The app’s windows, in the order they were opened.
- write_
stored - Writes
valueunderkeyin user defaults now (seeread_stored). - zstack
- Children on top of one another, the first at the back: text or a glass
panel over a picture, a badge over an icon. The stack is as large as its
largest child. Children that fill (a picture with
.fill_width()and.fill_height()) take its whole size; the others keep their own and are centred, or placed byalignment.
Type Aliases§
- Write
File - A file’s writer: called with where to write it.