<!--
{
  "availability" : [
    "macOS: 10.6.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "AppKit",
  "identifier" : "/documentation/AppKit/NSApplication/searchString(_:inUserInterfaceItemString:range:found:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "AppKit"
    ],
    "preciseIdentifier" : "c:objc(cs)NSApplication(im)searchString:inUserInterfaceItemString:searchRange:foundRange:"
  },
  "title" : "searchString(_:inUserInterfaceItemString:range:found:)"
}
-->

# searchString(_:inUserInterfaceItemString:range:found:)

Searches for the string in the user interface.

```
func searchString(_ searchString: String, inUserInterfaceItemString stringToSearch: String, range searchRange: NSRange, found foundRange: UnsafeMutablePointer<NSRange>?) -> Bool
```

## Parameters

`searchString`

The search string.

`stringToSearch`

The string to search.

`searchRange`

The subrange of the `stringToSearch` to restrict the search to.

`foundRange`

Returns, by-reference, the range of the `searchString` within `stringToSearch`.

## Return Value

<doc://com.apple.documentation/documentation/Swift/true> if the searchString is matched, otherwise <doc://com.apple.documentation/documentation/Swift/false>.

## Discussion

The search uses the default matching rules for Spotlight for Help.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)