Я запутался с sectionNameKeyPath, потому что tableViewCell не разделены sectionNameKeyPath fetchResultsController.Надеясь на ваш ответ, спасибо заранее.
Таблица основных данных имеет свойство "ctype" для хранения "0" или "1" ![enter image description here](https://i.stack.imgur.com/kYvzP.png)
, а UITableViewController имеет значениевот так:
func configureCell(_ cell: UITableViewCell, withCate catalog:Cate) {
cell.textLabel!.text = catalog.emoji! + catalog.citem! + catalog.ctype.description
}
override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: "Cell", for: indexPath)
let cataitem = fetchedResultsController.object(at: indexPath)
configureCell(cell, withCate:cataitem)
return cell
}
и fetchResultsController просто так:
let aFetchedResultsController = NSFetchedResultsController(fetchRequest: fetchRequest, managedObjectContext: self.viewContext, sectionNameKeyPath: "ctype", cacheName: "Money")
но объекты FetchResultController не разделены ctype.![enter image description here](https://i.stack.imgur.com/yt0eN.png)