UICollectionView + NSFetchedResultsController in Swift 3

社会主义新天地 提交于 2019-12-06 15:37:05

Thank you Pawel, your Gist was very helpful. I forked it and updated it to fully support Swift 3 and iOS10. Since it doesn't solved the problem with updating the UICollectionView from a background thread.

The error is caused by updating the UICollectionView from a background thread.

This application is modifying the autolayout engine from a background thread after the engine was accessed from the main thread.

To get a combination of NSFetchedResultsController and UICollectionView working you have to wrap every update of the collectionView object inside

DispatchQueue.main.async {
    // i.e. insertion of new items                          
    this.collectionView!.insertItems(at: [newIndexPath!])
}

Here is a link to the full updated Gist

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!