0

I'm trying to make a web view to load an URL.

import UIKit class ViewController: UIViewController, WKNavigationDelegate{ @IBOutlet weak var webView: WKWebView! @IBOutlet weak var statusLabel: UILabel! @IBOutlet weak var activityIndicator: UIActivityIndicatorView! override func viewDidLoad() { super.viewDidLoad() // Do any additional setup after loading the view. } @IBAction func loadButtonPressed(_ sender: UIButton) { if let url = URL(string: "https://www.google.com") { let urlRequest = URLRequest(url: url) webView.load(URLRequest) } } } 

It shows Use of undeclared type 'WKNavigationDelegate'. I can't find what's go wrong. How can I fix it? Do I miss something?

1 Answer 1

4

OK I fix it.

I have to do import WebKit first

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.