Skip to content
This repository has been archived by the owner on Feb 2, 2023. It is now read-only.

Commit

Permalink
Put back a couple methods
Browse files Browse the repository at this point in the history
  • Loading branch information
Adlai Holler committed Oct 14, 2016
1 parent 70cd643 commit 7313ca8
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 9 deletions.
28 changes: 19 additions & 9 deletions AsyncDisplayKit/ASCollectionNode.h
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,17 @@ NS_ASSUME_NONNULL_BEGIN
*/
- (void)performBatchAnimated:(BOOL)animated updates:(nullable __attribute((noescape)) void (^)())updates completion:(nullable void (^)(BOOL finished))completion;

/**
* Perform a batch of updates asynchronously, optionally disabling all animations in the batch. This method must be called from the main thread.
* The data source must be updated to reflect the changes before the update block completes.
*
* @param updates The block that performs the relevant insert, delete, reload, or move operations.
* @param completion A completion handler block to execute when all of the operations are finished. This block takes a single
* Boolean parameter that contains the value YES if all of the related animations completed successfully or
* NO if they were interrupted. This parameter may be nil. If supplied, the block is run on the main thread.
*/
- (void)performBatchUpdates:(nullable __attribute((noescape)) void (^)())updates completion:(nullable void (^)(BOOL finished))completion;

/**
* Inserts one or more sections.
*
Expand Down Expand Up @@ -241,6 +252,14 @@ NS_ASSUME_NONNULL_BEGIN
*/
- (void)reloadDataWithCompletion:(nullable void (^)())completion;


/**
* Reload everything from scratch, destroying the working range and all cached nodes.
*
* @warning This method is substantially more expensive than UICollectionView's version.
*/
- (void)reloadData;

#pragma mark - Querying Data

/**
Expand Down Expand Up @@ -301,15 +320,6 @@ NS_ASSUME_NONNULL_BEGIN

@interface ASCollectionNode (Deprecated)

/**
* Reload everything from scratch, destroying the working range and all cached nodes.
*
* @warning This method is substantially more expensive than UICollectionView's version.
*
* @deprecated This method is deprecated in 2.0. Use @c reloadDataWithCompletion: instead.
*/
- (void)reloadData ASDISPLAYNODE_DEPRECATED;

/**
* Reload everything from scratch, destroying the working range and all cached nodes.
*
Expand Down
18 changes: 18 additions & 0 deletions AsyncDisplayKit/ASTableNode.h
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,13 @@ NS_ASSUME_NONNULL_BEGIN
*/
- (void)reloadDataWithCompletion:(nullable void (^)())completion;

/**
* Reload everything from scratch, destroying the working range and all cached nodes.
*
* @warning This method is substantially more expensive than UITableView's version.
*/
- (void)reloadData;

/**
* Perform a batch of updates asynchronously, optionally disabling all animations in the batch. This method must be called from the main thread.
* The data source must be updated to reflect the changes before the update block completes.
Expand All @@ -104,6 +111,17 @@ NS_ASSUME_NONNULL_BEGIN
*/
- (void)performBatchAnimated:(BOOL)animated updates:(nullable __attribute((noescape)) void (^)())updates completion:(nullable void (^)(BOOL finished))completion;

/**
* Perform a batch of updates asynchronously, optionally disabling all animations in the batch. This method must be called from the main thread.
* The data source must be updated to reflect the changes before the update block completes.
*
* @param updates The block that performs the relevant insert, delete, reload, or move operations.
* @param completion A completion handler block to execute when all of the operations are finished. This block takes a single
* Boolean parameter that contains the value YES if all of the related animations completed successfully or
* NO if they were interrupted. This parameter may be nil. If supplied, the block is run on the main thread.
*/
- (void)performBatchUpdates:(nullable __attribute((noescape)) void (^)())updates completion:(nullable void (^)(BOOL finished))completion;

/**
* Blocks execution of the main thread until all section and row updates are committed. This method must be called from the main thread.
*/
Expand Down
10 changes: 10 additions & 0 deletions AsyncDisplayKit/ASTableNode.mm
Original file line number Diff line number Diff line change
Expand Up @@ -282,13 +282,23 @@ - (void)reloadDataWithCompletion:(void (^)())completion
[self.view reloadDataWithCompletion:completion];
}

- (void)reloadData
{
[self reloadDataWithCompletion:nil];
}

- (void)performBatchAnimated:(BOOL)animated updates:(void (^)())updates completion:(void (^)(BOOL))completion
{
[self.view beginUpdates];
updates();
[self.view endUpdatesAnimated:animated completion:completion];
}

- (void)performBatchUpdates:(void (^)())updates completion:(void (^)(BOOL))completion
{
[self performBatchAnimated:YES updates:updates completion:completion];
}

- (void)insertSections:(NSIndexSet *)sections withRowAnimation:(UITableViewRowAnimation)animation
{
[self.view insertSections:sections withRowAnimation:animation];
Expand Down

0 comments on commit 7313ca8

Please sign in to comment.