Skip to content

Instantly share code, notes, and snippets.

@andrewweaver
Created July 31, 2017 16:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save andrewweaver/4a0e13245f185e8f31ba812b91f7dddd to your computer and use it in GitHub Desktop.
Save andrewweaver/4a0e13245f185e8f31ba812b91f7dddd to your computer and use it in GitHub Desktop.
WKWebView View Controller
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