I am calling cellForRowAtindexPath manually in a textFieldShouldReturn from a view controller, and the arguments for cellForRowAtindexPath are tableViewOutlet and indexPath ("index" in this example). Here both cellForRowAtindexPath and tableViewOutlet are from another view controller, I'm calling them by using instance.
Once cellForRowAtindexPath calling it showing error like:
unexpectedly found nil while unwrapping an optional value.
func textFieldShouldReturn(_ textField: UITextField) -> Bool {
textField.resignFirstResponder()
if(textField == carRating){
let rating = Float(textField.text!)
secondInstanceForMyData.masterCarData[index.row].carRating = rating
let _: MyTableViewCell = myViewControllerInstance.tableView(myViewControllerInstance.tableViewWillLoad as UITableView, cellForRowAt: index) as! MyTableViewCell
}
return true
}