When rendering HTML into my view, I have the following part:
struct HTMLStringView: UIViewRepresentable {
let htmlContent: String
func makeUIView(context: Context) -> WKWebView {
return WKWebView()
}
func updateUIView(_ uiView: WKWebView, context: Context) {
let headerString = "<head><meta name='viewport' content='width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=no'></head>"
uiView.loadHTMLString(headerString + htmlContent, baseURL: nil)
}
}
Everything works fine but some problems:
Thx
struct HTMLStringView: UIViewRepresentable {
let htmlContent: String
func makeUIView(context: Context) -> WKWebView {
return WKWebView()
}
func updateUIView(_ uiView: WKWebView, context: Context) {
let headerString = "<head><meta name='viewport' content='width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=no'></head>"
uiView.loadHTMLString(headerString + htmlContent, baseURL: nil)
}
}
Everything works fine but some problems:
If the html is long, It will create an another vertical scrollbar inside my view (so I will have 2 scrollbars)
Font family and size still dont match the original view.
Thx