Untitled
unknown
plain_text
4 years ago
716 B
5
Indexable
func htmlText() -> NSAttributedString { let fontName = ".SFUI-Medium" let htmlString = """ <htlml><head><style>body {font-family:'\(fontName)', -apple-system, sans-serif; font-size: 10pt; line-height: 15pt; color: #333333;} </style></head><body>test String with <a href="https://google.com"> LINK</a> </body></html> """ let htmlData = htmlString.data(using: .utf8)! let html = try! NSAttributedString(data: htmlData, options: [NSAttributedString.DocumentReadingOptionKey.documentType: NSAttributedString.DocumentType.html, NSAttributedString.DocumentReadingOptionKey.characterEncoding: String.Encoding.utf8.rawValue], documentAttributes: nil) return html }
Editor is loading...