###実現したいこと
WKWebViewを利用して、アプリ内にウェブを表示させたい。
下記URLに記載のAppleのリファレンスから参考にしたコードで作成。
https://qiita.com/aminosan000/items/ae2e9de0e910af42304d
###エラー
しかし、Buildすると、下記のエラーが発生。
3行目のclass AppDelegate〜、にThread 1: signal SIGABRTというエラー
swift
1import UIKit 2@UIApplicationMain 3class AppDelegate: UIResponder, UIApplicationDelegate 4 5 var window: UIWindow? 6 7 func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { 8 // Override point for customization after application launch. 9 return true 10 }
###コード
swift
1import UIKit 2import WebKit 3class ViewController: UIViewController, WKUIDelegate { 4 5 var webView: WKWebView! 6 7 override func loadView() { 8 let webConfiguration = WKWebViewConfiguration() 9 webView = WKWebView(frame: .zero, configuration: webConfiguration) 10 webView.uiDelegate = self 11 view = webView 12 } 13 override func viewDidLoad() { 14 super.viewDidLoad() 15 16 let myURL = URL(string: "https://www.apple.com") 17 let myRequest = URLRequest(url: myURL!) 18 webView.load(myRequest) 19 }}
Storyboardは触ってませんか?