Here is my code:
override func viewDidAppear(animated: Bool) {
if let vid = self.selectedVideo {
self.titleLabel.text = vid.videoTitle
self.descriptionLabel.text = vid.videoDescription
let width = self.view.frame.size.width
let height = width/320 * 180
let videoEmbedString = "<html><head><style type=\"text/css\">body {background-color: transparent;color: white;}</style></head><body style=\"margin:0\"><iframe frameBorder=\"0\" height=\"" + String(height) + "\" width=\"" + String(width) + "\" src=\"http://www.youtube.com/embed/" + vid.videoId + "?showinfo=0&modestbranding=1&frameborder=0&rel=0\"></iframe></body></html>"
self.webView.loadHTMLString(videoEmbedString, baseURL: nil)
}
}
I have problems on the last line:
fatal error: unexpectedly found nil while unwrapping an Optional value (lldb)