[Documentation] Improve ASCollectionView docs. (#2317)

* Improve ASCollectionView docs.

* Move note to @note.

* Hannah comments
This commit is contained in:
Garrett Moon
2016-10-05 17:16:53 -07:00
committed by appleguy
parent 23d1b00a46
commit 409c14890d

View File

@@ -27,29 +27,59 @@ NS_ASSUME_NONNULL_BEGIN
/**
* Asynchronous UICollectionView with Intelligent Preloading capabilities.
*
* ASCollectionNode is recommended over ASCollectionView. This class exists for adoption convenience.
*
* ASCollectionView is a true subclass of UICollectionView, meaning it is pointer-compatible
* @discussion ASCollectionView is a true subclass of UICollectionView, meaning it is pointer-compatible
* with code that currently uses UICollectionView.
*
* The main difference is that asyncDataSource expects -nodeForItemAtIndexPath, an ASCellNode, and
* the sizeForItemAtIndexPath: method is eliminated (as are the performance problems caused by it).
* This is made possible because ASCellNodes can calculate their own size, and preload ahead of time.
*
* @note ASCollectionNode is strongly recommended over ASCollectionView. This class exists for adoption convenience.
*/
@interface ASCollectionView : UICollectionView
/**
* Initializer.
* Initializes an ASCollectionView
*
* @discussion Initializes and returns a newly allocated collection view object with the specified layout.
*
* @param layout The layout object to use for organizing items. The collection view stores a strong reference to the specified object. Must not be nil.
*/
- (instancetype)initWithCollectionViewLayout:(UICollectionViewLayout *)layout;
/**
* Initializes an ASCollectionView
*
* @discussion Initializes and returns a newly allocated collection view object with the specified frame and layout.
*
* @param frame The frame rectangle for the collection view, measured in points. The origin of the frame is relative to the superview in which you plan to add it. This frame is passed to the superclass during initialization.
* @param layout The layout object to use for organizing items. The collection view stores a strong reference to the specified object. Must not be nil.
*/
- (instancetype)initWithFrame:(CGRect)frame collectionViewLayout:(UICollectionViewLayout *)layout;
// The corresponding ASCollectionNode, which exists even if directly allocating & handling the view class.
/**
* Returns the corresponding ASCollectionNode
*
* @return collectionNode The corresponding ASCollectionNode which exists even if directly allocating & handling the view class.
*/
@property (nonatomic, weak, readonly) ASCollectionNode *collectionNode;
/**
* The object that acts as the asynchronous delegate of the collection view
*
* @discussion The delegate must adopt the ASCollectionDelegate protocol. The collection view maintains a weak reference to the delegate object.
*
* The delegate object is responsible for providing size constraints for nodes and indicating whether batch fetching should begin.
*/
@property (nonatomic, weak) id<ASCollectionDelegate> asyncDelegate;
/**
* The object that acts as the asynchronous data source of the collection view
*
* @discussion The datasource must adopt the ASCollectionDataSource protocol. The collection view maintains a weak reference to the datasource object.
*
* The datasource object is responsible for providing nodes or node creation blocks to the collection view.
*/
@property (nonatomic, weak) id<ASCollectionDataSource> asyncDataSource;
/**
@@ -169,6 +199,7 @@ NS_ASSUME_NONNULL_BEGIN
/**
* Triggers a relayout of all nodes.
*
* @discussion This method invalidates and lays out every cell node in the collection view.
*/
- (void)relayoutItems;