SwiftUI Advent Calendar Open
Explore SwiftUI

Explore SwiftUI
Visually

Discover SwiftUI APIs, components, and modifiers through visual examples with ready-to-use code samples. Copy, paste, and ship.

Explore iPhone Duo
Six display modes

Explore SwiftUI for iPhone Duo

Explore SwiftUI APIs, components, and modifiers for iPhone Duo. Compare layouts across orientations and hinge states with visual previews and Swift code.

Inline Photos Picker Style - iOS on iPhone Duo - Landscape - Fully Open - Liquid Glass - Light Mode - Preview
style

Inline Photos Picker Style

A photos picker style that displays the picker inline without presenting a sheet.

Compact Photos Picker Style - iOS on iPhone Duo - Landscape - Fully Open - Liquid Glass - Light Mode - Preview
style

Compact Photos Picker Style

A photos picker style that displays the picker without presenting a sheet.

Photos Picker - iOS on iPhone Duo - Landscape - Fully Open - Liquid Glass - Light Mode - Preview
initializer

Photos Picker

Creates a picker with a title key and selection, and optionally configures the types of items to show and item encoding behavior.

Container Content Margins - iOS on iPhone Duo - Landscape - Fully Open - Liquid Glass - Light Mode - Preview
modifier

Container Content Margins

Adds the margins of the container the view is in.

Preferred Top Column - iOS on iPhone Duo - Landscape - Closed - Liquid Glass - Light Mode - Preview
initializer

Preferred Top Column

Controls which column appears on top of the stack when NavigationSplitView collapses into a single stack in certain contexts, such as on iPhone, when iPhone Duo is closed, or on Apple Watch. By default, the sidebar appears on top. In this case, the detail column does instead.

Hide Sidebar Toggle - iOS on iPhone Duo - Landscape - Fully Open - Liquid Glass - Light Mode - Preview
modifier

Hide Sidebar Toggle

Removes the sidebar toggle toolbar item a NavigationSplitView adds by default.

Toolbar Vertical Edge - iOS on iPhone Duo - Portrait - Fully Open - Liquid Glass - Light Mode - Preview
environment

Toolbar Vertical Edge

This value reflects the system’s preferred edge for the vertical bar in the current context, regardless of whether a vertical bar is currently visible. Use it to position custom bars or other UI relative to the system’s bar placement.

Reserved Regions - iOS on iPhone Duo - Landscape - Partially Open - Liquid Glass - Light Mode - Preview
method

Reserved Regions

Returns the reserved regions for the given kind. A reserved region indicates that an area within a view’s coordinate space has been claimed by something the view does not own

Role Button With Default Label - iOS on iPhone - Portrait - Liquid Glass - Light Mode - Preview
initializer

Role Button With Default Label

Creates a button that displays a default label.

Button - iOS on iPhone - Portrait - Liquid Glass - Light Mode - Preview
initializer

Button

Three ways to initialize a button

Glass Button Styles - iOS on iPhone - Portrait - Liquid Glass - Light Mode - Preview
style

Glass Button Styles

A button style that applies glass border artwork based on the button’s context

Button Tint - iOS on iPhone - Portrait - Liquid Glass - Light Mode - Preview
style

Button Tint

Sets the buttons tint color

Button Roles - iOS on iPhone - Portrait - Liquid Glass - Light Mode - Preview
style

Button Roles

A value that describes the purpose of a button.

Button Styles - iOS on iPhone - Portrait - Liquid Glass - Light Mode - Preview
style

Button Styles

A type that applies standard interaction behavior and a custom appearance to all buttons within a view hierarchy

Button Sizing - iOS on iPhone - Portrait - Liquid Glass - Light Mode - Preview
modifier

Button Sizing

The preferred sizing behavior of buttons in the view hierarchy.

RenameButton - iOS on iPhone - Portrait - Liquid Glass - Light Mode - Preview
TextField

RenameButton

A button that triggers a standard rename action

EditButton - iOS on iPhone - Portrait - Liquid Glass - Light Mode - Preview
type

EditButton

A button that toggles the edit mode environment value

