DittoDiffer

public class DittoDiffer

Calculates diffs between arrays of DittoQueryResultItems.

Use a DittoDiffer with a DittoStoreObserver to get the diff between subsequent query results delivered by the store observer.

  • Create a new differ.

    Declaration

    Swift

    public init()
  • Calculate the diff of the provided items against the last set of items that were passed to this differ.

    The returned DittoDiff identifies changes from the old array of items to the new array of items using indices into both arrays.

    Initially, the differ has no items, so the first call to this method will always return a diff showing all items as insertions.

    The identity of items is determined by their _id field.

    Declaration

    Swift

    public func diff(
        _ items: [DittoQueryResultItem]
    ) -> DittoDiff

    Parameters

    items

    The query result items to compare against the last array of items.