swift 3 - How to close open page in a webview?

1

In a, index.html viewcontroller I'm using this code to open a local html file

self.webView = WKWebView(frame: webFrame, configuration: config) self.webView?.uiDelegate = self as? WKUIDelegate self.webView?.navigationDelegate = self self.webView?.scrollView.bounces = false self.container!.addSubview(webView!) let testUrl: URL! = Bundle.main.url(forResource: "index", withExtension: "html", subdirectory: "assets") self.webView!.loadFileURL(testUrl, allowingReadAccessTo: testUrl)

debugging by safari in the Developer > Simulator appears on the open page (index.html) It turns out that every time I exit this viewControler and return it is added in the Developer > Simulator a new page (index.html, index.html, ...). I believe that new pages are opened in new tabs

In the function I use to exit this viewController I use this code

self.webView?.removeFromSuperview() self.container.removeFromSuperview()

the objects are removed but the pages are not, does anyone know how to remove them?

    
asked by anonymous 18.05.2017 / 17:02

0 answers