DecodeHTML
DecodeHTML copied to clipboard
A String extension to decode HTML entities to string
DecodeHTML
Simply convert HTML to readable strings or attributed string in Swift!
Installation
Installation can be done via Swift Package Manager or by dragging Sources/DecodeHTML into your project.
dependencies: [
.package(url: "https://github.com/flowbe/DecodeHTML.git", .upToNextMajor(from: "1.0.0"))
]
Usage
This package adds 2 properties to String.
htmlToString:
let myHtmlString = "C’est la France"
print("\(myHtmlString.htmlToString)") // prints "C'est la France"
htmlToAttributedString:
let myHtmlString = "C’est la France"
let label = UILabel()
label.attributedText = myHtmlString.htmlToAttributedString