The Undocumented Facts of Diffable Data Source Section Snapshot

What you should know but Apple didn’t tell you.

Lee Kah Seng
Swift2Go

--

The Undocumented Facts of Diffable Data Source Section Snapshot

This article is originally published at https://swiftsenpai.com on January 25, 2021.

The diffable data source section snapshot is an UIKit component introduced in iOS 14. It opens up new possibilities for developers to build various types of hierarchical lists using collection view declaratively.

Even though it is such a powerful component, Apple’s official documentation does not provide much information on how it works and how to use it effectively.

In this article, I would like to share with you some interesting facts about section snapshot that I recently discovered.

With all the being said, let’s get right into it!

The Visual Descriptor

When working with a section snapshot, it is very important to know the hierarchical structure as well as the content of the section snapshot. Therefore, Apple has shipped a visual descriptor alongside the NSDiffableDataSourceSectionSnapshot generic struct.

By leveraging the visual descriptor, we can easily write an ASCII representation of the section snapshot to the Xcode debug console. What’s even better is that it is extremely…

--

--

Lee Kah Seng
Swift2Go

Support me by becoming a Medium member: https://leekahseng.medium.com/membership ⦿ 🇲🇾 Creator of https://swiftsenpai.com ⦿ iOS developer since 2011