NSOrderedSet
A static, ordered collection of unique objects.
Declaration
class NSOrderedSetOverview
NSOrderedSet declares the programmatic interface for static sets of distinct objects. You establish a static set’s entries when it’s created, and thereafter the entries can’t be modified. NSMutableOrderedSet, on the other hand, declares a programmatic interface for dynamic sets of distinct objects. A dynamic—or mutable—set allows the addition and deletion of entries at any time, automatically allocating memory as needed.
You can use ordered sets as an alternative to arrays when the order of elements is important and performance in testing whether an object is contained in the set is a consideration—testing for membership of an array is slower than testing for membership of a set.
Topics
Creating an Ordered Set
Initializing an Ordered Set
init(array:)init(array:copyItems:)init(array:range:copyItems:)init(object:)init(objects:count:)init(orderedSet:)init(orderedSet:copyItems:)init(orderedSet:range:copyItems:)init(set:)init(set:copyItems:)init()
Counting Entries
Accessing Set Members
contains(_:)enumerateObjects(at:options:using:)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:)indexes(options:ofObjectsPassingTest:)objectEnumerator()reverseObjectEnumerator()reversed
Key-Value Coding Support
Key-Value Observing Support
addObserver(_:forKeyPath:options:context:)removeObserver(_:forKeyPath:)removeObserver(_:forKeyPath:context:)