<!--
{
  "availability" : [
    "iOS: -",
    "iPadOS: -",
    "macCatalyst: -",
    "macOS: -",
    "tvOS: -",
    "visionOS: -",
    "watchOS: -"
  ],
  "documentType" : "symbol",
  "framework" : "CoreFoundation",
  "identifier" : "/documentation/CoreFoundation/CFMutableSet",
  "metadataVersion" : "0.1.0",
  "role" : "Class",
  "symbol" : {
    "kind" : "Class",
    "modules" : [
      "Core Foundation"
    ],
    "preciseIdentifier" : "c:@T@CFMutableSetRef"
  },
  "title" : "CFMutableSet"
}
-->

# CFMutableSet

```
class CFMutableSet
```

## Overview

CFMutableSet manages dynamic sets. The basic interface for managing sets is provided by [`CFSet`](/documentation/CoreFoundation/CFSet). CFMutableSet adds functions to modify the contents of a set.

You create a mutable set object using either the [`CFSetCreateMutable(_:_:_:)`](/documentation/CoreFoundation/CFSetCreateMutable(_:_:_:)) or [`CFSetCreateMutableCopy(_:_:_:)`](/documentation/CoreFoundation/CFSetCreateMutableCopy(_:_:_:)) function.

CFMutableSet provides several functions for adding and removing values from a set. The [`CFSetAddValue(_:_:)`](/documentation/CoreFoundation/CFSetAddValue(_:_:)) function adds a value to a set and [`CFSetRemoveValue(_:_:)`](/documentation/CoreFoundation/CFSetRemoveValue(_:_:)) removes a value from a set.

CFMutableSet is “toll-free bridged” with its Cocoa Foundation counterpart, <doc://com.apple.documentation/documentation/Foundation/NSMutableSet>. What this means is that the Core Foundation type is interchangeable in function or method calls with the bridged Foundation object. This means that in a method where you see an `NSMutableSet *` parameter, you can pass in a `CFMutableSetRef`, and in a function where you see a `CFMutableSetRef` parameter, you can pass in an NSMutableSet instance. This also applies to concrete subclasses of NSMutableSet. See [Toll-Free Bridged Types](https://developer.apple.com/library/archive/documentation/CoreFoundation/Conceptual/CFDesignConcepts/Articles/tollFreeBridgedTypes.html#//apple_ref/doc/uid/TP40010677) for more information on toll-free bridging.

## Topics

### CFMutableSet Miscellaneous Functions

[`CFSetAddValue(_:_:)`](/documentation/CoreFoundation/CFSetAddValue(_:_:))

Adds a value to a CFMutableSet object.

[`CFSetCreateMutable(_:_:_:)`](/documentation/CoreFoundation/CFSetCreateMutable(_:_:_:))

Creates an empty CFMutableSet object.

[`CFSetCreateMutableCopy(_:_:_:)`](/documentation/CoreFoundation/CFSetCreateMutableCopy(_:_:_:))

Creates a new mutable set with the values from another set.

[`CFSetRemoveAllValues(_:)`](/documentation/CoreFoundation/CFSetRemoveAllValues(_:))

Removes all values from a CFMutableSet object.

[`CFSetRemoveValue(_:_:)`](/documentation/CoreFoundation/CFSetRemoveValue(_:_:))

Removes a value from a CFMutableSet object.

[`CFSetReplaceValue(_:_:)`](/documentation/CoreFoundation/CFSetReplaceValue(_:_:))

Replaces a value in a CFMutableSet object.

[`CFSetSetValue(_:_:)`](/documentation/CoreFoundation/CFSetSetValue(_:_:))

Sets a value in a CFMutableSet object.

## See Also

  [Collections Programming Topics for Core Foundation](https://developer.apple.com/library/archive/documentation/CoreFoundation/Conceptual/CFCollections/CFCollections.html#//apple_ref/doc/uid/10000124i)



---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)