No such module 'UIKit'

All I want to do is make the most basic macOS / OS X app that just shows a WKWebView...

import UIKit
import WebKit
class ViewController: UIViewController, WKUIDelegate {

var webView: WKWebView!

override func loadView() {
    let webConfiguration = WKWebViewConfiguration()
    webView = WKWebView(frame: .zero, configuration: webConfiguration)
    webView.uiDelegate = self
    view = webView
override func viewDidLoad() {
    let myURL = URL(string: "https://www.apple.com")
    let myRequest = URLRequest(url: myURL!)

But this shows the error:

No such module 'UIKit'


  • UIKit is for mobile apps, not MacOS apps. You want AppKit.