'How can NSAttributedString in iOS 15 have " no member 'rtf' "?
According to Apple Documentation, from iOS 3.2, NSAttributedString has a method rtf, defined as:
var attrText : NSAttributedString = textView.attributedText!
var docAttr = [NSAttributedString.DocumentAttributeKey : Any]()
let rtfData = attrText.rtf(
from: NSMakeRange(0, attrText.length),
documentAttributes: docAttr)
print(String(data: rtfData, encoding: .utf8) ?? "no data")
However, in my iOS 15 class (which imports UIKit), in XCode 13.2, when I try to access the method XCode warns me "Value of type 'NSAttributedString' has no member 'rtf'.
What's going on?
(Please see attached images).
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|


