Created
July 31, 2017 16:53
-
-
Save andrewweaver/4a0e13245f185e8f31ba812b91f7dddd to your computer and use it in GitHub Desktop.
WKWebView View Controller
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import UIKit | |
import WebKit | |
class ViewController: UIViewController, WKUIDelegate { | |
var webView: WKWebView! | |
// Instantiate the web view | |
override func loadView() { | |
let webConfiguration = WKWebViewConfiguration() | |
webView = WKWebView(frame: .zero, configuration: webConfiguration) | |
webView.uiDelegate = self | |
view = webView | |
} | |
override func viewDidLoad() { | |
super.viewDidLoad() | |
let url = URL(string: "https://www.google.com") | |
let request = URLRequest(url: url!) | |
webView.load(request) | |
} | |
override func didReceiveMemoryWarning() { | |
super.didReceiveMemoryWarning() | |
// Dispose of any resources that can be recreated. | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment