Skip to content

Instantly share code, notes, and snippets.

@jeksys
Created January 20, 2021 04:37
Show Gist options
  • Save jeksys/fadaab4a9631176a25aabd26bbdb5740 to your computer and use it in GitHub Desktop.
Save jeksys/fadaab4a9631176a25aabd26bbdb5740 to your computer and use it in GitHub Desktop.
import UIKit
import WebKit
class WebViewController: UIViewController, WKNavigationDelegate {
var webView: WKWebView!
private let url: URL
init(title: String, url: URL) {
self.url = url
super.init(nibName: nil, bundle: nil)
self.title = title
}
required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
override func loadView() {
webView = WKWebView()
webView.navigationDelegate = self
view = webView
webView.load(URLRequest(url: url))
navigationController?.navigationBar.isTranslucent = false
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment