Skip to main content

Crate ferrokit

Crate ferrokit 

Source
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();

Start with the guide, 14 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;

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.md lists 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.framework and names a feed (cargo ferrokit bundle puts 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).
AnyView
A type-erased view (any View converts into one).
App
The application: a name, its windows and the AppKit run loop.
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.
CellStyle
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, heatmap or sparkline: 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 to value.
Clipboard
A pasteboard: Clipboard::general is the system clipboard (⌘C/⌘V); Clipboard::private is one of the app’s own (for tests, or data that mustn’t reach the clipboard).
Collection
A grid of items (see collection).
CollectionItem
What a collection shows for one item.
ColorWell
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.
ColumnBrowser
A column browser (see column_browser).
ColumnState
A column’s place and width, as the user arranged them (for saving).
ComboBox
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.
CrashReport
A report of a crash in an earlier run (see App::crash_reports).
Cx
Where a view is being built: the native view its leaves are added to.
DatePicker
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.
DocumentType
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 f reads 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).
FileDates
A file’s dates (see file_dates); None where the file system doesn’t keep one.
Filter
Rules, all, any or none of which must hold: what a filter_editor edits. An empty filter lets everything through, and a number rule whose number isn’t filled in yet (NaN) is left out.
FilterEditor
A filter builder (see filter_editor).
FilterField
A field a filter_editor offers: its key (in the Filter), its title (in the editor) and its kind.
Font
A font: one of the system’s text styles (sized as the Mac sizes them: body is 13 pt, large_title 26 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).
FrameLoop
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 gauge and rating).
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.
HelpButton
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 Copy handle, owned like a Signal.
MenuBarExtra
An item in the menu bar (see App::menu_bar_extra): SwiftUI’s MenuBarExtra.
MenuButton
See menu_button.
MenuItem
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.
NSWindow
The AppKit window type the window functions take and return. Apple’s documentation
NativeView
An NSView of the app’s choosing, wrapped as a Ferrokit view (see native).
Node
A built view: native views, effects and helper objects it owns.
Notification
A notification (see notify).
OpenOptions
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.
PathControl
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) or None for indeterminate.
RadioGroup
Radio buttons choosing one of several values (see radio_group).
RelatedFiles
Access to the files beside a document, held while this lives (see related_files).
Reporter
What a job started by spawn_with_progress reports 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 source reads 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 (as returned by open). 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::y runs across at a value (bar, line, area, scatter and histogram charts, and sparklines); Rule::x runs 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.
SearchField
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.
SentNotification
A sent notification’s text, as testing::sent_notifications reports 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).
ShareButton
A Share button (see share_button).
SheetHandle
A sheet showing a view tree (see sheet). Closing it tears the tree down.
Signal
Mutable state: a Copy handle (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.
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. stacked puts them top to bottom. collapsible panes (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 value within a range.
Syntax
How to colour a language. Build one with Syntax::new and its methods, or start from Syntax::sql or Syntax::rust.
Table
A native NSTableView showing a TableModel: millions of rows, sorting, column resizing, type-select and VoiceOver come from AppKit.
TableModel
A native table backed by rows of T. See the module docs.
Tabs
Panes chosen by tabs (see tabs).
Text
Text (see text).
TextEditor
A native plain-text editor (NSTextView in a scroll view) showing a TextModel: input methods, spell checking, find, undo, text services and VoiceOver come from AppKit.
TextField
A single-line text field bound to a Signal<String>.
TextModel
A native plain-text editor. Cheap to clone (a handle); main thread only.
TextStyle
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).
TimePicker
A time-of-day picker (hour and minute, in the user’s 12- or 24-hour format) bound two ways to value.
TokenField
A token field (see token_field).
TreeNode
One item of a tree, with its children.
VideoPlayer
A video player (see video_player).
ViewId
Identifies a mounted native view. Chosen by the caller; stable for the view’s lifetime (views are created once and updated in place).
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’s WebPage.
WebView
A web view (see web_view).
Window
A window to open when the app starts.

Enums§

Align
Alignment across a stack’s axis.
AppEvent
What the app hears about its environment.
Appearance
The app’s appearance.
Axis
Stack direction.
ButtonStyle
How a button is drawn (Button::style, MenuButton::style).
CanvasDrag
A drag inside a canvas (see Canvas::on_drag), in the canvas’s coordinates.
CellImage
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.
ControlSize
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.
DragItem
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).
FieldKind
What kind of values a FilterField has, and so its tests.
FieldValue
A field’s value, for Filter::matches.
FilterRule
A rule of a Filter: a test of one field, or a group of rules.
FilterTest
What a rule tests a field for.
FormStyle
How a form lays 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.
ItemImage
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 (Command is always included).
PanelStyle
A panel’s kind (Window::panel): a secondary window serving the main ones, which hides while the app is in the background.
ShareItem
Something to share (see share_button).
SymbolEffect
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 tabs shows its tabs.
Tabbing
Whether a window opens as a tab of its app’s other windows (Window::tabbing).
TableKey
A key a table can take without ⌘ (see TableModel::set_keys).
ToolbarItem
An item of a window’s toolbar: made by toolbar_button, toolbar_group, toolbar_picker, toolbar_search, toolbar_space or toolbar_fixed_space.
ToolbarStyle
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 (see ViewExt::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.
VideoControls
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.
IntoValue
What a view or modifier taking a value accepts: the value itself, or a closure computing it from signals.
Stored
A value stored can keep in user defaults.
View
Something that can be shown. Build-once: View::build creates native views and effects; it is never called again for the same place.
ViewExt
Modifiers every view has.
Views
A list of child views: a tuple of views, or a Vec<AnyView>.

Functions§

after_batch
Registers f to run after every outermost batch, once its effects have run (the layout pass hooks in here).
alert
Shows alert as a sheet on window; on_response gets the index of the button chosen.
animate
Animates value from where it is to to with animation, setting it every frame (about 120 times a second): views and drawings that read it follow. A spring passes to and comes back; a new animation of the same signal takes over from where it is. With Reduce Motion on, it’s set to to at once.
animated
Runs f (as a batch) and animates what it changes: views that move or resize because of it, opacity and colours set by opacity_when and background_when, and views with a transition that come or go. Over a quarter of a second, easing in and out.
animated_with
animated with 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 path may 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_access is what has_full_disk_access says; read it once per walk.
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; action runs inside a batch. The title is fixed, or a closure computing it from signals (“Show Sidebar” or “Hide Sidebar”).
can_perform
Whether perform would run something now.
can_perform_in
Whether perform_in would 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 to value.
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 window and tears down its views (its node is dropped: effects stop, native views go). The app no longer lists it in windows.
collection
A native grid: items (reading signals) gives the items, describe what each shows (see CollectionItem).
collection_cells_made
Collection cells made since launch: stays near a screenful however many items scroll past (diagnostic).
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, title each 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 with accessibility_label.
combo_box
A text field bound two ways to value, with suggestions in a pop-up list (typing completes from them).
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; see DatePicker::with_time).
disclosure
A title with a disclosure triangle; clicking either shows or hides content, built when it’s shown (expanded says 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 window has unsaved changes.
dynamic
A region rebuilt when the signals f reads change (see Dynamic).
dynamic_submenu
A submenu whose items items builds each time it opens (Open Recent, a list of servers…), so it always shows the current state.
effect_runs
Total effect runs on this thread so far (diagnostic).
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 to filter: 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 name nearest the focus (see ViewExt::focused_value): what a menu command acts on, such as the selected note of the focused list. None if nothing near the focus publishes one of type T.
focused_value_in
focused_value as if window were 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 (see Form).
form_content
A row of content without a label (a checkbox, a note, a button).
form_row
A row with label and 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
seconds since 1970 as the user’s locale writes the date format template: "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
value with decimals decimals, 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_number for the locale named identifier ("de_DE").
gauge
A level indicator showing value() out of max (0 to max), redrawn when the signals it reads change: storage used, a battery, signal strength. Give it a warning and critical level to colour it.
grid
A grid from rows of views (rows may be shorter than others).
group_box
A titled box: content on the system’s fill for grouped content, rounded, its title above (SwiftUI’s GroupBox).
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 (unless no_legend). The shade is the first of colors, 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 with value_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 (see App::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 window is in full screen.
is_quick_look_open
Whether the Quick Look panel is open.
keyframes
Takes value through frames (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).
labelDeprecated
Text computed from signals: the same as text with a closure.
language
The language the app’s strings are in: a code like "de" or "pt-BR", or "en" (the keys’ own language).
later
Runs f on a later pass of the main run loop.
layout_passes
Layout passes so far. With layout_times_us, the times of the passes since an earlier count: let t = layout_times_us(); &t[t.len() - (layout_passes() - n0) as usize..].
layout_stats
Layout counters since the app started: nodes placed, subtrees skipped as clean, and ideal sizes computed (cache misses). Diagnostic.
layout_times_us
Microseconds of the recent layout passes, oldest first (diagnostic; at least the last 10,000).
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 title that opens url (a web page, mailto:, or a file:// URL) in its app when clicked. VoiceOver reads it as a link.
live_nodes
Number of live nodes (diagnostic, for teardown checks).
live_signals
Live signals in the arena (diagnostic: freed ones are reused).
local_day
The calendar day seconds since 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 (see local_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 command on 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) with std::fs::rename to 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 NSView Ferrokit doesn’t have: make builds it, once, when the view is built (on the main thread; mtm is the marker AppKit’s initialisers take). Any view works: AppKit’s, another framework’s (MKMapView, SCNView), or the app’s own subclass made with define_class!.
new_document
Opens a new, empty document. None if 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 run binary can’t).
notify
Posts notification through 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 f once per frame of the display window is on, in step with its refresh (60 or 120 Hz), with the frame’s target time in seconds. Runs in a batch, so signal updates and layout happen once per frame: the place to apply data that arrived since the last frame.
open
Opens window now (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_done gets the chosen paths, or None if cancelled.
open_settings
Opens the app’s Settings window (see App::settings), or brings it to the front, and returns it. None if the app has none.
open_tab
Opens window as a new tab of beside (the tab bar’s + and a “New Tab” command use this).
open_url
Opens url in the app that handles it: a web page in the browser, a mailto: in Mail, a System Settings pane (such as FULL_DISK_ACCESS_SETTINGS). False if no app handles it.
open_with
Opens the window make builds, now, and returns it: the signals make creates (a form’s fields, a selection) belong to the window and are freed when it closes. Prefer it to open in 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, title each item’s text.
parse_strings
Parses a .strings table: "key" = "value"; lines, with /* */ and // comments and the escapes \", \\, \n, \t and \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 sets path to it.
pdf_data
view as a PDF (see save_pdf).
pdf_view
A PDF view showing the file at path(), reloaded when the signals it reads change (None shows 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() (from pdf_data, a download or a database).
perform
Runs command in the focused window (see focused_window); false if nothing handles it there or its handler is disabled.
perform_in
Runs command as if window were focused (None: the app’s handler).
picker
A pop-up menu bound two ways to value, offering options (title, value).
pie_chart
Shares of a whole as slices, with a legend of names, values and percentages. donut makes a ring with the total in its middle. Values of zero or less are left out.
plural_category
The plural category of n in language (CLDR’s rules for integers): "one", "few", "many" or "other".
print
Prints view laid out at the page’s width, across as many pages as it needs, with the Print sheet on window (printer, copies, Save as PDF).
progress
A progress bar driven by f (reading signals): Some(0.0..=1.0) or None while the amount is unknown. spinner makes it a spinner.
quick_look
Opens the Quick Look panel on paths, at paths[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 (or horizontal).
rating
Stars from 0 to max, bound two ways to value: 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 a stored signal 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 path again in the App Sandbox through the bookmark remember_access kept, until the app quits (a folder’s contents too). Whether the app can reach it: true outside the sandbox, false when 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 document named by appending each of suffixes to its name ("-wal" gives data.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. Call regain_access for it after a relaunch, before reading it. Does nothing outside the sandbox (or for a path the app can’t reach now). Documents opened through DocumentType are kept already.
remove_stored
Removes the user-defaults value under key.
reveal_in_finder
Shows paths selected 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 window back 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 NSForceRightToLeftWritingDirection default is set. Ferrokit mirrors its layout then, as AppKit mirrors its own.
save_document
Saves the document in window to its file. An error if it has none yet (use save_document_as, or the Save menu item, which asks).
save_document_as
Saves the document in window to path (Save As… without the panel); it then belongs to that file.
save_panel
Shows the Save panel as a sheet on window, proposing name (in directory, if given); on_done gets the chosen path, or None if cancelled. Nothing is written: saving is the app’s job.
save_pdf
Saves view as a PDF at path, on letter or A4 pages (the user’s default paper) as print() 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 to value.
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 to value; no segment is selected while value matches none.
set_appearance
Sets the app’s appearance; every native view follows, and an AppEvent::AppearanceChanged is 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 with None: for tests and in-app language pickers. Strings already shown (menus, labels that don’t read a signal) stay as they are.
set_undoable
Sets signal to value as an undoable change named title (see undoable). 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 (a Window built as usual: size and view) as a sheet on parent. on_close runs when it closes; the view tree is then dropped.
sheet_with
sheet for the window make builds: the signals make creates (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.
slider
A slider over min..=max, bound two ways to value: horizontal and continuous unless given ticks, vertical or circular.
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_size says). A Rule::y draws a faint target line.
spawn
Runs work on a background thread, then then with its result on the main thread, inside a batch. Call from the main thread.
spawn_with_progress
spawn for a long job that reports how far it is: progress reads Some(0.0) at once, the fractions work reports through its Reporter as it goes, and None once it’s done (just before then runs; also if work panics, when then doesn’t run). Show it with progress:
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 of series_names.
stepper
A stepper over min..=max in steps of step, bound two ways to value.
stop_animation
Stops animating value (where it is now).
stored
A signal holding the user-defaults value under key (or default when 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 every stored with the same key (and type) gives the same signal.
submenu
A submenu.
system_colors
Resolves the system colours for the app’s appearance.
t
key translated into the app’s language, or key itself 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
t with {name} placeholders filled in: t_with("Open “{file}”", &[("file", &name)]). Translations can put them in any order.
table
A native table showing model (see Table).
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 (see TextEditor).
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, use date_picker with DatePicker::with_time.
today
Today, as a local_day.
toggle
A labelled switch (NSSwitch) bound two ways to value. With an empty title, the switch alone (a form_row names it).
toggle_full_screen
Puts window into 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 command on 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, under label.
toolbar_picker
A choice of one in the toolbar, as segments with SF Symbols (Finder’s view modes): value is 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 content in 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 on toolbar_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 apply now (in a batch) and records revert in the frontmost window’s undo history under title (“Rename”, “Delete Row”…). ⌘Z runs revert, ⇧⌘Z runs apply again.
undoable_in
As undoable, in window’s undo history.
untrack
Reads signals inside f without subscribing the running effect to them.
video_player
A video player for the file at path(), replaced when the signals it reads change (None shows 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 .m3u8 playlist 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 real WKWebView, 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 value under key in user defaults now (see read_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 by alignment.

Type Aliases§

Label
Text: label(f) was the name for text computed from signals; text takes a closure too.
WriteFile
A file’s writer: called with where to write it.