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.

Type e.g. “16” or “macos 13” in the search field to match a specific OS version.

Views

Collection Containers

  • ControlGroup iOS 15.0 macOS 12.0

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

  • DisclosureGroup iOS 14.0 macOS 11.0

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

  • ForEach iOS 13.0 macOS 10.15 watchOS 6.0 tvOS 13.0

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

  • Form iOS 13.0 macOS 10.15 watchOS 6.0 tvOS 13.0

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

  • Group iOS 13.0 macOS 10.15 watchOS 6.0 tvOS 13.0

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

  • GroupBox iOS 14.0 macOS 10.15

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

  • LabeledContent iOS 16.0 macOS 13.0 watchOS 9.0 tvOS 16.0

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

  • List iOS 13.0 macOS 10.15 watchOS 6.0 tvOS 13.0

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

  • OutlineGroup iOS 14.0 macOS 11.0

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

  • ScrollView iOS 13.0 macOS 10.15 watchOS 6.0 tvOS 13.0

    A scrollable view.

  • ScrollViewReader iOS 14.0 macOS 11.0 watchOS 7.0 tvOS 14.0

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

  • Section iOS 13.0 macOS 10.15 watchOS 6.0 tvOS 13.0

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

Controls and Indicators

  • Button iOS 13.0 macOS 10.15 watchOS 6.0 tvOS 13.0

    A control that initiates an action.

  • ColorPicker iOS 14.0 macOS 11.0

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

  • DatePicker iOS 13.0 macOS 10.15

    A control for selecting an absolute date.

  • DefaultDateProgressLabel iOS 16.0 macOS 13.0 watchOS 9.0 tvOS 16.0

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

  • EditButton iOS 13.0

    A button that toggles the edit mode environment value.

  • Gauge iOS 16.0 macOS 13.0 watchOS 7.0

    A view that shows a value within a range.

  • Link iOS 14.0 macOS 11.0 watchOS 7.0 tvOS 14.0

    A control for navigating to a URL.

  • Menu iOS 14.0 macOS 11.0

    A control for presenting a menu of actions.

  • MultiDatePicker iOS 16.0

    A control for picking multiple dates.

  • PasteButton iOS 16.0 macOS 10.15

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

  • Picker iOS 13.0 macOS 10.15 watchOS 6.0 tvOS 13.0

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

  • ProgressView iOS 14.0 macOS 11.0 watchOS 7.0 tvOS 14.0

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

  • RenameButton iOS 16.0 macOS 13.0 watchOS 9.0 tvOS 16.0

    A button that triggers a standard rename action.

  • ShareLink iOS 16.0 macOS 13.0 watchOS 9.0

    A view that controls a sharing presentation.

  • Slider iOS 13.0 macOS 10.15 watchOS 6.0

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

  • Stepper iOS 13.0 macOS 10.15 watchOS 9.0

    A control that performs increment and decrement actions.

  • TextFieldLink watchOS 9.0

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

  • Toggle iOS 13.0 macOS 10.15 watchOS 6.0 tvOS 13.0

    A control that toggles between on and off states.

Drawing and Graphics

  • Canvas iOS 15.0 macOS 12.0 watchOS 8.0 tvOS 15.0

    A view type that supports immediate mode drawing.

  • Color iOS 13.0 macOS 10.15 watchOS 6.0 tvOS 13.0

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

  • GeometryReader iOS 13.0 macOS 10.15 watchOS 6.0 tvOS 13.0

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

Images

  • AsyncImage iOS 15.0 macOS 12.0 watchOS 8.0 tvOS 15.0

    A view that asynchronously loads and displays an image.

  • Image iOS 13.0 macOS 10.15 watchOS 6.0 tvOS 13.0

    A view that displays an image.

Layout Containers

  • Divider iOS 13.0 macOS 10.15 watchOS 6.0 tvOS 13.0

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

  • Grid iOS 16.0 macOS 13.0 watchOS 9.0 tvOS 16.0

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

  • GridRow iOS 16.0 macOS 13.0 watchOS 9.0 tvOS 16.0

    A horizontal row in a two dimensional grid container.

  • HStack iOS 13.0 macOS 10.15 watchOS 6.0 tvOS 13.0

    A view that arranges its children in a horizontal line.

  • LazyHGrid iOS 14.0 macOS 11.0 watchOS 7.0 tvOS 14.0

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

  • LazyHStack iOS 14.0 macOS 11.0 watchOS 7.0 tvOS 14.0

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

  • LazyVGrid iOS 14.0 macOS 11.0 watchOS 7.0 tvOS 14.0

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

  • LazyVStack iOS 14.0 macOS 11.0 watchOS 7.0 tvOS 14.0

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

  • Spacer iOS 13.0 macOS 10.15 watchOS 6.0 tvOS 13.0

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

  • ViewThatFits iOS 16.0 macOS 13.0 watchOS 9.0 tvOS 16.0

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

  • VStack iOS 13.0 macOS 10.15 watchOS 6.0 tvOS 13.0

    A view that arranges its children in a vertical line.

  • ZStack iOS 13.0 macOS 10.15 watchOS 6.0 tvOS 13.0

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

Presentation Containers

  • HSplitView macOS 10.15

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

  • NavigationLink iOS 13.0 macOS 10.15 watchOS 6.0 tvOS 13.0

    A view that controls a navigation presentation.

  • NavigationSplitView iOS 16.0 macOS 13.0 watchOS 9.0 tvOS 16.0

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

  • NavigationStack iOS 16.0 macOS 13.0 watchOS 9.0 tvOS 16.0

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

  • TabView iOS 13.0 macOS 10.15 watchOS 7.0 tvOS 13.0

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

  • TimelineView iOS 15.0 macOS 12.0 watchOS 8.0 tvOS 15.0

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

  • VSplitView macOS 10.15

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

Shapes

  • AngularGradient iOS 13.0 macOS 10.15 watchOS 6.0 tvOS 13.0

    An angular gradient.

  • AnyShape iOS 16.0 macOS 13.0 watchOS 9.0 tvOS 16.0

    A type-erased shape value.

  • Capsule iOS 13.0 macOS 10.15 watchOS 6.0 tvOS 13.0

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

  • Circle iOS 13.0 macOS 10.15 watchOS 6.0 tvOS 13.0

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

  • ContainerRelativeShape iOS 14.0 macOS 11.0 watchOS 7.0 tvOS 14.0

    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.

  • Ellipse iOS 13.0 macOS 10.15 watchOS 6.0 tvOS 13.0

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

  • EllipticalGradient iOS 15.0 macOS 12.0 watchOS 8.0 tvOS 15.0

    A radial gradient that draws an ellipse.

  • LinearGradient iOS 13.0 macOS 10.15 watchOS 6.0 tvOS 13.0

    A linear gradient.

  • OffsetShape iOS 13.0 macOS 10.15 watchOS 6.0 tvOS 13.0

    A shape with a translation offset transform applied to it.

  • Path iOS 13.0 macOS 10.15 watchOS 6.0 tvOS 13.0

    The outline of a 2D shape.

  • RadialGradient iOS 13.0 macOS 10.15 watchOS 6.0 tvOS 13.0

    A radial gradient.

  • Rectangle iOS 13.0 macOS 10.15 watchOS 6.0 tvOS 13.0

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

  • RotatedShape iOS 13.0 macOS 10.15 watchOS 6.0 tvOS 13.0

    A shape with a rotation transform applied to it.

  • RoundedRectangle iOS 13.0 macOS 10.15 watchOS 6.0 tvOS 13.0

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

  • ScaledShape iOS 13.0 macOS 10.15 watchOS 6.0 tvOS 13.0

    A shape with a scale transform applied to it.

  • TransformedShape iOS 13.0 macOS 10.15 watchOS 6.0 tvOS 13.0

    A shape with an affine transform applied to it.

Tables

  • Table iOS 16.0 macOS 12.0

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

Text Input and Output

  • Label iOS 14.0 macOS 11.0 watchOS 7.0 tvOS 14.0

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

  • SecureField iOS 13.0 macOS 10.15 watchOS 6.0 tvOS 13.0

    A control into which the user securely enters private text.

  • Text iOS 13.0 macOS 10.15 watchOS 6.0 tvOS 13.0

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

  • TextEditor iOS 14.0 macOS 11.0

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

  • TextField iOS 13.0 macOS 10.15 watchOS 6.0 tvOS 13.0

    A control that displays an editable text interface.

