Attributed 8.1.0

Attributed 8.1.0

TestsTested
LangLanguage SwiftSwift
License MIT
ReleasedLast Release Dec 2019
SPMSupports SPM

Maintained by Hilton Campbell.



  • By
  • Hilton Campbell

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.preferredFont(forTextStyle: .body)
let modifier = modifierWithBaseAttributes([.font: baseFont], modifiers: [
	selectMap("em", Modifiers.italic),
	selectMap("span.bold", Modifiers.bold),
])

let attributedString = NSAttributedString.attributedStringFromMarkup(html, withModifier: modifier)

License

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