---
title: invert()
framework: foundation
role: symbol
role_heading: Instance Method
path: foundation/nsmutablecharacterset/invert()
---

# invert()

Replaces all the characters in the receiver with all the characters it didn’t previously contain.

## Declaration

```swift
func invert()
```

## Discussion

Discussion Inverting a mutable character set, whether by invert() or by inverted, is much less efficient than inverting an immutable character set with inverted.

## See Also

### Related Documentation

- [inverted](foundation/nscharacterset/inverted.md)
