I'm afraid that doesn't work Claude. I get an error that says "Nil is incompatable with return type UITableViewCell." What I've ended up doing is giving the "videoURL" variable in my VideoTableViewCell an URL (documents folder), and this in my controller:
override func numberOfSections(in tableView: UITableView) -> Int{
let videoURLs = try! FileManager.default.contentsOfDirectory(at: docDir, includingPropertiesForKeys: nil)
return videoURLs.count
}
override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return 1
}
override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let videoURLs = try! FileManager.default.contentsOfDirectory(at: docDir, includingPropertiesForKeys: nil)
let cell = self.tableView.dequeueReusableCell(withIdentifier: "cell") as! VideoTableViewCell
cell.videoURL = videoURLs[0] //set to first part of array for testing
cell.setDate()
cell.setTitle()
cell.setImage()
return cell
}
I have no issues with this. If there's no URLs no cells are built, and if there are, it initializes one cell for each URL. Now I'm working on passing each part of the array to the appropriate cell. Thanks guys for all of your help.