brandenr / Attributed

Convert HTML or XML to an NSAttributedString.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Attributed

Pod Version Pod License Pod Platform Build Status

Convert HTML or XML to an NSAttributedString.

Installation

Install with CocoaPods by adding the following to your Podfile:

use_frameworks!

pod 'Attributed'

Then run:

pod install

Usage

import Attributed

let html = "Waltz, <em>bad nymph</em>, for quick jigs <span class=\"bold\">vex</span>."

let baseFont = UIFont.preferredFontForTextStyle(UIFontTextStyleBody)
let modifier = modifierWithBaseAttributes([NSFontAttributeName: baseFont], modifiers: [
	selectMap("em", italic),
	selectMap("span.bold", bold),
])

let attributedString = NSAttributedString.attributedStringFromMarkup(html, modifier)

License

Attributed is released under the MIT license. See LICENSE for details.

About

Convert HTML or XML to an NSAttributedString.

License:MIT License


Languages

Language:Swift 90.9%Language:Objective-C 6.1%Language:Ruby 3.0%