Contents

NSMutableSet

A dynamic unordered collection of unique objects.

Declaration

class NSMutableSet

Overview

You can use this type in Swift instead of a Set in cases that require reference semantics.

The NSMutableSet class declares the programmatic interface to a mutable, unordered collection of distinct objects.

The NSCountedSet class, which is a concrete subclass of NSMutableSet, supports mutable sets that can contain multiple instances of the same element. The NSSet class supports creating and managing immutable sets.

NSMutableSet is “toll-free bridged” with its Core Foundation counterpart, CFMutableSet. See Toll-Free Bridging for more information.

Subclassing Notes

There should be little need of subclassing. If you need to customize behavior, it is often better to consider composition instead of subclassing.

Methods to Override

In a subclass, you must override both of its primitive methods:

You must also override the primitive methods of the NSSet class.

Topics

Creating a mutable set

Adding and removing entries

Combining and recombining sets

Initializers