CollectionViewProvider
public class CollectionViewProvider : CollectionViewResultsProxy
A helper object to easily track changes reported by a ResultsController and apply them to a CollectionView
-
When set as the delegate
Declaration
Swift
public unowned let collectionView: CollectionView
-
If true, a cell will be inserted when a section becomes empty
Discussion
When displaying sections within a CollectionView, it can be helpful to fill empty sections with a placholder cell. This causes an issue when responding to updates from a results controller. For example, when an object is inserted into an empty section, the results controller will report a single insert change. The CollectionView though would need to remove the exisitng cell AND insert the new one.
Setting hasEmptySectionPlaceholders to true, will report changes as such, making it easy to propagate the reported changes to a CollectionView.
Declaration
Swift
public var populateEmptySections: Bool
-
If true, a cell will be inserted when a collection view becomes completely empty
Discussion
When displaying sections within a CollectionView, it can be helpful to display a cell representing the empty state. This causes an issue when responding to updates from a results controller. For example, when the last section is removed from a data source (i.e. ResultsController), the controller will report a single remove change. The CollectionView though would need to remove those cells AND insert the new one to act as the palceholder.
Setting populateWhenEmpty to true, will report changes as such, making it easy to propagate the reported changes to a CollectionView.
Declaration
Swift
public var populateWhenEmpty: Bool
-
Declaration
Swift
public func controllerDidLoadContent(controller: ResultsController)
-
Declaration
Swift
public func controllerWillChangeContent(controller: ResultsController)
-
Declaration
Swift
public func controller(_ controller: ResultsController, didChangeObject object: Any, at indexPath: IndexPath?, for changeType: ResultsControllerChangeType)
-
Declaration
Swift
public func controller(_ controller: ResultsController, didChangeSection section: Any, at indexPath: IndexPath?, for changeType: ResultsControllerChangeType)
-
Declaration
Swift
public func controllerDidChangeContent(controller: ResultsController)