PasteButton - iOS on iPhone - Portrait - Liquid Glass - Light Mode - Preview
type

PasteButton

A system button that reads items from the pasteboard and delivers it to a closure.

Button Border Shape - iOS on iPhone - Portrait - Liquid Glass - Light Mode - Preview

Button Border Shape

A shape used to draw a button’s border.

Toolbar Overflow Menu - iOS on iPhone - Portrait - Liquid Glass - Light Mode - Preview
initializer

Toolbar Overflow Menu

The overflow menu of a toolbar. An overflow menu represents actions that are always placed in the toolbar’s overflow menu, regardless of the toolbar mode, platform, or customizability.

ToolbarSpacer - iOS on iPhone - Portrait - Liquid Glass - Light Mode - Preview
initializer

ToolbarSpacer

A standard space item in toolbars

Prefer Vertical Toolbar Items - iOS on iPhone Duo - Landscape - Closed - Liquid Glass - Light Mode - Preview
modifier

Prefer Vertical Toolbar Items

A compression behavior that prioritizes keeping toolbar items visible over other elements, such as tabs. By default, tabs are prioritized.

Axis Behavior - iOS on iPhone Duo - Landscape - Closed - Liquid Glass - Light Mode - Preview
modifier

Axis Behavior

The bar axis behavior of the toolbar item.

Toolbar Item Visibility Priority - iOS on iPhone - Portrait - Liquid Glass - Light Mode - Preview
modifier

Toolbar Item Visibility Priority

Defines the visibility priority for a toolbar item.

Remove Toolbar Item Margin - iOS on iPhone - Portrait - Liquid Glass - Light Mode - Preview
modifier

Remove Toolbar Item Margin

Configures whether the content margins are removed.

ToolbarItem Shared Background Visibility - iOS on iPhone - Portrait - Liquid Glass - Light Mode - Preview
modifier

ToolbarItem Shared Background Visibility

Controls the visibility of the glass background effect on items in the toolbar. In certain contexts, such as the navigation bar on iOS and the window toolbar on macOS, toolbar items will be given a glass background effect that is shared with other items in the same logical grouping

Pinned Toolbar Item Placement - iOS on iPhone - Portrait - Liquid Glass - Light Mode - Preview
initializer

Pinned Toolbar Item Placement

A placement that pins the item to the trailing edge of the toolbar.

Title Toolbar Item Placement - iOS on iPhone - Portrait - Liquid Glass - Light Mode - Preview
initializers

Title Toolbar Item Placement

Places content in the title area

SliderTickContentForEach - iOS on iPhone - Portrait - Liquid Glass - Light Mode - Preview
initializer

SliderTickContentForEach

A type of slider content that creates content by iterating over a collection.

Custom Slider Ticks - iOS on iPhone - Portrait - Liquid Glass - Light Mode - Preview
initializer

Custom Slider Ticks

Creates a slider to select a value from a given range, subject to a step increment, which displays the provided labels and customizable ticks.

Stepped Min Max Label Slider - iOS on iPhone - Portrait - Liquid Glass - Light Mode - Preview
initializer

Stepped Min Max Label Slider

Creates a slider to select a value from a given range, subject to a step increment, which displays the provided labels

Stepped Slider - iOS on iPhone - Portrait - Liquid Glass - Light Mode - Preview
initializer

Stepped Slider

Creates a slider to select a value from a given range, subject to a step increment

Slider - iOS on iPhone - Portrait - Liquid Glass - Light Mode - Preview
initializer

Slider

Creates a slider to select a value from a given range

Slider Color - iOS on iPhone - Portrait - Liquid Glass - Light Mode - Preview
style

Slider Color

Customizing the color of the slider

Multiple Sources Toggle - iOS on iPhone - Portrait - Liquid Glass - Light Mode - Preview
initializer

Multiple Sources Toggle

Creates a toggle that updates the selected property for all sources. Once toggled, all sources will have the same value.

Toggle - iOS on iPhone - Portrait - Liquid Glass - Light Mode - Preview
initializer

Toggle

Creates a toggle with title, image, systemImage, and custom label.

CheckboxToggleStyle - macOS - Liquid Glass - Light Mode - Preview
style

