Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
View Controller for Peekaboo iFrame
import UIKit
class ViewController: UIViewController, UIWebViewDelegate {
@IBOutlet weak var webView: UIWebView!
override func viewDidLoad() {
let url = URL(string: "https://*"); // Replace * with your host
let request = URLRequest(url: url!) as URLRequest;
func webView(_ webView: UIWebView, shouldStartLoadWith request: URLRequest, navigationType: UIWebViewNavigationType) -> Bool {
if navigationType == UIWebViewNavigationType.linkClicked {
if (request.url?.host! == "*"){ // Replace * with your host
return true
} else {!, options: [:], completionHandler: nil)
return false
return true
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment