What is new on ios 18 in terms of swiftui?
Generated on 7/30/2024
1 search

This post is brought to you by Tailscan,
the best devtool for Tailwind CSS.
In iOS 18, there are several new features and improvements in SwiftUI:
-
New TabView Syntax: SwiftUI introduces a new syntax for
TabView
to make it easier to catch common errors at build time. You now declare a tab struct with a title, image, and its content view. Optionally, you can include a selection value in the tab to enable programmatic selection. This ensures that all tabs have the same selection type and that the type matches theTabView
itself. (Elevate your tab and sidebar experience in iPadOS) -
Graphics Capabilities: SwiftUI now allows you to mix colors beautifully with a new
mix
modifier onColor
, which blends it with another color by a given amount. Additionally, custom shaders can now be precompiled to avoid frame drops caused by lazy shader compilation. (What’s new in SwiftUI) -
Scroll View Enhancements: There are new APIs for fine-grained control over scroll views. You can now react to changes in content offsets, content size, and more with
onScrollGeometryChange
. This allows for features like auto-playing videos when a view's visibility changes due to scrolling. (What’s new in SwiftUI) -
Improved Interoperability: SwiftUI has enhanced its interoperability with UIKit and AppKit. Gesture recognition has been factored out of UIKit, allowing you to use any built-in or custom UI gesture recognizer in your SwiftUI view hierarchy. Animations have also been factored out, enabling you to set up animations on UIKit or AppKit views and drive them with SwiftUI, including fully custom animations. (Platforms State of the Union)
-
Custom Containers and Mesh Gradients: SwiftUI introduces custom containers and mesh gradients, providing more tools for creating immersive experiences. (Platforms State of the Union)
-
Main Actor Isolation: The new Swift 6 language mode enables compile-time data race safety. Views in SwiftUI are now evaluated on the main actor, and the
View
protocol is marked with the@MainActor
annotation, meaning all types conforming toView
are implicitly isolated to the main actor by default. (What’s new in SwiftUI)
These updates make SwiftUI more powerful and easier to use, allowing developers to create more dynamic and responsive user interfaces.

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.

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

Elevate your tab and sidebar experience in iPadOS
iPadOS 18 introduces a new navigation system that gives people the flexibility to choose between using a tab bar or sidebar. The newly redesigned tab bar provides more space for content and other functionality. Learn how to use SwiftUI and UIKit to enable customization features – like adding, removing and reordering tabs – to enable a more personal touch in your app.

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.

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.