79398070

Date: 2025-01-29 20:15:13
Score: 2.5
Natty:
Report link

I was trying to do the same thing (my own text before the newline) and arrived here. To add to @Willeke's suggestion above, I removed the \n I was adding in my string and added my own text one character after the edited range and that did the trick. So if you change your code to:

textStorage.mutableString.insertString("$$$$", atIndex: editedRange.location + 1)

I think that should give you what you're after.

Reasons:
  • Blacklisted phrase (1): trying to do the same
  • Has code block (-0.5):
  • User mentioned (1): @Willeke's
  • Low reputation (1):
Posted by: Jon Hellebuyck