MacKuba

🍎 Kuba Suder's blog on Mac & iOS development

SwiftUI Index

Filter by platform: | Search:

Note: iPadOS and Catalyst are only listed if their versions differ from iOS.

SwiftUI 4.0 (2022) iOS 16.0|macOS 13.0|watchOS 9.0|tvOS 16.0

Views SwiftUI 4.0

  • AddPassToWalletButton PassKit iOS

  • AnyShape iOS macOS watchOS tvOS

    A type-erased shape value.

  • AsyncShareablePassConfiguration PassKit iOS

  • DefaultDateProgressLabel iOS macOS watchOS tvOS

    The default type of current value label for a date-relative progress view.

  • DevicePicker DeviceDiscoveryUI tvOS

    A SwiftUI view that displays other devices on the network, and creates an encrypted connection to a copy of your app running on that device.

  • Gauge watchOS iOS macOS

    A view that shows a value within a range.

  • Grid iOS macOS watchOS tvOS

    A container view that arranges other views in a two dimensional layout.

  • GridRow iOS macOS watchOS tvOS

    A horizontal row in a two dimensional grid container.

  • LabeledContent iOS macOS watchOS tvOS

    A container for attaching a label to a value-bearing view.

  • LocalAuthenticationView Local Authentication macOS

    A SwiftUI view that displays an authentication interface.

  • MultiDatePicker iOS

    A control for picking multiple dates.

  • NavigationSplitView iOS macOS watchOS tvOS

    A view that presents views in two or three columns, where selections in leading columns control presentations in subsequent columns.

  • NavigationStack iOS macOS watchOS tvOS

    A view that displays a root view and enables you to present additional views over the root view.

  • PasteButton macOS iOS

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

  • PayWithApplePayButton PassKit iOS macOS watchOS

  • PhotosPicker PhotosUI iOS macOS watchOS

    A view that displays a Photos picker for choosing assets from the photo library.

  • RenameButton iOS macOS watchOS tvOS

    A button that triggers a standard rename action.

  • ShareLink iOS macOS watchOS

    A view that controls a sharing presentation.

  • Stepper iOS macOS watchOS

    A control that performs increment and decrement actions.

  • Table macOS iOS

    A container that presents rows of data arranged in one or more columns, optionally providing the ability to select one or more members.

  • TextFieldLink watchOS

    A control that requests text input from the user when pressed.

  • VerifyIdentityWithWalletButton PassKit iOS

  • ViewThatFits iOS macOS watchOS tvOS

    A view that adapts to the available space by providing the first child view that fits.

Scenes SwiftUI 4.0

  • MenuBarExtra macOS

    A scene that renders itself as a persistent control in the system menu bar.

  • Window macOS

    A scene that presents its content in a single, unique window.

Classes SwiftUI 4.0

  • ImageRenderer iOS macOS watchOS tvOS

    An object that creates images from SwiftUI views.

View Modifiers SwiftUI 4.0

  • .accessibilityActions() iOS macOS watchOS tvOS

    Adds multiple accessibility actions to the view.

  • .accessibilityQuickAction() iOS macOS watchOS tvOS

    Adds a quick action to be shown by the system when active.

  • .backgroundStyle() iOS macOS watchOS tvOS

    Sets the specified style to render backgrounds within the view.

  • .baselineOffset() iOS macOS watchOS tvOS

    Sets the vertical offset for the text relative to its baseline in this view.

  • .bold() iOS macOS watchOS tvOS

    Applies a bold font weight to the text in this view.

  • .chartBackground() iOS macOS watchOS tvOS

    Adds a background to a view that contains a chart.

  • .chartForegroundStyleScale() iOS macOS watchOS tvOS

    Configures the foreground style scale for charts.

  • .chartLegend() iOS macOS watchOS tvOS

    Configures the legend for charts.

  • .chartOverlay() iOS macOS watchOS tvOS

    Adds an overlay to a view that contains a chart.

  • .chartPlotStyle() iOS macOS watchOS tvOS

    Configures the plot area of charts.

  • .chartSymbolScale() iOS macOS watchOS tvOS

    Configures the symbol scale for charts.

  • .chartSymbolSizeScale() iOS macOS watchOS tvOS

    Configures the symbol size scale for charts.

  • .chartXAxis() iOS macOS watchOS tvOS

    Sets the visibility of the x axis.

  • .chartXScale() iOS macOS watchOS tvOS

    Configures the X scale for charts.

  • .chartYAxis() iOS macOS watchOS tvOS

    Sets the visibility of the y axis.

  • .chartYScale() iOS macOS watchOS tvOS

    Configures the Y scale for charts.

  • .contentTransition() iOS macOS watchOS tvOS

    Modifies the view to use a given transition as its method of animating changes to the contents of its views.

  • .contextAction() iOS macOS

    Adds an item-based context action to the view.

  • .controlSize() iOS macOS watchOS

    Sets the size for controls within this view.

  • .defaultFocus() iOS macOS watchOS tvOS

    Defines a region of the window in which default focus is evaluated by assigning a value to a given focus state binding.

  • .defersSystemGestures() iOS

    Sets the screen edge from which you want your gesture to take precedence over the system gesture.

  • .digitalCrownAccessory() watchOS

    Specifies the visibility of Digital Crown accessory Views on Apple Watch.

  • .disclosureGroupStyle() iOS macOS

    Sets the style for disclosure groups within this view.

  • .draggable() iOS macOS

    Activates this view as the source of a drag and drop operation.

  • .dropDestination() iOS macOS

    Defines the destination of a drag and drop operation that handles the dropped content with a closure that you specify.

  • .findDisabled() iOS

    Prevents find and replace operations in a text editor.

  • .findNavigator() iOS

    Programmatically presents the find and replace interface for text editor views.

  • .focusSection() tvOS macOS

    Indicates that the view’s frame and cohort of focusable descendants should be used to guide focus movement.

  • .fontWeight() iOS macOS watchOS tvOS

    Sets the font weight of the text in this view.

  • .gaugeStyle() watchOS iOS macOS

    Sets the style for gauges within this view.

  • .gridCellAnchor() iOS macOS watchOS tvOS

    Specifies a custom alignment anchor for a view that acts as a grid cell.

  • .gridCellColumns() iOS macOS watchOS tvOS

    Tells a view that acts as a cell in a grid to span the specified number of rows.

  • .gridCellUnsizedAxes() iOS macOS watchOS tvOS

    Asks grid layouts not to offer the view extra size in the specified axes.

  • .gridColumnAlignment() iOS macOS watchOS tvOS

    Overrides the default horizontal alignment of the grid column that the view appears in.

  • .hoverEffect() iOS tvOS

    Applies a pointer hover effect to the view.

  • .interactionActivityTrackingTag() iOS macOS watchOS tvOS

    Sets a tag that you use for tracking interactivity.

  • .italic() iOS macOS watchOS tvOS

    Applies italics to the text in this view.

  • .kerning() iOS macOS watchOS tvOS

    Sets the spacing, or kerning, between characters for the text in this view.

  • .layoutValue() iOS macOS watchOS tvOS

    Associates a value with a custom layout property.

  • .linkEntity() iOS macOS watchOS tvOS

    Associate a AppEntity to the current view

  • .listRowSeparator() iOS macOS

    Sets the display mode for the separator associated with this specific row.

  • .listRowSeparatorTint() iOS macOS

    Sets the tint color associated with a row.

  • .listSectionSeparator() iOS macOS

    Sets whether to hide the separator associated with a list section.

  • .listSectionSeparatorTint() iOS macOS

    Sets the tint color associated with a section.

  • .menuOrder() iOS macOS watchOS tvOS

    Sets the preferred order of items for menus presented from this view.

  • .monospaced() iOS macOS watchOS tvOS

    Modifies the fonts of all child views to use the fixed-width variant of the current font, if possible.

  • .navigationDestination() iOS macOS watchOS tvOS

    Associates a destination view with a presented data type for use within a navigation stack.

  • .navigationDocument() iOS macOS watchOS tvOS

    Configures the view’s document for purposes of navigation.

  • .navigationSplitViewColumnWidth() iOS macOS watchOS tvOS

    Sets a fixed, preferred width for the column containing this view.

  • .navigationSplitViewStyle() iOS macOS watchOS tvOS

    Sets the style for navigation split views within this view.

  • .offerCodeRedemption() iOS

    Presents a sheet that enables users to redeem subscription offer codes that you configure in App Store Connect.

  • .onContinuousHover() iOS macOS tvOS

    Adds an action to perform when the pointer enters, moves within, and exits the view’s bounds.

  • .onLongTouchGesture() tvOS

    Adds an action to perform when this view recognizes a remote long touch gesture. A long touch gesture is when the finger is on the remote touch surface without actually pressing.

  • .onTapGesture() iOS macOS watchOS tvOS

    Adds an action to perform when this view recognizes a tap gesture.

  • .persistentSystemOverlays() iOS macOS watchOS tvOS

    Sets the preferred visibility of the non-transient system views overlaying the app.

  • .presentationDetents() iOS macOS watchOS tvOS

    Sets the available detents for the enclosing sheet.

  • .presentationDragIndicator() iOS macOS watchOS tvOS

    Sets the visibility of the drag indicator on top of a sheet.

  • .renameAction() iOS macOS watchOS tvOS

    Sets a closure to run for the rename action.

  • .replaceDisabled() iOS

    Prevents replace operations in a text editor.

  • .scrollDisabled() iOS macOS watchOS tvOS

    Disables or enables scrolling in scrollable views.

  • .scrollDismissesKeyboard() iOS macOS watchOS tvOS

    Configures the behavior in which scrollable content interacts with the software keyboard.

  • .scrollIndicators() iOS macOS watchOS tvOS

    Sets the visibility of scroll indicators within this view.

  • .searchSuggestions() iOS macOS watchOS tvOS

    Configures how to display search suggestions within this view.

  • .shortcutsLinkStyle() iOS macOS watchOS tvOS

    Sets the given style for ShortcutsLinks within the view hierarchy

  • .siriTipViewStyle() iOS macOS watchOS tvOS

    Sets the given style for SiriTipView within the view hierarchy

  • .strikethrough() iOS macOS watchOS tvOS

    Applies a strikethrough to the text in this view.

  • .tableStyle() macOS iOS

    Sets the style for tables within this view.

  • .toolbarBackground() iOS macOS watchOS tvOS

    Specifies the preferred visibility of backgrounds on a bar managed by SwiftUI.

  • .toolbarColorScheme() iOS macOS watchOS tvOS

    Specifies the preferred color scheme of a bar managed by SwiftUI.

  • .toolbarRole() iOS macOS watchOS tvOS

    Configures the semantic role for the content populating the toolbar.

  • .toolbarTitleActions() iOS macOS watchOS tvOS

    Configure the title actions of a toolbar.

  • .tracking() iOS macOS watchOS tvOS

    Sets the tracking for the text in this view.

  • .underline() iOS macOS watchOS tvOS

    Applies an underline to the text in this view.

  • .widgetAccentable() iOS macOS watchOS

    Adds the view and all of its subviews to the accented group.

  • .widgetLabel() iOS watchOS

    Returns a text label that displays additional content outside the accessory family widget’s main SwiftUI view.

  • .widgetURL() iOS macOS watchOS

    Sets the URL to open in the containing app when the user clicks the widget.

