MCArrayComparer

public protocol MCArrayComparer

This protocol allows conforming instances to compare arrays of MCRecordable, by granting access to the check method.

  • Each array being compared has to conform to MCRecordable

    Declaration

    Swift

    typealias Element = MCRecordable
  • check(_:against:) Default implementation

    This method compares passed arguments and returns the results of the comparison with a tuple containing values that need to be modified to resolve conflicts between two arguments.

    Default Implementation

    Declaration

    Swift

    func check(_ original: [Element], against changed: [Element]) -> (add: [Element], edited: [Element], remove: [Element])

    Parameters

    original

    This argument represents an array before changes have been made.

    changed

    This argument represents an array after changes have been made.

    Return Value

    Tuple whose value (add) represents new, (edited) modified elements and (remove) represents original elements missing from changed array.