使用未声明的类型 'WKNavigationDelegate'

Use of undeclared type 'WKNavigationDelegate'

我正在尝试制作网页视图以加载 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)
        }
    }
}

显示Use of undeclared type 'WKNavigationDelegate'。我找不到哪里出了问题。我该如何解决?我错过了什么吗?

好的,我解决了。

我必须先做 import WebKit