SwiftUI.cc
SwiftUI collection

Controls SwiftUI reference

Focused SwiftUI controls pages with original examples, usage guidance, and implementation notes.

Showing 1-9 of 20 reference pages
Page 1 of 3Next

Button pairs an action with any label. Roles mark destructive and cancel semantics, built-in styles cover most designs, and buttonRepeatBehavior auto-repeats while held.

4 min readOpen

Toggle binds a Bool to a switch. Recolor with tint, render as a button with .button style, batch with sections, or design your own look via ToggleStyle.

4 min readOpen

Slider binds a continuous value to a track. Set bounds and step, add min/max images, react to editing phases with onEditingChanged, and tint the filled track.

3 min readOpen

Stepper increments a value in precise steps with plus/minus buttons. Clamp with a range, format the label live, or supply custom onIncrement/onDecrement logic.

3 min readOpen

Picker binds a selection to tagged options. Drive it from a CaseIterable enum, choose menu, wheel, inline, or navigationLink styles, and group options with sections.

4 min readOpen

pickerStyle(.segmented) shows every option side by side — the right widget for 2–4 visible, equal choices like view modes and filters.

3 min readOpen

DatePicker binds a Date with selectable components — date, time, or both — bounded ranges, and styles from compact rows to the full graphical calendar.

4 min readOpen

MultiDatePicker binds a Set of DateComponents and lets users toggle several days on a calendar grid — availability, shifts, and recurring plans.

3 min readOpen

ColorPicker opens the system color well with eyedropper, sliders, and palettes, binding a Color and optionally hiding alpha with supportsOpacity: false.

3 min readOpen