View Fundamentals

  • AnyView iOS 13.0 macOS 10.15 watchOS 6.0 tvOS 13.0

    A type-erased view.

  • EmptyView iOS 13.0 macOS 10.15 watchOS 6.0 tvOS 13.0

    A view that doesn’t contain any content.

  • EquatableView iOS 13.0 macOS 10.15 watchOS 6.0 tvOS 13.0

    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.

  • ModifiedContent iOS 13.0 macOS 10.15 watchOS 6.0 tvOS 13.0

    A value with a modifier applied to it.

  • SubscriptionView iOS 13.0 macOS 10.15 watchOS 6.0 tvOS 13.0

    A view that subscribes to a publisher with an action.

  • TupleView iOS 13.0 macOS 10.15 watchOS 6.0 tvOS 13.0

    A View created from a swift tuple of View values.

Integrating Other Frameworks

  • AddPassToWalletButton PassKit iOS 16.0

  • AsyncShareablePassConfiguration PassKit iOS 16.0

  • CameraView HomeKit iOS 14.0 watchOS 7.0 tvOS 14.0

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

  • DevicePicker DeviceDiscoveryUI tvOS 16.0

    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.

  • LocalAuthenticationView Local Authentication macOS 13.0

    A SwiftUI view that displays an authentication interface.

  • LocationButton CoreLocationUI iOS 15.0 watchOS 8.0

    A SwiftUI button that grants one-time location authorization.

  • Map MapKit iOS 14.0 macOS 11.0 watchOS 7.0 tvOS 14.0

    A view that displays an embedded map interface.

  • NowPlayingView WatchKit watchOS 7.0

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

  • PayWithApplePayButton PassKit iOS 16.0 macOS 13.0 watchOS 9.0

  • PhotosPicker PhotosUI iOS 16.0 macOS 13.0 watchOS 9.0

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

  • SceneView SceneKit iOS 14.0 macOS 11.0 Catalyst 14.2 watchOS 7.0 tvOS 14.0

    A SwiftUI view for displaying 3D SceneKit content.

  • SignInWithAppleButton Authentication Services iOS 14.0 macOS 11.0 Catalyst 14.2 watchOS 7.0 tvOS 14.0

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

  • SpriteView SpriteKit iOS 14.0 macOS 11.0 Catalyst 14.2 watchOS 7.0 tvOS 14.0

    A SwiftUI view that renders a SpriteKit scene.

  • VerifyIdentityWithWalletButton PassKit iOS 16.0

  • VideoPlayer AVKit iOS 14.0 macOS 11.0 watchOS 7.0 tvOS 14.0

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

Deprecated Views and Controls

  • MenuButton Deprecated macOS 10.15

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

    → Use Menu instead.

  • NavigationView Deprecated iOS 13.0 macOS 10.15 watchOS 7.0 tvOS 13.0

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

    → Use NavigationStack and NavigationSplitView instead.

Scenes

  • DocumentGroup iOS 14.0 macOS 11.0

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

  • Group iOS 13.0 macOS 10.15 watchOS 6.0 tvOS 13.0

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

  • MenuBarExtra macOS 13.0

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

  • ModifiedContent iOS 13.0 macOS 10.15 watchOS 6.0 tvOS 13.0

    A value with a modifier applied to it.

  • Settings macOS 11.0

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

  • Window macOS 13.0

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

  • WindowGroup iOS 14.0 macOS 11.0 watchOS 7.0 tvOS 14.0

    A scene that presents a group of identically structured windows.

  • WKNotificationScene watchOS 7.0

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

Commands

  • CommandGroup iOS 14.0 macOS 11.0

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

  • CommandMenu iOS 14.0 macOS 11.0

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

  • EmptyCommands iOS 14.0 macOS 11.0

    An empty group of commands.

  • Group iOS 13.0 macOS 10.15 watchOS 6.0 tvOS 13.0

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

  • ImportFromDevicesCommands macOS 12.0

    A built-in set of commands that enables importing content from nearby devices.

  • SidebarCommands iOS 14.0 macOS 11.0

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

  • TextEditingCommands iOS 14.0 macOS 11.0

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

  • TextFormattingCommands iOS 14.0 macOS 11.0

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

  • ToolbarCommands iOS 14.0 macOS 11.0

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

Classes

  • ImageRenderer iOS 16.0 macOS 13.0 watchOS 9.0 tvOS 16.0

    An object that creates images from SwiftUI views.

  • NSHostingController macOS 10.15

    An AppKit view controller that hosts SwiftUI view hierarchy.

  • NSHostingView macOS 10.15

    An AppKit view that hosts a SwiftUI view hierarchy.

  • UIHostingController iOS 13.0 tvOS 13.0

    A UIKit view controller that manages a SwiftUI view hierarchy.

  • WKHostingController watchOS 6.0

    A WatchKit interface controller that hosts a SwiftUI view hierarchy.

  • WKUserNotificationHostingController watchOS 6.0

    A WatchKit user notification interface controller that hosts a SwiftUI view hierarchy.

View Modifiers

Accessibility Modifiers

  • .accessibilityAction() iOS 13.0 macOS 11.0 watchOS 6.0 tvOS 13.0

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

  • .accessibilityActions() iOS 16.0 macOS 13.0 watchOS 9.0 tvOS 16.0

    Adds multiple accessibility actions to the view.

  • .accessibilityActivationPoint() iOS 14.0 macOS 11.0 watchOS 7.0 tvOS 14.0

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

  • .accessibilityAddTraits() iOS 14.0 macOS 11.0 watchOS 7.0 tvOS 14.0

    Adds the given traits to the view.

  • .accessibilityAdjustableAction() iOS 13.0 macOS 10.15 watchOS 6.0 tvOS 13.0

    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.

  • .accessibilityChartDescriptor() iOS 15.0 macOS 12.0 watchOS 8.0 tvOS 15.0

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

  • .accessibilityChildren() iOS 15.0 macOS 12.0 watchOS 8.0 tvOS 15.0

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

  • .accessibilityCustomContent() iOS 15.0 macOS 12.0 watchOS 8.0 tvOS 15.0

    Add additional accessibility information to the view.

  • .accessibilityElement() iOS 13.0 macOS 10.15 watchOS 6.0 tvOS 13.0

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

  • .accessibilityFocused() iOS 15.0 macOS 12.0 watchOS 8.0 tvOS 15.0

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

  • .accessibilityHeading() iOS 15.0 macOS 12.0 watchOS 8.0 tvOS 15.0

    Sets the accessibility level of this heading.

  • .accessibilityHidden() iOS 14.0 macOS 11.0 watchOS 7.0 tvOS 14.0

    Specifies whether to hide this view from system accessibility features.

  • .accessibilityHint() iOS 14.0 macOS 11.0 watchOS 7.0 tvOS 14.0

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

  • .accessibilityIdentifier() iOS 14.0 macOS 11.0 watchOS 7.0 tvOS 14.0

    Uses the string you specify to identify the view.

  • .accessibilityIgnoresInvertColors() iOS 14.0 macOS 11.0 watchOS 7.0 tvOS 14.0

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

  • .accessibilityInputLabels() iOS 14.0 macOS 11.0 watchOS 7.0 tvOS 14.0

    Sets alternate input labels with which users identify a view.

  • .accessibilityLabel() iOS 14.0 macOS 11.0 watchOS 7.0 tvOS 14.0

    Adds a label to the view that describes its contents.

  • .accessibilityLabeledPair() iOS 14.0 macOS 11.0 watchOS 7.0 tvOS 14.0

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

  • .accessibilityQuickAction() iOS 16.0 macOS 13.0 watchOS 9.0 tvOS 16.0

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

  • .accessibilityRemoveTraits() iOS 14.0 macOS 11.0 watchOS 7.0 tvOS 14.0

    Removes the given traits from this view.

  • .accessibilityRepresentation() iOS 15.0 macOS 12.0 watchOS 8.0 tvOS 15.0

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

  • .accessibilityRespondsToUserInteraction() iOS 15.0 macOS 12.0 watchOS 8.0 tvOS 15.0

    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.

  • .accessibilityScrollAction() iOS 13.0 macOS 10.15 watchOS 6.0 tvOS 13.0

    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.

  • .accessibilityShowsLargeContentViewer() iOS 15.0 macOS 12.0 watchOS 8.0 tvOS 15.0

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

  • .accessibilityTextContentType() iOS 15.0 macOS 12.0 watchOS 8.0 tvOS 15.0

    Sets an accessibility text content type.

  • .accessibilityValue() iOS 14.0 macOS 11.0 watchOS 7.0 tvOS 14.0

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

  • .speechAdjustedPitch() iOS 15.0 macOS 12.0 watchOS 8.0 tvOS 15.0

    Raises or lowers the pitch of spoken text.

  • .speechAlwaysIncludesPunctuation() iOS 15.0 macOS 12.0 watchOS 8.0 tvOS 15.0

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

  • .speechAnnouncementsQueued() iOS 15.0 macOS 12.0 watchOS 8.0 tvOS 15.0

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

  • .speechSpellsOutCharacters() iOS 15.0 macOS 12.0 watchOS 8.0 tvOS 15.0

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

