PSPDFTextSearchDelegate

@protocol PSPDFTextSearchDelegate <NSObject>

Search status delegate. All delegates are guaranteed to be called within the main thread.

  • Called when search is started.

    Declaration

    Objective-C

    - (void)willStartSearch:(nonnull PSPDFTextSearch *)textSearch
                       term:(nonnull NSString *)searchTerm
               isFullSearch:(BOOL)isFullSearch;

    Swift

    optional func willStart(_ textSearch: PSPDFTextSearch, term searchTerm: String, isFullSearch: Bool)
  • Search was updated, a new page has been scanned. Consider page a hint. There might be situations where this is called with a larger set of search results. page in this case is set to NSNotFound.

    Declaration

    Objective-C

    - (void)didUpdateSearch:(nonnull PSPDFTextSearch *)textSearch
                       term:(nonnull NSString *)searchTerm
           newSearchResults:(nonnull NSArray<PSPDFSearchResult *> *)searchResults
                  pageIndex:(NSUInteger)pageIndex;

    Swift

    optional func didUpdate(_ textSearch: PSPDFTextSearch, term searchTerm: String, newSearchResults searchResults: [PSPDFSearchResult], pageIndex: UInt)
  • Called when a text search operation was aborted due to an error.

    Declaration

    Objective-C

    - (void)didFailSearch:(nonnull PSPDFTextSearch *)textSearch
                withError:(nonnull NSError *)error;

    Swift

    optional func didFail(_ textSearch: PSPDFTextSearch, withError error: Error)

    Parameters

    textSearch

    The text search operation which was stopped.

    error

    The error for which it was stopped.

  • Search has finished.

    Declaration

    Objective-C

    - (void)didFinishSearch:(nonnull PSPDFTextSearch *)textSearch
                       term:(nonnull NSString *)searchTerm
              searchResults:(nonnull NSArray<PSPDFSearchResult *> *)searchResults
               isFullSearch:(BOOL)isFullSearch
              pageTextFound:(BOOL)pageTextFound;

    Swift

    optional func didFinish(_ textSearch: PSPDFTextSearch, term searchTerm: String, searchResults: [PSPDFSearchResult], isFullSearch: Bool, pageTextFound: Bool)
  • Search has been cancelled.

    Declaration

    Objective-C

    - (void)didCancelSearch:(nonnull PSPDFTextSearch *)textSearch
                       term:(nonnull NSString *)searchTerm
               isFullSearch:(BOOL)isFullSearch;

    Swift

    optional func didCancel(_ textSearch: PSPDFTextSearch, term searchTerm: String, isFullSearch: Bool)