---
title: "objects(options:passingTest:)"
framework: foundation
role: symbol
role_heading: Instance Method
path: "foundation/nsset/objects(options:passingtest:)"
---

# objects(options:passingTest:)

Returns a set of objects that pass a test in a given block, using the specified enumeration options.

## Declaration

```swift
func objects(options opts: NSEnumerationOptions = [], passingTest predicate: (Any, UnsafeMutablePointer<ObjCBool>) -> Bool) -> Set<AnyHashable>
```

## Parameters

- `opts`: A bitmask that specifies the options for the enumeration.
- `predicate`: The block to apply to elements in the set. The block takes two arguments: The block returns a Boolean value that indicates whether obj passed the test.

## Return Value

Return Value An NSSet containing objects that pass the test.

## See Also

### Accessing Set Members

- [allObjects](foundation/nsset/allobjects.md)
- [anyObject()](foundation/nsset/anyobject().md)
- [contains(_:)](foundation/nsset/contains(_:).md)
- [filtered(using:)](foundation/nsset/filtered(using:).md)
- [member(_:)](foundation/nsset/member(_:).md)
- [objectEnumerator()](foundation/nsset/objectenumerator().md)
- [enumerateObjects(_:)](foundation/nsset/enumerateobjects(_:).md)
- [enumerateObjects(options:using:)](foundation/nsset/enumerateobjects(options:using:).md)
- [objects(passingTest:)](foundation/nsset/objects(passingtest:).md)
