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

Recent Posts

See All

How to work with an api in Swift

Create a URl let url = URL(string: " your_url")! Create a URL Session let datatask = URLSession.shared.dataTask(with: url) { (data, response, error) in if let data = data { print(data) }else { p

 

Follow

  • Facebook
  • Instagram
  • LinkedIn
  • Twitter

Contact

Address

VILLAGE-HiRAPUR KALAN
POST-KARANWAS DIBAI

©2020 by ThE RoYaL LaKsHyA.