// // ASObjectBasedCollectionDataSource.h // AsyncDisplayKit // // Created by Adlai Holler on 5/16/17. // Copyright © 2017 Facebook. All rights reserved. // #import #import #import @class ASDisplayNode; NS_ASSUME_NONNULL_BEGIN @protocol IGListDiffable @end @protocol ASCopyDiffable @end AS_SUBCLASSING_RESTRICTED @interface ASCollectionData, SectionType: id, ItemType: id> : NSObject @property (atomic, copy, readonly) ObjectType rootObject; @property (atomic, copy, readonly) NSArray *sections; - (NSArray *)itemsInSectionWithID:(id)sectionID; @end @interface ASMutableCollectionData, SectionType: id, ItemType: id> : NSObject @end @interface ASSectionController2, ItemType : id> : NSObject @property (atomic, copy, readonly) NSArray *items; - (void)didUpdateToObject:(ObjectType)object; @end @interface ASCellNode (ObjectHandling) - (BOOL)canUpdateToObject:(id)object; - (void)didUpdateToObject:(id)object; @end AS_SUBCLASSING_RESTRICTED @interface ASCollectionDataRequest> : NSObject @property (atomic, readonly, getter=isCancelled) BOOL cancelled; @end typedef ASDisplayNode *_Nullable(^ASObjectRenderBlock)(id object); AS_SUBCLASSING_RESTRICTED @interface ASObjectRenderer : NSObject @property (class, atomic, strong, readonly) ASObjectRenderer *sharedRenderer; /** * You should call this in the `load` method of your display node subclass. * * @param c The class of objects you can render. * @param block The block that attempts to render the object into a node. */ - (void)addRenderMethodForObjectClass:(nullable Class)c block:(ASObjectRenderBlock)block; /** */ - (nullable ASDisplayNode *)renderObject:(id)object; @end AS_SUBCLASSING_RESTRICTED @interface ASSectionRenderer : NSObject @property (class, atomic, strong, readonly) ASObjectRenderer *sharedRenderer; /** * You should call this in the `load` method of your display node subclass. * * @param c The class of objects you can render. * @param block The block that attempts to render the object into a node. */ - (void)addRenderMethodForObjectClass:(nullable Class)c block:(ASObjectRenderBlock)block; /** */ - (nullable NSArray *)renderObject:(id)object; @end AS_SUBCLASSING_RESTRICTED @interface ASObjectBasedCollectionDataSource, SectionType: id, ItemType: id> : NSObject - (instancetype)initWithCollectionNode:(ASCollectionNode *)collectionNode sourceQueue:(nullable dispatch_queue_t)sourceQueue; @property (nonatomic, weak, readonly) ASCollectionNode *collectionNode; @property (nonatomic, weak) id scrollViewDelegate; @property (nonatomic, copy, nullable) ASCollectionData *(^dataBlock)(ASCollectionDataRequest *request); /** * If this is the main queue (default) the method will be called on the main thread. */ @property (nonatomic, strong, readonly) dispatch_queue_t sourceQueue; /** * @note You can call this inside `+performWithoutAnimation:`. * @note You can call this method from any thread. */ - (void)invalidateWithAnimationCompletion:(void(^)(BOOL finished))animationCompletion; @end NS_ASSUME_NONNULL_END