Diffing
-
Represents a value that can compare whether the content are equal.
See moreDeclaration
Swift
public protocol ContentEquatable
-
Declaration
Swift
@frozen extension Optional: ContentEquatable where Wrapped: ContentEquatable
-
Represents the value that identified for differentiate.
See moreDeclaration
Swift
public protocol Differentiable : ContentEquatable
-
Represents the section of collection that can be identified and compared to whether has updated.
See moreDeclaration
Swift
public protocol DifferentiableSection : Differentiable
-
A type-erased differentiable value.
The
AnyDifferentiable
type hides the specific underlying types. Associated typeDifferenceIdentifier
is erased byAnyHashable
. 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 inAnyDifferentiable
:
See moreextension 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"
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 moreDeclaration
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.Declaration
Swift
public struct ElementPath : Hashable