How to create a Web View In swift Ios
import UIKit
// import webkit framework
import WebKit
class ViewController: UIViewController, WKNavigationDelegate {
// view controller inherit from WkNavigation Delegate
// create a object of WkWebview
var webView: WKWebView!
var websites : String?
override func loadView() {
webView = WKWebView()
webView.navigationDelegate = self
view = webView
}
override func viewDidLoad() {
super.viewDidLoad()
// create a url which you want to load in your app
let url = URL(string: "https://" + websites!)!
webView.load(URLRequest(url: url))
webView.allowsBackForwardNavigationGestures = true
}
for any query and want any material to learn more about swift and Ios contact me at : madhavrajverma175@gmail.com
7 views0 comments