---
title: "metadataQuery(_:replacementValueForAttribute:value:)"
framework: foundation
role: symbol
role_heading: Instance Method
path: "foundation/nsmetadataquerydelegate/metadataquery(_:replacementvalueforattribute:value:)"
---

# metadataQuery(_:replacementValueForAttribute:value:)

Returns a different value for a given attribute and value.

## Declaration

```swift
optional func metadataQuery(_ query: NSMetadataQuery, replacementValueForAttribute attrName: String, value attrValue: Any) -> Any
```

## Parameters

- `query`: The query that produced the result object with attrName.
- `attrName`: The attribute in question.
- `attrValue`: The attribute value to replace.

## Return Value

Return Value Object that replaces the value of attrName in the result object

## Discussion

Discussion The delegate implementation of this method could convert specific query attribute values to other attribute values, for example, converting date object values to formatted strings for display.

## See Also

### Getting Query Results

- [metadataQuery(_:replacementObjectForResultObject:)](foundation/nsmetadataquerydelegate/metadataquery(_:replacementobjectforresultobject:).md)