Accessible Navigation

  • .accessibilityLinkedGroup() iOS 14.0 macOS 11.0 watchOS 7.0 tvOS 14.0

    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.

  • .accessibilityRotor() iOS 15.0 macOS 12.0 watchOS 8.0 tvOS 15.0

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

  • .accessibilityRotorEntry() iOS 15.0 macOS 12.0 watchOS 8.0 tvOS 15.0

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

  • .accessibilitySortPriority() iOS 14.0 macOS 11.0 watchOS 7.0 tvOS 14.0

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

Appearance Modifiers

  • .background() iOS 13.0 macOS 12.0 watchOS 6.0 tvOS 13.0

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

  • .backgroundStyle() iOS 16.0 macOS 13.0 watchOS 9.0 tvOS 16.0

    Sets the specified style to render backgrounds within the view.

  • .border() iOS 13.0 macOS 10.15 watchOS 6.0 tvOS 13.0

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

  • .buttonBorderShape() iOS 15.0 macOS 12.0 watchOS 8.0 tvOS 15.0

    Sets the border shape for buttons in this view.

  • .controlSize() iOS 15.0 macOS 10.15 watchOS 9.0

    Sets the size for controls within this view.

  • .defaultWheelPickerItemHeight() watchOS 6.0

    Sets the default wheel-style picker item height.

  • .foregroundColor() iOS 13.0 macOS 10.15 watchOS 6.0 tvOS 13.0

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

  • .foregroundStyle() iOS 15.0 macOS 12.0 watchOS 8.0 tvOS 15.0

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

  • .headerProminence() iOS 15.0 macOS 12.0 watchOS 8.0 tvOS 15.0

    Sets the header prominence for this view.

  • .hidden() iOS 13.0 macOS 10.15 watchOS 6.0 tvOS 13.0

    Hides this view unconditionally.

  • .horizontalRadioGroupLayout() macOS 10.15

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

  • .labelsHidden() iOS 13.0 macOS 10.15 watchOS 6.0 tvOS 13.0

    Hides the labels of any controls contained within this view.

  • .listItemTint() iOS 14.0 macOS 11.0 watchOS 7.0 tvOS 14.0

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

  • .listRowBackground() iOS 13.0 macOS 10.15 watchOS 6.0 tvOS 13.0

    Places a custom background view behind a list row item.

  • .listRowSeparator() iOS 15.0 macOS 13.0

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

  • .listRowSeparatorTint() iOS 15.0 macOS 13.0

    Sets the tint color associated with a row.

  • .listSectionSeparator() iOS 15.0 macOS 13.0

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

  • .listSectionSeparatorTint() iOS 15.0 macOS 13.0

    Sets the tint color associated with a section.

  • .menuIndicator() iOS 15.0 macOS 12.0

    Sets the menu indicator visibility for controls within this view.

  • .menuOrder() iOS 16.0 macOS 13.0 watchOS 9.0 tvOS 16.0

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

  • .overlay() iOS 13.0 macOS 12.0 watchOS 6.0 tvOS 13.0

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

  • .persistentSystemOverlays() iOS 16.0 macOS 13.0 watchOS 9.0 tvOS 16.0

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

  • .preferredColorScheme() iOS 13.0 macOS 11.0 watchOS 6.0 tvOS 13.0

    Sets the preferred color scheme for this presentation.

  • .privacySensitive() iOS 15.0 macOS 12.0 watchOS 8.0 tvOS 15.0

    Marks the view as containing sensitive, private user data.

  • .redacted() iOS 14.0 macOS 11.0 watchOS 7.0 tvOS 14.0

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

  • .scrollContentBackground() iOS 16.0 macOS 13.0 watchOS 9.0

    Specifies the visibility of the background for scrollable views within this view.

  • .scrollDisabled() iOS 16.0 macOS 13.0 watchOS 9.0 tvOS 16.0

    Disables or enables scrolling in scrollable views.

  • .scrollIndicators() iOS 16.0 macOS 13.0 watchOS 9.0 tvOS 16.0

    Sets the visibility of scroll indicators within this view.

  • .tint() iOS 15.0 macOS 12.0 watchOS 8.0 tvOS 15.0

    Sets the tint within this view.

  • .unredacted() iOS 14.0 macOS 11.0 watchOS 7.0 tvOS 14.0

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

Auxiliary View Modifiers

  • .badge() iOS 15.0 macOS 12.0

    Generates a badge for the view from a string.

  • .contextAction() iOS 16.0 macOS 13.0

    Adds an item-based context action to the view.

  • .contextMenu() iOS 13.0 macOS 13.0 watchOS 6.0 tvOS 14.0

    Adds a context menu with a preview to a view.

  • .help() iOS 14.0 macOS 11.0 watchOS 7.0 tvOS 14.0

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

  • .navigationBarBackButtonHidden() iOS 13.0 watchOS 6.0 tvOS 13.0

    Hides the navigation bar back button for the view.

  • .navigationBarTitleDisplayMode() iOS 14.0 watchOS 8.0

    Configures the title display mode for this view.

  • .navigationDestination() iOS 16.0 macOS 13.0 watchOS 9.0 tvOS 16.0

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

  • .navigationDocument() iOS 16.0 macOS 13.0 watchOS 9.0 tvOS 16.0

    Configures the view’s document for purposes of navigation.

  • .navigationSplitViewColumnWidth() iOS 16.0 macOS 13.0 watchOS 9.0 tvOS 16.0

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

  • .navigationSubtitle() macOS 11.0 Catalyst 14.0

    Configures the view’s subtitle for purposes of navigation.

  • .navigationTitle() iOS 14.0 macOS 11.0 watchOS 7.0 tvOS 14.0

    Configures the view’s title for purposes of navigation.

  • .statusBarHidden() iOS 13.0

    Sets the visibility of the status bar.

  • .tabItem() iOS 13.0 macOS 10.15 watchOS 7.0 tvOS 13.0

    Sets the tab bar item associated with this view.

  • .toolbar() iOS 14.0 macOS 11.0 watchOS 7.0 tvOS 14.0

    Populates the toolbar or navigation bar with the specified items.

  • .toolbarBackground() iOS 16.0 macOS 13.0 watchOS 9.0 tvOS 16.0

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

  • .toolbarColorScheme() iOS 16.0 macOS 13.0 watchOS 9.0 tvOS 16.0

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

  • .toolbarRole() iOS 16.0 macOS 13.0 watchOS 9.0 tvOS 16.0

    Configures the semantic role for the content populating the toolbar.

  • .toolbarTitleMenu() iOS 16.0 macOS 13.0 watchOS 9.0 tvOS 16.0

    Configure the title menu of a toolbar.

  • .touchBar() macOS 10.15

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

  • .touchBarCustomizationLabel() macOS 10.15

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

  • .touchBarItemPresence() macOS 10.15

    Sets the behavior of the user-customized view.

  • .touchBarItemPrincipal() macOS 10.15

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

Chart View Modifiers

  • .chartBackground() Charts iOS 16.0 macOS 13.0 watchOS 9.0 tvOS 16.0

    Adds a background to a view that contains a chart.

  • .chartForegroundStyleScale() Charts iOS 16.0 macOS 13.0 watchOS 9.0 tvOS 16.0

    Configures the foreground style scale for charts.

  • .chartLegend() Charts iOS 16.0 macOS 13.0 watchOS 9.0 tvOS 16.0

    Configures the legend for charts.

  • .chartLineStyleScale() Charts iOS 16.0 macOS 13.0 watchOS 9.0 tvOS 16.0

    Configures the line style scale for charts.

  • .chartOverlay() Charts iOS 16.0 macOS 13.0 watchOS 9.0 tvOS 16.0

    Adds an overlay to a view that contains a chart.

  • .chartPlotStyle() Charts iOS 16.0 macOS 13.0 watchOS 9.0 tvOS 16.0

    Configures the plot area of charts.

  • .chartSymbolScale() Charts iOS 16.0 macOS 13.0 watchOS 9.0 tvOS 16.0

    Configures the symbol scale for charts.

  • .chartSymbolSizeScale() Charts iOS 16.0 macOS 13.0 watchOS 9.0 tvOS 16.0

    Configures the symbol size scale for charts.

  • .chartXAxis() Charts iOS 16.0 macOS 13.0 watchOS 9.0 tvOS 16.0

    Sets the visibility of the x axis.

  • .chartXScale() Charts iOS 16.0 macOS 13.0 watchOS 9.0 tvOS 16.0

    Configures the X scale for charts.

  • .chartYAxis() Charts iOS 16.0 macOS 13.0 watchOS 9.0 tvOS 16.0

    Sets the visibility of the y axis.

  • .chartYScale() Charts iOS 16.0 macOS 13.0 watchOS 9.0 tvOS 16.0

    Configures the Y scale for charts.

Graphics and Rendering Modifiers

  • .animation() iOS 13.0 macOS 12.0 watchOS 6.0 tvOS 13.0

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

  • .aspectRatio() iOS 13.0 macOS 10.15 watchOS 6.0 tvOS 13.0

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

  • .blendMode() iOS 13.0 macOS 10.15 watchOS 6.0 tvOS 13.0

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

  • .blur() iOS 13.0 macOS 10.15 watchOS 6.0 tvOS 13.0

    Applies a Gaussian blur to this view.

  • .brightness() iOS 13.0 macOS 10.15 watchOS 6.0 tvOS 13.0

    Brightens this view by the specified amount.

  • .clipped() iOS 13.0 macOS 10.15 watchOS 6.0 tvOS 13.0

    Clips this view to its bounding rectangular frame.

  • .clipShape() iOS 13.0 macOS 10.15 watchOS 6.0 tvOS 13.0

    Sets a clipping shape for this view.

  • .colorInvert() iOS 13.0 macOS 10.15 watchOS 6.0 tvOS 13.0

    Inverts the colors in this view.

  • .colorMultiply() iOS 13.0 macOS 10.15 watchOS 6.0 tvOS 13.0

    Adds a color multiplication effect to this view.

  • .compositingGroup() iOS 13.0 macOS 10.15 watchOS 6.0 tvOS 13.0

    Wraps this view in a compositing group.

  • .containerShape() iOS 15.0 macOS 12.0 watchOS 8.0 tvOS 15.0

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

  • .contentTransition() iOS 16.0 macOS 13.0 watchOS 9.0 tvOS 16.0

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

  • .contrast() iOS 13.0 macOS 10.15 watchOS 6.0 tvOS 13.0

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

  • .cornerRadius() iOS 13.0 macOS 10.15 watchOS 6.0 tvOS 13.0

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

  • .drawingGroup() iOS 13.0 macOS 10.15 watchOS 6.0 tvOS 13.0

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

  • .grayscale() iOS 13.0 macOS 10.15 watchOS 6.0 tvOS 13.0

    Adds a grayscale effect to this view.

  • .hueRotation() iOS 13.0 macOS 10.15 watchOS 6.0 tvOS 13.0

    Applies a hue rotation effect to this view.

  • .imageScale() iOS 13.0 macOS 11.0 watchOS 6.0 tvOS 13.0

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

  • .luminanceToAlpha() iOS 13.0 macOS 10.15 watchOS 6.0 tvOS 13.0

    Adds a luminance to alpha effect to this view.

  • .mask() iOS 13.0 macOS 12.0 watchOS 6.0 tvOS 13.0

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

  • .matchedGeometryEffect() iOS 14.0 macOS 11.0 watchOS 7.0 tvOS 14.0

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

  • .opacity() iOS 13.0 macOS 10.15 watchOS 6.0 tvOS 13.0

    Sets the transparency of this view.

  • .projectionEffect() iOS 13.0 macOS 10.15 watchOS 6.0 tvOS 13.0

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

  • .rotation3DEffect() iOS 13.0 macOS 10.15 watchOS 6.0 tvOS 13.0

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

  • .rotationEffect() iOS 13.0 macOS 10.15 watchOS 6.0 tvOS 13.0

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

  • .saturation() iOS 13.0 macOS 10.15 watchOS 6.0 tvOS 13.0

    Adjusts the color saturation of this view.

  • .scaledToFill() iOS 13.0 macOS 10.15 watchOS 6.0 tvOS 13.0

    Scales this view to fill its parent.

  • .scaledToFit() iOS 13.0 macOS 10.15 watchOS 6.0 tvOS 13.0

    Scales this view to fit its parent.

  • .scaleEffect() iOS 13.0 macOS 10.15 watchOS 6.0 tvOS 13.0

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

  • .shadow() iOS 13.0 macOS 10.15 watchOS 6.0 tvOS 13.0

    Adds a shadow to this view.

  • .transaction() iOS 13.0 macOS 10.15 watchOS 6.0 tvOS 13.0

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

  • .transformEffect() iOS 13.0 macOS 10.15 watchOS 6.0 tvOS 13.0

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

  • .transition() iOS 13.0 macOS 10.15 watchOS 6.0 tvOS 13.0

    Associates a transition with the view.

Input and Event Modifiers

  • .allowsHitTesting() iOS 13.0 macOS 10.15 watchOS 6.0 tvOS 13.0

    Configures whether this view participates in hit test operations.

  • .contentShape() iOS 13.0 macOS 12.0 watchOS 6.0 tvOS 13.0

    Defines the content shape for hit testing.

  • .copyable() macOS 13.0

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

  • .cuttable() macOS 13.0

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

  • .defaultFocus() iOS 16.0 macOS 13.0 watchOS 9.0 tvOS 16.0

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

  • .defersSystemGestures() iOS 16.0

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

  • .deleteDisabled() iOS 13.0 macOS 10.15 watchOS 6.0 tvOS 13.0

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

  • .digitalCrownAccessory() watchOS 9.0

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

  • .digitalCrownRotation() watchOS 6.0

    Tracks Digital Crown rotations by updating the specified binding.

  • .disabled() iOS 13.0 macOS 10.15 watchOS 6.0 tvOS 13.0

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

  • .draggable() iOS 16.0 macOS 13.0

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

  • .dropDestination() iOS 16.0 macOS 13.0

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

  • .exportableToServices() macOS 13.0

    Exports items for consumption by shortcuts, quick actions, and services.

  • .exportsItemProviders() macOS 12.0

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

  • .focusable() macOS 12.0 watchOS 6.0 tvOS 13.0

    Specifies if the view is focusable.

  • .focused() iOS 15.0 macOS 12.0 watchOS 8.0 tvOS 15.0

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

  • .focusedObject() iOS 16.0 macOS 13.0 watchOS 9.0 tvOS 16.0

    Creates a new view that exposes the provided object to other views whose state depends on the focused view hierarchy.

  • .focusedSceneObject() iOS 16.0 macOS 13.0 watchOS 9.0 tvOS 16.0

    Creates a new view that exposes the provided object to other views whose whose state depends on the active scene.

  • .focusedSceneValue() iOS 15.0 macOS 12.0 watchOS 8.0 tvOS 15.0

    Creates a new view that exposes the provided value to other views whose state depends on the active scene.

  • .focusedValue() iOS 14.0 macOS 11.0 watchOS 7.0 tvOS 14.0

    Creates a new view that exposes the provided value to other views whose state depends on the focused view hierarchy.

  • .focusScope() macOS 12.0 watchOS 7.0 tvOS 14.0

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

  • .focusSection() macOS 13.0 tvOS 15.0

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

  • .gesture() iOS 13.0 macOS 10.15 watchOS 6.0 tvOS 13.0

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

  • .handlesExternalEvents() iOS 14.0 macOS 11.0

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

  • .highPriorityGesture() iOS 13.0 macOS 10.15 watchOS 6.0 tvOS 13.0

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

  • .hoverEffect() iOS 13.4 tvOS 16.0

    Applies a pointer hover effect to the view.

  • .importableFromServices() macOS 13.0

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

  • .importsItemProviders() macOS 12.0

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

  • .interactionActivityTrackingTag() iOS 16.0 macOS 13.0 watchOS 9.0 tvOS 16.0

    Sets a tag that you use for tracking interactivity.

  • .itemProvider() iOS 13.0 macOS 10.15 watchOS 6.0 tvOS 13.0

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

  • .keyboardShortcut() iOS 14.0 macOS 11.0

    Assigns a keyboard shortcut to the modified control.

  • .moveDisabled() iOS 13.0 macOS 10.15 watchOS 6.0 tvOS 13.0

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

  • .onAppear() iOS 13.0 macOS 10.15 watchOS 6.0 tvOS 13.0

    Adds an action to perform before this view appears.

  • .onChange() iOS 14.0 macOS 11.0 watchOS 7.0 tvOS 14.0

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

  • .onCommand() macOS 10.15

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

  • .onContinueUserActivity() iOS 14.0 macOS 11.0 watchOS 7.0 tvOS 14.0

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

  • .onContinuousHover() iOS 16.0 macOS 13.0 tvOS 16.0

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

  • .onCopyCommand() macOS 10.15

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

  • .onCutCommand() macOS 10.15

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

  • .onDeleteCommand() macOS 10.15

    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 13.0 macOS 10.15 watchOS 6.0 tvOS 13.0

    Adds an action to perform after this view disappears.

  • .onDrag() iOS 15.0 macOS 12.0

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

  • .onDrop() iOS 14.0 macOS 11.0

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

  • .onExitCommand() macOS 10.15 tvOS 13.0

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

  • .onHover() iOS 13.4 macOS 10.15

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

  • .onLongPressGesture() iOS 13.0 macOS 10.15 watchOS 6.0 tvOS 14.0

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

  • .onLongTouchGesture() tvOS 16.0

    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.

  • .onMoveCommand() macOS 10.15 tvOS 13.0

    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.

  • .onOpenURL() iOS 14.0 macOS 11.0 watchOS 7.0 tvOS 14.0

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

  • .onPasteCommand() macOS 11.0

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

  • .onPlayPauseCommand() tvOS 13.0

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

  • .onReceive() iOS 13.0 macOS 10.15 watchOS 6.0 tvOS 13.0

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

  • .onSubmit() iOS 15.0 macOS 12.0 watchOS 8.0 tvOS 15.0

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

  • .onTapGesture() iOS 13.0 macOS 13.0 watchOS 6.0 tvOS 16.0

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

  • .pageCommand() tvOS 14.3

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

  • .pasteDestination() macOS 13.0

    Adds an action to perform in response to the system’s Paste command with items that you validate.

  • .prefersDefaultFocus() macOS 12.0 watchOS 7.0 tvOS 14.0

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

  • .refreshable() iOS 15.0 macOS 12.0 watchOS 8.0 tvOS 15.0

    Marks this view as refreshable.

  • .renameAction() iOS 16.0 macOS 13.0 watchOS 9.0 tvOS 16.0

    Sets a closure to run for the rename action.

  • .simultaneousGesture() iOS 13.0 macOS 10.15 watchOS 6.0 tvOS 13.0

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

  • .submitLabel() iOS 15.0 macOS 12.0 watchOS 8.0 tvOS 15.0

    Sets the submit label for this view.

  • .submitScope() iOS 15.0 macOS 12.0 watchOS 8.0 tvOS 15.0

    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 15.0 macOS 12.0 watchOS 8.0

    Adds custom swipe actions to a row in a list.

  • .task() iOS 15.0 macOS 12.0 watchOS 8.0 tvOS 15.0

    Adds an asynchronous task to perform before this view appears.

  • .userActivity() iOS 14.0 macOS 11.0 watchOS 7.0 tvOS 14.0

    Advertises a user activity type.

