С
Size: a a a
ВР
GM
MG
v
let content: UITextView = {
let c = UITextView()
c.isEditable = false
c.font = UIFont.systemFont(ofSize: 15)
c.textColor = Color.text
c.textContainer.maximumNumberOfLines = 0
c.textContainer.lineBreakMode = .byWordWrapping
c.isScrollEnabled = false
c.dataDetectorTypes = .link
return c
}()
@objc func configure(text: String) {
do {
let str = try NSAttributedString (data: Data(text.utf8), options: [.documentType: NSAttributedString.DocumentType.html, .characterEncoding: String.Encoding.utf8.rawValue], documentAttributes: nil)
let mStr = NSMutableAttributedString(attributedString: str)
let strRange = NSRange.init(location: 0, length: str.length);
mStr.removeAttribute(.font, range: strRange)
mStr.addAttribute(.font, value: UIFont.systemFont(ofSize: 15), range: strRange)
content.attributedText = mStr
content.linkTextAttributes = [.foregroundColor: Color.primaryDark, .underlineStyle: 0]
} catch {
content.text = text
}
}