Contents

SwiftUI updates

Learn about important changes to SwiftUI.

Overview

Browse notable changes in SwiftUI.

June 2025

General

Text

Accessibility

HDR

  • Color.ResolvedHDR is a set of RGBA values that represent a color that can be shown, including HDR headroom information.

UIKit and AppKit integration

Immersive spaces

June 2024

Volumes

Windows

  • Change the default initial size and position of a window using the defaultWindowPlacement(_:) modifier.

  • Change the default behavior for how windows behave when performing a zoom using WindowIdealSize and provide the placement for the zoomed window with the windowIdealPlacement(_:) modifier.

  • Create utility windows in SwiftUI using the new UtilityWindow scene type and toggle the window’s visibility using the WindowVisibilityToggle.

  • Customize the style of a window using the new doc://com.apple.documentation/documentation/SwiftUI/ContainerBackgroundPlacement/window container background placement, the toolbar(removing:) view modifier, and the plain window style.

  • Set the default launch behavior for a scene using the defaultLaunchBehavior(_:) modifier.

  • Replace one scene with another using the pushWindow method.

Immersive spaces

  • Add an action to perform when the state of the immersion changes using the onImmersionChange(_:) modifier.

  • Apply a custom color or dim a passthrough video in an immersive space using the doc://com.apple.documentation/documentation/SwiftUI/SurroundingsEffect/colorMultiply(_:) and dim(intensity:) initializers.

Documents

Toolbars

  • Specify the display mode of toolbars in macOS using the ToolbarLabelStyle type.

  • Configure the foreground style in the toolbar environment in watchOS using the toolbarForegroundStyle(_:for:) view modifier.

  • Anchor ornaments relative to the depth of your volume — in addition to the height and width — using the scene(_:) method that takes a UnitPoint3D.

Views

Animation

Text input and output

Drawing and graphics

Layout

Scrolling

Gestures

Input events

Previews in Xcode

  • Write dynamic properties inline in previews using the new Previewable() macro.

  • Inject shared environment objects, model containers, or other dependencies into previews using the PreviewModifier protocol.

Accessibility

  • Specify that your accessibility element behaves as a tab bar using the isTabBar accessibility trait with the accessibilityAddTraits(_:) modifier. In UIKit, use tabBar.

  • Generate a localized description of a color in a string interpolation by adding accessibilityName:, such as "\(accessibilityName: myColor)". Pass that string to any accessibility modifier.

Framework interoperability

  • Reuse existing UIKit gesture recognizer code in SwiftUI. In SwiftUI, create UIKit gesture recognizers using UIGestureRecognizerRepresentable. In UIKit, refer to SwiftUI gestures by name using name.

  • Share menu content definitions between SwiftUI and AppKit by using the NSHostingMenu in your AppKit view hierarchy.

June 2023, visionOS

Scenes

  • Create a volume that can display 3D models by applying the volumetric window style to an app’s window.

  • Make use of a Full Space by opening an ImmersiveSpace scene. You can use the mixed immersion style to place objects in a person’s surroundings, or the full style to completely control the visual experience.

  • Display 3D models in a volume or a Full Space using RealityKit entities that you load with that framework’s Model3D or RealityView structure.

Toolbars and ornaments

Drawing and graphics

View configuration

View layout

Gestures

  • Enable people to rotate objects in three dimensions when you add a RotateGesture3D gesture.

June 2023

Scenes

  • Close windows by their identifier using the dismissWindow action stored in the environment.

  • Enable people to open a settings window by presenting a SettingsLink button.

Toolbars

Data and storage

  • Bridge between SwiftUI environment keys and UIKit traits more easily using the UITraitBridgedEnvironmentKey protocol.

  • Get better performance when you share data throughout your app by using the new Observable() macro.

  • Access both the old and new values of a value that changes when processing the completion closure of the onChange(of:initial:_:) view modifier.

Views

  • Display a standard interface when a resource, like search results or a network connection, isn’t available using the ContentUnavailableView view type.

  • Display a standard inspector interface with a platform-appropriate appearance by applying the inspector(isPresented:content:) modifier.

Animation

  • Perform an action when an animation completes by specifying a completion closure to the withAnimation(_:completionCriteria:_:completion:) view modifier.

  • Define custom animation behaviors by creating a type that conforms to the CustomAnimation protocol.

  • Perform animations that progress through predefined phases using the PhaseAnimator structure, or according to a set of time-based keyframes by using the Keyframes protocol.

  • Specify information about a change in state — for example, to request a particular animation — using custom TransactionKey instances.

  • Design custom animation curves using UnitCurve.

  • Apply streamlined spring parameters, now standardized across all Apple frameworks, using the new spring(duration:bounce:blendDuration:) animation. You can also use the Spring structure as a convenience to represent a spring’s motion.

Text input and output

  • Indicate the language that appears in a specific Text view so that SwiftUI can help to avoid clipping and collision of text, and perform proper line breaking and hyphenation using the typesettingLanguage(_:isEnabled:) view modifier.

  • Scale text semantically, for example by labeling it as having a secondary text scale, using the textScale(_:isEnabled:) modifier.

Shapes

Drawing and graphics

  • Create fully customizable, high-performance graphics by drawing with Metal shaders inside a SwiftUI app using a Shader structure.

  • Configure an image with a specific dynamic range by applying the allowedDynamicRange(_:) view modifier.

  • Compose effects that you apply to a view based on some aspect of the geometry of the view using the visualEffect(_:) modifier. For example, you can apply a blur that varies depending on the view’s position in the display.

Layout

Lists and tables

Scrolling

Gestures

  • Make smoother transitions between gestures and animations by using a new velocity property on the values associated with certain gestures and a tracksVelocity property on Transaction.

  • Gain access to more information, including both velocity and position, by migrating to the new MagnifyGesture and RotateGesture, which replace the now deprecated MagnificationGesture and RotationGesture.

Input events

Focus

  • Distinguish between views for which focus serves different purposes, such as those that have a primary action like a button and those that take input like a text field, using the new focusable(_:interactions:) view modifier.

  • Manage the effect that receiving focus has on a view using the focusEffectDisabled(_:) modifier.

Previews in Xcode

See Also

Technology updates