SwiftUI: Tabview, keep state when changing tab : <p>I create an application, with several tabs, for each tab there is a webview.</p>

<p>My webview:</p>

<pre><code>struct WebView : UIViewRepresentable {

    let request: URLRequest


    func makeUIView(context: Context) -&gt; WKWebView  {
        return WKWebView()
    }

    func updateUIView(_ uiView: WKWebView, context: Context) {
        uiView.load(request)
    }

}
</code></pre>

<p>The problem when im changing tab, the web view recreate again. I want create the webviews only once, then every time I change tab, it keeped state And webview will not recharge each time</p>

<p>My code:</p>

<pre><code>struct ContentView: View {

    var body: some View {
        TabView {
            WebView(request: URLRequest(url: URL(string: "https://www.google.com/")!))
                    .tabItem {
                        Image(systemName: "1.circle")
                        Text("Messenger")
                    }.tag(0)

            WebView(request: URLRequest(url: URL(string: "https://facebook.com/login")!))
                    .tabItem {
                        Image(systemName: "2.circle")
                        Text("Trello")
                    }.tag(1)
        }
    }

}
</code></pre>
