<!--
{
  "availability" : [
    "iOS: 15.0.0 -",
    "iPadOS: 15.0.0 -",
    "macCatalyst: 15.0.0 -",
    "tvOS: 15.0.0 -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "UIKit",
  "identifier" : "/documentation/UIKit/NSTextStorageObserving/processEditing(for:edited:range:changeInLength:invalidatedRange:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "UIKit"
    ],
    "preciseIdentifier" : "c:objc(pl)NSTextStorageObserving(im)processEditingForTextStorage:edited:range:changeInLength:invalidatedRange:"
  },
  "title" : "processEditing(for:edited:range:changeInLength:invalidatedRange:)"
}
-->

# processEditing(for:edited:range:changeInLength:invalidatedRange:)

Notifies the observer that the text storage has been edited.

```
func processEditing(for textStorage: NSTextStorage, edited editMask: NSTextStorage.EditActions, range newCharRange: NSRange, changeInLength delta: Int, invalidatedRange invalidatedCharRange: NSRange)
```

## Parameters

`textStorage`

The text storage that was edited.

`editMask`

The type of edit.

`newCharRange`

The range of characters that changed.

`delta`

The change in length.

`invalidatedCharRange`

The full invalidated range including attribute fixing.

## Discussion

The `newCharRange` is the range in the final string which was explicitly
edited. The `invalidatedRange` includes portions that changed as a result of
attribute fixing — it is either equal to `newCharRange` or larger.
Controllers should not change the contents of the text storage during the
execution of this message.

---

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)