This repository was archived by the owner on Feb 2, 2023. It is now read-only.
File tree Expand file tree Collapse file tree
examples/ASTableViewStressTest/Sample Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -150,7 +150,10 @@ - (instancetype)_initWithFrame:(CGRect)frame collectionViewLayout:(UICollectionV
150150
151151 if (!ownedByNode) {
152152 // See commentary at the definition of .strongCollectionNode for why we create an ASCollectionNode.
153- ASCollectionNode *collectionNode = [[ASCollectionNode alloc ] _initWithCollectionView: self ];
153+ // FIXME: The _view pointer of the node retains us, but the node will die immediately if we don't
154+ // retain it. At the moment there isn't a great solution to this, so we can't yet move our core
155+ // logic to ASCollectionNode (required to have a shared superclass with ASTable*).
156+ ASCollectionNode *collectionNode = nil ; // [[ASCollectionNode alloc] _initWithCollectionView:self];
154157 self.strongCollectionNode = collectionNode;
155158 }
156159
@@ -349,6 +352,11 @@ - (CGSize)calculatedSizeForNodeAtIndexPath:(NSIndexPath *)indexPath
349352 return [[_dataController nodeAtIndexPath: indexPath] calculatedSize ];
350353}
351354
355+ - (NSArray <NSArray <ASCellNode *> *> *)completedNodes
356+ {
357+ return [_dataController completedNodes ];
358+ }
359+
352360- (ASCellNode *)nodeForItemAtIndexPath : (NSIndexPath *)indexPath
353361{
354362 return [_dataController nodeAtIndexPath: indexPath];
Original file line number Diff line number Diff line change @@ -31,8 +31,10 @@ @implementation ASTableNode
3131
3232- (instancetype )_initWithTableView : (ASTableView *)tableView
3333{
34- if (self = [super initWithViewBlock: ^UIView *{ return tableView; }]) {
35- __unused ASTableView *tableView = [self view ];
34+ // Avoid a retain cycle. In this case, the ASTableView is creating us, and strongly retains us.
35+ ASTableView * __weak weakTableView = tableView;
36+ if (self = [super initWithViewBlock: ^UIView *{ return weakTableView; }]) {
37+ __unused __weak ASTableView *view = [self view ];
3638 return self;
3739 }
3840 return nil ;
Original file line number Diff line number Diff line change @@ -198,14 +198,17 @@ - (instancetype)_initWithFrame:(CGRect)frame style:(UITableViewStyle)style dataC
198198 }
199199
200200 if (!dataControllerClass) {
201- dataControllerClass = [self . class dataControllerClass ];
201+ dataControllerClass = [[ self class ] dataControllerClass ];
202202 }
203203
204204 [self configureWithDataControllerClass: dataControllerClass];
205205
206206 if (!ownedByNode) {
207207 // See commentary at the definition of .strongTableNode for why we create an ASTableNode.
208- ASTableNode *tableNode = [[ASTableNode alloc ] _initWithTableView: self ];
208+ // FIXME: The _view pointer of the node retains us, but the node will die immediately if we don't
209+ // retain it. At the moment there isn't a great solution to this, so we can't yet move our core
210+ // logic to ASTableNode (required to have a shared superclass with ASCollection*).
211+ ASTableNode *tableNode = nil ; // [[ASTableNode alloc] _initWithTableView:self];
209212 self.strongTableNode = tableNode;
210213 }
211214
@@ -333,6 +336,11 @@ - (void)setRangeTuningParameters:(ASRangeTuningParameters)tuningParameters
333336 [self setTuningParameters: tuningParameters forRangeType: ASLayoutRangeTypeDisplay];
334337}
335338
339+ - (NSArray <NSArray <ASCellNode *> *> *)completedNodes
340+ {
341+ return [_dataController completedNodes ];
342+ }
343+
336344- (ASCellNode *)nodeForRowAtIndexPath : (NSIndexPath *)indexPath
337345{
338346 return [_dataController nodeAtIndexPath: indexPath];
Original file line number Diff line number Diff line change @@ -117,6 +117,8 @@ NS_ASSUME_NONNULL_BEGIN
117117
118118- (ASDisplayNode *)rangeController : (ASRangeController *)rangeController nodeAtIndexPath : (NSIndexPath *)indexPath ;
119119
120+ - (NSArray <NSArray <ASCellNode *> *> *)completedNodes ;
121+
120122@end
121123
122124/* *
Original file line number Diff line number Diff line change 1313
1414#import "ViewController.h"
1515
16+ #import <AsyncDisplayKit/ASDisplayNode.h>
17+ #import <AsyncDisplayKit/ASDisplayNode+Beta.h>
18+
1619@implementation AppDelegate
1720
1821- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
1922{
23+ [ASDisplayNode setShouldUseNewRenderingRange:YES];
24+
2025 self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
2126 self.window.backgroundColor = [UIColor whiteColor];
2227 self.window.rootViewController = [[UINavigationController alloc] init];
You can’t perform that action at this time.
0 commit comments