FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Deprecate willDisplayNode:/didEndDisplayingNode: methods · SummerXZX/AsyncDisplayKit@9873f4b · GitHub

Repository navigation

Commit 9873f4b

Browse files
Adlai Holler
committed
Deprecate willDisplayNode:/didEndDisplayingNode: methods
1 parent c129b78 commit 9873f4b

4 files changed

Lines changed: 80 additions & 28 deletions

File tree

‎AsyncDisplayKit/ASCollectionView.h‎

Lines changed: 34 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -430,19 +430,6 @@ NS_ASSUME_NONNULL_BEGIN
430430

431431
@optional
432432

433-
- (void)collectionView:(ASCollectionView *)collectionView willDisplayNodeForItemAtIndexPath:(NSIndexPath *)indexPath;
434-
435-
/**
436-
* Informs the delegate that the collection view did remove the provided node from the view hierarchy.
437-
* This may be caused by the node scrolling out of view, or by deleting the item
438-
* or its containing section with @c deleteItemsAtIndexPaths: or @c deleteSections: .
439-
*
440-
* @param collectionView The sender.
441-
* @param node The node which was removed from the view hierarchy.
442-
* @param indexPath The index path at which the node was located before it was removed.
443-
*/
444-
- (void)collectionView:(ASCollectionView *)collectionView didEndDisplayingNode:(ASCellNode *)node forItemAtIndexPath:(NSIndexPath *)indexPath;
445-
446433
/**
447434
* Receive a message that the collectionView is near the end of its data set and more data should be fetched if
448435
* necessary.
@@ -475,10 +462,43 @@ NS_ASSUME_NONNULL_BEGIN
475462
* Informs the delegate that the collection view did remove the node which was previously
476463
* at the given index path from the view hierarchy.
477464
*
478-
* This method is deprecated. Use @c collectionView:didEndDisplayingNode:forItemAtIndexPath: instead.
465+
* @warning AsyncDisplayKit processes table view edits asynchronously. The index path
466+
* passed into this method may not correspond to the same item in your data source
467+
* if your data source has been updated since the last edit was processed.
468+
*
469+
* This method is deprecated. Use @c visibleStateDidChange: on the cell node instead.
479470
*/
480471
- (void)collectionView:(ASCollectionView *)collectionView didEndDisplayingNodeForItemAtIndexPath:(NSIndexPath *)indexPath ASDISPLAYNODE_DEPRECATED;
481472

473+
/**
474+
* Informs the delegate that the collection view will add the node
475+
* at the given index path to the view hierarchy.
476+
*
477+
* @warning AsyncDisplayKit processes collection view edits asynchronously. The index path
478+
* passed into this method may not correspond to the same item in your data source
479+
* if your data source has been updated since the last edit was processed.
480+
*
481+
* This method is deprecated. Use @c visibleStateDidChange: on the cell node instead.
482+
*/
483+
- (void)collectionView:(ASCollectionView *)collectionView willDisplayNodeForItemAtIndexPath:(NSIndexPath *)indexPath ASDISPLAYNODE_DEPRECATED;
484+
485+
/**
486+
* Informs the delegate that the collection view did remove the provided node from the view hierarchy.
487+
* This may be caused by the node scrolling out of view, or by deleting the item
488+
* or its containing section with @c deleteItemsAtIndexPaths: or @c deleteSections: .
489+
*
490+
* @param collectionView The sender.
491+
* @param node The node which was removed from the view hierarchy.
492+
* @param indexPath The index path at which the node was located before it was removed.
493+
*
494+
* @warning AsyncDisplayKit processes collection view edits asynchronously. The index path
495+
* passed into this method may not correspond to the same item in your data source
496+
* if your data source has been updated since the last edit was processed.
497+
*
498+
* This method is deprecated. Use @c visibleStateDidChange: on the cell node instead.
499+
*/
500+
- (void)collectionView:(ASCollectionView *)collectionView didEndDisplayingNode:(ASCellNode *)node forItemAtIndexPath:(NSIndexPath *)indexPath ASDISPLAYNODE_DEPRECATED;
501+
482502
@end
483503

484504
/**

‎AsyncDisplayKit/ASCollectionView.mm‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -605,9 +605,12 @@ - (void)collectionView:(UICollectionView *)collectionView willDisplayCell:(_ASCo
605605
ASCellNode *cellNode = [cell node];
606606
cellNode.scrollView = collectionView;
607607

608+
#pragma clang diagnostic push
609+
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
608610
if (_asyncDelegateFlags.asyncDelegateCollectionViewWillDisplayNodeForItemAtIndexPath) {
609611
[_asyncDelegate collectionView:self willDisplayNodeForItemAtIndexPath:indexPath];
610612
}
613+
#pragma clang diagnostic pop
611614

612615
[_rangeController visibleNodeIndexPathsDidChangeWithScrollDirection:self.scrollDirection];
613616

@@ -625,10 +628,13 @@ - (void)collectionView:(UICollectionView *)collectionView didEndDisplayingCell:(
625628

626629
ASCellNode *cellNode = [cell node];
627630

631+
#pragma clang diagnostic push
632+
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
628633
if (_asyncDelegateFlags.asyncDelegateCollectionViewDidEndDisplayingNodeForItemAtIndexPath) {
629634
ASDisplayNodeAssertNotNil(cellNode, @"Expected node associated with removed cell not to be nil.");
630635
[_asyncDelegate collectionView:self didEndDisplayingNode:cellNode forItemAtIndexPath:indexPath];
631636
}
637+
#pragma clang diagnostic pop
632638

633639
if ([_cellsForVisibilityUpdates containsObject:cell]) {
634640
[_cellsForVisibilityUpdates removeObject:cell];

‎AsyncDisplayKit/ASTableView.h‎

Lines changed: 34 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -390,19 +390,6 @@ NS_ASSUME_NONNULL_BEGIN
390390

391391
@optional
392392

393-
- (void)tableView:(ASTableView *)tableView willDisplayNodeForRowAtIndexPath:(NSIndexPath *)indexPath;
394-
395-
/**
396-
* Informs the delegate that the table view did remove the provided node from the view hierarchy.
397-
* This may be caused by the node scrolling out of view, or by deleting the row
398-
* or its containing section with @c deleteRowsAtIndexPaths:withRowAnimation: or @c deleteSections:withRowAnimation: .
399-
*
400-
* @param tableView The sender.
401-
* @param node The node which was removed from the view hierarchy.
402-
* @param indexPath The index path at which the node was located before the removal.
403-
*/
404-
- (void)tableView:(ASTableView *)tableView didEndDisplayingNode:(ASCellNode *)node forRowAtIndexPath:(NSIndexPath *)indexPath;
405-
406393
/**
407394
* Receive a message that the tableView is near the end of its data set and more data should be fetched if necessary.
408395
*
@@ -430,14 +417,47 @@ NS_ASSUME_NONNULL_BEGIN
430417
*/
431418
- (BOOL)shouldBatchFetchForTableView:(ASTableView *)tableView;
432419

420+
/**
421+
* Informs the delegate that the table view did remove the provided node from the view hierarchy.
422+
* This may be caused by the node scrolling out of view, or by deleting the row
423+
* or its containing section with @c deleteRowsAtIndexPaths:withRowAnimation: or @c deleteSections:withRowAnimation: .
424+
*
425+
* @param tableView The sender.
426+
* @param node The node which was removed from the view hierarchy.
427+
* @param indexPath The index path at which the node was located before the removal.
428+
*
429+
* @warning AsyncDisplayKit processes table view edits asynchronously. The index path
430+
* passed into this method may not correspond to the same item in your data source
431+
* if your data source has been updated since the last edit was processed.
432+
*
433+
* This method is deprecated. Use @c visibleStateDidChange: on the cell node instead.
434+
*/
435+
- (void)tableView:(ASTableView *)tableView didEndDisplayingNode:(ASCellNode *)node forRowAtIndexPath:(NSIndexPath *)indexPath ASDISPLAYNODE_DEPRECATED;
436+
433437
/**
434438
* Informs the delegate that the table view did remove the node which was previously
435439
* at the given index path from the view hierarchy.
436440
*
437-
* This method is deprecated. Use @c tableView:didEndDisplayingNode:forRowAtIndexPath: instead.
441+
* @warning AsyncDisplayKit processes table view edits asynchronously. The index path
442+
* passed into this method may not correspond to the same item in your data source
443+
* if your data source has been updated since the last edit was processed.
444+
*
445+
* This method is deprecated. Use @c visibleStateDidChange: on the cell node instead.
438446
*/
439447
- (void)tableView:(ASTableView *)tableView didEndDisplayingNodeForRowAtIndexPath:(NSIndexPath *)indexPath ASDISPLAYNODE_DEPRECATED;
440448

449+
/**
450+
* Informs the delegate that the table view will add the node
451+
* at the given index path to the view hierarchy.
452+
*
453+
* @warning AsyncDisplayKit processes table view edits asynchronously. The index path
454+
* passed into this method may not correspond to the same item in your data source
455+
* if your data source has been updated since the last edit was processed.
456+
*
457+
* This method is deprecated. Use @c visibleStateDidChange: on the cell node instead.
458+
*/
459+
- (void)tableView:(ASTableView *)tableView willDisplayNodeForRowAtIndexPath:(NSIndexPath *)indexPath ASDISPLAYNODE_DEPRECATED;
460+
441461
@end
442462

443463
@protocol ASTableViewDelegate <ASTableDelegate>

‎AsyncDisplayKit/ASTableView.mm‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -623,9 +623,12 @@ - (void)tableView:(UITableView *)tableView willDisplayCell:(_ASTableViewCell *)c
623623
ASCellNode *cellNode = [cell node];
624624
cellNode.scrollView = tableView;
625625

626+
#pragma clang diagnostic push
627+
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
626628
if (_asyncDelegateFlags.asyncDelegateTableViewWillDisplayNodeForRowAtIndexPath) {
627629
[_asyncDelegate tableView:self willDisplayNodeForRowAtIndexPath:indexPath];
628630
}
631+
#pragma clang diagnostic pop
629632

630633
[_rangeController visibleNodeIndexPathsDidChangeWithScrollDirection:[self scrollDirection]];
631634

@@ -648,10 +651,13 @@ - (void)tableView:(UITableView *)tableView didEndDisplayingCell:(_ASTableViewCel
648651

649652
[_rangeController visibleNodeIndexPathsDidChangeWithScrollDirection:[self scrollDirection]];
650653

654+
#pragma clang diagnostic push
655+
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
651656
if (_asyncDelegateFlags.asyncDelegateTableViewDidEndDisplayingNodeForRowAtIndexPath) {
652657
ASDisplayNodeAssertNotNil(cellNode, @"Expected node associated with removed cell not to be nil.");
653658
[_asyncDelegate tableView:self didEndDisplayingNode:cellNode forRowAtIndexPath:indexPath];
654659
}
660+
#pragma clang diagnostic pop
655661

656662
if ([_cellsForVisibilityUpdates containsObject:cell]) {
657663
[_cellsForVisibilityUpdates removeObject:cell];

0 commit comments

Comments
 (0)

Back | FazBrowse Home | New Git URL