Home

didModifyRange

DidModifyRange is a method associated with the text system used by Cocoa and Cocoa Touch, primarily within the NSTextStorage class of the Text Kit architecture. It serves as a hook for notifying that a specific portion of the text storage has been changed.

In the text system, edits to a text storage can affect its layout and rendering. didModifyRange provides

The method is generally considered a lower-level notification. It is often used in conjunction with other editing

Practical implications include more efficient rendering and layout updates when only a subset of text changes,

See also: NSTextStorage, NSLayoutManager, NSAttributedString, edited:range:changeInLength:.

a
targeted
signal
indicating
that
the
characters
within
a
given
range
were
modified,
allowing
dependent
components
such
as
layout
managers
to
focus
work
only
on
the
affected
portion
rather
than
performing
a
full
refresh.
The
exact
behavior
is
typically
implemented
by
subclasses
of
NSTextStorage
or
by
components
that
manage
or
observe
text
storage.
APIs,
such
as
the
standard
edited:range:changeInLength:
notifications,
to
coordinate
incremental
updates
across
the
text
system.
The
default
implementation
of
didModifyRange
does
not
impose
any
specific
action,
so
implementations
that
need
to
react
to
range-specific
changes
must
override
it.
avoiding
unnecessary
work
on
unchanged
regions.
Because
didModifyRange
is
tied
to
the
internal
text
system,
it
is
primarily
relevant
to
developers
implementing
custom
text
storage
subclasses
or
extending
text-handling
behavior
rather
than
to
typical
app-level
text
manipulation.