DataProvider
public protocol DataProvider : AnyObject
DataProvider provides data in a way which is related to UITableViewDataSource or UICollectionViewDataSource.
It is generic over Object, which is the kind of data it provides.
See also
AnyDataProvider
-
Element is the kind of data
DataProviderprovides.Declaration
Swift
associatedtype Element -
An observable where one can subscribe to changes of data provider.
Declaration
Swift
var observable: DataProviderObservable { get } -
Returns an object for a given index path.
Declaration
Swift
func object(at indexPath: IndexPath) -> ElementParameters
indexPaththe index path to get the object for.
Return Value
the object at the given index path.
-
Returns the number of items in a given section.
Declaration
Swift
func numberOfItems(inSection section: Int) -> IntParameters
sectionthe section.
Return Value
number of items in the given section.
-
Return the number of sections.
Declaration
Swift
func numberOfSections() -> IntReturn Value
the number of sections.
-
safeAccessToObject(at:Extension method) Returns an object for a given index path. If the index path is out of range,
nilgets returned.Declaration
Swift
public func safeAccessToObject(at indexPath: IndexPath) -> Element?Parameters
indexPaththe index path to get the object for.
Return Value
the object at the given index path.
-
lazyTransform(_:Extension method) Lazy transforms the content with a given closure into a new data provider.
See also
Declaration
Swift
public func lazyTransform<TargetType>(_ transform: @escaping (Element) -> TargetType) -> LazyTransformationDataProvider<TargetType>Parameters
transformthe closure which transforms the element into the target value
Return Value
a
LazyTransformationDataProviderwhich provides newly transformed objects.
View on GitHub
DataProvider Protocol Reference