---
title: "object(withID:)"
framework: Scripting Bridge
role: symbol
role_heading: Instance Method
platforms: [Mac Catalyst 13.0+, macOS 10.5+]
path: "scriptingbridge/sbelementarray/object(withid:)"
---

# object(withID:)

Returns the object in the array with the given identifier.

## Declaration

```swift
func object(withID identifier: Any) -> Any
```

## Parameters

- `identifier`: The identifier of one of the receiver’s objects.

## Return Value

Return Value A reference to the identified object or nil if could not be found.

## Discussion

Discussion This method is provided as an alternative to object(at:) for applications where an identifier is available instead of (or in addition to) an index. A unique ID is generally more stable than an index. For example, it may be more useful to identify a contact in Address Book by its identifier (which doesn’t change over time) than by its index in the list of contacts (which can change as contacts are added or removed).

## See Also

### Getting Objects in the Array

- [object(withName:)](scriptingbridge/sbelementarray/object(withname:).md)
- [object(atLocation:)](scriptingbridge/sbelementarray/object(atlocation:).md)
