Create NSAttributedString from HTML in iOS 7

With the release of iOS 7, Apple introduced the method below in the NSAttributedString UIKit Additions:

initWithFileURL:options:documentAttributes:error:

With this little gem you can create an NSAttributedString from data retrieved via URL, and using a document attribute of NSDocumentTypeDocumentAttribute, generate the string from HTML.

Let’s look at an example:

Continue reading