2020-05-08 17:49:14 +10:00
|
|
|
// Copyright © 2020 Australian Government All rights reserved.
|
|
|
|
|
|
|
|
import UIKit
|
|
|
|
|
|
|
|
extension UITextView {
|
|
|
|
func addLink(_ linkString: String, enclosedIn marker: String) {
|
|
|
|
guard let attributedText = attributedText else { return }
|
|
|
|
|
|
|
|
let mutableString = NSMutableAttributedString(attributedString: attributedText)
|
|
|
|
mutableString.addLink(enclosedIn: marker, urlString: linkString)
|
|
|
|
self.attributedText = mutableString
|
|
|
|
tintColor = UIColor.covidSafeColor
|
|
|
|
}
|
2020-07-21 15:42:48 +10:00
|
|
|
|
|
|
|
func parseHTMLLinks() {
|
|
|
|
guard let attributedText = attributedText else { return }
|
|
|
|
|
|
|
|
let mutableString = NSMutableAttributedString(attributedString: attributedText)
|
|
|
|
mutableString.parseHTMLLinks()
|
|
|
|
self.attributedText = mutableString
|
2020-08-03 16:01:39 +10:00
|
|
|
tintColor = UIColor.covidSafeColor
|
2020-07-21 15:42:48 +10:00
|
|
|
}
|
2020-05-08 17:49:14 +10:00
|
|
|
}
|