Integrating Other Frameworks

  • .activityBackgroundTint() WidgetKit iOS 16.0

    The tint color for the activity background while in the activity list. If setting a background tint color, consider activitySystemActionForegroundColor for any actions that may appear over that context.

  • .activitySystemActionForegroundColor() WidgetKit iOS 16.0

    The text color for auxilliary action buttons provided by the system.

  • .appStoreOverlay() StoreKit iOS 14.0

    Presents a StoreKit overlay when a given condition is true.

  • .familyActivityPicker() FamilyControls iOS 15.0

    Presents an activity picker view as a sheet.

  • .manageSubscriptionsSheet() StoreKit iOS 15.0

  • .musicSubscriptionOffer() MusicKit iOS 15.0 macOS 12.0

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

  • .offerCodeRedemption() StoreKit iOS 16.0

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

  • .quickLookPreview() QuickLook iOS 14.0 macOS 11.0

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

  • .refundRequestSheet() StoreKit iOS 15.0

  • .shortcutsLinkStyle() AppIntents iOS 16.0 macOS 13.0 watchOS 9.0 tvOS 16.0

    Sets the given style for ShortcutsLinks within the view hierarchy

  • .siriTipViewStyle() AppIntents iOS 16.0 macOS 13.0 watchOS 9.0 tvOS 16.0

    Sets the given style for SiriTipView within the view hierarchy

  • .widgetAccentable() WidgetKit iOS 16.0 macOS 13.0 watchOS 9.0

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

  • .widgetLabel() WidgetKit iOS 16.0 watchOS 9.0

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

  • .widgetURL() WidgetKit iOS 14.0 macOS 11.0 watchOS 9.0

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

Layout Modifiers

  • .alignmentGuide() iOS 13.0 macOS 10.15 watchOS 6.0 tvOS 13.0

    Sets the view’s vertical alignment.

  • .coordinateSpace() iOS 13.0 macOS 10.15 watchOS 6.0 tvOS 13.0

    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.

  • .fixedSize() iOS 13.0 macOS 10.15 watchOS 6.0 tvOS 13.0

    Fixes this view at its ideal size.

  • .frame() iOS 13.0 macOS 10.15 watchOS 6.0 tvOS 13.0

    Positions this view within an invisible frame.

  • .gridCellAnchor() iOS 16.0 macOS 13.0 watchOS 9.0 tvOS 16.0

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

  • .gridCellColumns() iOS 16.0 macOS 13.0 watchOS 9.0 tvOS 16.0

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

  • .gridCellUnsizedAxes() iOS 16.0 macOS 13.0 watchOS 9.0 tvOS 16.0

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

  • .gridColumnAlignment() iOS 16.0 macOS 13.0 watchOS 9.0 tvOS 16.0

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

  • .ignoresSafeArea() iOS 14.0 macOS 11.0 watchOS 7.0 tvOS 14.0

    Expands the view out of its safe area.

  • .layoutPriority() iOS 13.0 macOS 10.15 watchOS 6.0 tvOS 13.0

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

  • .layoutValue() iOS 16.0 macOS 13.0 watchOS 9.0 tvOS 16.0

    Associates a value with a custom layout property.

  • .listRowInsets() iOS 13.0 macOS 10.15 watchOS 6.0 tvOS 13.0

    Applies an inset to the rows in a list.

  • .offset() iOS 13.0 macOS 10.15 watchOS 6.0 tvOS 13.0

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

  • .padding() iOS 13.0 macOS 10.15 watchOS 6.0 tvOS 13.0

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

  • .position() iOS 13.0 macOS 10.15 watchOS 6.0 tvOS 13.0

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

  • .safeAreaInset() iOS 15.0 macOS 12.0 watchOS 8.0 tvOS 15.0

    Shows the specified content beside the modified view.

  • .scenePadding() iOS 15.0 macOS 12.0 watchOS 8.0 tvOS 15.0

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

  • .zIndex() iOS 13.0 macOS 10.15 watchOS 6.0 tvOS 13.0

    Controls the display order of overlapping views.

Presentation Modifiers

  • .alert() iOS 13.0 macOS 12.0 watchOS 6.0 tvOS 13.0

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

  • .confirmationDialog() iOS 15.0 macOS 12.0 watchOS 8.0 tvOS 15.0

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

  • .fileExporter() iOS 14.0 macOS 11.0

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

  • .fileImporter() iOS 14.0 macOS 11.0

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

  • .fileMover() iOS 14.0 macOS 11.0

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

  • .fullScreenCover() iOS 14.0 watchOS 7.0 tvOS 14.0

    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.

  • .interactiveDismissDisabled() iOS 15.0 macOS 12.0 watchOS 8.0 tvOS 15.0

    Conditionally prevents interactive dismissal of a popover or a sheet.

  • .popover() iOS 13.0 macOS 10.15

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

  • .presentationDetents() iOS 16.0 macOS 13.0 watchOS 9.0 tvOS 16.0

    Sets the available detents for the enclosing sheet.

  • .presentationDragIndicator() iOS 16.0 macOS 13.0 watchOS 9.0 tvOS 16.0

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

  • .sheet() iOS 13.0 macOS 10.15 watchOS 6.0 tvOS 13.0

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

Previews in Xcode

  • .previewContext() iOS 14.0 macOS 11.0 watchOS 7.0 tvOS 14.0

    Declares a context for the preview.

  • .previewDevice() iOS 13.0 macOS 10.15 watchOS 6.0 tvOS 13.0

    Overrides the device for a preview.

  • .previewDisplayName() iOS 13.0 macOS 10.15 watchOS 6.0 tvOS 13.0

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

  • .previewInterfaceOrientation() iOS 15.0 macOS 12.0 watchOS 8.0 tvOS 15.0

    Overrides the orientation of the preview.

  • .previewLayout() iOS 13.0 macOS 10.15 watchOS 6.0 tvOS 13.0

    Overrides the size of the container for the preview.

