0

I have text as NSMutableAttributedString and I can save as rtf file. Let say in this text I have marked one line with red background color. I would like to make additional text description for this marked line. How can I save this description into rtf file to be able later to read this description and to display it in the TextView window ?

VYT
  • 1,071
  • 19
  • 35

1 Answers1

1

The NSAttributedString AppKit (MacOS-only) additions includes a couple helpful methods for you:

RTFFromRange(_:documentAttributes:)

RTFDFromRange(_:documentAttributes:)

These API's result in NSData objects that you can write out as RTF files.

Michael Dautermann
  • 88,797
  • 17
  • 166
  • 215