Recently, I developed a straightforward application that guides users to a web-based platform. One of the app's pages allows users to search for store stock from various stores by manually inputting the store number or utilizing automatic location detection. After inputting the appropriate barcode, users are directed back to the UIWebView. However, I encountered an obstacle when trying to automatically populate the barcode into a specific div field and execute a JavaScript function. Despite attempting to use evaluatejavascript without much success, I haven't lost hope and seek assistance!
The view controller code is outlined below:
import UIKit
import WebKit
class ViewController: UIViewController {
var webView: WebView
@IBOutlet weak var searchText: UITextField!
required init(coder aDecoder: NSCoder) {
self.webView = WebView()
super.init(coder: aDecoder)!
}
override func viewDidLoad() {
super.viewDidLoad()
view.addSubview(webView)
webView.setPosition(view)
}
// Further actions and functions are defined in the code...