Class

NSDiffableDataSourceSnapshotReference

The Swift representation of the Objective-C object you use to represent the state of the data in a view at a specific point in time.

Declaration

class NSDiffableDataSourceSnapshotReference : NSObject

Overview

Avoid using this type in Swift code. Only use this type to bridge from Objective-C code to Swift code by typecasting from a snapshot reference to a snapshot:

let snapshot = snapshotReference as NSDiffableDataSourceSnapshot<Int, UUID>

Topics

Creating a Snapshot

func appendSections(withIdentifiers: [Any])

Adds the sections with the specified identifiers to the snapshot.

func appendItems(withIdentifiers: [Any], intoSectionWithIdentifier: Any)

Adds the items with the specified identifiers to the specified section of the snapshot.

func appendItems(withIdentifiers: [Any])

Adds the items with the specified identifiers to the last section of the snapshot.

Getting Item and Section Metrics

var numberOfItems: Int

The number of items in the snapshot.

var numberOfSections: Int

The number of sections in the snapshot.

func numberOfItems(inSection: Any) -> Int

Returns the number of items in the specified section of the snapshot.

Identifying Items and Sections

var itemIdentifiers: [Any]

The identifiers of all of the items in the snapshot.

var sectionIdentifiers: [Any]

The identifiers of all of the sections in the snapshot.

func index(ofItemIdentifier: Any) -> Int

Returns the index of the item in the snapshot with the specified identifier.

func index(ofSectionIdentifier: Any) -> Int

Returns the index of the section of the snapshot with the specified identifier.

func itemIdentifiersInSection(withIdentifier: Any) -> [Any]

Returns the identifiers of all of the items in the specified section of the snapshot.

func sectionIdentifier(forSectionContainingItemIdentifier: Any) -> Any?

Returns the identifier of the section containing the specified item in the snapshot.

Inserting Items and Sections

func insertItems(withIdentifiers: [Any], afterItemWithIdentifier: Any)

Inserts the provided items immediately after the item with the specified identifier in the snapshot.

func insertItems(withIdentifiers: [Any], beforeItemWithIdentifier: Any)

Inserts the provided items immediately before the item with the specified identifier in the snapshot.

func insertSections(withIdentifiers: [Any], afterSectionWithIdentifier: Any)

Inserts the provided sections immediately after the section with the specified identifier in the snapshot.

func insertSections(withIdentifiers: [Any], beforeSectionWithIdentifier: Any)

Inserts the provided sections immediately before the section with the specified identifier in the snapshot.

Removing Items and Sections

func deleteAllItems()

Deletes all of the items from the snapshot.

func deleteItems(withIdentifiers: [Any])

Deletes the items with the specified identifiers from the snapshot.

func deleteSections(withIdentifiers: [Any])

Deletes the sections with the specified identifiers from the snapshot.

Reordering Items and Sections

func moveItem(withIdentifier: Any, afterItemWithIdentifier: Any)

Moves the item from its current position in the snapshot to the position immediately after the specified item.

func moveItem(withIdentifier: Any, beforeItemWithIdentifier: Any)

Moves the item from its current position in the snapshot to the position immediately before the specified item.

func moveSection(withIdentifier: Any, afterSectionWithIdentifier: Any)

Moves the section from its current position in the snapshot to the position immediately after the specified section.

func moveSection(withIdentifier: Any, beforeSectionWithIdentifier: Any)

Moves the section from its current position in the snapshot to the position immediately before the specified section.

Reloading Data

func reloadItems(withIdentifiers: [Any])

Reloads the data within the specified items in the snapshot.

func reloadSections(withIdentifiers: [Any])

Reloads the data within the specified sections of the snapshot.

Supporting Bridging

var impl: __UIDiffableDataSourceSnapshot

The underlying bridging type.

Relationships

Inherits From