Contents

compare(document:toDocument:)

Compares documents containing matching ranges from the set the aggregator provides to determine navigation order.

Declaration

func compare(document: Self.DocumentIdentifier, toDocument: Self.DocumentIdentifier) -> ComparisonResult

Parameters

  • document:

    A string that uniquely identifies the document to compare from.

  • toDocument:

    A string that uniquely identifies the document to compare to.

Return Value

Returns the result of comparing the two documents.

Discussion

The system calls this method during a find session to determine which document’s ranges to highlight next when a user taps the “next” or “previous” button. Return ComparisonResult.orderedAscending if the text ranges found in the fromDocument come before those found in the toDocument in your view. Otherwise, return ComparisonResult.orderedDescending.

The system only calls this method if you provide document identifiers to the session’s result aggregator.

See Also

Handling searches