Scene Modifiers SwiftUI 4.0

Environment Values SwiftUI 4.0

Other Updates SwiftUI 4.0

  • Color:

    • .gradient iOS macOS watchOS tvOS

      Returns the standard gradient for the color self.

  • CommandGroupPlacement:

    • .singleWindowList macOS

      Standard placement for commands that describe and reveal any SingleWindows defined by the app.

  • Font:

    • .system(_:design:weight:) iOS macOS watchOS tvOS

      Use this function to create a system font by specifying the text style, a type design, and weight together. The following styles the text with a system font in Font.TextStyle.body text style and semibold weight:

    • .system(size:weight:design:) iOS macOS watchOS tvOS

      Specifies a system font to use, along with the style, weight, and any design parameters you want applied to the text.

  • GaugeStyle:

    • .accessoryCircular iOS macOS watchOS

      A gauge style that displays an open ring with a marker that appears at a point along the ring to indicate the gauge’s current value.

    • .accessoryCircularCapacity iOS macOS watchOS

      A gauge style that displays a closed ring that’s partially filled in to indicate the gauge’s current value.

    • .accessoryLinear iOS macOS watchOS

      A gauge style that displays bar with a marker that appears at a point along the bar to indicate the gauge’s current value.

    • .accessoryLinearCapacity iOS macOS watchOS

      A gauge style that displays bar that fills from leading to trailing edges as the gauge’s current value increases.

    • .linearCapacity iOS macOS watchOS

      A gauge style that displays a bar that fills from leading to trailing edges as the gauge’s current value increases.

  • HorizontalAlignment:

  • MenuStyle:

    • .button iOS macOS

      A menu style that displays a button that toggles the display of the menu’s contents when pressed.

  • NSHostingController:

    • .sizingOptions macOS

      The options for how the hosting controller’s view creates and updates constraints based on the size of its SwiftUI content.

  • NSHostingView:

    • .sizingOptions macOS

      The options for how the hosting view creates and updates constraints based on the size of its SwiftUI content.

  • NSViewControllerRepresentable:

  • NSViewRepresentable:

  • Shape:

    • .sizeThatFits(_:) iOS macOS watchOS tvOS

      Returns the size of the view that will render the shape, given a proposed size.

  • ShapeStyle:

  • TableRowContent:

  • ToggleStyle:

    • .button iOS macOS watchOS

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

  • ToolbarItemPlacement:

  • UIHostingController:

    • .sizingOptions iOS tvOS

      The options for how the hosting controller tracks changes to the size of its SwiftUI content.

  • UIViewControllerRepresentable:

  • UIViewRepresentable:

  • WidgetConfiguration:

SwiftUI 3.0 (2021) iOS 15.0|macOS 12.0|watchOS 8.0|tvOS 15.0

Views SwiftUI 3.0

  • AsyncImage iOS macOS watchOS tvOS

    A view that asynchronously loads and displays an image.

  • Canvas iOS macOS watchOS tvOS

    A view type that supports immediate mode drawing.

  • ControlGroup iOS macOS

    A container view that displays semantically-related controls in a visually-appropriate manner for the context

  • EllipticalGradient iOS macOS watchOS tvOS

    A radial gradient that draws an ellipse.

  • LocationButton CoreLocationUI iOS watchOS

    A SwiftUI button that grants one-time location authorization.

  • Table macOS iOS

    A container that presents rows of data arranged in one or more columns, optionally providing the ability to select one or more members.

  • TimelineView iOS macOS watchOS tvOS

    A view that updates according to a schedule that you provide.

Commands SwiftUI 3.0

