SwiftUI is Apple's modern, declarative UI framework that allows you to design and build user interfaces across all Apple platforms using a single, unified codebase. Instead of imperative layout engines like UIKit or AppKit, you declare what your interface should look like and how it behaves under various states. The SwiftUI runtime automatically manages the layout lifecycle, rendering changes instantly and smoothly whenever the underlying data changes.
The framework is centered around the concept of views and modifiers. A view is a lightweight, transient struct that conforms to the `View` protocol, describing a piece of user interface. You customize views by chaining modifiers — functions that wrap the view and return a modified version, such as changing fonts, applying padding, or adding gestures. State is managed using reactive property wrappers like `@State`, `@Binding`, `@StateObject`, or the modern `@Observable` macro, ensuring that UI updates are a direct function of your application state.
SwiftUI provides a comprehensive set of building blocks, from layout containers to interactive controls and navigation systems. You group items into structured containers like lists, forms, and scroll views, and manage user interactions with pickers, text fields, buttons, and sliders. Navigation is driven by modern containers like `NavigationStack` and `NavigationSplitView`. SwiftUI also integrates advanced platform features, including native accessibility rotors, focus systems, document-based app support, and immersive 3D spaces on visionOS.
Get started
Interactive SwiftUI Showcase — edit the Swift source code and preview live rendering on a virtual iPhone canvas.
Key concepts
Declarative Composition
In SwiftUI, you describe your UI as a tree of views rather than a series of instructions. The body property of a View is evaluated by the system. When state changes, SwiftUI re-evaluates the body and applies a highly optimized diff to update only the modified parts of the screen.
Single Source of Truth
State flows down from a single source of truth to the views that display it. Using `@State` for local private state, `@Binding` to pass write access to child views, or environment containers to share data globally, you ensure that the UI is always in sync with your data.
Chained View Modifiers
Modifiers let you wrap and style views. Chaining is order-dependent: `.padding().background(Color.blue)` results in a padded blue box, whereas `.background(Color.blue).padding()` styles the view blue first and then adds uncolored padding around it.
Adaptive Platform Layouts
SwiftUI views automatically adapt their appearance, spacing, and control styles to the platform they run on. A `Toggle` renders as a switch on iOS, a checkbox on macOS, and a button on watchOS, while respecting dark mode and dynamic type sizing out of the box.
Presentation and Dialogs 19
Display sheets, action sheets, popovers, and alerts dynamically by binding their visibility to state properties.
- StAlertA container representing an alert presentation. Deprecated in favor of modern `.alert` view modifiers, but still present in the SDK catalog to display warnings, choices, or inputs with standard system styling.init(title:message:dismissButton:)Button
let alert = Alert( title: Text("Success"), message: Text("Your profile was updated."), dismissButton: .default(Text("OK")) ) - St
- StContextMenu✓ rendersA container for views that you present as menu items in a context menu.Example & live preview →
- StThe severity of an alert or confirmation dialog.Example & live preview →
- StStrategies for adapting a presentation to a different size class.Example & live preview →
- StThe kinds of interaction available to views behind a presentation.Example & live preview →
- StA behavior that you can use to influence how a presentation responds toExample & live preview →
- StA type that represents a height where a sheet naturally rests.Example & live preview →
- PrThe definition of a custom detent with a calculated height.Example & live preview →
- StPresentationMode✓ rendersAn indication whether a view is currently presented by another view.Example & live preview →
- PrA type that defines the size of the presentation content and how theExample & live preview →
- StContextual information about a presentation.Example & live preview →
- StA proxy to a view provided to the presentation with aExample & live preview →
- StThe default presentation sizing, appropriate for the platform.Example & live preview →
- StThe size of the presentation is dictated by the ideal size of the content.Example & live preview →
- StThe size is appropriate for forms and slightly less wide than`.page`Example & live preview →
- StThe size is roughly the size of a page of paper, appropriate forExample & live preview →
- StThe set of menu dismissal behavior options.Example & live preview →
- St
Navigation 15
Coordinate transitions between screens, managing navigation paths, split views, and transitions smoothly.
- StA type-erased list of data representing the content of a navigation stack.Example & live preview →
- StNavigationBarItem✓ rendersA configuration for a navigation bar that represents a view at the top of aExample & live preview →
- StA view that represents a column in a navigation split view.Example & live preview →
- StThe visibility of the leading columns in a navigation split view.Example & live preview →
- StThe properties of a navigation split view instance.Example & live preview →
- PrNavigationViewStyle✓ rendersA specification for the appearance and interaction of a `NavigationView`.Example & live preview →
- St
- StColumnNavigationViewStyle✓ rendersA navigation view style represented by a series of views in columns.Example & live preview →
- StDoubleColumnNavigationViewStyle✓ rendersA navigation view style represented by a primary view stack thatExample & live preview →
- PrA type that defines the transition to use when navigating to a view.Example & live preview →
- StA type-erasing navigation transition that allows for providing anyExample & live preview →
- StA style that automatically chooses the appropriate presentationExample & live preview →
- StCrossFadeNavigationTransition✓ rendersA navigation transition that cross-fades between the appearing viewExample & live preview →
- PrA configuration that defines the appearance of a matched transitionExample & live preview →
- StAn unstyled matched transition source configuration.Example & live preview →
Lists and Collections 16
Render collections of data as scrollable lists or grids, using custom styles and supporting swipe actions or editing.
- PrA protocol that describes the behavior and appearance of a list.Example & live preview →
- StThe list style that describes a platform's default behavior and appearanceExample & live preview →
- StThe list style that describes the behavior and appearance of a plain list.Example & live preview →
- StGroupedListStyle✓ rendersThe list style that describes the behavior and appearance of a grouped list.Example & live preview →
- StInsetListStyle✓ rendersThe list style that describes the behavior and appearance of an inset list.Example & live preview →
- StInsetGroupedListStyle✓ rendersThe list style that describes the behavior and appearance of an insetExample & live preview →
- StA tint effect configuration that you can apply to content in a list.Example & live preview →
- StListSectionSpacing✓ rendersThe spacing options between two adjacent sections in a list.Example & live preview →
- StOutlineGroup✓ rendersA structure that computes views and disclosure groups on demand from anExample & live preview →
- PrDynamicTableRowContent✓ rendersA type of table row content that generates table rows from an underlyingExample & live preview →
- StA set of edit actions on a collection of data that a view can offerExample & live preview →
- StAn opaque wrapper view that adds editing capabilities to a row in a list.Example & live preview →
- StA collection wrapper that iterates over the indices and identifiers of aExample & live preview →
- StReorderDifference✓ rendersThe difference produced by a reordering operation.Example & live preview →
- StAn opaque, empty type used to identify reorderable containers and modifiersExample & live preview →
- StA description of a row or a column in a lazy grid.Example & live preview →
Controls and Style Configurations 18
Interactive elements and their custom styling objects, enabling custom configurations for buttons, gauges, and labels.
- St
- StThe options for controlling the repeatability of button actions.Example & live preview →
- St
- St
- StThe properties of a button.Example & live preview →
- St
- St
- StDatePickerComponents✓ rendersOptions that specify which date and time components a date picker displays.Example & live preview →
- StDisclosureGroupStyleConfiguration✓ rendersThe properties of a disclosure group instance.Example & live preview →
- St
- St
- St
- St
- StA container for attaching a label to a value-bearing view.Example & live preview →
- StThe properties of a labeled content instance.Example & live preview →
- St
- StThe properties of a progress view instance.Example & live preview →
- St
Pickers and Text Fields 16
Provide selectors and input controls for user selections, menus, forms, and raw text editing.
- PrA type that specifies the appearance and interaction of all pickers withinExample & live preview →
- StThe default picker style, based on the picker's context.Example & live preview →
- StA `PickerStyle` where each option is displayed inline with other views inExample & live preview →
- StMenuPickerStyle✓ rendersA picker style that presents the options as a menu when the user presses aExample & live preview →
- StNavigationLinkPickerStyle✓ rendersA picker style represented by a navigation link that presents the optionsExample & live preview →
- StPalettePickerStyle✓ rendersA picker style that presents the options as a row of compact elements.Example & live preview →
- StPaletteSelectionEffect✓ rendersThe selection effect to apply to a palette item.Example & live preview →
- St
- PrA specification for the appearance and interaction of a text field.Example & live preview →
- StThe default text field style, based on the text field's context.Example & live preview →
- St
- StRoundedBorderTextFieldStyle✓ rendersA text field style with a system-defined rounded border.Example & live preview →
- PrIndexViewStyle✓ rendersDefines the implementation of all `IndexView` instances within a viewExample & live preview →
- StPageIndexViewStyle✓ rendersAn index view style that places a page index view over its content.Example & live preview →
- StRepresents a selection of attributed text.Example & live preview →
- PrSliderTickContent✓ rendersA type that provides content for a `SliderTickBuilder`.Example & live preview →
Scrolling 14
Control scroll behaviors, visibility of indicators, target snapping, phase transitions, and custom scrolling containers.
- PrA type that defines the scroll behavior of a scrollable view.Example & live preview →
- StProperties influencing the scroll view a scroll target behaviorExample & live preview →
- StThe context in which a scroll target behavior can decide its properties.Example & live preview →
- StThe scroll behavior that aligns scroll targets to container-based geometry.Example & live preview →
- StA type defining the role of a scroll anchor.Example & live preview →
- StThe ways that a scrollable view can bounce when it reaches the end of itsExample & live preview →
- StA structure that specifies blur transitions between scrolling content and anExample & live preview →
- StThe visibility of scroll indicators of a UI element.Example & live preview →
- StA type that defines whether input should scroll a view.Example & live preview →
- St
- StA type that provides you with more content when the phase of a scrollExample & live preview →
- StThe configuration of a scroll transition that controls how a transitionExample & live preview →
- StA proxy value that supports programmatic scrolling of the scrollableExample & live preview →
- StA pausable schedule of dates updating at a frequency no more quickly thanExample & live preview →
Search and Find 7
Integrate system search bars, search suggestions, find-and-replace, and swipe-to-refresh actions.
- StThe placement of a search field in a view hierarchy.Example & live preview →
- StA type that defines how the toolbar behaves when presenting search.Example & live preview →
- StThe ways that searchable modifiers can show or hide search scopes.Example & live preview →
- StThe ways that SwiftUI displays search suggestions.Example & live preview →
- StFindContext✓ rendersThe status of the find navigator for views which support text editing.Example & live preview →
- StAn action that initiates a refresh operation.Example & live preview →
- StAn action that activates a standard rename interaction.Example & live preview →
Toolbars and Commands 9
Define system toolbars, keyboard shortcuts, keyboard press handlers, and commands for menu bar integration.
- PrConforming types represent items that can be placed in various locationsExample & live preview →
- StA structure that specifies where toolbar content is placed.Example & live preview →
- St
- StThe placement of a container background.Example & live preview →
- StCommandGroupPlacement✓ rendersThe standard locations that you can place new command groups relative to.Example & live preview →
- StA placement for tabs in a tab view using the adaptable sidebar style.Example & live preview →
- StKeyboardShortcut✓ rendersKeyboard shortcuts describe combinations of keys on a keyboard that the userExample & live preview →
- StKeyEquivalent✓ rendersKey equivalents consist of a letter, punctuation, or function key that canExample & live preview →
- StKeyPress✓ rendersA structure that describes a key press event received by a view.Example & live preview →
Documents 18
Types for building document-backed applications, configuring file wrappers, and opening system file dialogs.
- Pr
- Pr
- Pr
- Pr
- Pr
- StDocumentConfiguration✓ rendersThe configuration of a document in a ``DocumentGroup``.Example & live preview →
- StDocumentCreationContext✓ rendersProvides context about how a document was created or opened.Example & live preview →
- StDocumentCreationSource✓ rendersDescribes the source used to create a new document.Example & live preview →
- StDocumentLaunchGeometryProxy✓ rendersA proxy for access to the frame of the scene and its title view.Example & live preview →
- StDocumentReadConfiguration✓ rendersProvides the information required to read a document from disk.Example & live preview →
- StDocumentWriteConfiguration✓ rendersProvides the information required to write a document to disk.Example & live preview →
- St
- StFileDocumentReadConfiguration✓ rendersThe configuration for reading file contents.Example & live preview →
- StFileDocumentWriteConfiguration✓ rendersThe configuration for serializing file contents.Example & live preview →
- StFileWrapperDocumentReader✓ rendersA document reader that uses `FileWrapper` for reading.Example & live preview →
- StFileWrapperDocumentWriter✓ rendersA document writer that uses `FileWrapper` for writing.Example & live preview →
- StFileDialogBrowserOptions✓ rendersThe way that file dialogs present the file system.Example & live preview →
- StNewDocumentButtonDataSource✓ rendersDescribes the source of data used to create a new document.Example & live preview →
Drag and Drop 6
Types that facilitate dragging and dropping data, matching drop proposals, and tracking active sessions.
- StDragConfiguration✓ rendersThe behavior of the drag, proposed by the dragging source.Example & live preview →
- St
- St
- St
- St
- StDropSession✓ rendersA structure that represents an in-progress drop session.Example & live preview →
Accessibility 8
Support voiceover, dynamic type, direct touch interaction, and custom accessibility rotors for assistive technologies.
- StDesignates an accessibility action category that is provided and namedExample & live preview →
- StThe structure that defines the kinds of available accessibility actions.Example & live preview →
- StDefines the behavior for the child elements of the new parent element.Example & live preview →
- StAn option set that defines the functionality of a view's direct touch area.Example & live preview →
- StA struct representing an entry in an Accessibility Rotor.Example & live preview →
- StDesignates a Rotor that replaces one of the automatic, system-providedExample & live preview →
- StAccessibility technologies available to the system.Example & live preview →
- StPosition and direction information of a zoom gesture that someone performsExample & live preview →
Focus 4
Manage input focus, programmatic keyboard focus, and prioritize focus evaluation across interactive elements.
- PrA protocol for identifier types used when publishing and observing focusedExample & live preview →
- StA collection of state exported by the focused scene or view and its ancestors.Example & live preview →
- StValues describe different focus interactions that a view can support.Example & live preview →
- StPrioritizations for default focus preferences when evaluating whereExample & live preview →
Immersive Spaces and visionOS 12
Controls for spatial computing on Apple Vision Pro, presenting immersive spaces, 3D coordinate spaces, and system breakthrough effects.
- Pr
- St
- StFullImmersionStyle✓ rendersAn immersion style that displays unbounded content that completely replacesExample & live preview →
- StMixedImmersionStyle✓ rendersAn immersion style that displays unbounded content intermixed with otherExample & live preview →
- StProgressiveImmersionStyle✓ rendersAn immersion style that displays unbounded content that partially replacesExample & live preview →
- StProgressiveImmersionAspectRatio✓ rendersConstants that specify the aspect ratio of a progressive immersive space.Example & live preview →
- StImmersionChangeContext✓ rendersA structure that represents a state of immersion of your app.Example & live preview →
- StImmersiveContentBrightness✓ rendersThe content brightness of an immersive space.Example & live preview →
- StImmersiveEnvironmentBehavior✓ rendersThe behavior of the system-provided immersive environments when a scene isExample & live preview →
- StBreakthroughEffect✓ rendersA structure that describes a breakthrough effect for immersive content.Example & live preview →
- StThe orientation of the interface from the user's perspective.Example & live preview →
- StGeometryProxyCoordinateSpace3D✓ rendersA representation of a `GeometryProxy3D` which can be used forExample & live preview →
Ornaments and Glass Effects 10
Create ornaments that float near spatial windows, and apply premium glass backgrounds or plate effects.
- ClUIHostingOrnament✓ rendersA model that represents an ornament suitable for being hosted in UIKit.Example & live preview →
- Cl
- St
- StOrnamentHoverContentEffect✓ rendersPresents an ornament on hover using a custom effect.Example & live preview →
- St
- PrGlassBackgroundEffect✓ rendersA specification for the appearance of a glass background.Example & live preview →
- StGlassBackgroundEffectConfiguration✓ rendersA configuration used to build a custom effect.Example & live preview →
- StAutomaticGlassBackgroundEffect✓ rendersThe automatic glass background effect.Example & live preview →
- StFeatheredGlassBackgroundEffect✓ rendersThe feathered glass background effect.Example & live preview →
- St
Hover and Pointer Effects 11
Define hover states, hand-tracking highlights, and custom pointer styles for trackpads or gaze inputs.
- St
- StHoverEffectGroup✓ rendersDescribes a grouping of effects that activate together.Example & live preview →
- StHoverEffectPhaseOverride✓ rendersOptions for overriding a hover effect's current phase.Example & live preview →
- StAutomaticHoverEffect✓ rendersThe default hover effect based on the surrounding context.Example & live preview →
- StContentHoverEffect✓ rendersA `CustomHoverEffect` that applies effects to a view on hover using aExample & live preview →
- StGroupHoverEffect✓ rendersA `CustomHoverEffect` that activates a named group of effects.Example & live preview →
- StHighlightHoverEffect✓ rendersA hover effect that highlights views using a light source to indicateExample & live preview →
- StLiftHoverEffect✓ rendersA hover effect that slides the pointer under the view and disappears as theExample & live preview →
- StPointerStyle✓ rendersA style describing the appearance of the pointer (also called a cursor) whenExample & live preview →
- StHandActivationBehavior✓ rendersAn activation behavior specific to hand-driven input.Example & live preview →
- StHandPointerBehavior✓ rendersA behavior that can be applied to the hand pointer while the user isExample & live preview →
Pencil Interactions 4
Handle Apple Pencil double-taps, squeezes, and precise hover location coordinates.
- StPencilDoubleTapGestureValue✓ rendersDescribes the value of an Apple Pencil double-tap gesture.Example & live preview →
- StPencilHoverPose✓ rendersA value describing the location and distance of an Apple Pencil hovering inExample & live preview →
- StPencilPreferredAction✓ rendersAn action that the user prefers to perform after double-tapping theirExample & live preview →
- StPencilSqueezeGestureValue✓ rendersDescribes the value of an Apple Pencil squeeze gesture.Example & live preview →
Scenes and Windows 9
Structure the window hierarchy, control window styling, handle background tasks, and manage scene restoration.
- PrWindowStyle✓ rendersA specification for the appearance and interaction of a window.Example & live preview →
- St
- St
- PrUIHostingSceneDelegate✓ rendersExtends ``UIKit/UISceneDelegate`` to bridge SwiftUI scenes.Example & live preview →
- St
- StThe restoration behavior for a scene.Example & live preview →
- StThe padding used to space a view from its containing scene.Example & live preview →
- StThe kinds of background tasks that your app or extension can handle.Example & live preview →
- StRemoteDeviceIdentifier✓ rendersAn opaque type that identifies a remote device displaying scene contentExample & live preview →
Previews and Layout Modifiers 4
Types for running live canvas previews and applying layout modifiers or animations.
- Pr
- Pr
- St
- PrAnimatableModifier✓ rendersA modifier that can create another modifier with animation.Example & live preview →
Classes 2
- ClUIHostingController✓ rendersA UIKit view controller that manages a SwiftUI view hierarchy.Example & live preview →
- ClURLDocumentConfiguration✓ rendersA set of settings and properties of an open document.Example & live preview →
Structures 276
- StA view modifier that adds accessibility properties to the viewExample & live preview →
- StA property wrapper type that can read and write a value that SwiftUI updatesExample & live preview →
- StResult builder you use to generate rotor entry content.Example & live preview →
- StAccessoryCircularCapacityGaugeStyle✓ rendersA gauge style that displays a closed ring that's partially filled in toExample & live preview →
- StAccessoryCircularGaugeStyle✓ rendersA gauge style that displays an open ring with a marker that appears at aExample & live preview →
- StAccessoryLinearCapacityGaugeStyle✓ rendersA gauge style that displays bar that fills from leading to trailingExample & live preview →
- StAccessoryLinearGaugeStyle✓ rendersA gauge style that displays bar with a marker that appears at aExample & live preview →
- St
- StA type-erased scroll target behavior.Example & live preview →
- St
- StA property wrapper type that reflects a value from `UserDefaults` andExample & live preview →
- StA scene that presents an interface appropriate for Assistive Access on iOSExample & live preview →
- StA view that asynchronously loads and displays an image.Example & live preview →
- St
- StAutomaticDisclosureGroupStyle✓ rendersA disclosure group style that resolves its appearance automaticallyExample & live preview →
- St
Show 260 more
- StThe default labeled content style.Example & live preview →
- StA navigation split style that resolves its appearance automaticallyExample & live preview →
- St
- StAutomaticTextEditorStyle✓ rendersThe default text editor style, based on the text editor's context.Example & live preview →
- StA navigation split style that reduces the size of the detail contentExample & live preview →
- StA button style that applies standard border artwork based on the button'sExample & live preview →
- StA button style that applies standard border prominent artwork basedExample & live preview →
- StBorderlessButtonMenuStyle✓ rendersA menu style that displays a borderless button that toggles the display ofExample & live preview →
- StA button style that doesn't apply a border.Example & live preview →
- StButtoniOS 13.0+An interactive control that triggers an action when tapped or pressed. You customize its appearance using standard styles like `.borderedProminent` or by creating a custom `ButtonStyle` that reacts to button press states.init(action:label:)init(_:action:)buttonStyle(_:)disabled(_:)
Button("Tap Me") { print("Tapped!") } .buttonStyle(.borderedProminent) - StButtonMenuStyle✓ rendersA menu style that displays a button that toggles the display of theExample & live preview →
- StButtonToggleStyle✓ rendersA toggle style that displays as a button with its label as the title.Example & live preview →
- StA progress view that uses a circular gauge to indicate the partialExample & live preview →
- StColorPicker✓ rendersA control used to select a color from the system color picker UI.Example & live preview →
- StA non-scrolling form style with a trailing aligned column of labelsExample & live preview →
- StCommandGroup✓ rendersGroups of controls that you can add to existing command menus.Example & live preview →
- StCommandMenu✓ rendersCommand menus are stand-alone, top-level containers for controls thatExample & live preview →
- StCommandsBuilder✓ rendersConstructs command sets from multi-expression closures. Like `ContentBuilder`,Example & live preview →
- StCompactDatePickerStyle✓ rendersA date picker style that displays the components in a compact, textualExample & live preview →
- StCompactMenuControlGroupStyle✓ rendersA control group style that presents its content as a compact menu when the userExample & live preview →
- StCompositorContentBuilder✓ rendersA result builder for composing a collection of ``CompositorContent``Example & live preview →
- StAn interface, consisting of a label and additional content, that youExample & live preview →
- StControlGroup✓ rendersA container view that displays semantically-related controlsExample & live preview →
- St
- St
- StThe default button style, based on the button's context.Example & live preview →
- St
- StThe default type of the current value label when used by a date-relativeExample & live preview →
- StDefaultDocumentGroupLaunchActions✓ rendersThe default actions for the document group launch scene and the document launch view.Example & live preview →
- StDefaultGaugeStyle✓ rendersThe default gauge view style in the current context of the view beingExample & live preview →
- St
- StThe default label style in the current context.Example & live preview →
- StDefaultMenuStyle✓ rendersThe default menu style, based on the menu's context.Example & live preview →
- StDefaultNewDocumentButtonLabel✓ rendersThe default label used for a new document button.Example & live preview →
- StThe default progress view style in the current context of the view beingExample & live preview →
- St
- StThe default label to use for a tab or tab section.Example & live preview →
- St
- St
- StA toolbar item that represents a system component.Example & live preview →
- StDisclosureGroup✓ rendersA view that shows or hides another content view, based on the state of aExample & live preview →
- StDisclosureTableRow✓ rendersA kind of table row that shows or hides additional rows based on the stateExample & live preview →
- St
- StDismissImmersiveSpaceAction✓ rendersAn action that dismisses an immersive space.Example & live preview →
- StAn action that can end a search interaction.Example & live preview →
- StDismissWindowAction✓ rendersAn action that dismisses a window associated to a particular scene.Example & live preview →
- StA visual element that can be used to separate other content.Example & live preview →
- StDocumentGroup✓ rendersA scene that enables support for opening, creating, and saving documents.Example & live preview →
- StDocumentGroupLaunchScene✓ rendersA launch scene for document-based applications.Example & live preview →
- StDragGesture✓ rendersA dragging motion that invokes an action as the drag-event sequence changes.Example & live preview →
- St
- St
- StEmptyTableRowContent✓ rendersA table row content that doesn't produce any rows.Example & live preview →
- St
- StA view type that compares itself against its previous value and prevents itsExample & live preview →
- StA property wrapper type that retrieves entities from a Core Data persistentExample & live preview →
- StA collection of results retrieved from a Core Data store.Example & live preview →
- StA shape style that displays one of the overlay fills.Example & live preview →
- StA property wrapper type that can read and write a value that SwiftUI updatesExample & live preview →
- StA convenience property wrapper for observing and automatically unwrappingExample & live preview →
- StA property wrapper type for an observable object supplied by the focusedExample & live preview →
- StA property wrapper for observing values from the focused view or one of itsExample & live preview →
- StA container for grouping controls used for data entry, such as in settingsExample & live preview →
- St
- StA property wrapper type that updates a property while the user performs aExample & live preview →
- StA gesture that updates the state provided by a gesture's updating callback.Example & live preview →
- StGraphicalDatePickerStyle✓ rendersA date picker style that displays an interactive calendar or clock.Example & live preview →
- StA container view that arranges other views in a two dimensional layout.Example & live preview →
- St
- StA horizontal row in a two dimensional grid container.Example & live preview →
- StGroupBox✓ rendersA stylized view, with an optional label, that visually collects a logicalExample & live preview →
- St
- StA label style that only displays the icon of the label.Example & live preview →
- StImmersiveSpace✓ rendersA scene that presents its content in an unbounded space.Example & live preview →
- StImmersiveSpaceContentBuilder✓ rendersA result builder for composing a collection of immersive space elements.Example & live preview →
- StImmersiveSpaceViewContent✓ rendersImmersive space content that uses a SwiftUI view hierarchy as theExample & live preview →
- StInsetTableStyle✓ rendersThe table style that describes the behavior and appearance of a table withExample & live preview →
- StInspectorCommands✓ rendersA built-in set of commands for manipulating inspectors.Example & live preview →
- StItemProviderTableRowModifier✓ rendersA table row modifier that associates an item provider with some baseExample & live preview →
- StA standard label for user interface items, consisting of an icon with aExample & live preview →
- StLabeledControlGroupContent✓ rendersA view that represents the body of a control group with a specifiedExample & live preview →
- StA view that represents the view of a toolbar item group with a specifiedExample & live preview →
- StA container view that arranges its child views in a grid thatExample & live preview →
- StA container view that arranges its child views in a grid thatExample & live preview →
- StLimitedAvailabilityConfiguration✓ rendersA type-erased widget configuration.Example & live preview →
- StLinearCapacityGaugeStyle✓ rendersA gauge style that displays bar that fills from leading to trailingExample & live preview →
- StA progress view that visually indicates its progress using a horizontal bar.Example & live preview →
- St
- St
- StListiOS 13.0+A container that presents rows of data in a scrollable, single-column layout. It is highly optimized for performance and integrates native behaviors like cell swiping, selection, dynamic reordering, and section grouping.init(content:)listStyle(_:)onDelete(perform:)onMove(perform:)
List(items, id: \.self) { item in Text(item) } .listStyle(.insetGrouped) - StA gesture that succeeds when the user performs a long press.Example & live preview →
- StMagnificationGesture✓ rendersA gesture that recognizes a magnification motion and tracks the amount ofExample & live preview →
- StMagnifyGesture✓ rendersA gesture that recognizes a magnification motion and tracks the amount ofExample & live preview →
- St
- St
- St
- St
- St
- St
- St
- StMenuControlGroupStyle✓ rendersA control group style that presents its content as a menu when the userExample & live preview →
- St
- St
- StNavigationLinkiOS 13.0+A view that controls a navigation presentation. When placed inside a navigation container (like `NavigationStack`), tapping the link pushes a target destination view onto the screen.init(_:value:)init(value:label:)init(_:destination:)
NavigationLink("View Profile", value: targetProfile) - StA view that presents views in two or three columns, where selections inExample & live preview →
- StNavigationStackiOS 16.0+A container that displays a root view and enables pushing and popping child views onto a navigation stack. You drive navigation programmatically by binding it to a `NavigationPath` or homogeneous data array.init(path:root:)navigationDestination(for:destination:)navigationTitle(_:)
NavigationStack(path: $path) { List(items) { i in NavigationLink(i.name, value: i) } .navigationDestination(for: Item.self) { item in DetailView(item: item) } } - StNavigationView✓ rendersA view for presenting a stack of views that represents a visible path in aExample & live preview →
- St
- StOnInsertTableRowModifier✓ rendersA table row modifier that adds the ability to insert data in some baseExample & live preview →
- StOpenImmersiveSpaceAction✓ rendersAn action that presents an immersive space.Example & live preview →
- St
- StOutlineSubgroupChildren✓ rendersA type-erased view representing the children in an outline subgroup.Example & live preview →
- StPageTabViewStyle✓ rendersA `TabViewStyle` that displays a paged scrolling `TabView`.Example & live preview →
- StPaletteControlGroupStyle✓ rendersA control group style that presents its content as a palette.Example & live preview →
- StPasteButton✓ rendersA system button that reads items from the pasteboard and delivers it to aExample & live preview →
- StPhysicalMetric✓ rendersProvides access to a value in points that corresponds to the specifiedExample & live preview →
- StPhysicalMetricsConverter✓ rendersA physical metrics converter provides conversion between point values andExample & live preview →
- StPickeriOS 13.0+A control that displays a set of mutually exclusive options from which a user selects a single value. You bind its selection to state, and configure styles like `.wheel`, `.segmented`, or `.menu`.init(_:selection:content:)pickerStyle(_:)
Picker("Flavor", selection: $selectedFlavor) { Text("Vanilla").tag(Flavor.vanilla) Text("Chocolate").tag(Flavor.chocolate) } .pickerStyle(.segmented) - StA style appropriate for placeholder text.Example & live preview →
- StA button style that doesn't style or decorate its content while idle, butExample & live preview →
- St
- StPresentedWindowContent✓ rendersA view that represents the content of a presented window.Example & live preview →
- StThe type-erased content of a preview.Example & live preview →
- StA view that shows the progress toward completion of a task.Example & live preview →
- StA navigation split style that attempts to maintain the size of theExample & live preview →
- StPushWindowAction✓ rendersAn action that opens the requested window in place of the window the actionExample & live preview →
- StReferenceFileDocumentConfiguration✓ rendersThe properties of an open reference file document.Example & live preview →
- StA button that triggers a standard rename action.Example & live preview →
- StRotateGesture✓ rendersA gesture that recognizes a rotation motion and tracks the angle of theExample & live preview →
- StRotateGesture3D✓ rendersA gesture that recognizes 3D rotation motion and tracks the angle and axisExample & live preview →
- StRotationGesture✓ rendersA gesture that recognizes a rotation motion and tracks the angle of theExample & live preview →
- StRoundedBorderTextEditorStyle✓ rendersA text editor style with a system-defined rounded border.Example & live preview →
- StA result builder for composing a collection of scenes into a singleExample & live preview →
- StA property wrapper type that reads and writes to persisted, per-sceneExample & live preview →
- StThe context in which a scroll target behavior updates its scroll target.Example & live preview →
- StScrollViewiOS 13.0+A container that enables scrolling of its content along a vertical, horizontal, or bi-directional axis. Unlike List, it does not enforce row styling, giving you complete layout freedom.init(_:showsIndicators:content:)scrollIndicators(_:)scrollTargetBehavior(_:)
ScrollView(.horizontal, showsIndicators: false) { HStack { ForEach(0..<10) { Text("Item \($0)") } } } - StA view that provides programmatic scrolling, by working with a proxyExample & live preview →
- StThe behavior of a search field in a toolbar.Example & live preview →
- StA structure that represents the body of a static placeholder search view.Example & live preview →
- StA container view that you can use to add hierarchy within certain views.Example & live preview →
- StA property wrapper type that retrieves entities, grouped into sections,Example & live preview →
- StA collection of results retrieved from a Core Data persistent store,Example & live preview →
- StA control into which people securely enter private text.Example & live preview →
- StSegmentedPickerStyle✓ rendersA picker style that presents the options in a segmented control.Example & live preview →
- StSelectionShapeStyle✓ rendersA style used to visually indicate selection following platform conventionalExample & live preview →
- StRepresents a type of haptic and/or audio feedback that can be played.Example & live preview →
- St
- St
- StSharePreview✓ rendersA representation of a type to display in a share preview.Example & live preview →
- StSidebarAdaptableTabViewStyle✓ rendersA tab bar style that adapts to each platform.Example & live preview →
- StSidebarCommands✓ rendersA built-in set of commands for manipulating window sidebars.Example & live preview →
- StSidebarListStyle✓ rendersThe list style that describes the behavior and appearance of aExample & live preview →
- StSliderA control for selecting a value from a bounded linear range of values, such as volume or brightness. It renders as a thumb along a horizontal track.init(value:in:step:onEditingChanged:)minimumValueLabelmaximumValueLabel
Slider(value: $volume, in: 0...100, step: 5.0) { Text("Volume") } - StSliderTick✓ rendersA representation of a tick in a slider, with associated value andExample & live preview →
- StSliderTickBuilder✓ rendersA result builder that constructs `SliderTick`s for use when creatingExample & live preview →
- StSliderTickContentForEach✓ rendersA type of slider content that creates content by iterating over a collection.Example & live preview →
- StSpatialEventCollection✓ rendersA collection of spatial input events that target a specific view.Example & live preview →
- StSpatialEventGesture✓ rendersA gesture that provides information about ongoing spatial events likeExample & live preview →
- StSpatialTapGesture✓ rendersA gesture that recognizes one or more taps and reports their location.Example & live preview →
- StThe options for controlling the spring loading behavior of views.Example & live preview →
- StStackNavigationViewStyle✓ rendersA navigation view style represented by a view stack that only shows aExample & live preview →
- St
- StA semantic label describing the label of submission within a view hierarchy.Example & live preview →
- StA type that defines various triggers that result in the firing of aExample & live preview →
- StA view that subscribes to a publisher with an action.Example & live preview →
- StSurfaceSnappingInfo✓ rendersA type representing information about the window scenes snap state.Example & live preview →
- StSurroundingsEffect✓ rendersEffects that the system can apply to passthrough video.Example & live preview →
- StA toggle style that displays a leading label and a trailing switch.Example & live preview →
- StCreates a transition that applies the Appear, Disappear, DrawOn orExample & live preview →
- StThe content for a tab and the tab's associated tab item in a tab view.Example & live preview →
- St
- StTabBarOnlyTabViewStyle✓ rendersA tab view style that displays a tab bar when possible.Example & live preview →
- St
- StA result builder that constructs tabs for a tab view that supportsExample & live preview →
- StThe customization behavior of customizable tab view content.Example & live preview →
- St
- St
- StConfigures the activation behavior of search in the search tab.Example & live preview →
- StA container that you can use to add hierarchy within a tab view.Example & live preview →
- StTabSectionExpansion✓ rendersThe default expansion state for a tab section in the sidebar.Example & live preview →
- StA view that switches between multiple child views using interactive userExample & live preview →
- StTabViewCustomization✓ rendersThe customizations a person makes to an adaptable sidebar tab view.Example & live preview →
- StTable✓ rendersA container that presents rows of data arranged in one or more columns,Example & live preview →
- St
- StTableColumnAlignment✓ rendersDescribes the alignment of the content of a table column.Example & live preview →
- StTableColumnBuilder✓ rendersA result builder that creates table column content from closures.Example & live preview →
- StTableColumnCustomization✓ rendersA representation of the state of the columns in a table.Example & live preview →
- StTableColumnCustomizationBehavior✓ rendersA set of customization behaviors of a column that a table can offer toExample & live preview →
- StTableColumnForEach✓ rendersA structure that computes columns on demand from an underlying collection ofExample & live preview →
- StTableForEachContent✓ rendersA type of table row content that creates table rows created by iteratingExample & live preview →
- StTableHeaderRowContent✓ rendersA table row that displays a single view instead of columned content.Example & live preview →
- StTableOutlineGroupContent✓ rendersAn opaque table row type created by a table's hierarchical initializers.Example & live preview →
- St
- StTableRowBuilder✓ rendersA result builder that creates table row content from closures.Example & live preview →
- St
- StTabsPickerStyle✓ rendersA picker style that presents options as segmented tabs.Example & live preview →
- StTextEditingCommands✓ rendersA built-in group of commands for searching, editing, and transformingExample & live preview →
- St
- St
- StTextFieldiOS 13.0+A control that displays an editable text interface, letting users enter single-line text input. You bind its text property to a state variable and can configure autocapitalization, keyboard types, and prompt placeholders.init(_:text:prompt:)textFieldStyle(_:)onSubmit(of:_:)
TextField("Enter username", text: $username) .textFieldStyle(.roundedBorder) .onSubmit { login() } - StTextFormattingCommands✓ rendersA built-in set of commands for transforming the styles applied to selectionsExample & live preview →
- StTextInputAutocapitalization✓ rendersThe kind of autocapitalization behavior applied during text input.Example & live preview →
- St
- St
- StA structure defining the system text formatting controlsExample & live preview →
- St
- StA view that updates according to a schedule that you provide.Example & live preview →
- StA label style that shows both the title and icon of the label using aExample & live preview →
- StA label style that only displays the title of the label.Example & live preview →
- StToggleiOS 13.0+A control that toggles between on and off states. It renders as a switch on iOS and tvOS, a checkbox on macOS, and a button on watchOS, adapting natively to each platform.init(_:isOn:)toggleStyle(_:)isOn
Toggle("Enable Notifications", isOn: $notificationsEnabled) .toggleStyle(.switch) - StThe properties of a toggle instance.Example & live preview →
- StToolbarCommands✓ rendersA built-in set of commands for manipulating window toolbars.Example & live preview →
- StConstructs a toolbar item set from multi-expression closures.Example & live preview →
- StThe customization behavior of customizable toolbar content.Example & live preview →
- StOptions that influence the default customization behavior ofExample & live preview →
- StA kind of toolbar item a `View` adds by default.Example & live preview →
- StA model that represents an item which can be placed in the toolbarExample & live preview →
- StA model that represents a group of `ToolbarItem`s which can be placed inExample & live preview →
- StA structure that defines the placement of a toolbar item.Example & live preview →
- StA value that defines the visibility priority of a toolbar item.Example & live preview →
- St
- StThe safe area adjustment during toolbar minimization.Example & live preview →
- St
- St
- St
- StThe purpose of content that populates the toolbar.Example & live preview →
- StA type that defines the behavior of title of a toolbar.Example & live preview →
- St
- StTupleSliderTickContent✓ rendersSlider content created from a Swift tuple of slider content.Example & live preview →
- StTupleTableColumnContent✓ rendersA type of table column content that creates table columns created from aExample & live preview →
- StTupleTableRowContent✓ rendersA type of table column content that creates table rows created from aExample & live preview →
- StUIApplicationDelegateAdaptor✓ rendersA property wrapper type that you use to create a UIKit app delegate.Example & live preview →
- StUIHostingConfiguration✓ rendersA content configuration suitable for hosting a hierarchy of SwiftUI views.Example & live preview →
- StUIHostingControllerSizingOptions✓ rendersOptions for how a hosting controller tracks its content's size.Example & live preview →
- StUIViewControllerRepresentableContext✓ rendersContextual information about the state of the system that you use to createExample & live preview →
- StUIViewRepresentableContext⚠ minimalContextual information about the state of the system that you use to createExample & live preview →
- StThe scroll behavior that aligns scroll targets to view-based geometry.Example & live preview →
- StA view that adapts to the available space by providing the firstExample & live preview →
- StViewpoint3D✓ rendersA type describing what direction something is being viewed from.Example & live preview →
- StVolumeViewpointUpdateStrategy✓ rendersA type describing when the action provided toExample & live preview →
- StVolumetricWindowStyle✓ rendersA window style that creates a 3D volumetric window.Example & live preview →
- StWheelDatePickerStyle✓ rendersA date picker style that displays each component as columns in a scrollableExample & live preview →
- StWheelPickerStyle✓ rendersA picker style that presents the options in a scrollable wheel that showsExample & live preview →
- StWidgetBundleBuilder✓ rendersA custom attribute that constructs a widget bundle's body.Example & live preview →
- StWindow✓ rendersA scene that presents its content in a single, unique window.Example & live preview →
- StA scene that presents a group of identically structured windows.Example & live preview →
- StWindowLayoutRoot✓ rendersA proxy which represents the root contents of a window.Example & live preview →
- StOptions for defining how a scene's windows behave when used within a managedExample & live preview →
- StWindowPlacement✓ rendersA type which represents a preferred size and position for a window.Example & live preview →
- StWindowPlacementContext✓ rendersA type which represents contextual information used for sizing andExample & live preview →
- St
- St
- StThe visibility of the window toolbar with respect to full screen mode.Example & live preview →
- StWorldAlignmentBehavior✓ rendersA type representing the world alignment behavior for a scene.Example & live preview →
- StWorldScalingBehavior✓ rendersSpecifies the scaling behavior a window should have within the world.Example & live preview →
- StWorldScalingCompensation✓ rendersIndicates whether returned metrics will take dynamic scaling into account.Example & live preview →
- StWorldTrackingLimitation✓ rendersA structure to represent limitations of tracking the user's surroundings.Example & live preview →
- StWritingToolsBehavior✓ rendersThe Writing Tools editing experience for text and text input.Example & live preview →
- St
- StZoomNavigationTransition✓ rendersA navigation transition that zooms the appearing view from a givenExample & live preview →
Enumerations 17
- EnA directional indicator you use when making an accessibility adjustment.Example & live preview →
- EnThe role of an accessibility element in a label / content pair.Example & live preview →
- EnThe current phase of the asynchronous image loading operation.Example & live preview →
- EnDropOperation✓ rendersOperation types that determine how a drag and drop session resolves when theExample & live preview →
- EnEditMode✓ rendersA mode that indicates whether the user can edit a view's content.Example & live preview →
- En
- En
- En
- EnPencilSqueezeGesturePhase✓ rendersDescribes the phase and value of an Apple Pencil squeeze gesture.Example & live preview →
- EnAn attachment anchor for a popover.Example & live preview →
- En
- En
- EnThe phases that a view transitions between when it scrolls among other views.Example & live preview →
- En
- EnSquareAzimuth✓ rendersA type describing what direction something is being viewed from alongExample & live preview →
- EnA placement of the bottom accessory in a tab view. You can use this toExample & live preview →
Show 1 more
- EnA representation of the direction or association of a selection or cursorExample & live preview →
Protocols 37
- PrContent within an accessibility rotor.Example & live preview →
- PrA type that represents the structure and behavior of an app.Example & live preview →
- PrA type that applies standard interaction behavior and a custom appearance toExample & live preview →
- PrCommands✓ rendersConforming types represent a group of related commands that can be exposedExample & live preview →
- Pr
- PrControlGroupStyle✓ rendersDefines the implementation of all control groups within a viewExample & live preview →
- PrDatePickerStyle✓ rendersA type that specifies the appearance and interaction of all date pickersExample & live preview →
- PrDisclosureGroupStyle✓ rendersA type that specifies the appearance and interaction of disclosure groupsExample & live preview →
- PrDropDelegate✓ rendersAn interface that you implement to interact with a drop operation in a viewExample & live preview →
- PrFileDocument✓ rendersA type that you use to serialize documents to and from file.Example & live preview →
- Pr
- PrGaugeStyle✓ rendersDefines the implementation of all gauge instances within a viewExample & live preview →
- PrGroupBoxStyle✓ rendersA type that specifies the appearance and interaction of all group boxesExample & live preview →
- PrImmersiveSpaceContent✓ rendersA type that you can use as the content of an immersive space.Example & live preview →
- PrA type that applies a custom appearance to all labels within a view.Example & live preview →
- PrThe appearance and behavior of a labeled content instance..Example & live preview →
Show 21 more
- PrMenuStyle✓ rendersA type that applies standard interaction behavior and a custom appearanceExample & live preview →
- PrA type that specifies the appearance and interaction of navigation splitExample & live preview →
- PrA type that defines an environment in which previews can appear.Example & live preview →
- PrA type that produces view previews in Xcode.Example & live preview →
- PrA type that applies custom interaction behavior and a custom appearance toExample & live preview →
- PrA type that applies standard interaction behavior to all progress viewsExample & live preview →
- PrReferenceFileDocument✓ rendersA type that you use to serialize reference type documents to and from file.Example & live preview →
- PrA part of an app's user interface with a life cycle managed by theExample & live preview →
- PrA type that provides content for programmatically selectable tabs in aExample & live preview →
- PrA specification for the appearance and interaction of a tab view.Example & live preview →
- Pr
- Pr
- PrTableStyle✓ rendersA type that applies a custom appearance to all tables within a view.Example & live preview →
- PrTextEditorStyle✓ rendersA specification for the appearance and interaction of a text editor.Example & live preview →
- Pr
- PrConforming types represent items that can be placed in various locationsExample & live preview →
- PrUIViewControllerRepresentable✓ rendersA view that represents a UIKit view controller.Example & live preview →
- PrUIViewRepresentable✓ rendersA wrapper for a UIKit view that you use to integrate that view into yourExample & live preview →
- PrWidget✓ rendersThe configuration and content of a widget to display on the Home screen orExample & live preview →
- PrWidgetBundle✓ rendersA container used to expose multiple widgets from a single widget extension.Example & live preview →
- Pr
Type Aliases 2
- TyTimelineViewDefaultContextInformation passed to a timeline view's content callback.
- TyUITraitBridgedEnvironmentKey