1 class ViewController:UIViewController,
UIWebViewDelegate {
2
3 override func viewDidLoad() {
4 super.viewDidLoad()
5 // Do any additional setup after loading the view,
typically from a nib.
6
7 let bounds = UIScreen.main.bounds
8 let frame = CGRect(x:0, y:0, width:bounds.width,
height:bounds.height)
9 let webView = UIWebView(frame:frame)
10 webView.delegate = self
11 webView.backgroundColor = UIColor.clear
12
13 let url = URL(string:“https://www.apple.com/”)
14 let urlRequest = NSURLRequest(url:url!)
15 webView.loadRequest(urlRequest as URLRequest)
16
17 self.view.addSubview(webView)
18 }
19
20 func webViewDidStartLoad(_ webView:UIWebView)
{
21
UIApplication.shared.isNetworkActivityIndicatorVisible =
true
22 }
23
24 func webViewDidFinishLoad(_ webView:UIWebView)
{
25
UIApplication.shared.isNetworkActivityIndicatorVisible =
false
26 }
27 }