Returns an enumerator object that lets you access each object in the set.
- iOS 2.0+
- macOS 10.0+
- UIKit for Mac 13.0+Beta
- tvOS 9.0+
- watchOS 2.0+
An enumerator object that lets you access each object in the set.
The following code fragment illustrates how you can use this method.
When this method is used with mutable subclasses of
NSSet, your code shouldn’t modify the set during enumeration. If you intend to modify the set, use the
all method to create a “snapshot” of the set’s members. Enumerate the snapshot, but make your modifications to the original set.
It is more efficient to use the fast enumeration protocol (see
NSFast). Fast enumeration is available in macOS 10.5 and later and iOS 2.0 and later.