View Modifiers SwiftUI 3.0

  • .accessibilityChartDescriptor() iOS macOS watchOS tvOS

    Adds a descriptor to a View that represents a chart to make the chart’s contents accessible to all users.

  • .accessibilityChildren() iOS macOS watchOS tvOS

    Replaces the existing accessibility element’s children with one or more new synthetic accessibility elements.

  • .accessibilityCustomContent() iOS macOS watchOS tvOS

    Add additional accessibility information to the view.

  • .accessibilityFocused() iOS macOS watchOS tvOS

    Modifies this view by binding its accessibility element’s focus state to the given boolean state value.

  • .accessibilityHeading() iOS macOS watchOS tvOS

    Sets the accessibility level of this heading.

  • .accessibilityRepresentation() iOS macOS watchOS tvOS

    Replaces one or more accessibility elements for this view with new accessibility elements.

  • .accessibilityRespondsToUserInteraction() iOS macOS watchOS tvOS

    Explicitly set whether this Accessibility element responds to user interaction and would thus be interacted with by technologies such as Switch Control, Voice Control or Full Keyboard Access.

  • .accessibilityRotor() iOS macOS watchOS tvOS

    Create an Accessibility Rotor replacing the specified system-provided Rotor.

  • .accessibilityRotorEntry() iOS macOS watchOS tvOS

    Defines an explicit identifier tying an Accessibility element for this view to an entry in an Accessibility Rotor.

  • .accessibilityShowsLargeContentViewer() iOS macOS watchOS tvOS

    Adds a default large content view to be shown by the large content viewer.

  • .accessibilityTextContentType() iOS macOS watchOS tvOS

    Sets an accessibility text content type.

  • .autocorrectionDisabled() iOS macOS tvOS watchOS

    Sets whether to disable autocorrection for this view.

  • .badge() iOS macOS

    Generates a badge for the view from a string.

  • .buttonBorderShape() iOS macOS watchOS tvOS

    Sets the border shape for buttons in this view.

  • .confirmationDialog() iOS macOS watchOS tvOS

    Presents a confirmation dialog when a given condition is true, using a text view for the title.

  • .containerShape() iOS macOS watchOS tvOS

    Sets the container shape to use for any container relative shape within this view.

  • .controlGroupStyle() iOS macOS

    Sets the style for control groups within this view.

  • .controlSize() macOS iOS watchOS

    Sets the size for controls within this view.

  • .disableAutocorrection() Deprecated iOS macOS tvOS watchOS

    Sets whether to disable autocorrection for this view.

    → Use autocorrectionDisabled(_:) instead.

  • .dynamicTypeSize() iOS macOS watchOS tvOS

    Sets the Dynamic Type size within the view to the given value.

  • .exportsItemProviders() macOS

    Exports a read-only item provider for consumption by shortcuts, quick actions, and services.

  • .familyActivityPicker() iOS

    Presents an activity picker view as a sheet.

  • .focused() iOS macOS watchOS tvOS

    Modifies this view by binding its focus state to the given Boolean state value.

  • .focusedSceneValue() iOS macOS watchOS tvOS

    Modifies this view by injecting a value that you provide for use by other views whose state depends on the focused scene.

  • .focusScope() watchOS tvOS macOS

    Creates a focus scope that SwiftUI uses to limit default focus preferences.

  • .focusSection() tvOS macOS

    Indicates that the view’s frame and cohort of focusable descendants should be used to guide focus movement.

  • .foregroundStyle() iOS macOS watchOS tvOS

    Sets a view’s foreground elements to use a given style.

  • .headerProminence() iOS macOS watchOS tvOS

    Sets the header prominence for this view.

  • .importsItemProviders() macOS

    Enables importing item providers from services, such as Continuity Camera on macOS.

  • .indexViewStyle() iOS tvOS watchOS

    Sets the style for the index view within the current environment.

  • .interactiveDismissDisabled() iOS macOS watchOS tvOS

    Conditionally prevents interactive dismissal of a popover or a sheet.

  • .listRowSeparator() iOS macOS

    Sets the display mode for the separator associated with this specific row.

  • .listRowSeparatorTint() iOS macOS

    Sets the tint color associated with a row.

  • .listSectionSeparator() iOS macOS

    Sets whether to hide the separator associated with a list section.

  • .listSectionSeparatorTint() iOS macOS

    Sets the tint color associated with a section.

  • .manageSubscriptionsSheet() iOS

  • .menuIndicator() iOS macOS

    Sets the menu indicator visibility for controls within this view.

  • .monospacedDigit() iOS macOS watchOS tvOS

    Modifies the fonts of all child views to use fixed-width digits, if possible, while leaving other characters proportionally spaced.

  • .musicSubscriptionOffer() iOS macOS

    Initiates the process of presenting a sheet with subscription offers for Apple Music when the isPresented binding is true.

  • .navigationBarTitleDisplayMode() iOS watchOS

    Configures the title display mode for this view.

  • .onSubmit() iOS macOS watchOS tvOS

    Adds an action to perform when the user submits a value to this view.

  • .prefersDefaultFocus() watchOS tvOS macOS

    Indicates that the view should receive focus by default for a given namespace.

  • .previewInterfaceOrientation() iOS macOS watchOS tvOS

    Overrides the orientation of the preview.

  • .privacySensitive() iOS macOS watchOS tvOS

    Marks the view as containing sensitive, private user data.

  • .refreshable() iOS macOS watchOS tvOS

    Marks this view as refreshable.

  • .refundRequestSheet() iOS

  • .safeAreaInset() iOS macOS watchOS tvOS

    Shows the specified content beside the modified view.

  • .scenePadding() iOS macOS watchOS tvOS

    Adds padding to the specified edges of this view using an amount that’s appropriate for the current scene.

  • .searchable() iOS macOS watchOS tvOS

    Marks this view as searchable, which configures the display of a search field.

  • .searchCompletion() iOS macOS watchOS tvOS

    Associates a search token with the value of this view.

  • .speechAdjustedPitch() iOS macOS watchOS tvOS

    Raises or lowers the pitch of spoken text.

  • .speechAlwaysIncludesPunctuation() iOS macOS watchOS tvOS

    Sets whether VoiceOver should always speak all punctuation in the text view.

  • .speechAnnouncementsQueued() iOS macOS watchOS tvOS

    Controls whether to queue pending announcements behind existing speech rather than interrupting speech in progress.

  • .speechSpellsOutCharacters() iOS macOS watchOS tvOS

    Sets whether VoiceOver should speak the contents of the text view character by character.

  • .submitLabel() iOS macOS watchOS tvOS

    Sets the submit label for this view.

  • .submitScope() iOS macOS watchOS tvOS

    Prevents submission triggers originating from this view to invoke a submission action configured by a submission modifier higher up in the view hierarchy.

  • .swipeActions() iOS macOS watchOS

    Adds custom swipe actions to a row in a list.

  • .symbolRenderingMode() iOS macOS watchOS tvOS

    Sets the rendering mode for symbol images within this view.

  • .symbolVariant() iOS macOS watchOS tvOS

    Makes symbols within the view show a particular variant.

  • .tableStyle() macOS iOS

    Sets the style for tables within this view.

  • .task() iOS macOS watchOS tvOS

    Adds an asynchronous task to perform before this view appears.

  • .textInputAutocapitalization() iOS watchOS tvOS

    Sets how often the shift key in the keyboard is automatically enabled.

  • .textSelection() iOS macOS

    Controls whether people can select text within this view.

  • .tint() iOS macOS watchOS tvOS

    Sets the tint within this view.

Environment Values SwiftUI 3.0

  • \.accessibilityLargeContentViewerEnabled iOS macOS watchOS tvOS

    Whether the Large Content Viewer is enabled.

  • \.accessibilitySwitchControlEnabled iOS macOS watchOS tvOS

    A Boolean value that indicates whether the Switch Control motor accessibility feature is in use.

  • \.accessibilityVoiceOverEnabled iOS macOS watchOS tvOS

    A Boolean value that indicates whether the VoiceOver screen reader is in use.

  • \.autocorrectionDisabled iOS macOS tvOS watchOS

    A Boolean value that determines whether the view hierarchy has auto-correction enabled.

  • \.backgroundMaterial iOS macOS watchOS tvOS

    The material underneath the current view.

  • \.controlSize macOS iOS watchOS

    The size to apply to controls within a view.

  • \.disableAutocorrection Deprecated iOS macOS tvOS watchOS

    A Boolean value that determines whether the view hierarchy has auto-correction enabled.

  • \.dismiss iOS macOS watchOS tvOS

    An action that dismisses the current presentation.

  • \.dismissSearch iOS macOS watchOS tvOS

    An action that ends the current search interaction.

  • \.dynamicTypeSize iOS macOS watchOS tvOS

    The current Dynamic Type size.

  • \.headerProminence iOS macOS watchOS tvOS

    The prominence to apply to section headers within a view.

  • \.isLuminanceReduced watchOS

    A Boolean value that indicates whether the display currently requires reduced luminance.

  • \.isPresented iOS macOS watchOS tvOS

    A Boolean value that indicates whether the view associated with this environment is currently presented.

  • \.isSearching iOS macOS watchOS tvOS

    A Boolean value that indicates when the user is searching.

  • \.keyboardShortcut iOS macOS

    The keyboard shortcut that buttons in this environment will be triggered with.

  • \.menuIndicatorVisibility iOS macOS

    The menu indicator visibility to apply to controls within a view.

  • \.refresh iOS macOS watchOS tvOS

    A refresh action stored in a view’s environment.

  • \.resetFocus watchOS tvOS macOS

    An action that requests the focus system to reevaluate default focus.

  • \.symbolRenderingMode iOS macOS watchOS tvOS

    The current symbol rendering mode, or nil denoting that the mode is picked automatically using the current image and foreground style as parameters.

  • \.symbolVariants iOS macOS watchOS tvOS

    The symbol variant to use in this environment.

Property Wrappers SwiftUI 3.0

  • @AccessibilityFocusState iOS macOS watchOS tvOS

    A property wrapper type that can read and write a value that SwiftUI updates as the focus of any active accessibility technology, such as VoiceOver, changes.

  • @FocusState iOS macOS watchOS tvOS

    A property wrapper type that can read and write a value that SwiftUI updates as the placement of focus within the scene changes.

  • @SectionedFetchRequest iOS macOS watchOS tvOS

    A property wrapper type that retrieves entities, grouped into sections, from a Core Data persistent store.

