Currently, I am displaying a webView in my iOS app using Swift. My goal is to retrieve an object from the JavaScript code within the webView. Upon inspecting the console, I discovered that the desired object is named "window.user". However, when attempting to use the provided method, no results are being returned. Is there another approach I should take? Any advice would be greatly appreciated. Thank you.
if let result = self.webView.stringByEvaluatingJavaScript(from: "document.getElementById(‘window.user’)") {
print(result)
}