---
title: objectEnumerator()
framework: foundation
role: symbol
role_heading: Instance Method
path: foundation/nshashtable/objectenumerator()
---

# objectEnumerator()

Returns an enumerator object that lets you access each object in the hash table.

## Declaration

```swift
func objectEnumerator() -> NSEnumerator
```

## Return Value

Return Value An enumerator object that lets you access each object in the hash table.

## Discussion

Discussion The following code fragment illustrates how you can use this method. NSEnumerator *enumerator = [myHashTable objectEnumerator]; id value;   while ((value = [enumerator nextObject])) {     /* code that acts on the hash table's values */ } Special Considerations It is more efficient to use the fast enumeration protocol (see NSFastEnumeration).

## See Also

### Accessing Content

- [anyObject](foundation/nshashtable/anyobject.md)
- [allObjects](foundation/nshashtable/allobjects.md)
- [setRepresentation](foundation/nshashtable/setrepresentation.md)
- [count](foundation/nshashtable/count.md)
- [contains(_:)](foundation/nshashtable/contains(_:).md)
- [member(_:)](foundation/nshashtable/member(_:).md)