Other Updates SwiftUI 3.0

  • Color:

    • .brown iOS macOS watchOS tvOS

      A context-dependent brown color suitable for use in UI elements.

    • .cyan iOS macOS watchOS tvOS

      A context-dependent cyan color suitable for use in UI elements.

    • .indigo iOS macOS watchOS tvOS

      A context-dependent indigo color suitable for use in UI elements.

    • .mint iOS macOS watchOS tvOS

      A context-dependent mint color suitable for use in UI elements.

    • .teal iOS macOS watchOS tvOS

      A context-dependent teal color suitable for use in UI elements.

  • FetchedResults:

    • .nsPredicate iOS macOS watchOS tvOS

      The request’s predicate.

    • .nsSortDescriptors iOS macOS watchOS tvOS

      The request’s sort descriptors, accessed as reference types.

    • .sortDescriptors iOS macOS watchOS tvOS

      The request’s sort descriptors, accessed as value types.

  • Font:

    • .monospaced() iOS macOS watchOS tvOS

      Returns a fixed-width font from the same family as the base font.

  • ListStyle:

    • .bordered macOS

      The list style that describes the behavior and appearance of a list with standard border.

    • .bordered(alternatesRowBackgrounds:) macOS

      The list style that describes the behavior and appearance of a list with standard border.

    • .inset(alternatesRowBackgrounds:) macOS

      The list style that describes the behavior and appearance of an inset list with optional alternating row backgrounds.

  • NavigationViewStyle:

    • .columns Deprecated iOS macOS

      A navigation view style represented by a series of views in columns.

      → Replace a styled NavigationView with a NavigationStack or NavigationSplitView.

  • PageTabViewStyle.IndexDisplayMode:

    • .always iOS tvOS watchOS

      Always display an index view regardless of page count

    • .never iOS tvOS watchOS

      Never display an index view

  • PrimitiveButtonStyle:

    • .bordered macOS watchOS tvOS iOS

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

    • .borderedProminent iOS macOS watchOS tvOS

      A button style that applies standard border prominent artwork based on the button’s context.

    • .borderless iOS macOS watchOS

      A button style that doesn’t apply a border.

  • RedactionReasons:

    • .privacy iOS macOS watchOS tvOS

      Displayed data should be obscured to protect private information.

  • ShapeStyle:

    • .background iOS macOS watchOS tvOS

      The background style in the current context.

    • .bar iOS macOS

      A material matching the style of system toolbars.

    • .blendMode(_:) iOS macOS watchOS tvOS

      Returns a new style based on self that applies the specified blend mode when drawing.

    • .brown iOS macOS watchOS tvOS

      A context-dependent brown color suitable for use in UI elements.

    • .cyan iOS macOS watchOS tvOS

      A context-dependent cyan color suitable for use in UI elements.

    • .ellipticalGradient(_:center:startRadiusFraction:endRadiusFraction:) iOS macOS watchOS tvOS

      A radial gradient that draws an ellipse.

    • .ellipticalGradient(colors:center:startRadiusFraction:endRadiusFraction:) iOS macOS watchOS tvOS

      A radial gradient that draws an ellipse defined by a collection of colors.

    • .ellipticalGradient(stops:center:startRadiusFraction:endRadiusFraction:) iOS macOS watchOS tvOS

      A radial gradient that draws an ellipse defined by a collection of color stops.

    • .foreground iOS macOS watchOS tvOS

      The foreground style in the current context.

    • .indigo iOS macOS watchOS tvOS

      A context-dependent indigo color suitable for use in UI elements.

    • .mint iOS macOS watchOS tvOS

      A context-dependent mint color suitable for use in UI elements.

    • .opacity(_:) iOS macOS watchOS tvOS

      Returns a new style based on self that multiplies by the specified opacity when drawing.

    • .primary iOS macOS watchOS tvOS

      A shape style that maps to the first level of the current content style.

    • .quaternary iOS macOS watchOS tvOS

      A shape style that maps to the fourth level of the current content style.

    • .regularMaterial iOS macOS tvOS

      A material that’s somewhat translucent.

    • .secondary iOS macOS watchOS tvOS

      A shape style that maps to the second level of the current content style.

    • .selection iOS macOS

      A style used to visually indicate selection following platform conventional colors and behaviors.

    • .teal iOS macOS watchOS tvOS

      A context-dependent teal color suitable for use in UI elements.

    • .tertiary iOS macOS watchOS tvOS

      A shape style that maps to the third level of the current content style.

    • .thickMaterial iOS macOS tvOS

      A material that’s more opaque than translucent.

    • .thinMaterial iOS macOS tvOS

      A material that’s more translucent than opaque.

    • .tint iOS macOS watchOS tvOS

      A style that reflects the current tint color.

    • .ultraThickMaterial iOS macOS tvOS

      A mostly opaque material.

    • .ultraThinMaterial iOS macOS tvOS

      A mostly translucent material.

  • ToggleStyle:

    • .button iOS macOS watchOS

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

  • ToolbarItemPlacement:

    • .keyboard iOS macOS

      The item is placed in the keyboard section.

SwiftUI 2.0 (2020) iOS 14.0|macOS 11.0|watchOS 7.0|tvOS 14.0

Views SwiftUI 2.0

  • CameraView HomeKit iOS watchOS tvOS

    A SwiftUI view into which a video stream or an image snapshot is rendered.

  • ColorPicker iOS macOS

    A control used to select a color from the system color picker UI.

  • ContainerRelativeShape iOS macOS watchOS tvOS

    A shape that is replaced by an inset version of the current container shape. If no container shape was defined, is replaced by a rectangle.

  • DisclosureGroup iOS macOS

    A view that shows or hides another content view, based on the state of a disclosure control.

  • Gauge watchOS iOS macOS

    A view that shows a value within a range.

  • GroupBox macOS iOS

    A stylized view, with an optional label, that visually collects a logical grouping of content.

  • Label iOS macOS watchOS tvOS

    A standard label for user interface items, consisting of an icon with a title.

  • LazyHGrid iOS macOS watchOS tvOS

    A container view that arranges its child views in a grid that grows horizontally, creating items only as needed.

  • LazyHStack iOS macOS watchOS tvOS

    A view that arranges its children in a line that grows horizontally, creating items only as needed.

  • LazyVGrid iOS macOS watchOS tvOS

    A container view that arranges its child views in a grid that grows vertically, creating items only as needed.

  • LazyVStack iOS macOS watchOS tvOS

    A view that arranges its children in a line that grows vertically, creating items only as needed.

  • Link iOS macOS watchOS tvOS

    A control for navigating to a URL.

  • Map MapKit iOS macOS watchOS tvOS

    A view that displays an embedded map interface.

  • Menu iOS macOS

    A control for presenting a menu of actions.

  • NavigationView Deprecated iOS macOS tvOS watchOS

    A view for presenting a stack of views that represents a visible path in a navigation hierarchy.

    → Use NavigationStack and NavigationSplitView instead.

  • NowPlayingView WatchKit watchOS

    A view that displays the system’s Now Playing interface so that the user can control audio.

  • OutlineGroup iOS macOS

    A structure that computes views and disclosure groups on demand from an underlying collection of tree-structured, identified data.

  • ProgressView iOS macOS watchOS tvOS

    A view that shows the progress towards completion of a task.

  • SceneView SceneKit iOS macOS watchOS tvOS

    A SwiftUI view for displaying 3D SceneKit content.

  • ScrollViewReader iOS macOS watchOS tvOS

    A view that provides programmatic scrolling, by working with a proxy to scroll to known child views.

  • SignInWithAppleButton Authentication Services iOS macOS watchOS tvOS

    The view that creates the Sign in with Apple button for display.

  • SpriteView SpriteKit iOS macOS watchOS tvOS

    A SwiftUI view that renders a SpriteKit scene.

  • TabView iOS macOS tvOS watchOS

    A view that switches between multiple child views using interactive user interface elements.

  • TextEditor iOS macOS

    A view that can display and edit long-form text.

  • VideoPlayer AVKit iOS macOS watchOS tvOS

    A view that displays content from a player and a native user interface to control playback.

Scenes SwiftUI 2.0

  • DocumentGroup iOS macOS

    A scene that enables support for opening, creating, and saving documents.

  • Settings macOS

    A scene that presents an interface for viewing and modifying an app’s settings.

  • WindowGroup iOS macOS watchOS tvOS

    A scene that presents a group of identically structured windows.

  • WKNotificationScene watchOS

    A scene which appears in response to receiving the specified category of remote or local notifications.

Commands SwiftUI 2.0

  • CommandGroup iOS macOS

    Command groups describe additional groupings of controls to add to existing command menus.

  • CommandMenu iOS macOS

    Command menus are stand-alone, top-level containers for controls that perform related, app-specific commands.

  • EmptyCommands iOS macOS

    An empty group of commands.

  • SidebarCommands iOS macOS

    A built-in set of commands for manipulating window sidebars.

  • TextEditingCommands iOS macOS

    A built-in group of commands for searching, editing, and transforming selections of text.

  • TextFormattingCommands iOS macOS

    A built-in set of commands for transforming the styles applied to selections of text.

  • ToolbarCommands iOS macOS

    A built-in set of commands for manipulating window toolbars.

