randombits
randombits

Reputation: 48490

Append content to WKWebView in iOS 10

I am looking to periodically continuing appending HTML to my WKWebView. Think of a chat room. Every time a line of chat comes in, I add an additional line of content to the view. I found the following method:

func loadHTMLString(_ string: String, 
            baseURL: URL?) -> WKNavigation?

This seems to be a one time load, however. I don't want to overwrite the content I have in my WKWebView. Instead I want to continue appending data to it as it becomes available.

What's the best way of going about that?

Upvotes: 1

Views: 457

Answers (1)

matt
matt

Reputation: 536026

The simplest way is to call evaluateJavaScript. This allows you to modify the DOM in real time.

Upvotes: 3

Related Questions