Closed avnerbarr closed 7 years ago
Our legacy datasource actually allows certain index paths to be handled by another object. This is the role of the decider: https://github.com/facebook/componentkit/blob/298d700b6a8e5b2ce30a7c2c35f4e4cc40371327/ComponentKit/DataSources/Common/CKComponentDataSource.h#L51
There's growing interest in replicating this behavior in the transactional datasource, since people seem to need it for conversions. For now you can use the legacy datasource.
Is there an example for using this type of datasource?
There's growing interest in replicating this behavior in the transactional datasource, since people seem to need it for conversions. For now you can use the legacy datasource.
Unfortunately I just removed the deprecated CKComponentDataSource
. The decider functionality was purposely lifted out of its replacement, the transactional data source, so it now becomes the responsibility of the UITableView
or UICollectionView
component data source layer above.
@avnerbarr when using the transactional data source you can mimic the behavior of the decider by implementing a simple fallback mechanism. Internally we do something like this when our collection view requests a cell:
To make things a bit easier I can spend some time implementing similar functionality in CKCollectionViewTransactionalDataSource
. That way it can either be used out-of-the-box or as an example for those rolling their own component data sources.
Do you have an example I can reference? I'm having problems getting this formula to work.
@avnerbarr I don't have any specific examples readily available. What problems are you running into?
Alright, just to summarize:
I have existing table view / table view cells etc. using plain UIView layout.
I'm now at the point where I need to add new UI (cells) to the existing list and would like to leverage components for that.
I've read the "dive deeper" documentation regarding UITableView et.al but I'm not clear how I can use my existing table view datasource in tandem with the CKComponentDataSource.
Obviously the indexpaths and "source of truth" aren't the same in this case.
Is there a way to mix and match?