Search Modifiers

  • .searchable() iOS 15.0 macOS 12.0 watchOS 8.0 tvOS 15.0

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

  • .searchCompletion() iOS 15.0 macOS 12.0 watchOS 8.0 tvOS 15.0

    Associates a search token with the value of this view.

  • .searchScopes() iOS 16.0 macOS 13.0

    Configures the search scopes for this view.

  • .searchSuggestions() iOS 16.0 macOS 13.0 watchOS 9.0 tvOS 16.0

    Configures the search suggestions for this view.

State Modifiers

  • .anchorPreference() iOS 13.0 macOS 10.15 watchOS 6.0 tvOS 13.0

    Sets a value for the specified preference key, the value is a function of a geometry value tied to the current coordinate space, allowing readers of the value to convert the geometry to their local coordinates.

  • .backgroundPreferenceValue() iOS 13.0 macOS 13.0 watchOS 6.0 tvOS 13.0

    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.

  • .defaultAppStorage() iOS 14.0 macOS 11.0 watchOS 7.0 tvOS 14.0

    The default store used by AppStorage contained within the view.

  • .environment() iOS 13.0 macOS 10.15 watchOS 6.0 tvOS 13.0

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

  • .environmentObject() iOS 13.0 macOS 10.15 watchOS 6.0 tvOS 13.0

    Supplies an ObservableObject to a view subhierarchy.

  • .id() iOS 13.0 macOS 10.15 watchOS 6.0 tvOS 13.0

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

  • .onPreferenceChange() iOS 13.0 macOS 10.15 watchOS 6.0 tvOS 13.0

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

  • .overlayPreferenceValue() iOS 13.0 macOS 13.0 watchOS 6.0 tvOS 13.0

    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.

  • .preference() iOS 13.0 macOS 10.15 watchOS 6.0 tvOS 13.0

    Sets a value for the given preference.

  • .tag() iOS 13.0 macOS 10.15 watchOS 6.0 tvOS 13.0

    Sets the unique tag value of this view.

  • .transformAnchorPreference() iOS 13.0 macOS 10.15 watchOS 6.0 tvOS 13.0

    Sets a value for the specified preference key, the value is a function of the key’s current value and a geometry value tied to the current coordinate space, allowing readers of the value to convert the geometry to their local coordinates.

  • .transformEnvironment() iOS 13.0 macOS 10.15 watchOS 6.0 tvOS 13.0

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

  • .transformPreference() iOS 13.0 macOS 10.15 watchOS 6.0 tvOS 13.0

    Applies a transformation to a preference value.

Style Modifiers

  • .buttonStyle() iOS 13.0 macOS 10.15 watchOS 6.0 tvOS 13.0

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

  • .controlGroupStyle() iOS 15.0 macOS 12.0

    Sets the style for control groups within this view.

  • .datePickerStyle() iOS 13.0 macOS 10.15

    Sets the style for date pickers within this view.

  • .disclosureGroupStyle() iOS 16.0 macOS 13.0

    Sets the style for disclosure groups within this view.

  • .gaugeStyle() iOS 16.0 macOS 13.0 watchOS 7.0

    Sets the style for gauges within this view.

  • .groupBoxStyle() iOS 14.0 macOS 11.0

    Sets the style for group boxes within this view.

  • .indexViewStyle() iOS 14.0 watchOS 8.0 tvOS 14.0

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

  • .labelStyle() iOS 14.0 macOS 11.0 watchOS 7.0 tvOS 14.0

    Sets the style for labels within this view.

  • .listStyle() iOS 13.0 macOS 10.15 watchOS 6.0 tvOS 13.0

    Sets the style for lists within this view.

  • .menuStyle() iOS 14.0 macOS 11.0

    Sets the style for menus within this view.

  • .navigationSplitViewStyle() iOS 16.0 macOS 13.0 watchOS 9.0 tvOS 16.0

    Sets the style for navigation split views within this view.

  • .pickerStyle() iOS 13.0 macOS 10.15 watchOS 6.0 tvOS 13.0

    Sets the style for pickers within this view.

  • .presentedWindowStyle() macOS 11.0

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

  • .presentedWindowToolbarStyle() macOS 11.0

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

  • .progressViewStyle() iOS 14.0 macOS 11.0 watchOS 7.0 tvOS 14.0

    Sets the style for progress views in this view.

  • .tableStyle() iOS 16.0 macOS 12.0

    Sets the style for tables within this view.

  • .tabViewStyle() iOS 14.0 macOS 11.0 watchOS 7.0 tvOS 14.0

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

  • .textFieldStyle() iOS 13.0 macOS 10.15 watchOS 6.0 tvOS 13.0

    Sets the style for text fields within this view.

  • .toggleStyle() iOS 13.0 macOS 10.15 watchOS 6.0 tvOS 13.0

    Sets the style for toggles in a view hierarchy.

Text and Symbol Modifiers

  • .allowsTightening() iOS 13.0 macOS 10.15 watchOS 6.0 tvOS 13.0

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

  • .autocorrectionDisabled() iOS 13.0 macOS 10.15 watchOS 8.0 tvOS 13.0

    Sets whether to disable autocorrection for this view.

  • .baselineOffset() iOS 16.0 macOS 13.0 watchOS 9.0 tvOS 16.0

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

  • .bold() iOS 16.0 macOS 13.0 watchOS 9.0 tvOS 16.0

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

  • .dynamicTypeSize() iOS 15.0 macOS 12.0 watchOS 8.0 tvOS 15.0

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

  • .findDisabled() iOS 16.0

    Prevents find and replace operations in a text editor.

  • .findNavigator() iOS 16.0

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

  • .flipsForRightToLeftLayoutDirection() iOS 13.0 macOS 10.15 watchOS 6.0 tvOS 13.0

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

  • .font() iOS 13.0 macOS 10.15 watchOS 6.0 tvOS 13.0

    Sets the default font for text in this view.

  • .fontWeight() iOS 16.0 macOS 13.0 watchOS 9.0 tvOS 16.0

    Sets the font weight of the text in this view.

  • .italic() iOS 16.0 macOS 13.0 watchOS 9.0 tvOS 16.0

    Applies italics to the text in this view.

  • .kerning() iOS 16.0 macOS 13.0 watchOS 9.0 tvOS 16.0

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

  • .keyboardType() iOS 13.0 tvOS 13.0

    Sets the keyboard type for this view.

  • .lineLimit() iOS 13.0 macOS 13.0 watchOS 6.0 tvOS 13.0

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

  • .lineSpacing() iOS 13.0 macOS 10.15 watchOS 6.0 tvOS 13.0

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

  • .minimumScaleFactor() iOS 13.0 macOS 10.15 watchOS 6.0 tvOS 13.0

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

  • .monospaced() iOS 16.0 macOS 13.0 watchOS 9.0 tvOS 16.0

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

  • .monospacedDigit() iOS 15.0 macOS 12.0 watchOS 8.0 tvOS 15.0

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

  • .multilineTextAlignment() iOS 13.0 macOS 10.15 watchOS 6.0 tvOS 13.0

    Sets the alignment of multiline text in this view.

  • .replaceDisabled() iOS 16.0

    Prevents replace operations in a text editor.

  • .scrollDismissesKeyboard() iOS 16.0 macOS 13.0 watchOS 9.0 tvOS 16.0

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

  • .strikethrough() iOS 16.0 macOS 13.0 watchOS 9.0 tvOS 16.0

    Applies a strikethrough to the text in this view.

  • .symbolRenderingMode() iOS 15.0 macOS 12.0 watchOS 8.0 tvOS 15.0

    Sets the rendering mode for symbol images within this view.

  • .symbolVariant() iOS 15.0 macOS 12.0 watchOS 8.0 tvOS 15.0

    Makes symbols within the view show a particular variant.

  • .textCase() iOS 14.0 macOS 11.0 watchOS 7.0 tvOS 14.0

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

  • .textContentType() iOS 13.0 macOS 11.0 watchOS 6.0 tvOS 13.0

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

  • .textInputAutocapitalization() iOS 15.0 watchOS 8.0 tvOS 15.0

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

  • .textSelection() iOS 15.0 macOS 12.0

    Controls whether people can select text within this view.

  • .tracking() iOS 16.0 macOS 13.0 watchOS 9.0 tvOS 16.0

    Sets the tracking for the text in this view.

  • .truncationMode() iOS 13.0 macOS 10.15 watchOS 6.0 tvOS 13.0

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

  • .underline() iOS 16.0 macOS 13.0 watchOS 9.0 tvOS 16.0

    Applies an underline to the text in this view.

