I'm using the code below to show my website in a webview added ?app=ios parameter to the end of the url. But now I want this parameter to be added in all urls on the website. I need to append this somewhere before loading every page. Please guide me through this as I'm a very newbie to swift. Thanks
import UIKit
import WebKit
class ViewController: UIViewController, WKNavigationDelegate, WKUIDelegate {
@IBOutlet var container: UIView!
var webView: WKWebView!
override func viewDidLoad() {
super.viewDidLoad()
webView = WKWebView()
container.addSubview(webView)
self.webView.navigationDelegate = self
self.webView.uiDelegate = self
}
let urlStr = "https://www.website.com/?app=ios"
let url = NSURL(string: urlStr)!
let req = NSURLRequest(url: url as URL)
webView.load(req as URLRequest)
AppDelegate
import UIKit
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
// Override point for customization after application launch.
return true
}
Note: I've checked almost every topic related to this on the website but couldn't find an answer to my need.