I want to check if the video url works before embedding it into my webView. Because if the user enters a url that doesn't resolve or contain video then the webView will display a whitebox
  // (if MyVariables.link is valid)
  {....
  let Code:NSString = "<iframe width=\(width) height=\(height) src=\(MyVariables.link)  frameborder=\(frame)></iframe>";
  self.wView.loadHTMLString(Code as String, baseURL: nil)
  }
                Check the url by using canOpenURL from UIApplication
 if let url = NSURL(string: yourUrlString) {
    var canOpen = UIApplication.sharedApplication().canOpenURL(url)
 }
                        If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With