Last active
February 16, 2019 17:06
-
-
Save tempire/717eb132e34471ae28f7aed94d65a17a to your computer and use it in GitHub Desktop.
This file contains hidden or 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
// In the MTR view controller | |
let vc = storyboard.instantiateViewController(withIdentifier: "WebViewController") | |
self.navigationController?.pushViewController(vc, animated: true) | |
// Web View Controller, assuming a matching view controller in the storyboard | |
class WebViewController: UIViewController { | |
@IBOutlet weak var webView = WKWebView() | |
override func viewDidLoad() { | |
super.viewDidLoad() | |
let url = URL(string: "https://whatever") | |
let request = URLRequest(url: url) | |
webView.navigationDelegate = self | |
webView.load(request) | |
// If loading a PDF from disk | |
// webView.loadFileURL(url, allowingReadAccessTo: url) | |
} | |
} | |
extension WebViewController: WKNavigationDelegate { | |
func webView(_ webView: WKWebView, didReceive challenge: URLAuthenticationChallenge, completionHandler: @escaping (URLSession.AuthChallengeDisposition, URLCredential?) -> Void) { | |
completionHandler(.performDefaultHandling, nil) | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment