Functions

The following functions are available globally.

  • Generates a patch sequence. It is a list of steps to be applied to obtain the to collection from the from one. The sorting function lets you sort the output e.g. you might want the output patch to have insertions first.

    Complexity

    O((N+M)*D)

    Declaration

    Swift

    public func extendedPatch<T: Collection>(
        from: T,
        to: T,
        sort: ExtendedDiff.OrderedBefore? = nil
    ) -> [ExtendedPatch<T.Element>] where T.Element: Equatable

    Parameters

    from

    The source collection

    to

    The target collection

    sort

    A sorting function

    Return Value

    Arbitrarly sorted sequence of steps to obtain to collection from the from one.

  • Generates arbitrarly sorted patch sequence. It is a list of steps to be applied to obtain the to collection from the from one. The sorting function lets you sort the output e.g. you might want the output patch to have insertions first.

    Complexity

    O((N+M)*D)

    Declaration

    Swift

    public func patch<T: Collection>(
        from: T,
        to: T,
        sort: Diff.OrderedBefore
    ) -> [Patch<T.Element>] where T.Element: Equatable

    Parameters

    from

    The source collection

    to

    The target collection

    sort

    A sorting function

    Return Value

    Arbitrarly sorted sequence of steps to obtain to collection from the from one.

  • Generates a patch sequence. It is a list of steps to be applied to obtain the to collection from the from one.

    Complexity

    O((N+M)*D)

    Declaration

    Swift

    public func patch<T: Collection>(
        from: T,
        to: T
    ) -> [Patch<T.Element>] where T.Element: Equatable

    Parameters

    from

    The source collection

    to

    The target collection

    Return Value

    A sequence of steps to obtain to collection from the from one.