SwiftUI in appleOS 27
macOS Golden Gate 27 Beta Release Notes:
AsyncImagenow automatically caches downloaded images using HTTP caching protocols, allowing servers to control caching behavior via standard headers.[…]
Xcode 27 introduces a new
@Stateimplementation that avoids this repeated evaluation. This new behavior back-deploys to iOS 17 aligned OSes. The new@Stateis implemented with a Swift macro. It is largely source compatible with the property wrapper version, with a few exceptions.[…]
Textviews now supportTextRenderer.[…]
In apps built with the 27.0 SDKs, the new
ReadableDocumentandWritableDocumentprotocols support asynchronous reading and writing, progress reporting, and direct access to document URLs. NewDocumentGroupinitializers that adopt these protocols let you disable document creation for editing-only apps and present custom UI before any document is opened.[…]
TextFieldrespects custom font and color styling applied to its prompt.[…]
Listaccepts drops in two cases that previously didn’t work: drags with compatible transfer representations are accepted into reorderable content even when the.reorderableItemtransfer type isn’t present, and a.dropDestination(…)modifier declared on a list item now performs the drop.
Build your project in Xcode 27 or later to construct type-agnostic content from closures that you mark with
ContentBuilder, which serves as the unified replacement for type-specific builders likeToolbarContentBuilderandCommandsBuilder.Add reordering by drag-and-drop in containers such as lists, stacks, grids, or custom layouts with
reorderable()andreorderContainer(for:isEnabled:move:).Add custom swipe actions to views in containers such as scroll views, stacks, grids, or custom layouts using
swipeActions(edge:allowsFullSwipe:content:onPresentationChanged:)andswipeActionsContainer().[…]
Use the
visibilityPriority(_:)modifier to prioritize important toolbar actions so SwiftUI keeps them visible as space shrinks, moving lower-priority items to the overflow menu first.[…]
Present an alert or confirmation dialog from an optional data item or error object, and use that data to produce the content and title[…]
Explore the latest additions to SwiftUI and discover how they can improve your apps. We’ll introduce a new Document protocol with direct disk access and snapshot-based diffing for building high-performance apps; new APIs for reordering content in lists, grids, and sections; and toolbar enhancements including visibility priority and auto-minimizing behavior. We’ll also cover expanded presentation APIs — including swipe actions on any view — plus AsyncImage caching improvements and lazy state initialization for Observable types.
Use SwiftUI with AppKit and UIKit:
Discover how to incrementally adopt SwiftUI in your existing AppKit or UIKit app. We’ll show you how to use the Observation framework to automatically update your views, integrate SwiftUI components into an existing view hierarchy, and bring gesture recognizers into SwiftUI. We’ll also explore how to add complete SwiftUI scenes to your app without changing your overall architecture.
Dive into lazy stacks and scrolling with SwiftUI:
Discover the inner workings of lazy stacks in SwiftUI. We’ll explore how LazyVStack and LazyHStack estimate sizes, lazily load subviews, and prefetch content to deliver smooth scrolling experiences. We’ll also cover advanced performance optimizations, state management best practices, and tips for precise programmatic scrolling. To get the most out of this session, we recommend basic familiarity with SwiftUI layout using stacks.
Compose advanced graphics effects with SwiftUI:
Discover how to craft rich, custom experiences by creatively composing SwiftUI layout and graphics APIs. We’ll show you how to break down complex designs and use a creative pipeline to chain simple building blocks together. Learn how to draw with layer shaders, animate with timelines, and anchor views with alignment guides.
Build powerful drag and drop in SwiftUI:
Follow along as we build a game of Solitaire to explore the latest drag-and-drop capabilities in SwiftUI. We’ll show you how to use the new reordering API to let people arrange content, implement drag containers to move multiple items at once, and customize the drag-and-drop lifecycle to fit your app’s rules.
There are also a bunch of labs.
Up until now it was a property wrapper conforming to the
DynamicPropertyprotocol, but in Xcode 27 it becomes a Swift macro. In this post we will look at what the change means for@Observablemodels stored in@State.
Only took 3 years lol!
SwiftUI also introduces a new prominent tab role. You can use the prominent role for trailing-separated tabs, similar to search.
[…]
Document-based apps get a refreshed look and feel, along with a performance boost. It looks like Xcode has started using these improvements, which might explain why we see so much work around document-based apps this year. And finally, Xcode introduces SwiftUI Specialist and What’s New in SwiftUI skills for agentic coding in Xcode.
For me, the biggest change in SwiftUI comes from its comprehensive support for document-based apps. It not only adds a large number of new APIs, but also shifts the mental model toward “observable document objects + asynchronous snapshots + dedicated readers / writers.” This is clearly better suited to complex document apps, and it also aligns more closely with the overall evolution of modern Swift around Observation and Concurrency.
The sessions also mentioned that SwiftUI continues to optimize layout- and container-related implementations, bringing noticeable performance improvements in some scenarios. This is an improvement developers have urgently needed. However, SwiftUI still does not provide the ability to create custom Lazy containers, which remains a clear disappointment.
iOS 27 introduces new reordering APIs that work with any container. We can mark dynamic content with
reorderable()and define the scope of the interaction withreorderContainer(for:). SwiftUI handles the drag preview, insertion placeholder, and drop animation, while our code applies the resulting change to the model.SwiftUI’s drag container APIs are also now available on iPhone and iPad, after previously being limited to macOS. They let us make items in a collection draggable without making the collection reorderable, and include multiple selected items in the same drag. The APIs also support lazy generation of transferable values and drag-session observation.
robb:
I love the new #SwiftUI Text selection but without a way to make selection span multiple Texts in a group, it doesn’t really address our needs at Linear – here’s hoping we see an update in a later seed 🤞
The NavigationTransition protocol has been available in SwiftUI since iOS 18, letting us control how views animate when pushed onto a
NavigationStackand when presenting sheets and full-screen covers. We specify the transition using thenavigationTransition(_:)modifier on the destination or presented view, and SwiftUI uses it instead of the default animation for that context. Before iOS 27, SwiftUI provided two built-in conforming types:AutomaticNavigationTransition, used via theautomaticstatic value, which defers to the system default for the current context, andZoomNavigationTransition, used viazoom(sourceID:in:), which animates the presented view expanding from a source view marked withmatchedTransitionSource(). iOS 27 introduces CrossFadeNavigationTransition, a new built-in transition that cross-fades between views without requiring a source, and adds AnyNavigationTransition, a type eraser that lets us select a transition at runtime.
The last few years watching WWDC has been a mixed experience for me, because I honestly believe Swift and SwiftUI are actively either bad or being made worst.
Yet every year, the problems I have with them are doubled down on, not improved.
The FB21333309 cache bug I submitted is now confirmed to be fixed on iOS 27.
Instead of introducing a new CacheKey like I suggested, SwiftUI team choose to move the intensity payload out of the FeedbackType enum to a new Payload enum and add a new payload var to SensoryFeedback storage.
A few weeks ago I realised that most iOS jobs require knowledge of SwiftUI. So I started to rebuild my Mastodon client in SwiftUI. Then I got an offer for a new job and accepted it. This means I can get back to working on the ObjC version. Feels good. :)
Previously: