Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@sturdysturge
Created February 7, 2021 00:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sturdysturge/f6fccfbba0febf8d3a8626eb3af8a497 to your computer and use it in GitHub Desktop.
Save sturdysturge/f6fccfbba0febf8d3a8626eb3af8a497 to your computer and use it in GitHub Desktop.
import SwiftUI
import WebKit
struct WebView: UIViewRepresentable {
let webView = WKWebView()
@Binding var htmlString: String
func makeUIView(context: Context) -> WKWebView {
webView
}
func updateUIView(_ uiView: WKWebView, context: Context) {
webView.loadHTMLString(htmlString, baseURL: nil)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment