BT

Facilitating the Spread of Knowledge and Innovation in Professional Software Development

Write for InfoQ

Topics

Choose your language

InfoQ Homepage News SwiftUI Adds New Document Protocol, Improves Performance, and More

SwiftUI Adds New Document Protocol, Improves Performance, and More

Listen to this article -  0:00

Announced at WWDC 2026, the latest SwiftUI release brings a new Document protocol for efficient disk access and snapshot-based updates, along with improved APIs for reordering items in lists, grids, and sections. In addition, it expands presentation features, such as swipe actions on any view, better AsyncImage caching, and lazy state initialization for Observable types to boost performance.

SwiftUI’s updated toolbar APIs help manage limited space as apps grow. The system automatically hides items that don’t fit, but developers can now control this behavior by prioritizing important buttons, like Undo/Redo, with visibilityPriority, moving less-used actions into an overflow menu, and pinning key actions, such as Share, so they’re always visible. Additionally, toolbars can auto-minimize on scroll to maximize screen space, improving usability across different device sizes.

SwiftUI also introduces a new Document architecture letting document-based apps to handle heavy data and frequent UI updates more efficiently. Developers define a document type that manages reading and writing, and integrate it with the Observation framework so views update only when needed.

For writing, the app creates a snapshot of the document’s state and uses an asynchronous DocumentWriter to save only the changed parts. This improves performance and keeps the UI responsive, all the while supporting progress reporting.

For reading, a complementary ReadableDocument and DocumentReader handle loading data from disk. Overall, the system uses snapshot-based diffing and async operations to optimize performance for complex document workflows.

SwiftUI introduces reorderable container APIs that let users drag and rearrange items easily in lists, grids, or other layouts using the same code, with built-in animations and cross-platform support, including on watchOS.

It also enhances interaction and presentation features adding support for swipe actions on any view, not just lists; allowing developers to use flexible layouts like LazyVStack without losing swipe behavior; and enabling context menus and confirmation dialogs to support item-based bindings for actions like deleting items.

As a final note, the latest SwiftUI release also delivers significant data flow and performance improvements. AsyncImage now benefits from automatic HTTP caching, preventing unnecessary reloads when scrolling, while still allowing customization of request and session configurations. The @State property has also been optimized with lazy initialization, ensuring objects are created only once rather than on every view reinitialization. Additionally, compiler performance is enhanced through the introduction of ContentBuilder, which simplifies view construction and helps eliminate the notorious "The compiler is unable to type-check this expression in reasonable time" error.

There’s much more to SwiftUI than can be covered here, so be sure to watch the official presentation for all the details.

About the Author

Rate this Article

Adoption
Style

BT