---
title: "modelIdentifierForElement(at:in:)"
framework: uikit
role: symbol
role_heading: Instance Method
path: "uikit/uidatasourcemodelassociation/modelidentifierforelement(at:in:)"
---

# modelIdentifierForElement(at:in:)

Returns the string that uniquely identifies the data at the specified location in the view.

## Declaration

```swift
func modelIdentifierForElement(at idx: IndexPath, in view: UIView) -> String?
```

## Parameters

- `idx`: The index path to the requested data object.
- `view`: The view that contains the data object.

## Return Value

Return Value A string that uniquely identifies the data object.

## Discussion

Discussion Use the provided information to locate the requested data object. From that object, extract a string that can be used later to identify the same piece of data again. The string you return must not be based on transient information, such as the pointer to the current object in memory; it must instead be tied to the underlying data. In fact, if two different in-memory objects represent the same piece of data in your app, they must both return the same model identifier string.

## See Also

### Locating the data

- [indexPathForElement(withModelIdentifier:in:)](uikit/uidatasourcemodelassociation/indexpathforelement(withmodelidentifier:in:).md)
