Diffing

  • A type-erased differentiable value.

    The AnyDifferentiable type hides the specific underlying types. Associated type DifferenceIdentifier is erased by AnyHashable. The comparisons of whether has updated is forwards to an underlying differentiable value.

    You can store mixed-type elements in collection that require Differentiable conformance by wrapping mixed-type elements in AnyDifferentiable:

    extension String: Differentiable {}
    extension Int: Differentiable {}
    
    let source = [
        AnyDifferentiable("ABC"),
        AnyDifferentiable(100)
    ]
    let target = [
        AnyDifferentiable("ABC"),
        AnyDifferentiable(100),
        AnyDifferentiable(200)
    ]
    
    let changeset = StagedChangeset(source: source, target: target)
    print(changeset.isEmpty)  // prints "false"
    
    See more

    Declaration

    Swift

    public struct AnyDifferentiable : Differentiable
  • A differentiable section with model and array of elements.

    Arrays are can not be identify each one and comparing whether has updated from other one. ArraySection is a generic wrapper to hold a model to allow it.

    See more

    Declaration

    Swift

    public struct ArraySection<Model, Element> : DifferentiableSection where Model : Differentiable, Element : Differentiable
  • Represents the path to a specific element in a tree of nested collections.

    Note

    Foundation.IndexPath is disadvantageous in performance.
    See more

    Declaration

    Swift

    public struct ElementPath : Hashable