Add first-pass view model support to collection node. #trivial (#356)

* Add first-pass view model support for collection node. Much more to come!

* Address issues

* Update the gorram license header

* Dear lord
This commit is contained in:
Adlai Holler
2017-06-12 16:50:33 -07:00
committed by GitHub
parent c297060113
commit 83111de0cc
12 changed files with 203 additions and 42 deletions

View File

@@ -418,6 +418,17 @@ NS_ASSUME_NONNULL_BEGIN
*/
- (nullable __kindof ASCellNode *)nodeForItemAtIndexPath:(NSIndexPath *)indexPath AS_WARN_UNUSED_RESULT;
/**
* Retrieves the view-model for the item at the given index path, if any.
*
* @param indexPath The index path of the requested item.
*
* @return The view-model for the given item, or @c nil if no item exists at the specified path or no view-model was provided.
*
* @warning This API is beta and subject to change. We'll try to provide an easy migration path.
*/
- (nullable id)viewModelForItemAtIndexPath:(NSIndexPath *)indexPath AS_WARN_UNUSED_RESULT;
/**
* Retrieve the index path for the item with the given node.
*
@@ -503,6 +514,17 @@ NS_ASSUME_NONNULL_BEGIN
*/
- (NSInteger)numberOfSectionsInCollectionNode:(ASCollectionNode *)collectionNode;
/**
* --BETA--
* Asks the data source for a view-model for the item at the given index path.
*
* @param collectionNode The sender.
* @param indexPath The index path of the item.
*
* @return An object that contains all the data for this item.
*/
- (nullable id)collectionNode:(ASCollectionNode *)collectionNode viewModelForItemAtIndexPath:(NSIndexPath *)indexPath;
/**
* Similar to -collectionNode:nodeForItemAtIndexPath:
* This method takes precedence over collectionNode:nodeForItemAtIndexPath: if implemented.