View Fundamentals

  • .modifier() iOS 13.0 macOS 10.15 watchOS 6.0 tvOS 13.0

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

Deprecated Modifiers

  • .accentColor() Deprecated iOS 13.0 macOS 10.15 watchOS 6.0 tvOS 13.0

    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 13.0 macOS 10.15 watchOS 6.0 tvOS 13.0

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

    → Use accessibilityHint(_:) instead.

  • .actionSheet() Deprecated iOS 13.0 watchOS 6.0 tvOS 13.0

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

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

  • .autocapitalization() Deprecated iOS 13.0 tvOS 13.0

    Sets whether to apply auto-capitalization to this view.

    → Use textInputAutocapitalization(_:) instead.

  • .colorScheme() Deprecated iOS 13.0 macOS 10.15 watchOS 6.0 tvOS 13.0

    Sets this view’s color scheme.

    → Use preferredColorScheme(_:) instead.

  • .disableAutocorrection() Deprecated iOS 13.0 macOS 10.15 watchOS 8.0 tvOS 13.0

    Sets whether to disable autocorrection for this view.

    → Use autocorrectionDisabled(_:) instead.

  • .edgesIgnoringSafeArea() Deprecated iOS 13.0 macOS 10.15 watchOS 6.0 tvOS 13.0

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

    → Use ignoresSafeArea(_:edges:) instead.

  • .listRowPlatterColor() Deprecated watchOS 6.0

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

    → Use listItemTint(_:) instead.

  • .menuButtonStyle() Deprecated macOS 10.15

    Sets the style for menu buttons within this view.

    → Use menuStyle(_:) instead.

  • .navigationBarHidden() Deprecated iOS 13.0 watchOS 6.0 tvOS 13.0

    Hides the navigation bar for this view.

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

  • .navigationBarItems() Deprecated iOS 13.0 tvOS 13.0

    Sets the navigation bar items for this view.

    → Use toolbar(content:) with navigationBarLeading placement.

  • .navigationBarTitle() Deprecated iOS 13.0 watchOS 6.0 tvOS 13.0

    Sets the title in the navigation bar for this view.

    → Use navigationTitle(_:) instead.

  • .navigationViewStyle() Deprecated iOS 13.0 macOS 10.15 watchOS 7.0 tvOS 13.0

    Sets the style for navigation views within this view.

    → Replace a styled NavigationView with a NavigationStack or NavigationSplitView.

  • .statusBar() Deprecated iOS 13.0

    Sets the visibility of the status bar.

    → Use statusBarHidden(_:) instead.

Scene Modifiers

  • .backgroundTask() iOS 16.0 macOS 13.0 watchOS 9.0 tvOS 16.0

    Runs the specified action when the system provides a background task.

  • .commands() iOS 14.0 macOS 11.0

    Adds commands to the scene.

  • .commandsRemoved() iOS 16.0 macOS 13.0

    Removes all commands defined by the modified scene.

  • .commandsReplaced() iOS 16.0 macOS 13.0

    Replaces all commands defined by the modified scene with the commands from the builder.

  • .defaultAppStorage() iOS 14.0 macOS 11.0 watchOS 7.0 tvOS 14.0

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

  • .defaultPosition() macOS 13.0

    Defines the default position of self.

  • .defaultSize() macOS 13.0

    Defines the default size of self.

  • .handlesExternalEvents() iOS 14.0 macOS 11.0

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

  • .keyboardShortcut() macOS 13.0

    Defines a keyboard shortcut for opening new scene windows.

  • .onChange() iOS 14.0 macOS 11.0 watchOS 7.0 tvOS 14.0

    Adds an action to perform when the given value changes.

  • .windowResizability() macOS 13.0

    Sets the desired window resizability for self.

  • .windowStyle() macOS 11.0

    Sets the style for windows created by this scene.

  • .windowToolbarStyle() macOS 11.0

    Sets the style for the toolbar defined within this scene.

