I have not been able to upload a Nib to my table view, this problem happened with other application I was working on as well, even though I did have some NIb's files working just fine. I have even reinstall Xcode trying to fix the problem. I am register my Nib as follows
let test = "test"
let cellNib = UINib(nibName: test, bundle: nil)
tableView.register(cellNib, forCellReuseIdentifier: test)
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: test, for:indexPath) as! testCell //after this function is called I get a crash
return cell
}
This is part of the message I get from the crash, I do not know if is useful.
'NSInternalInconsistencyException', reason: 'Could not load NIB in bundle: 'NSBundle (loaded)' with name 'tests'' *** First throw call stack: ( 0 CoreFoundation 0x000000010afdab0b __exceptionPreprocess + 171 1 libobjc.A.dylib 0x0000000107b98141 objc_exception_throw + 48 2 CoreFoundation 0x000000010b043625 +[NSException raise:format:] + 197 3 UIKit 0x0000000108b59b24 -[UINib instantiateWithOwner:options:] + 501 4 UIKit 0x00000001088ac567 -[UITableView _dequeueReusableViewOfType:withIdentifier:] + 402 5 UIKit 0x00000001088aca4b -[UITableView dequeueReusableCellWithIdentifier:forIndexPath:] + 71 6 Chaol 0x000000010759ebe9 _TFC5Chaol23QuestionsViewController9tableViewfTCSo11UITableView12cellForRowAtV10Foundation9IndexPath_CSo15UITableViewCell + 153
My .XIB file appears on copy bundle resources.