Skip to main content

Module view

Module view 

Source
Expand description

View — chainable modifier API for ergonomic view construction.

ⓘ
use swiftui_native::prelude::*;

text("Hello").bold().padding(16.0).bg(Color::BLUE).opacity(0.9)

Modules§

style
Swift’s generic modifiers, as Rust traits.

Structs§

Image
A SwiftUI Image, before it becomes a view.
Shape
A shape, before it is given something to draw with.
View
A SwiftUI view with chainable modifiers.

Enums§

Transition
Which transition a view uses when it appears or leaves.

Traits§

IntoView
Anything that can become a View.

Functions§

async_image
AsyncImage(url:scale:) — an image fetched from a URL.
button
Create a Button.
button_labelled
Button { action } label: { … } — a button whose label is a view rather than a string.
canvas
Canvas { … } — immediate-mode drawing.
capsule
Capsule()
capsule_shape
Capsule(), ready to be filled.
circle
Circle()
circle_shape
Circle(), ready to be filled.
color
Create a Color view.
color_picker
Create a ColorPicker showing a fixed colour the user cannot change. See color_picker_bound.
color_picker_bound
Create a ColorPicker wired to Rust state.
conditional
A ViewBuilder if/else, preserving branch identity.
content_unavailable
ContentUnavailableView — the placeholder for a screen with nothing on it.
control_group
ControlGroup { … }
date_picker
Create a DatePicker showing a fixed date the user cannot change, as seconds since the reference date. See date_picker_bound.
date_picker_bound
Create a DatePicker wired to Rust state, in seconds since the reference date.
date_picker_range
DatePicker(_:selection:in:displayedComponents:) — a date picker with bounds.
disclosure_group
DisclosureGroup(_:content:)
divider
Create a Divider.
ellipse
Ellipse()
ellipse_shape
Ellipse(), ready to be filled.
empty
Create an EmptyView.
environment_reader
A view whose content is a function of the environment.
equatable_text
EquatableView(content:) — let SwiftUI skip redrawing when the value has not changed.
for_each
ForEach(0..<count) { … }.
for_each_items
GeometryReader { … } ForEach over a Rust collection.
form
Form { … }
gauge
Gauge(value:in:) { label }
geometry_reader
grid
Grid { … } over rows.
grid_row
GridRow { … }
grid_row_aligned
GridRow(alignment:) { … } — this row’s own vertical alignment, which overrides the grid’s for the row alone.
group
Group { … } — several views where one is wanted, with no layout of its own.
group_box
GroupBox { … }
hstack
hstack_aligned
HStack(alignment:) { … } — how children line up across the stack’s height. The baseline cases align on the children’s text rather than on their boxes.
hstack_aligned_spacing
HStack(alignment:spacing:) { … } — None keeps SwiftUI’s own spacing.
hstack_spacing
HStack(spacing:) { … }.
image
Create an SF Symbol Image.
label
Create a Label(_:systemImage:).
laid_out
A layout written in Rust, given children — MyLayout { … }.
layout
Build a layout from a sizing pass and a placement pass.
lazy_hstack
Create a LazyHStack.
lazy_hstack_aligned
LazyHStack(alignment:).
lazy_vstack
Create a LazyVStack.
lazy_vstack_aligned
LazyVStack(alignment:).
link
Link(_:destination:) — opens a URL.
list
List { … }
list_identified
List(ids, id: \.self) { id in … } — rows identified by value.
list_identified_str
List(names, id: \.self) { name in … } — the same, keyed by String.
menu
Menu(_:) { … }
named_image
Image(_:) — a named asset, kept as an Image.
navigation_link
navigation_link_labelled
NavigationLink(_:destination:) NavigationLink(destination:) { label } — a link whose label is a view.
navigation_split_view
NavigationSplitView { sidebar } detail: { detail }
navigation_split_view3
NavigationSplitView { sidebar } content: { content } detail: { detail }
navigation_stack
NavigationStack { … }
ns_view
An AppKit view hosted in a SwiftUI tree.
outline_group
OutlineGroup(_:children:) over an Int root.
picker
Create a Picker over content, showing a fixed selection the user cannot change. See picker_bound().
picker_bound
Create a Picker wired to Rust state — choosing a row writes its tag into state.
progress
Create a ProgressView.
progress_indeterminate
ProgressView() with no value — the indeterminate spinner, as distinct from progress, which shows a fraction.
rectangle
Rectangle()
rectangle_shape
Rectangle(), ready to be filled.
rounded_rectangle
RoundedRectangle(cornerRadius:)
rounded_rectangle_shape
RoundedRectangle(cornerRadius:), ready to be filled.
rounded_rectangle_shape_styled
RoundedRectangle(cornerRadius:style:) — false gives the circular arc rather than Swift’s default squircle.
scroll_reader
A ScrollViewReader, whose content is handed a proxy it can scroll with.
scroll_view
ScrollView { … } — a vertical scroll view with indicators.
section
Section { … } with no header.
section_expanded
Section(isExpanded:) { … } header: { … } — a section that collapses.
section_footer
Section { … } footer: { … }
section_titled
Section { … } header: { … }
section_titled_footer
Section { … } header: { … } footer: { … }
securefield
Create a SecureField showing a fixed string, which the user cannot edit. See securefield_bound.
securefield_bound
Create a SecureField wired to Rust state — every keystroke writes into it.
shape
A Shape written in Rust, drawn with the foreground style.
share_link
ShareLink(item:) over a URL.
slider
Create a Slider showing a fixed value, which the user cannot move.
slider_bound
Create a Slider wired to Rust state, readable and writable from both sides.
slider_step_bound
Slider(value:in:step:) — a slider that snaps to multiples of step.
spacer
Create a Spacer.
stepper
Create a Stepper.
stepper_actions
Stepper(_:onIncrement:onDecrement:) — a stepper driven by callbacks.
stepper_bound
Create a Stepper wired to Rust state — the +/− buttons write back.
system_image
Image(systemName:), kept as an Image so its own modifiers are reachable.
tab
Tab("Home", systemImage: "house") { … } — one tab of a modern TabView.
tab_view
TabView { … }
tab_view_tabs
TabView { Tab(…); Tab(…); … } — the modern tab view.
table
Table(of:) over interface orientations, with a single column.
text
Create a Text view.
text_editor
TextEditor(text:) showing a fixed string, which the user cannot edit.
text_verbatim
Text(verbatim:) — shown exactly as given.
textfield
Create a TextField showing a fixed string, which the user cannot edit.
textfield_axis
TextField(_:text:axis:) — a field that grows along axis as it is typed into.
textfield_bound
Create a TextField wired to Rust state — every keystroke writes into it.
timeline
TimelineView(.animation) { … } — rebuild on SwiftUI’s clock so that Rust state changes appear without an explicit redisplay.
toggle
Create a Toggle.
toggle_bound
Create a Toggle wired to Rust state, readable and writable from both sides.
toggle_labelled
Toggle(isOn:) { label } — a toggle whose label is any view.
toggle_sources
Toggle(_:sources:isOn:) — one toggle over several bindings.
tuple_view
TupleView<(A, B, …)> — several views with no container around them.
view_that_fits
ViewThatFits(in:) { … } — the first child that fits, along the given axes.
vstack
Create a VStack.
vstack_aligned
VStack(alignment:) { … } — how children line up across the stack’s width.
vstack_aligned_spacing
VStack(alignment:spacing:) { … } — None keeps SwiftUI’s own spacing.
vstack_spacing
VStack(spacing:) { … }.
zstack
Create a ZStack.
zstack_aligned
ZStack(alignment:) { … }.