Close and open app and keep the last url visited in iOS webview

I wish to open app with the latest url viewd on a webview ios app. Tryied this inside viewdidload() var hasHistoryUrl = false WebView.evaluateJavaScript("window.location.href") { (result,error)->Void in if (result != nil){ hasHistoryUrl=true } } if (hasHistoryUrl){ // let url = URL(string: historyUrl) } else { let url = URL(string: "https://www.url.com/") let request = URLRequest(url: url!)… Read More Close and open app and keep the last url visited in iOS webview