How to display a HTML file in UITextView?

Hi all,


Does anyone know to to display a HTML file correctly in a UITextView? Currently I am able to display the file in the view but I am not able to encode the HTML so that the tags do not appear in the view. Below is the code that I am using to call the file in the UITextView.


if let filepath = Bundle.main.path(forResource: "test", ofType: "html") {
            do {
                let contents = try String(contentsOfFile: filepath)
                TextView.text = contents
            } catch {
        } else {


This is the output of the code…


Powered by WPeMatico


You may also like...

Comments are closed.