what are new apis in swiftUI
Generated on 7/29/2024
1 search

This post is brought to you by Tailscan,
the best devtool for Tailwind CSS.
New APIs in SwiftUI
SwiftUI has introduced several new APIs and enhancements this year. Here are some of the key updates:
-
Graphics Capabilities:
- Mix Modifier on Color: Allows blending colors together by a given amount.
- Custom Shader Precompilation: Enables precompiling shaders before their first use to avoid frame drops caused by lazy shader compilation.
-
Scroll View Enhancements:
- On Scroll Geometry Change: React to changes in content, offsets, content size, and more.
- Visibility Detection: Detect when a view's visibility changes due to scrolling, useful for creating experiences like auto-playing videos.
- Programmatic Control: More control over scroll positions, turning off bouncing along a given axis, programmatically stopping scrolling, and controlling content alignment.
-
Text and Selection Management:
- Programmatic Text Selection: Access and control text selection within text editing controls.
-
Interoperability:
- UIKit and AppKit Integration: Improved interoperability with UIKit and AppKit, including gesture recognition and animations.
- HostingViewController: Embed SwiftUI views into UIKit or AppKit view hierarchies.
-
Accessibility:
- Conditional Modifier Support: New accessibility features such as conditional modifier support and app intent-based accessibility actions.
-
Xcode Previews:
- Dynamic Linking Architecture: Switch between a preview and build and run without needing to rebuild the project.
- Previewable Macro: Use state directly in previews, eliminating the need for boilerplate code.
-
Custom Containers and Mesh Gradients:
- Custom Containers: New ways to create custom containers.
- Mesh Gradients: Enhanced gradient capabilities for more complex visual effects.
-
Swift 6 Language Mode:
- Compile Time Data Race Safety: New language mode that enables compile-time data race safety.
- Main Actor Annotation: Views in SwiftUI are now marked with the main actor annotation, ensuring they are implicitly isolated to the main actor by default.
For more detailed information, you can refer to the following sessions:
- What’s new in SwiftUI (00:15:56)
- Platforms State of the Union (00:39:22)
Relevant Sessions

SwiftUI essentials
Join us on a tour of SwiftUI, Apple’s declarative user interface framework. Learn essential concepts for building apps in SwiftUI, like views, state variables, and layout. Discover the breadth of APIs for building fully featured experiences and crafting unique custom components. Whether you’re brand new to SwiftUI or an experienced developer, you’ll learn how to take advantage of what SwiftUI has to offer when building great apps.

Platforms State of the Union
Discover the newest advancements on Apple platforms.

What’s new in SwiftUI
Learn how you can use SwiftUI to build great apps for any Apple platform. Explore a fresh new look and feel for tabs and documents on iPadOS. Improve your window management with new windowing APIs, and gain more control over immersive spaces and volumes in your visionOS apps. We’ll also take you through other exciting refinements that help you make expressive charts, customize and layout text, and so much more.

What’s new in UIKit
Explore everything new in UIKit, including tab and document launch experiences, transitions, and text and input changes. We’ll also discuss better-than-ever interoperability between UIKit and SwiftUI animations and gestures, as well as general improvements throughout UIKit.

What’s new in watchOS 11
Explore new opportunities on Apple Watch, including bringing Double Tap support to your watchOS app, making your Smart Stack widgets even more relevant and interactive, and displaying your iOS Live Activities in the Smart Stack.