Thanks for being a part of WWDC25!

How did we do? We’d love to know your thoughts on this year’s conference. Take the survey here

Debugging Snapshot Thread Confinement Warning in UITableViewDiffableDataSource

I first applied a snapshot on the main thread like this:

var snapshot = NSDiffableDataSourceSnapshot<Section, MessageViewModel>()
snapshot.appendSections([.main])
snapshot.appendItems([], toSection: .main)
dataSource.applySnapshotUsingReloadData(snapshot)

After loading data, I applied the snapshot again using:

Task { @MainActor in
  await dataSource.applySnapshotUsingReloadData(snapshot)
}

On an iPhone 13 mini, I received the following warning:

Warning: applying updates in a non-thread confined manner is dangerous and can lead to deadlocks. Please always submit updates either always on the main queue or always off the main queue

However, this warning did not appear when I ran the same code on an iPhone 16 Pro simulator.

Can anyone explain it to me? Thank you

Debugging Snapshot Thread Confinement Warning in UITableViewDiffableDataSource
 
 
Q