enumerateObjects(at:options:using:)
Executes a given block using the objects in the ordered set at the specified indexes.
Declaration
func enumerateObjects(at s: IndexSet, options opts: NSEnumerationOptions = [], using block: (Any, Int, UnsafeMutablePointer<ObjCBool>) -> Void)Parameters
- s:
The indexes of the objects over which to enumerate.
- opts:
A bitmask that specifies the options for the enumeration (whether it should be performed concurrently and whether it should be performed in reverse order).
- block:
The block to apply to elements in the ordered set.
The block takes three arguments:
- obj
The element in the ordered set.
- idx
The index of the element in the ordered set.
- stop
A reference to a Boolean value. The block can set the value to True to stop further processing of the array. The
stopargument is an out-only argument. You should only ever set this Boolean to True within the block.
Discussion
By default, the enumeration starts with the first object and continues serially through the ordered set to the last element specified by s. You can specify concurrent and/or reverse as enumeration options to modify this behavior.
See Also
Accessing Set Members
contains(_:)enumerateObjects(_:)enumerateObjects(options:using:)firstObjectlastObjectobject(at:)subscript(_:)objects(at:)index(of:)index(of:inSortedRange:options:usingComparator:)index(ofObjectAt:options:passingTest:)index(ofObjectPassingTest:)index(_:ofObjectPassingTest:)indexes(ofObjectsAt:options:passingTest:)indexes(ofObjectsPassingTest:)