Skip to content

Instantly share code, notes, and snippets.

@Koze
Last active December 4, 2018 02:38
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Koze/fa268ab18e1a0ac2c239 to your computer and use it in GitHub Desktop.
Save Koze/fa268ab18e1a0ac2c239 to your computer and use it in GitHub Desktop.
NSAttributedString from RTFD document format
UIPasteboard *pboard = [UIPasteboard generalPasteboard];
NSData *data = [pboard valueForPasteboardType:@"com.apple.flat-rtfd"];
NSAttributedString *aString = [[NSAttributedString alloc] initWithData:data
options:@{NSDocumentTypeDocumentAttribute: NSRTFDTextDocumentType}
documentAttributes:nil
error:nil];
NSLog(@"%@", aString);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment