I have a URL stored in my database that plays a video for a product. I have successfully parsed my JSON so that I have my URL being pulled from my Model. I don't have any errors but my WebView is also blank. I am not sure if my method is working correctly with my Web Kit View. I have found little to no information on how to find a solution for this process in OS X. Any help would be greatly appreciated.
import Cocoa
import WebKit
class ProductDetail: NSViewController {
@IBOutlet weak var mainVideo: WebView!
var buildProductDetail: ProductModel? {
didSet{
setupAppVideo()
}
}
override func viewDidLoad() {
super.viewDidLoad()
}
func setupAppVideo(){
if let appVideoURL = buildProductDetail?.product_video {
let url = NSURL(string: appVideoURL)
URLSession.shared.dataTask(with: url! as URL,completionHandler:{(data,response,error) in
if error != nil {
print(error)
return
}
self.mainVideo.webPlugInMainResourceDidReceive(data!)
}).resume()
}
}
}