View Modifiers SwiftUI 2.0

  • .accessibilityActivationPoint() iOS macOS watchOS tvOS

    The activation point for an element is the location assistive technologies use to initiate gestures.

  • .accessibilityAddTraits() iOS macOS watchOS tvOS

    Adds the given traits to the view.

  • .accessibilityHidden() iOS macOS watchOS tvOS

    Specifies whether to hide this view from system accessibility features.

  • .accessibilityHint() iOS macOS watchOS tvOS

    Communicates to the user what happens after performing the view’s action.

  • .accessibilityIdentifier() iOS macOS watchOS tvOS

    Uses the string you specify to identify the view.

  • .accessibilityIgnoresInvertColors() iOS macOS watchOS tvOS

    Sets whether this view should ignore the system Smart Invert setting.

  • .accessibilityInputLabels() iOS macOS watchOS tvOS

    Sets alternate input labels with which users identify a view.

  • .accessibilityLabel() iOS macOS watchOS tvOS

    Adds a label to the view that describes its contents.

  • .accessibilityLabeledPair() iOS macOS watchOS tvOS

    Pairs an accessibility element representing a label with the element for the matching content.

  • .accessibilityLinkedGroup() iOS macOS watchOS tvOS

    Links multiple accessibility elements so that the user can quickly navigate from one element to another, even when the elements are not near each other in the accessibility hierarchy.

  • .accessibilityRemoveTraits() iOS macOS watchOS tvOS

    Removes the given traits from this view.

  • .accessibilitySortPriority() iOS macOS watchOS tvOS

    Sets the sort priority order for this view’s accessibility element, relative to other elements at the same level.

  • .accessibilityValue() iOS macOS watchOS tvOS

    Adds a textual description of the value that the view contains.

  • .appStoreOverlay() iOS

    Presents a StoreKit overlay when a given condition is true.

  • .contextMenu() iOS macOS watchOS tvOS

    Adds a context menu with a preview to a view.

  • .defaultAppStorage() iOS macOS watchOS tvOS

    The default store used by AppStorage contained within the view.

  • .fileExporter() iOS macOS

    Presents a system interface for allowing the user to export a collection of in-memory documents to files on disk.

  • .fileImporter() iOS macOS

    Presents a system interface for allowing the user to import an existing file.

  • .fileMover() iOS macOS

    Presents a system interface for allowing the user to move an existing file to a new location.

  • .focusedValue() iOS macOS watchOS tvOS

    Modifies this view by injecting a value that you provide for use by other views whose state depends on the focused view hierarchy.

  • .focusScope() watchOS tvOS macOS

    Creates a focus scope that SwiftUI uses to limit default focus preferences.

  • .fullScreenCover() iOS watchOS tvOS

    Presents a modal view that covers as much of the screen as possible using the binding you provide as a data source for the sheet’s content.

  • .gaugeStyle() watchOS iOS macOS

    Sets the style for gauges within this view.

  • .groupBoxStyle() iOS macOS

    Sets the style for group boxes within this view.

  • .handlesExternalEvents() iOS macOS

    Specifies a modifier indicating the Scene this View is in can handle matching incoming External Events.

  • .help() iOS macOS watchOS tvOS

    Adds help text to a view using a string that you provide.

  • .ignoresSafeArea() iOS macOS watchOS tvOS

    Expands the view out of its safe area.

  • .imageScale() iOS watchOS tvOS macOS

    Scales images within the view according to one of the relative sizes available including small, medium, and large images sizes.

  • .indexViewStyle() iOS tvOS watchOS

    Sets the style for the index view within the current environment.

  • .keyboardShortcut() iOS macOS

    Assigns a keyboard shortcut to the modified control.

  • .labelStyle() iOS macOS watchOS tvOS

    Sets the style for labels within this view.

  • .listItemTint() iOS macOS watchOS tvOS

    Sets the tint effect associated with specific content in a list.

  • .matchedGeometryEffect() iOS macOS watchOS tvOS

    Defines a group of views with synchronized geometry using an identifier and namespace that you provide.

  • .menuStyle() iOS macOS

    Sets the style for menus within this view.

  • .navigationBarTitleDisplayMode() iOS watchOS

    Configures the title display mode for this view.

  • .navigationSubtitle() macOS Catalyst

    Configures the view’s subtitle for purposes of navigation.

  • .navigationTitle() iOS macOS watchOS tvOS

    Configures the view’s title for purposes of navigation.

  • .navigationViewStyle() Deprecated iOS macOS tvOS watchOS

    Sets the style for navigation views within this view.

    → Replace a styled NavigationView with a NavigationStack or NavigationSplitView.

  • .onChange() iOS macOS watchOS tvOS

    Adds a modifier for this view that fires an action when a specific value changes.

  • .onContinueUserActivity() iOS macOS watchOS tvOS

    Registers a handler to invoke when the view receives the specified activity type for the scene or window the view is in.

  • .onLongPressGesture() iOS macOS watchOS tvOS

    Adds an action to perform when this view recognizes a long press gesture.

  • .onOpenURL() iOS macOS watchOS tvOS

    Registers a handler to invoke when the view receives a url for the scene or window the view is in.

  • .pageCommand() tvOS

    Steps a value through a range in response to page up or page down commands.

  • .preferredColorScheme() iOS watchOS tvOS macOS

    Sets the preferred color scheme for this presentation.

  • .prefersDefaultFocus() watchOS tvOS macOS

    Indicates that the view should receive focus by default for a given namespace.

  • .presentedWindowStyle() macOS

    Sets the style for windows created by interacting with this view.

  • .presentedWindowToolbarStyle() macOS

    Sets the style for the toolbar in windows created by interacting with this view.

  • .previewContext() iOS macOS watchOS tvOS

    Declares a context for the preview.

  • .progressViewStyle() iOS macOS watchOS tvOS

    Sets the style for progress views in this view.

  • .quickLookPreview() iOS macOS

    Presents a Quick Look preview of the contents of a single URL.

  • .redacted() iOS macOS watchOS tvOS

    Adds a reason to apply a redaction to this view hierarchy.

  • .tabItem() iOS macOS tvOS watchOS

    Sets the tab bar item associated with this view.

  • .tabViewStyle() iOS macOS watchOS tvOS

    Sets the style for the tab view within the current environment.

  • .textCase() iOS macOS watchOS tvOS

    Sets a transform for the case of the text contained in this view when displayed.

  • .textContentType() iOS watchOS tvOS macOS

    Sets the text content type for this view, which the system uses to offer suggestions while the user enters text on macOS.

  • .toolbar() iOS macOS watchOS tvOS

    Populates the toolbar or navigation bar with the specified items.

  • .unredacted() iOS macOS watchOS tvOS

    Removes any reason to apply a redaction to this view hierarchy.

  • .userActivity() iOS macOS watchOS tvOS

    Advertises a user activity type.

  • .widgetURL() iOS macOS watchOS

    Sets the URL to open in the containing app when the user clicks the widget.

Scene Modifiers SwiftUI 2.0

  • .commands() iOS macOS

    Adds commands to the scene.

  • .defaultAppStorage() iOS macOS watchOS tvOS

    The default store used by AppStorage contained within the scene and its view content.

  • .handlesExternalEvents() iOS macOS

    Specifies a modifier to indicate if this Scene can be used when creating a new Scene for the received External Event.

  • .onChange() iOS macOS watchOS tvOS

    Adds an action to perform when the given value changes.

  • .windowStyle() macOS

    Sets the style for windows created by this scene.

  • .windowToolbarStyle() macOS

    Sets the style for the toolbar defined within this scene.

Environment Values SwiftUI 2.0

  • \.accessibilityShowButtonShapes iOS macOS watchOS tvOS

    Whether the system preference for Show Button Shapes is enabled.

  • \.imageScale iOS watchOS tvOS macOS

    The image scale for this environment.

  • \.isFocused iOS macOS watchOS tvOS

    Returns whether the nearest focusable ancestor has focus.

  • \.openURL iOS macOS watchOS tvOS

    An action that opens a URL.

  • \.redactionReasons iOS macOS watchOS tvOS

    The current redaction reasons applied to the view hierarchy.

  • \.resetFocus watchOS tvOS macOS

    An action that requests the focus system to reevaluate default focus.

  • \.scenePhase iOS macOS watchOS tvOS

    The current phase of the scene.

  • \.textCase iOS macOS watchOS tvOS

    A stylistic override to transform the case of Text when displayed, using the environment’s locale.

  • \.widgetFamily iOS macOS watchOS

    The template of the widget — small, medium, or large.

Property Wrappers SwiftUI 2.0

  • @AppStorage iOS macOS watchOS tvOS

    A property wrapper type that reflects a value from UserDefaults and invalidates a view on a change in value in that user default.

  • @FocusedBinding iOS macOS watchOS tvOS

    A convenience property wrapper for observing and automatically unwrapping state bindings from the focused view or one of its ancestors.

  • @FocusedValue iOS macOS watchOS tvOS

    A property wrapper for observing values from the focused view or one of its ancestors.

  • @Namespace iOS macOS watchOS tvOS

    A dynamic property type that allows access to a namespace defined by the persistent identity of the object containing the property (e.g. a view).

  • @NSApplicationDelegateAdaptor macOS

    A property wrapper type that you use to create an AppKit app delegate.

  • @ScaledMetric iOS macOS watchOS tvOS

    A dynamic property that scales a numeric value.

  • @SceneStorage iOS macOS watchOS tvOS

    A property wrapper type that reads and writes to persisted, per-scene storage.

  • @StateObject iOS macOS watchOS tvOS

    A property wrapper type that instantiates an observable object.

  • @UIApplicationDelegateAdaptor iOS tvOS

    A property wrapper type that you use to create a UIKit app delegate.

  • @WKApplicationDelegateAdaptor watchOS

    A property wrapper that is used in App to provide a delegate from WatchKit.

  • @WKExtensionDelegateAdaptor watchOS

    A property wrapper type that you use to create a WatchKit extension delegate.

Other Updates SwiftUI 2.0

  • Color:

    • .cgColor iOS macOS watchOS tvOS

      A Core Graphics representation of the color, if available.

  • DatePickerStyle:

    • .compact macOS Catalyst iOS

      A date picker style that displays the components in a compact, textual format.

    • .graphical macOS iOS

      A date picker style that displays an interactive calendar or clock.

  • Font:

    • .caption2 iOS macOS watchOS tvOS

      Create a font with the alternate caption text style.

    • .custom(_:fixedSize:) iOS macOS watchOS tvOS

      Create a custom font with the given name and a fixed size that does not scale with Dynamic Type.

    • .custom(_:size:relativeTo:) iOS macOS watchOS tvOS

      Create a custom font with the given name and size that scales relative to the given textStyle.

    • .leading(_:) iOS macOS watchOS tvOS

      Adjusts the line spacing of a font.

    • .title2 iOS macOS watchOS tvOS

      Create a font for second level hierarchical headings.

    • .title3 iOS macOS watchOS tvOS

      Create a font for third level hierarchical headings.

  • ListStyle:

    • .elliptical watchOS

      The list style that describes the behavior and appearance of an elliptical list.

    • .inset iOS macOS

      The list style that describes the behavior and appearance of an inset list.

    • .insetGrouped iOS

      The list style that describes the behavior and appearance of an inset grouped list.

    • .sidebar macOS iOS

      The list style that describes the behavior and appearance of a sidebar list.

  • PickerStyle:

    • .inline iOS macOS watchOS tvOS

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

    • .menu iOS macOS

      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.

  • PrimitiveButtonStyle:

    • .bordered macOS tvOS watchOS iOS

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

    • .card tvOS

      A button style that doesn’t pad the content, and applies a motion effect when a button has focus.

  • TabViewStyle:

    • .page iOS watchOS tvOS

      A TabViewStyle that implements a paged scrolling TabView.

    • .page(indexDisplayMode:) iOS watchOS tvOS

      A TabViewStyle that implements a paged scrolling TabView with an index display mode.

SwiftUI 1.0 (2019) iOS 13.0|macOS 10.15|watchOS 6.0|tvOS 13.0

Views SwiftUI 1.0

  • AngularGradient iOS macOS watchOS tvOS

    An angular gradient.

  • AnyView iOS macOS watchOS tvOS

    A type-erased view.

  • Button iOS macOS watchOS tvOS

    A control that initiates an action.

  • Capsule iOS macOS watchOS tvOS

    A capsule shape aligned inside the frame of the view containing it.

  • Circle iOS macOS watchOS tvOS

    A circle centered on the frame of the view containing it.

  • Color iOS macOS watchOS tvOS

    A representation of a color that adapts to a given context.

  • DatePicker iOS macOS

    A control for selecting an absolute date.

  • Divider iOS macOS watchOS tvOS

    A visual element that can be used to separate other content.

  • EditButton iOS

    A button that toggles the edit mode environment value.

  • Ellipse iOS macOS watchOS tvOS

    An ellipse aligned inside the frame of the view containing it.

  • EmptyView iOS macOS watchOS tvOS

    A view that doesn’t contain any content.

  • EquatableView iOS macOS watchOS tvOS

    A view type that compares itself against its previous value and prevents its child updating if its new value is the same as its old value.

  • ForEach iOS macOS watchOS tvOS

    A structure that computes views on demand from an underlying collection of identified data.

  • Form iOS macOS watchOS tvOS

    A container for grouping controls used for data entry, such as in settings or inspectors.

  • GeometryReader iOS macOS watchOS tvOS

    A container view that defines its content as a function of its own size and coordinate space.

  • Group iOS macOS watchOS tvOS

    A type that collects multiple instances of a content type — like views, scenes, or commands — into a single unit.

  • GroupBox macOS iOS

    A stylized view, with an optional label, that visually collects a logical grouping of content.

  • HSplitView macOS

    A layout container that arranges its children in a horizontal line and allows the user to resize them using dividers placed between them.

  • HStack iOS macOS watchOS tvOS

    A view that arranges its children in a horizontal line.

  • Image iOS macOS watchOS tvOS

    A view that displays an image.

  • LinearGradient iOS macOS watchOS tvOS

    A linear gradient.

  • List iOS macOS watchOS tvOS

    A container that presents rows of data arranged in a single column, optionally providing the ability to select one or more members.

  • MenuButton Deprecated macOS

    A button that displays a menu containing a list of choices when pressed.

    → Use Menu instead.

  • ModifiedContent iOS macOS watchOS tvOS

    A value with a modifier applied to it.

  • NavigationLink iOS macOS watchOS tvOS

    A view that controls a navigation presentation.

  • NavigationView Deprecated iOS macOS tvOS watchOS

    A view for presenting a stack of views that represents a visible path in a navigation hierarchy.

    → Use NavigationStack and NavigationSplitView instead.

  • OffsetShape iOS macOS watchOS tvOS

    A shape with a translation offset transform applied to it.

  • PasteButton macOS iOS

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

  • Path iOS macOS watchOS tvOS

    The outline of a 2D shape.

  • Picker iOS macOS watchOS tvOS

    A control for selecting from a set of mutually exclusive values.

  • RadialGradient iOS macOS watchOS tvOS

    A radial gradient.

  • Rectangle iOS macOS watchOS tvOS

    A rectangular shape aligned inside the frame of the view containing it.

  • RotatedShape iOS macOS watchOS tvOS

    A shape with a rotation transform applied to it.

  • RoundedRectangle iOS macOS watchOS tvOS

    A rectangular shape with rounded corners, aligned inside the frame of the view containing it.

  • ScaledShape iOS macOS watchOS tvOS

    A shape with a scale transform applied to it.

  • ScrollView iOS macOS watchOS tvOS

    A scrollable view.

  • Section iOS macOS watchOS tvOS

    A container view that you can use to add hierarchy to certain collection views.

  • SecureField iOS macOS watchOS tvOS

    A control into which the user securely enters private text.

  • Slider iOS macOS watchOS

    A control for selecting a value from a bounded linear range of values.

  • Spacer iOS macOS watchOS tvOS

    A flexible space that expands along the major axis of its containing stack layout, or on both axes if not contained in a stack.

  • Stepper iOS macOS watchOS

    A control that performs increment and decrement actions.

  • SubscriptionView iOS macOS watchOS tvOS

    A view that subscribes to a publisher with an action.

  • TabView iOS macOS tvOS watchOS

    A view that switches between multiple child views using interactive user interface elements.

  • Text iOS macOS watchOS tvOS

    A view that displays one or more lines of read-only text.

  • TextField iOS macOS watchOS tvOS

    A control that displays an editable text interface.

  • Toggle iOS macOS watchOS tvOS

    A control that toggles between on and off states.

  • TransformedShape iOS macOS watchOS tvOS

    A shape with an affine transform applied to it.

  • TupleView iOS macOS watchOS tvOS

    A View created from a swift tuple of View values.

  • VSplitView macOS

    A layout container that arranges its children in a vertical line and allows the user to resize them using dividers placed between them.

  • VStack iOS macOS watchOS tvOS

    A view that arranges its children in a vertical line.

  • ZStack iOS macOS watchOS tvOS

    A view that overlays its children, aligning them in both axes.

Classes SwiftUI 1.0

View Modifiers SwiftUI 1.0

  • .accentColor() Deprecated iOS macOS watchOS tvOS

    Sets the accent color for this view and the views it contains.

    → Use the asset catalog’s accent color or tint(_:) instead.

  • .accessibility() Deprecated iOS macOS watchOS tvOS

    Communicates to the user what happens after performing the view’s action.

    → Use accessibilityHint(_:) instead.

  • .accessibilityAction() iOS macOS watchOS tvOS

    Adds an accessibility action to the view. Actions allow assistive technologies, such as the VoiceOver, to interact with the view by invoking the action.

  • .accessibilityAdjustableAction() iOS macOS watchOS tvOS

    Adds an accessibility adjustable action to the view. Actions allow assistive technologies, such as the VoiceOver, to interact with the view by invoking the action.

  • .accessibilityElement() iOS macOS watchOS tvOS

    Creates a new accessibility element, or modifies the AccessibilityChildBehavior of the existing accessibility element.

  • .accessibilityScrollAction() iOS macOS watchOS tvOS

    Adds an accessibility scroll action to the view. Actions allow assistive technologies, such as the VoiceOver, to interact with the view by invoking the action.

  • .actionSheet() Deprecated iOS watchOS tvOS

    Presents an action sheet using the given item as a data source for the sheet’s content.

    → Use confirmationDialog(_:isPresented:titleVisibility:actions:message:) instead.

  • .alert() iOS macOS watchOS tvOS

    Presents an alert when a given condition is true, using a text view for the title.

  • .alignmentGuide() iOS macOS watchOS tvOS

    Sets the view’s vertical alignment.

  • .allowsHitTesting() iOS macOS watchOS tvOS

    Configures whether this view participates in hit test operations.

  • .allowsTightening() iOS macOS watchOS tvOS

    Sets whether text in this view can compress the space between characters when necessary to fit text in a line.

  • .anchorPreference() iOS macOS watchOS tvOS

  • .animation() iOS macOS watchOS tvOS

    Applies the given animation to this view when this view changes.

  • .aspectRatio() iOS macOS watchOS tvOS

    Constrains this view’s dimensions to the specified aspect ratio.

  • .autocapitalization() Deprecated iOS tvOS

    Sets whether to apply auto-capitalization to this view.

    → Use textInputAutocapitalization(_:) instead.

  • .autocorrectionDisabled() iOS macOS tvOS watchOS

    Sets whether to disable autocorrection for this view.

  • .background() iOS macOS watchOS tvOS

    Sets the view’s background to the default background style.

  • .backgroundPreferenceValue() iOS macOS watchOS tvOS

    Reads the specified preference value from the view, using it to produce a second view that is applied as the background of the original view.

  • .blendMode() iOS macOS watchOS tvOS

    Sets the blend mode for compositing this view with overlapping views.

  • .blur() iOS macOS watchOS tvOS

    Applies a Gaussian blur to this view.

  • .border() iOS macOS watchOS tvOS

    Adds a border to this view with the specified style and width.

  • .brightness() iOS macOS watchOS tvOS

    Brightens this view by the specified amount.

  • .buttonStyle() iOS macOS watchOS tvOS

    Sets the style for buttons within this view to a button style with a custom appearance and custom interaction behavior.

  • .clipped() iOS macOS watchOS tvOS

    Clips this view to its bounding rectangular frame.

  • .clipShape() iOS macOS watchOS tvOS

    Sets a clipping shape for this view.

  • .colorInvert() iOS macOS watchOS tvOS

    Inverts the colors in this view.

  • .colorMultiply() iOS macOS watchOS tvOS

    Adds a color multiplication effect to this view.

  • .colorScheme() Deprecated iOS macOS watchOS tvOS

    Sets this view’s color scheme.

    → Use preferredColorScheme(_:) instead.

  • .compositingGroup() iOS macOS watchOS tvOS

    Wraps this view in a compositing group.

  • .contentShape() iOS macOS watchOS tvOS

    Defines the content shape for hit testing.

  • .contextMenu() iOS macOS watchOS tvOS

    Adds a context menu with a preview to a view.

  • .contrast() iOS macOS watchOS tvOS

    Sets the contrast and separation between similar colors in this view.

  • .controlSize() macOS iOS watchOS

    Sets the size for controls within this view.

  • .coordinateSpace() iOS macOS watchOS tvOS

    Assigns a name to the view’s coordinate space, so other code can operate on dimensions like points and sizes relative to the named space.

  • .cornerRadius() iOS macOS watchOS tvOS

    Clips this view to its bounding frame, with the specified corner radius.

  • .datePickerStyle() iOS macOS

    Sets the style for date pickers within this view.

  • .defaultWheelPickerItemHeight() watchOS

    Sets the default wheel-style picker item height.

  • .deleteDisabled() iOS macOS watchOS tvOS

    Adds a condition for whether the view’s view hierarchy is deletable.

  • .digitalCrownRotation() watchOS

    Tracks Digital Crown rotations by updating the specified binding.

  • .disableAutocorrection() Deprecated iOS macOS tvOS watchOS

    Sets whether to disable autocorrection for this view.

    → Use autocorrectionDisabled(_:) instead.

  • .disabled() iOS macOS watchOS tvOS

    Adds a condition that controls whether users can interact with this view.

  • .drawingGroup() iOS macOS watchOS tvOS

    Composites this view’s contents into an offscreen image before final display.

  • .edgesIgnoringSafeArea() Deprecated iOS macOS watchOS tvOS

    Changes the view’s proposed area to extend outside the screen’s safe areas.

    → Use ignoresSafeArea(_:edges:) instead.

  • .environment() iOS macOS watchOS tvOS

    Sets the environment value of the specified key path to the given value.

  • .environmentObject() iOS macOS watchOS tvOS

    Supplies an ObservableObject to a view subhierarchy.

  • .fixedSize() iOS macOS watchOS tvOS

    Fixes this view at its ideal size.

  • .flipsForRightToLeftLayoutDirection() iOS macOS watchOS tvOS

    Sets whether this view mirrors its contents horizontally when the layout direction is right-to-left.

  • .focusable() macOS watchOS tvOS

    Specifies if the view is focusable.

  • .font() iOS macOS watchOS tvOS

    Sets the default font for text in this view.

  • .foregroundColor() iOS macOS watchOS tvOS

    Sets the color of the foreground elements displayed by this view.

  • .frame() iOS macOS watchOS tvOS

    Positions this view within an invisible frame.

  • .gesture() iOS macOS watchOS tvOS

    Attaches a gesture to the view with a lower precedence than gestures defined by the view.

  • .grayscale() iOS macOS watchOS tvOS

    Adds a grayscale effect to this view.

  • .hidden() iOS macOS watchOS tvOS

    Hides this view unconditionally.

  • .highPriorityGesture() iOS macOS watchOS tvOS

    Attaches a gesture to the view with a higher precedence than gestures defined by the view.

  • .horizontalRadioGroupLayout() macOS

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

  • .hoverEffect() iOS tvOS

    Applies a pointer hover effect to the view.

  • .hueRotation() iOS macOS watchOS tvOS

    Applies a hue rotation effect to this view.

  • .id() iOS macOS watchOS tvOS

    Binds a view’s identity to the given proxy value.

  • .imageScale() iOS watchOS tvOS macOS

    Scales images within the view according to one of the relative sizes available including small, medium, and large images sizes.

  • .itemProvider() iOS macOS watchOS tvOS

    Provides a closure that vends the drag representation to be used for a particular data element.

  • .keyboardType() iOS tvOS

    Sets the keyboard type for this view.

  • .labelsHidden() iOS macOS watchOS tvOS

    Hides the labels of any controls contained within this view.

  • .layoutPriority() iOS macOS watchOS tvOS

    Sets the priority by which a parent layout should apportion space to this child.

  • .lineLimit() iOS macOS watchOS tvOS

    Sets the maximum number of lines that text can occupy in this view.

  • .lineSpacing() iOS macOS watchOS tvOS

    Sets the amount of space between lines of text in this view.

  • .listRowBackground() iOS macOS watchOS tvOS

    Places a custom background view behind a list row item.

  • .listRowInsets() iOS macOS watchOS tvOS

    Applies an inset to the rows in a list.

  • .listRowPlatterColor() Deprecated watchOS

    Sets the color that the system applies to the row background when this view is placed in a list.

    → Use listItemTint(_:) instead.

  • .listStyle() iOS macOS watchOS tvOS

    Sets the style for lists within this view.

  • .luminanceToAlpha() iOS macOS watchOS tvOS

    Adds a luminance to alpha effect to this view.

  • .mask() iOS macOS watchOS tvOS

    Masks this view using the alpha channel of the given view.

  • .menuButtonStyle() Deprecated macOS

    Sets the style for menu buttons within this view.

    → Use menuStyle(_:) instead.

  • .minimumScaleFactor() iOS macOS watchOS tvOS

    Sets the minimum amount that text in this view scales down to fit in the available space.

  • .modifier() iOS macOS watchOS tvOS

    Applies a modifier to a view and returns a new view.

  • .moveDisabled() iOS macOS watchOS tvOS

    Adds a condition for whether the view’s view hierarchy is movable.

  • .multilineTextAlignment() iOS macOS watchOS tvOS

    Sets the alignment of multiline text in this view.

  • .navigationBarBackButtonHidden() iOS watchOS tvOS

    Hides the navigation bar back button for the view.

  • .navigationBarHidden() Deprecated iOS watchOS tvOS

    Hides the navigation bar for this view.

    → Use toolbar(_:in:) with the Visibility.hidden visibility and the navigationBar placement instead.

  • .navigationBarItems() Deprecated iOS tvOS

    Sets the navigation bar items for this view.

    → Use toolbar(content:) with navigationBarLeading placement.

  • .navigationBarTitle() Deprecated iOS watchOS tvOS

    Sets the title in the navigation bar for this view.

    → Use navigationTitle(_:) instead.

  • .navigationViewStyle() Deprecated iOS macOS tvOS watchOS

    Sets the style for navigation views within this view.

    → Replace a styled NavigationView with a NavigationStack or NavigationSplitView.

  • .offset() iOS macOS watchOS tvOS

    Offset this view by the horizontal and vertical amount specified in the offset parameter.

  • .onAppear() iOS macOS watchOS tvOS

    Adds an action to perform before this view appears.

  • .onCommand() macOS

    Adds an action to perform in response to the given selector.

  • .onCopyCommand() macOS

    Adds an action to perform in response to the system’s Copy command.

  • .onCutCommand() macOS

    Adds an action to perform in response to the system’s Cut command.

  • .onDeleteCommand() macOS

    Adds an action to perform in response to the system’s Delete command, or pressing either the ⌫ (backspace) or ⌦ (forward delete) keys while the view has focus.

  • .onDisappear() iOS macOS watchOS tvOS

    Adds an action to perform after this view disappears.

  • .onDrag() iOS macOS

    Activates this view as the source of a drag and drop operation.

  • .onDrop() iOS macOS

    Defines the destination of a drag and drop operation using behavior controlled by the delegate that you provide.

  • .onExitCommand() macOS tvOS

    Sets up an action that triggers in response to receiving the exit command while the view has focus.

  • .onHover() iOS macOS

    Adds an action to perform when the user moves the pointer over or away from the view’s frame.

  • .onLongPressGesture() iOS macOS watchOS tvOS

    Adds an action to perform when this view recognizes a long press gesture.

  • .onMoveCommand() macOS tvOS

    Adds an action to perform in response to a move command, like when the user presses an arrow key on a Mac keyboard, or taps the edge of the Siri Remote when controlling an Apple TV.

  • .onPasteCommand() macOS

    Adds an action to perform in response to the system’s Paste command.

  • .onPlayPauseCommand() tvOS

    Adds an action to perform in response to the system’s Play/Pause command.

  • .onPreferenceChange() iOS macOS watchOS tvOS

    Adds an action to perform when the specified preference key’s value changes.

  • .onReceive() iOS macOS watchOS tvOS

    Adds an action to perform when this view detects data emitted by the given publisher.

  • .onTapGesture() iOS macOS watchOS tvOS

    Adds an action to perform when this view recognizes a tap gesture.

  • .opacity() iOS macOS watchOS tvOS

    Sets the transparency of this view.

  • .overlay() iOS macOS watchOS tvOS

    Layers the views that you specify in front of this view.

  • .overlayPreferenceValue() iOS macOS watchOS tvOS

    Reads the specified preference value from the view, using it to produce a second view that is applied as an overlay to the original view.

  • .padding() iOS macOS watchOS tvOS

    Adds a specific padding amount to each edge of this view.

  • .pickerStyle() iOS macOS watchOS tvOS

    Sets the style for pickers within this view.

  • .popover() iOS macOS

    Presents a popover using the given item as a data source for the popover’s content.

  • .position() iOS macOS watchOS tvOS

    Positions the center of this view at the specified point in its parent’s coordinate space.

  • .preference() iOS macOS watchOS tvOS

    Sets a value for the given preference.

  • .preferredColorScheme() iOS watchOS tvOS macOS

    Sets the preferred color scheme for this presentation.

  • .previewDevice() iOS macOS watchOS tvOS

    Overrides the device for a preview.

  • .previewDisplayName() iOS macOS watchOS tvOS

    Sets a user visible name to show in the canvas for a preview.

  • .previewLayout() iOS macOS watchOS tvOS

    Overrides the size of the container for the preview.

  • .projectionEffect() iOS macOS watchOS tvOS

    Applies a projection transformation to this view’s rendered output.

  • .rotation3DEffect() iOS macOS watchOS tvOS

    Rotates this view’s rendered output in three dimensions around the given axis of rotation.

  • .rotationEffect() iOS macOS watchOS tvOS

    Rotates this view’s rendered output around the specified point.

  • .saturation() iOS macOS watchOS tvOS

    Adjusts the color saturation of this view.

  • .scaledToFill() iOS macOS watchOS tvOS

    Scales this view to fill its parent.

  • .scaledToFit() iOS macOS watchOS tvOS

    Scales this view to fit its parent.

  • .scaleEffect() iOS macOS watchOS tvOS

    Scales this view’s rendered output by the given vertical and horizontal size amounts, relative to an anchor point.

  • .shadow() iOS macOS watchOS tvOS

    Adds a shadow to this view.

  • .sheet() iOS macOS watchOS tvOS

    Presents a sheet using the given item as a data source for the sheet’s content.

  • .simultaneousGesture() iOS macOS watchOS tvOS

    Attaches a gesture to the view to process simultaneously with gestures defined by the view.

  • .statusBar() Deprecated iOS

    Sets the visibility of the status bar.

    → Use statusBarHidden(_:) instead.

  • .statusBarHidden() iOS

    Sets the visibility of the status bar.

  • .tabItem() iOS macOS tvOS watchOS

    Sets the tab bar item associated with this view.

  • .tag() iOS macOS watchOS tvOS

    Sets the unique tag value of this view.

  • .textContentType() iOS watchOS tvOS macOS

    Sets the text content type for this view, which the system uses to offer suggestions while the user enters text on macOS.

  • .textFieldStyle() iOS macOS watchOS tvOS

    Sets the style for text fields within this view.

  • .toggleStyle() iOS macOS watchOS tvOS

    Sets the style for toggles in a view hierarchy.

  • .touchBar() macOS

    Sets the Touch Bar content to be shown in the Touch Bar when applicable.

  • .touchBarCustomizationLabel() macOS

    Sets a user-visible string that identifies the view’s functionality.

  • .touchBarItemPresence() macOS

    Sets the behavior of the user-customized view.

  • .touchBarItemPrincipal() macOS

    Sets principal views that have special significance to this Touch Bar.

  • .transaction() iOS macOS watchOS tvOS

    Applies the given transaction mutation function to all animations used within the view.

  • .transformAnchorPreference() iOS macOS watchOS tvOS

  • .transformEffect() iOS macOS watchOS tvOS

    Applies an affine transformation to this view’s rendered output.

  • .transformEnvironment() iOS macOS watchOS tvOS

    Transforms the environment value of the specified key path with the given function.

  • .transformPreference() iOS macOS watchOS tvOS

    Applies a transformation to a preference value.

  • .transition() iOS macOS watchOS tvOS

    Associates a transition with the view.

  • .truncationMode() iOS macOS watchOS tvOS

    Sets the truncation mode for lines of text that are too long to fit in the available space.

  • .zIndex() iOS macOS watchOS tvOS

    Controls the display order of overlapping views.