Environment Values

  • \.accessibilityDifferentiateWithoutColor iOS 13.0 macOS 10.15 watchOS 6.0 tvOS 13.0

    Whether the system preference for Differentiate without Color is enabled.

  • \.accessibilityEnabled iOS 13.0 macOS 10.15 watchOS 6.0 tvOS 13.0

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

  • \.accessibilityInvertColors iOS 13.0 macOS 10.15 watchOS 6.0 tvOS 13.0

    Whether the system preference for Invert Colors is enabled.

  • \.accessibilityLargeContentViewerEnabled iOS 15.0 macOS 12.0 watchOS 8.0 tvOS 15.0

    Whether the Large Content Viewer is enabled.

  • \.accessibilityQuickActionsEnabled iOS 16.0 macOS 13.0 watchOS 9.0 tvOS 16.0

    A Boolean that indicates whether the quick actions feature is enabled.

  • \.accessibilityReduceMotion iOS 13.0 macOS 10.15 watchOS 6.0 tvOS 13.0

    Whether the system preference for Reduce Motion is enabled.

  • \.accessibilityReduceTransparency iOS 13.0 macOS 10.15 watchOS 6.0 tvOS 13.0

    Whether the system preference for Reduce Transparency is enabled.

  • \.accessibilityShowButtonShapes iOS 14.0 macOS 11.0 watchOS 7.0 tvOS 14.0

    Whether the system preference for Show Button Shapes is enabled.

  • \.accessibilitySwitchControlEnabled iOS 15.0 macOS 12.0 watchOS 8.0 tvOS 15.0

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

  • \.accessibilityVoiceOverEnabled iOS 15.0 macOS 12.0 watchOS 8.0 tvOS 15.0

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

  • \.allowsTightening iOS 13.0 macOS 10.15 watchOS 6.0 tvOS 13.0

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

  • \.autocorrectionDisabled iOS 13.0 macOS 10.15 watchOS 8.0 tvOS 13.0

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

  • \.backgroundMaterial iOS 15.0 macOS 12.0 watchOS 8.0 tvOS 15.0

    The material underneath the current view.

  • \.backgroundStyle iOS 16.0 macOS 13.0 watchOS 9.0 tvOS 16.0

    An optional style that overrides the default system background style when set.

  • \.calendar iOS 13.0 macOS 10.15 watchOS 6.0 tvOS 13.0

    The current calendar that views should use when handling dates.

  • \.colorScheme iOS 13.0 macOS 10.15 watchOS 6.0 tvOS 13.0

    The color scheme of this environment.

  • \.colorSchemeContrast iOS 13.0 macOS 10.15 watchOS 6.0 tvOS 13.0

    The contrast associated with the color scheme of this environment.

  • \.contentTransition iOS 16.0 macOS 13.0 watchOS 9.0 tvOS 16.0

    The current method of animating the contents of views.

  • \.contentTransitionAddsDrawingGroup iOS 16.0 macOS 13.0 watchOS 9.0 tvOS 16.0

    A Boolean value that controls whether views that render content transitions use GPU-accelerated rendering.

  • \.controlActiveState macOS 10.15

    The active state of controls in the view.

  • \.controlSize iOS 15.0 macOS 10.15 watchOS 9.0

    The size to apply to controls within a view.

  • \.defaultMinListHeaderHeight iOS 13.0 macOS 10.15 watchOS 6.0 tvOS 13.0

    The default minimum height of a header in a list.

  • \.defaultMinListRowHeight iOS 13.0 macOS 10.15 watchOS 6.0 tvOS 13.0

    The default minimum height of a row in a list.

  • \.defaultWheelPickerItemHeight watchOS 6.0

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

  • \.description iOS 13.0 macOS 10.15 watchOS 6.0 tvOS 13.0

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

  • \.disableAutocorrection Deprecated iOS 13.0 macOS 10.15 watchOS 8.0 tvOS 13.0

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

  • \.dismiss iOS 15.0 macOS 12.0 watchOS 8.0 tvOS 15.0

    An action that dismisses the current presentation.

  • \.dismissSearch iOS 15.0 macOS 12.0 watchOS 8.0 tvOS 15.0

    An action that ends the current search interaction.

  • \.displayScale iOS 13.0 macOS 10.15 watchOS 6.0 tvOS 13.0

    The display scale of this environment.

  • \.displayStoreKitMessage StoreKit iOS 16.0

  • \.dynamicTypeSize iOS 15.0 macOS 12.0 watchOS 8.0 tvOS 15.0

    The current Dynamic Type size.

  • \.editMode iOS 13.0 tvOS 13.0

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

  • \.font iOS 13.0 macOS 10.15 watchOS 6.0 tvOS 13.0

    The default font of this environment.

  • \.headerProminence iOS 15.0 macOS 12.0 watchOS 8.0 tvOS 15.0

    The prominence to apply to section headers within a view.

  • \.horizontalScrollIndicatorVisibility iOS 16.0 macOS 13.0 watchOS 9.0 tvOS 16.0

    The visibility to apply to scroll indicators of any horizontally scrollable content.

  • \.horizontalSizeClass iOS 13.0

    The horizontal size class of this environment.

  • \.imageScale iOS 13.0 macOS 11.0 watchOS 6.0 tvOS 13.0

    The image scale for this environment.

  • \.isEnabled iOS 13.0 macOS 10.15 watchOS 6.0 tvOS 13.0

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

  • \.isFocused iOS 14.0 macOS 11.0 watchOS 7.0 tvOS 14.0

    Returns whether the nearest focusable ancestor has focus.

  • \.isLuminanceReduced watchOS 8.0

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

  • \.isPresented iOS 15.0 macOS 12.0 watchOS 8.0 tvOS 15.0

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

  • \.isScrollEnabled iOS 16.0 macOS 13.0 watchOS 9.0 tvOS 16.0

    A Boolean value that indicates whether any scroll views associated with this environment allow scrolling to occur.

  • \.isSearching iOS 15.0 macOS 12.0 watchOS 8.0 tvOS 15.0

    A Boolean value that indicates when the user is searching.

  • \.keyboardShortcut iOS 15.0 macOS 12.0

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

  • \.layoutDirection iOS 13.0 macOS 10.15 watchOS 6.0 tvOS 13.0

    The layout direction associated with the current environment.

  • \.legibilityWeight iOS 13.0 macOS 10.15 watchOS 6.0 tvOS 13.0

    The font weight to apply to text.

  • \.lineLimit iOS 13.0 macOS 10.15 watchOS 6.0 tvOS 13.0

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

  • \.lineSpacing iOS 13.0 macOS 10.15 watchOS 6.0 tvOS 13.0

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

  • \.locale iOS 13.0 macOS 10.15 watchOS 6.0 tvOS 13.0

    The current locale that views should use.

  • \.managedObjectContext iOS 13.0 macOS 10.15 watchOS 6.0 tvOS 13.0

  • \.menuIndicatorVisibility iOS 15.0 macOS 12.0

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

  • \.menuOrder iOS 16.0 macOS 13.0 watchOS 9.0 tvOS 16.0

    The preferred order of items for menus presented from this view.

  • \.minimumScaleFactor iOS 13.0 macOS 10.15 watchOS 6.0 tvOS 13.0

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

  • \.multilineTextAlignment iOS 13.0 macOS 10.15 watchOS 6.0 tvOS 13.0

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

  • \.newDocument macOS 13.0

    An action that presents a new document.

  • \.openDocument macOS 13.0

    An action that presents an existing document.

  • \.openURL iOS 14.0 macOS 11.0 watchOS 7.0 tvOS 14.0

    An action that opens a URL.

  • \.openWindow iOS 16.0 macOS 13.0

    An action that presents a window.

  • \.pixelLength iOS 13.0 macOS 10.15 watchOS 6.0 tvOS 13.0

    The size of a pixel on the screen.

  • \.presentationMode Deprecated iOS 13.0 macOS 10.15 watchOS 6.0 tvOS 13.0

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

    → Use isPresented or dismiss instead.

  • \.redactionReasons iOS 14.0 macOS 11.0 watchOS 7.0 tvOS 14.0

    The current redaction reasons applied to the view hierarchy.

  • \.refresh iOS 15.0 macOS 12.0 watchOS 8.0 tvOS 15.0

    A refresh action stored in a view’s environment.

  • \.rename iOS 16.0 macOS 13.0 watchOS 9.0 tvOS 16.0

    An action that activates the standard rename interaction.

  • \.requestReview StoreKit iOS 16.0 macOS 13.0

  • \.resetFocus macOS 12.0 watchOS 7.0 tvOS 14.0

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

  • \.scenePhase iOS 14.0 macOS 11.0 watchOS 7.0 tvOS 14.0

    The current phase of the scene.

  • \.scrollDismissesKeyboardMode iOS 16.0 macOS 13.0 watchOS 9.0 tvOS 16.0

    The way that scrollable content interacts with the software keyboard.

  • \.searchSuggestionsPlacement iOS 16.0 macOS 13.0 watchOS 9.0 tvOS 16.0

    The current placement of search suggestions.

  • \.showsWidgetLabel WidgetKit iOS 16.0 watchOS 9.0

    A Boolean value that indicates whether an accessory family widget can display an accessory label.

  • \.sizeCategory Deprecated iOS 13.0 macOS 10.15 watchOS 6.0 tvOS 13.0

    The size of content.

    → Use dynamicTypeSize instead.

  • \.supportsMultipleWindows iOS 16.0 macOS 13.0 watchOS 9.0 tvOS 16.0

    A Boolean that indicates whether the current platform supports opening multiple windows.

  • \.symbolRenderingMode iOS 15.0 macOS 12.0 watchOS 8.0 tvOS 15.0

    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 15.0 macOS 12.0 watchOS 8.0 tvOS 15.0

    The symbol variant to use in this environment.

  • \.textCase iOS 14.0 macOS 11.0 watchOS 7.0 tvOS 14.0

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

  • \.timeZone iOS 13.0 macOS 10.15 watchOS 6.0 tvOS 13.0

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

  • \.truncationMode iOS 13.0 macOS 10.15 watchOS 6.0 tvOS 13.0

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

  • \.undoManager iOS 13.0 macOS 10.15 watchOS 6.0 tvOS 13.0

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

  • \.verticalScrollIndicatorVisibility iOS 16.0 macOS 13.0 watchOS 9.0 tvOS 16.0

    The visiblity to apply to scroll indicators of any vertically scrollable content.

  • \.verticalSizeClass iOS 13.0

    The vertical size class of this environment.

  • \.widgetFamily WidgetKit iOS 14.0 macOS 11.0 watchOS 9.0

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

  • \.widgetRenderingMode WidgetKit iOS 16.0 macOS 13.0 watchOS 9.0

    The widget’s rendering mode, based on where the system is displaying it.

Property Wrappers

Accessibility Modifiers

  • @AccessibilityFocusState iOS 15.0 macOS 12.0 watchOS 8.0 tvOS 15.0

    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.

App Structure and Behavior

Drawing and Graphics

  • @Namespace iOS 14.0 macOS 11.0 watchOS 7.0 tvOS 14.0

    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).

Gestures

  • @GestureState iOS 13.0 macOS 10.15 watchOS 6.0 tvOS 13.0

    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.

State and Data Flow

  • @AppStorage iOS 14.0 macOS 11.0 watchOS 7.0 tvOS 14.0

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

  • @Binding iOS 13.0 macOS 10.15 watchOS 6.0 tvOS 13.0

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

  • @Environment iOS 13.0 macOS 10.15 watchOS 6.0 tvOS 13.0

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

  • @EnvironmentObject iOS 13.0 macOS 10.15 watchOS 6.0 tvOS 13.0

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

  • @FetchRequest iOS 13.0 macOS 10.15 watchOS 6.0 tvOS 13.0

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

  • @ObservedObject iOS 13.0 macOS 10.15 watchOS 6.0 tvOS 13.0

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

  • @SceneStorage iOS 14.0 macOS 11.0 watchOS 7.0 tvOS 14.0

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

  • @SectionedFetchRequest iOS 15.0 macOS 12.0 watchOS 8.0 tvOS 15.0

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

  • @State iOS 13.0 macOS 10.15 watchOS 6.0 tvOS 13.0

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

  • @StateObject iOS 14.0 macOS 11.0 watchOS 7.0 tvOS 14.0

    A property wrapper type that instantiates an observable object.

Text Input and Output

  • @ScaledMetric iOS 14.0 macOS 11.0 watchOS 7.0 tvOS 14.0

    A dynamic property that scales a numeric value.

User Input

  • @FocusedBinding iOS 14.0 macOS 11.0 watchOS 7.0 tvOS 14.0

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

  • @FocusedObject iOS 16.0 macOS 13.0 watchOS 9.0 tvOS 16.0

    A property wrapper type for an observable object supplied by the focused view or one of its ancestors.

  • @FocusedValue iOS 14.0 macOS 11.0 watchOS 7.0 tvOS 14.0

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

  • @FocusState iOS 15.0 macOS 12.0 watchOS 8.0 tvOS 15.0

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