Using this code to convert Attributed string into Data for making a pasteboard item.
extension NSAttributedString {
var convertToData: Data? {
let options: [NSAttributedString.DocumentAttributeKey: Any] = [
.documentType: NSAttributedString.DocumentType.rtfd,
.characterEncoding: String.Encoding.utf8 ]
let range = NSRange(location: 0, length: length)
return try? data(from: range, documentAttributes: options)
}
In the MacCatalyst, Whenever the user copy something with ctrl + c key commands, data is sent to pasteboard by its own method
func copy()
method. Even overriding copy() method isn't helping.
Using this code to convert Attributed string into Data for making a pasteboard item.
extension NSAttributedString {
var convertToData: Data? {
let options: [NSAttributedString.DocumentAttributeKey: Any] = [
.documentType: NSAttributedString.DocumentType.rtfd,
.characterEncoding: String.Encoding.utf8 ]
let range = NSRange(location: 0, length: length)
return try? data(from: range, documentAttributes: options)
}
In the MacCatalyst, Whenever the user copy something with ctrl + c key commands, data is sent to pasteboard by its own method
func copy()
method. Even overriding copy() method isn't helping.