CheckboxToggleStyle

A toggle style that displays a checkbox followed by its label.

SwitchToggleStyle - iOS on iPhone - Portrait - Liquid Glass - Light Mode - Preview
style

SwitchToggleStyle

A toggle style that displays a leading label and a trailing switch.

ButtonToggleStyle - iOS on iPhone - Portrait - Liquid Glass - Light Mode - Preview
style

ButtonToggleStyle

A toggle style that displays as a button with its label as the title.

Custom Value Label Picker - iOS on iPhone - Portrait - Liquid Glass - Light Mode - Preview
initializer

Custom Value Label Picker

Creates a picker that generates its label from a localized string key and accepts a custom current value label.

Multiple Sources Picker - iOS on iPhone - Portrait - Liquid Glass - Light Mode - Preview
initializer

Multiple Sources Picker

Creates a picker that updates the selected property for all sources.

Picker - iOS on iPhone - Portrait - Liquid Glass - Light Mode - Preview
initializer

Picker

Creates a pickers with title, image, systemImage, and custom label.

TabsPickerStyle - iOS on iPhone - Portrait - Liquid Glass - Light Mode - Preview
style

TabsPickerStyle

A picker style that presents options as segmented tabs. On macOS, this style produces a segmented picker with a visual treatment that distinguishes tab navigation from value selection. On iOS, tvOS, and visionOS, the visual appearance matches that of the standard standard .segmented style. On all supported platforms, VoiceOver announces options as tabs.

WheelPickerStyle - iOS on iPhone - Portrait - Liquid Glass - Light Mode - Preview
style

WheelPickerStyle

A picker style that presents the options in a scrollable wheel that shows the selected option and a few neighboring options.

SegmentedPickerStyle - iOS on iPhone - Portrait - Liquid Glass - Light Mode - Preview
style

SegmentedPickerStyle

A picker style that presents the options in a segmented control. Use this style when there are two to five options. Consider using menu when there are more than five options.

PalettePickerStyle - iOS on iPhone - Portrait - Liquid Glass - Light Mode - Preview
style

PalettePickerStyle

A picker style that presents the options as a row of compact elements. When used outside of menus, this style is rendered as a segmented picker. If that is the intended usage, consider segmented instead.

RadioGroupPickerStyle - macOS - Liquid Glass - Light Mode - Preview
style

RadioGroupPickerStyle

A picker style that presents the options as a group of radio buttons.

NavigationLinkPickerStyle - iOS on iPhone - Portrait - Liquid Glass - Light Mode - Preview
style

NavigationLinkPickerStyle

A picker style represented by a navigation link that presents the options by pushing a List-style picker view.

MenuPickerStyle - iOS on iPhone - Portrait - Liquid Glass - Light Mode - Preview
style

MenuPickerStyle

A picker style that presents the options as a menu when the user presses a button, or as a submenu when nested within a larger menu.

InlinePickerStyle - iOS on iPhone - Portrait - Liquid Glass - Light Mode - Preview
style

InlinePickerStyle

A PickerStyle where each option is displayed inline with other views in the current container.

Wheel Picker Item Height - watchOS - Liquid Glass - Light Mode - Preview
modifier

Wheel Picker Item Height

Sets the default wheel-style picker item height.

Horizontal Radio Group Layout - macOS - Liquid Glass - Light Mode - Preview
modifier

Horizontal Radio Group Layout

Sets the style for radio group style pickers within this view to be horizontally positioned with the radio buttons inside the layout.

Picker Section - iOS on iPhone - Portrait - Liquid Glass - Light Mode - Preview
content

Picker Section

A Section inside a Picker

Picker Divider - iOS on iPhone - Portrait - Liquid Glass - Light Mode - Preview
content

Picker Divider

A Picker with a Divider

Future DatePicker - iOS on iPhone - Portrait - Liquid Glass - Light Mode - Preview
initializer

Future DatePicker

Creates an instance that selects multiple dates on or after some start date

MultiDatePicker - iOS on iPhone - Portrait - Liquid Glass - Light Mode - Preview
initializer

MultiDatePicker

A control for picking multiple dates.