forked from confirmedcode/Lockdown-iOS
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathWebViewViewController.swift
More file actions
48 lines (39 loc) · 1.23 KB
/
Copy pathWebViewViewController.swift
File metadata and controls
48 lines (39 loc) · 1.23 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
//
// WebViewViewController.swift
// Lockdown
//
// Copyright © 2019 Confirmed Inc. All rights reserved.
//
import WebKit
import UIKit
class WebViewViewController: BaseViewController, WKNavigationDelegate {
@IBOutlet weak var activity: UIActivityIndicatorView!
@IBOutlet weak var webView: WKWebView!
@IBOutlet weak var titleLabel: UILabel!
var url: URL?
var titleLabelText: String = ""
override func viewDidLoad() {
super.viewDidLoad()
if let u = url {
webView.load(URLRequest(url: u))
}
webView.navigationDelegate = self
titleLabel.text = titleLabelText
}
func webView(_ webView: WKWebView, didFinish navigation: WKNavigation!) {
if (webView.isLoading == false) {
self.activity.stopAnimating()
}
}
func webView(_ webView: WKWebView, didStartProvisionalNavigation navigation: WKNavigation!) {
self.activity.startAnimating()
}
@IBAction func safariTapped(_ sender: Any) {
if let u = url {
UIApplication.shared.open(u, options: [:], completionHandler: nil)
}
}
@IBAction func dismiss() {
self.dismiss(animated: true, completion: nil)
}
}