<!--
{
  "availability" : [
    "macOS: 10.9.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Foundation",
  "identifier" : "/documentation/Foundation/NSPredicate/init(fromMetadataQueryString:)",
  "metadataVersion" : "0.1.0",
  "role" : "Initializer",
  "symbol" : {
    "kind" : "Initializer",
    "modules" : [
      "Foundation"
    ],
    "preciseIdentifier" : "c:objc(cs)NSPredicate(cm)predicateFromMetadataQueryString:"
  },
  "title" : "init(fromMetadataQueryString:)"
}
-->

# init(fromMetadataQueryString:)

Creates a predicate with a metadata query string.

```
init?(fromMetadataQueryString queryString: String)
```

## Parameters

`queryString`

A metadata query string.

## Discussion

For details of the format of the query string, see [File Metadata Query Expression Syntax](https://developer.apple.com/library/archive/documentation/Carbon/Conceptual/SpotlightQuery/Concepts/QueryFormat.html#//apple_ref/doc/uid/TP40001849).

---

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)