Skip to content

Instantly share code, notes, and snippets.

@artygus
Created December 1, 2017 21:39
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 artygus/036714dc69cf538abe185d7f8ae19ada to your computer and use it in GitHub Desktop.
Save artygus/036714dc69cf538abe185d7f8ae19ada to your computer and use it in GitHub Desktop.
import UIKit
class ViewController: UIViewController {
@IBOutlet weak var myWebView: UIWebView!
@IBOutlet weak var btnSwitch: UIButton!
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view, typically from a nib.
let url = NSURL (string: "https://coub.com");
let requestObj = URLRequest(url: url! as URL);
myWebView.loadRequest(requestObj);
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
@IBAction func kickSwitchBtn(_ sender: Any) {
let webView:UIWebView = UIWebView();
let url = NSURL (string: "https://coub.com");
let requestObj = URLRequest(url: url! as URL);
webView.loadRequest(requestObj);
self.view.addSubview(webView);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment