Synchronously finds all instances of the specified string in the document.
SDKs
- iOS 11.0+
- macOS 10.4+
- Mac Catalyst 13.0+
Framework
- PDFKit
Declaration
func findString(_ string: String, withOptions options: NSString.Compare Options = []) -> [PDFSelection]
Discussion
Each hit gets added to an NSArray
object as a PDFSelection
object. If there are no hits, this method returns an empty array.
Use this method when the complete search process will be brief and when you don’t need the flexibility or control offered by begin
. For options, refer to Searching, Comparing, and Sorting Strings.