Environment Values SwiftUI 1.0

  • \.accessibilityDifferentiateWithoutColor iOS macOS watchOS tvOS

    Whether the system preference for Differentiate without Color is enabled.

  • \.accessibilityEnabled iOS macOS watchOS tvOS

    A Boolean value that indicates whether the user has enabled an assistive technology.

  • \.accessibilityInvertColors iOS macOS watchOS tvOS

    Whether the system preference for Invert Colors is enabled.

  • \.accessibilityReduceMotion iOS macOS watchOS tvOS

    Whether the system preference for Reduce Motion is enabled.

  • \.accessibilityReduceTransparency iOS macOS watchOS tvOS

    Whether the system preference for Reduce Transparency is enabled.

  • \.allowsTightening iOS macOS watchOS tvOS

    A Boolean value that indicates whether inter-character spacing should tighten to fit the text into the available space.

  • \.autocorrectionDisabled iOS macOS tvOS watchOS

    A Boolean value that determines whether the view hierarchy has auto-correction enabled.

  • \.calendar iOS macOS watchOS tvOS

    The current calendar that views should use when handling dates.

  • \.colorScheme iOS macOS watchOS tvOS

    The color scheme of this environment.

  • \.colorSchemeContrast iOS macOS watchOS tvOS

    The contrast associated with the color scheme of this environment.

  • \.controlActiveState macOS

    The active state of controls in the view.

  • \.controlSize macOS iOS watchOS

    The size to apply to controls within a view.

  • \.defaultMinListHeaderHeight iOS macOS watchOS tvOS

    The default minimum height of a header in a list.

  • \.defaultMinListRowHeight iOS macOS watchOS tvOS

    The default minimum height of a row in a list.

  • \.defaultWheelPickerItemHeight watchOS

    The default height of an item in a wheel-style picker, such as a date picker.

  • \.description iOS macOS watchOS tvOS

    A string that represents the contents of the environment values instance.

  • \.disableAutocorrection Deprecated iOS macOS tvOS watchOS

    A Boolean value that determines whether the view hierarchy has auto-correction enabled.

  • \.displayScale iOS macOS watchOS tvOS

    The display scale of this environment.

  • \.editMode iOS tvOS

    An indication of whether the user can edit the contents of a view associated with this environment.

  • \.font iOS macOS watchOS tvOS

    The default font of this environment.

  • \.horizontalSizeClass iOS

    The horizontal size class of this environment.

  • \.imageScale iOS watchOS tvOS macOS

    The image scale for this environment.

  • \.isEnabled iOS macOS watchOS tvOS

    A Boolean value that indicates whether the view associated with this environment allows user interaction.

  • \.layoutDirection iOS macOS watchOS tvOS

    The layout direction associated with the current environment.

  • \.legibilityWeight iOS macOS watchOS tvOS

    The font weight to apply to text.

  • \.lineLimit iOS macOS watchOS tvOS

    The maximum number of lines that text can occupy in a view.

  • \.lineSpacing iOS macOS watchOS tvOS

    The distance in points between the bottom of one line fragment and the top of the next.

  • \.locale iOS macOS watchOS tvOS

    The current locale that views should use.

  • \.managedObjectContext iOS macOS watchOS tvOS

  • \.minimumScaleFactor iOS macOS watchOS tvOS

    The minimum permissible proportion to shrink the font size to fit the text into the available space.

  • \.multilineTextAlignment iOS macOS watchOS tvOS

    A value that indicates how text instance aligns its lines when the content wraps or contains newlines.

  • \.pixelLength iOS macOS watchOS tvOS

    The size of a pixel on the screen.

  • \.presentationMode Deprecated iOS macOS watchOS tvOS

    A binding to the current presentation mode of the view associated with this environment.

    → Use isPresented or dismiss instead.

  • \.sizeCategory Deprecated iOS macOS watchOS tvOS

    The size of content.

    → Use dynamicTypeSize instead.

  • \.timeZone iOS macOS watchOS tvOS

    The current time zone that views should use when handling dates.

  • \.truncationMode iOS macOS watchOS tvOS

    A value that indicates how the layout truncates the last line of text to fit into the available space.

  • \.undoManager iOS macOS watchOS tvOS

    The undo manager used to register a view’s undo operations.

  • \.verticalSizeClass iOS

    The vertical size class of this environment.

Property Wrappers SwiftUI 1.0

  • @Binding iOS macOS watchOS tvOS

    A property wrapper type that can read and write a value owned by a source of truth.

  • @Environment iOS macOS watchOS tvOS

    A property wrapper that reads a value from a view’s environment.

  • @EnvironmentObject iOS macOS watchOS tvOS

    A property wrapper type for an observable object supplied by a parent or ancestor view.

  • @FetchRequest iOS macOS watchOS tvOS

    A property wrapper type that retrieves entities from a Core Data persistent store.

  • @GestureState iOS macOS watchOS tvOS

    A property wrapper type that updates a property while the user performs a gesture and resets the property back to its initial state when the gesture ends.

  • @ObservedObject iOS macOS watchOS tvOS

    A property wrapper type that subscribes to an observable object and invalidates a view whenever the observable object changes.

  • @State iOS macOS watchOS tvOS

    A property wrapper type that can read and write a value managed by SwiftUI.