title: Reading HTML String using SwiftUI
body: <p>I'm <strong>trying to read HTML formatted content using SwiftUI,</strong> I tried using several different methods to load the HTML string but the string was not displayed. I'm using XCode 11.2.1, I will appreciate your help.</p>
  
  <pre><code>import SwiftUI
  import Combine
  import WebKit
  
  struct SubChapterDetails: View {
      let sentDescription: String
      let webView = WKWebView()
  
      var body: some View {
             VStack {
                 Text("Testing HTML Content")
                 Spacer()
                 HTMLStringView(htmlContent: "&lt;h1&gt;This is HTML String&lt;/h1&gt;")  //It doesn't displays this when the code is executed
                 Spacer()
             }
         }
  }
  
  struct SubChapterDetails_Previews: PreviewProvider {
      static var previews: some View {
          SubChapterDetails(sentDescription: "")
      }
  }
  
  struct HTMLStringView: UIViewRepresentable {
      let htmlContent: String
  
      func makeUIView(context: Context) -&gt; WKWebView {
          return WKWebView()
      }
  
      func updateUIView(_ uiView: WKWebView, context: Context) {
          uiView.loadHTMLString(htmlContent, baseURL: nil)
      }
  }
  </code></pre>