Во втором выводит 0.Значит всё что выше вызова
.performFetch()
неверно. Где-то тут var fetchedResultsController = CoreDataManager.instance.fetchedResultsController("Customer", keyForSort: "name")
Как надо, смотрите тут https://developer.apple.com/documentation/coredata... потом проверить все что писал выше. Если всё это не поможет, будем думать дальше. if let ... , guard let ...
https://developer.apple.com/documentation/coredata... func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
if section == 0 {
let sections = fetchedResultsController.sections
return sections![section].numberOfObjects // <-- Cюда брейкпоинт
}
else if section == 1 {
let sections2 = fetchedResultsController2.sections
return sections2![section].numberOfObjects
}
else {
return 1
}
}
, а в консоли e sections.count
, если тут будет ошибка, тогда надо смотреть выше, а там у нас fetchedResultsController. Выведи в методе override func viewDidLoad()
в конце метода print(fetchedResultsController.fetchedObjects?.count)