Skip to content

Commit 8bb9d17

Browse files
committed
Merge branch 'master' into update-objc
Conflicts: AsyncDisplayKit/ASDisplayNode+Subclasses.h AsyncDisplayKit/ASMultiplexImageNode.h AsyncDisplayKit/ASViewController.h AsyncDisplayKit/Details/ASDataController.h
2 parents 73af8f1 + 2f1d57e commit 8bb9d17

68 files changed

Lines changed: 2337 additions & 159 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.travis.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ env:
1111
- MODE=tests
1212
- MODE=examples
1313
- MODE=life-without-cocoapods
14+
- MODE=framework
1415
script: ./build.sh $MODE
1516
after_success:
1617
- slather

AsyncDisplayKit.xcodeproj/project.pbxproj

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,8 @@
140140
205F0E211B376416007741D0 /* CGRect+ASConvenience.h in Headers */ = {isa = PBXBuildFile; fileRef = 205F0E1F1B376416007741D0 /* CGRect+ASConvenience.h */; settings = {ATTRIBUTES = (Public, ); }; };
141141
205F0E221B376416007741D0 /* CGRect+ASConvenience.m in Sources */ = {isa = PBXBuildFile; fileRef = 205F0E201B376416007741D0 /* CGRect+ASConvenience.m */; };
142142
242995D31B29743C00090100 /* ASBasicImageDownloaderTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 242995D21B29743C00090100 /* ASBasicImageDownloaderTests.m */; };
143+
2767E9411BB19BD600EA9B77 /* ASViewController.h in Headers */ = {isa = PBXBuildFile; fileRef = ACC945A81BA9E7A0005E1FB8 /* ASViewController.h */; settings = {ATTRIBUTES = (Public, ); }; };
144+
2767E9421BB19BD600EA9B77 /* ASViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = ACC945AA1BA9E7C1005E1FB8 /* ASViewController.m */; settings = {ASSET_TAGS = (); }; };
143145
2911485C1A77147A005D0878 /* ASControlNodeTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 2911485B1A77147A005D0878 /* ASControlNodeTests.m */; };
144146
291B63FB1AA53A7A000A71B3 /* ASScrollDirection.h in Headers */ = {isa = PBXBuildFile; fileRef = 296A0A311A951715005ACEAA /* ASScrollDirection.h */; settings = {ATTRIBUTES = (Public, ); }; };
145147
292C599F1A956527007E5DD6 /* ASLayoutRangeType.h in Headers */ = {isa = PBXBuildFile; fileRef = 292C59991A956527007E5DD6 /* ASLayoutRangeType.h */; settings = {ATTRIBUTES = (Public, ); }; };
@@ -154,6 +156,7 @@
154156
299DA1AA1A828D2900162D41 /* ASBatchContext.mm in Sources */ = {isa = PBXBuildFile; fileRef = 299DA1A81A828D2900162D41 /* ASBatchContext.mm */; };
155157
29CDC2E21AAE70D000833CA4 /* ASBasicImageDownloaderContextTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 29CDC2E11AAE70D000833CA4 /* ASBasicImageDownloaderContextTests.m */; };
156158
2C107F5B1BA9F54500F13DE5 /* AsyncDisplayKit.h in Headers */ = {isa = PBXBuildFile; fileRef = 6BDC61F51978FEA400E50D21 /* AsyncDisplayKit.h */; settings = {ATTRIBUTES = (Public, ); }; };
159+
34566CB31BC1213700715E6B /* ASPhotosFrameworkImageRequest.m in Sources */ = {isa = PBXBuildFile; fileRef = CC7FD9DD1BB5E962005CCB2B /* ASPhotosFrameworkImageRequest.m */; settings = {ASSET_TAGS = (); }; };
157160
34EFC75B1B701BAF00AD841F /* ASDimension.h in Headers */ = {isa = PBXBuildFile; fileRef = ACF6ED071B17843500DA7C62 /* ASDimension.h */; settings = {ATTRIBUTES = (Public, ); }; };
158161
34EFC75C1B701BD200AD841F /* ASDimension.mm in Sources */ = {isa = PBXBuildFile; fileRef = ACF6ED081B17843500DA7C62 /* ASDimension.mm */; };
159162
34EFC75D1B701BE900AD841F /* ASInternalHelpers.h in Headers */ = {isa = PBXBuildFile; fileRef = ACF6ED431B17847A00DA7C62 /* ASInternalHelpers.h */; };
@@ -372,6 +375,10 @@
372375
B350625D1B0111740018CF92 /* Photos.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 051943141A1575670030A7D0 /* Photos.framework */; };
373376
B350625E1B0111780018CF92 /* AssetsLibrary.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 051943121A1575630030A7D0 /* AssetsLibrary.framework */; };
374377
B350625F1B0111800018CF92 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 058D09AF195D04C000B7D73C /* Foundation.framework */; };
378+
CC7FD9DE1BB5E962005CCB2B /* ASPhotosFrameworkImageRequest.h in Headers */ = {isa = PBXBuildFile; fileRef = CC7FD9DC1BB5E962005CCB2B /* ASPhotosFrameworkImageRequest.h */; settings = {ATTRIBUTES = (Public, ); }; };
379+
CC7FD9DF1BB5E962005CCB2B /* ASPhotosFrameworkImageRequest.m in Sources */ = {isa = PBXBuildFile; fileRef = CC7FD9DD1BB5E962005CCB2B /* ASPhotosFrameworkImageRequest.m */; settings = {ASSET_TAGS = (); }; };
380+
CC7FD9E11BB5F750005CCB2B /* ASPhotosFrameworkImageRequestTests.m in Sources */ = {isa = PBXBuildFile; fileRef = CC7FD9E01BB5F750005CCB2B /* ASPhotosFrameworkImageRequestTests.m */; settings = {ASSET_TAGS = (); }; };
381+
CC7FD9E21BB603FF005CCB2B /* ASPhotosFrameworkImageRequest.h in Headers */ = {isa = PBXBuildFile; fileRef = CC7FD9DC1BB5E962005CCB2B /* ASPhotosFrameworkImageRequest.h */; settings = {ATTRIBUTES = (Public, ); }; };
375382
D785F6621A74327E00291744 /* ASScrollNode.h in Headers */ = {isa = PBXBuildFile; fileRef = D785F6601A74327E00291744 /* ASScrollNode.h */; settings = {ATTRIBUTES = (Public, ); }; };
376383
D785F6631A74327E00291744 /* ASScrollNode.m in Sources */ = {isa = PBXBuildFile; fileRef = D785F6611A74327E00291744 /* ASScrollNode.m */; };
377384
DB7121BCD50849C498C886FB /* libPods-AsyncDisplayKitTests.a in Frameworks */ = {isa = PBXBuildFile; fileRef = EFA731F0396842FF8AB635EE /* libPods-AsyncDisplayKitTests.a */; };
@@ -617,6 +624,9 @@
617624
ACF6ED5B1B178DC700DA7C62 /* ASStackLayoutSpecSnapshotTests.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = ASStackLayoutSpecSnapshotTests.mm; sourceTree = "<group>"; };
618625
B35061DA1B010EDF0018CF92 /* AsyncDisplayKit.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = AsyncDisplayKit.framework; sourceTree = BUILT_PRODUCTS_DIR; };
619626
B35061DD1B010EDF0018CF92 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; name = Info.plist; path = "../AsyncDisplayKit-iOS/Info.plist"; sourceTree = "<group>"; };
627+
CC7FD9DC1BB5E962005CCB2B /* ASPhotosFrameworkImageRequest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ASPhotosFrameworkImageRequest.h; sourceTree = "<group>"; };
628+
CC7FD9DD1BB5E962005CCB2B /* ASPhotosFrameworkImageRequest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ASPhotosFrameworkImageRequest.m; sourceTree = "<group>"; };
629+
CC7FD9E01BB5F750005CCB2B /* ASPhotosFrameworkImageRequestTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ASPhotosFrameworkImageRequestTests.m; sourceTree = "<group>"; };
620630
D3779BCFF841AD3EB56537ED /* Pods-AsyncDisplayKitTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-AsyncDisplayKitTests.release.xcconfig"; path = "Pods/Target Support Files/Pods-AsyncDisplayKitTests/Pods-AsyncDisplayKitTests.release.xcconfig"; sourceTree = "<group>"; };
621631
D785F6601A74327E00291744 /* ASScrollNode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ASScrollNode.h; sourceTree = "<group>"; };
622632
D785F6611A74327E00291744 /* ASScrollNode.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ASScrollNode.m; sourceTree = "<group>"; };
@@ -799,6 +809,7 @@
799809
ACF6ED581B178DC700DA7C62 /* ASLayoutSpecSnapshotTestsHelper.m */,
800810
242995D21B29743C00090100 /* ASBasicImageDownloaderTests.m */,
801811
29CDC2E11AAE70D000833CA4 /* ASBasicImageDownloaderContextTests.m */,
812+
CC7FD9E01BB5F750005CCB2B /* ASPhotosFrameworkImageRequestTests.m */,
802813
296A0A341A951ABF005ACEAA /* ASBatchFetchingTests.m */,
803814
9F06E5CC1B4CAF4200F015D8 /* ASCollectionViewTests.m */,
804815
2911485B1A77147A005D0878 /* ASControlNodeTests.m */,
@@ -834,6 +845,8 @@
834845
058D09E1195D050800B7D73C /* Details */ = {
835846
isa = PBXGroup;
836847
children = (
848+
CC7FD9DC1BB5E962005CCB2B /* ASPhotosFrameworkImageRequest.h */,
849+
CC7FD9DD1BB5E962005CCB2B /* ASPhotosFrameworkImageRequest.m */,
837850
058D09E2195D050800B7D73C /* _ASDisplayLayer.h */,
838851
058D09E3195D050800B7D73C /* _ASDisplayLayer.mm */,
839852
058D09E4195D050800B7D73C /* _ASDisplayView.h */,
@@ -1104,6 +1117,7 @@
11041117
9C8221951BA237B80037F19A /* ASStackBaselinePositionedLayout.h in Headers */,
11051118
9C49C36F1B853957000B0DD5 /* ASStackLayoutable.h in Headers */,
11061119
AC21EC101B3D0BF600C8B19A /* ASStackLayoutDefines.h in Headers */,
1120+
CC7FD9DE1BB5E962005CCB2B /* ASPhotosFrameworkImageRequest.h in Headers */,
11071121
ACF6ED2F1B17843500DA7C62 /* ASStackLayoutSpec.h in Headers */,
11081122
ACF6ED4E1B17847A00DA7C62 /* ASStackLayoutSpecUtilities.h in Headers */,
11091123
ACF6ED4F1B17847A00DA7C62 /* ASStackPositionedLayout.h in Headers */,
@@ -1206,7 +1220,9 @@
12061220
9C8221961BA237B80037F19A /* ASStackBaselinePositionedLayout.h in Headers */,
12071221
9C49C3701B853961000B0DD5 /* ASStackLayoutable.h in Headers */,
12081222
34EFC7701B701CFA00AD841F /* ASStackLayoutDefines.h in Headers */,
1223+
CC7FD9E21BB603FF005CCB2B /* ASPhotosFrameworkImageRequest.h in Headers */,
12091224
34EFC7711B701CFF00AD841F /* ASStackLayoutSpec.h in Headers */,
1225+
2767E9411BB19BD600EA9B77 /* ASViewController.h in Headers */,
12101226
044284FE1BAA387800D16268 /* ASStackLayoutSpecUtilities.h in Headers */,
12111227
34EFC7751B701D2400AD841F /* ASStackPositionedLayout.h in Headers */,
12121228
34EFC7771B701D2D00AD841F /* ASStackUnpositionedLayout.h in Headers */,
@@ -1490,6 +1506,7 @@
14901506
058D0A21195D050800B7D73C /* NSMutableAttributedString+TextKitAdditions.m in Sources */,
14911507
205F0E101B371875007741D0 /* UICollectionViewLayout+ASConvenience.m in Sources */,
14921508
058D0A25195D050800B7D73C /* UIView+ASConvenience.m in Sources */,
1509+
CC7FD9DF1BB5E962005CCB2B /* ASPhotosFrameworkImageRequest.m in Sources */,
14931510
);
14941511
runOnlyForDeploymentPostprocessing = 0;
14951512
};
@@ -1511,6 +1528,7 @@
15111528
056D21551ABCEF50001107EF /* ASImageNodeSnapshotTests.m in Sources */,
15121529
ACF6ED5E1B178DC700DA7C62 /* ASInsetLayoutSpecSnapshotTests.mm in Sources */,
15131530
ACF6ED601B178DC700DA7C62 /* ASLayoutSpecSnapshotTestsHelper.m in Sources */,
1531+
CC7FD9E11BB5F750005CCB2B /* ASPhotosFrameworkImageRequestTests.m in Sources */,
15141532
052EE0661A159FEF002C6279 /* ASMultiplexImageNodeTests.m in Sources */,
15151533
058D0A3C195D057000B7D73C /* ASMutableAttributedStringBuilderTests.m in Sources */,
15161534
ACF6ED611B178DC700DA7C62 /* ASOverlayLayoutSpecSnapshotTests.mm in Sources */,
@@ -1534,6 +1552,7 @@
15341552
B35062401B010EFD0018CF92 /* _ASAsyncTransactionContainer.m in Sources */,
15351553
B35062421B010EFD0018CF92 /* _ASAsyncTransactionGroup.m in Sources */,
15361554
B350624A1B010EFD0018CF92 /* _ASCoreAnimationExtras.mm in Sources */,
1555+
2767E9421BB19BD600EA9B77 /* ASViewController.m in Sources */,
15371556
B35062101B010EFD0018CF92 /* _ASDisplayLayer.mm in Sources */,
15381557
B35062121B010EFD0018CF92 /* _ASDisplayView.mm in Sources */,
15391558
B350624C1B010EFD0018CF92 /* _ASPendingState.m in Sources */,
@@ -1594,6 +1613,7 @@
15941613
B35062351B010EFD0018CF92 /* ASTextNodeTextKitHelpers.mm in Sources */,
15951614
B35062381B010EFD0018CF92 /* ASTextNodeWordKerner.m in Sources */,
15961615
509E68661B3AEDD7009B9150 /* CGRect+ASConvenience.m in Sources */,
1616+
34566CB31BC1213700715E6B /* ASPhotosFrameworkImageRequest.m in Sources */,
15971617
B350623B1B010EFD0018CF92 /* NSMutableAttributedString+TextKitAdditions.m in Sources */,
15981618
044284FD1BAA365100D16268 /* UICollectionViewLayout+ASConvenience.m in Sources */,
15991619
B35062441B010EFD0018CF92 /* UIView+ASConvenience.m in Sources */,

AsyncDisplayKit.xcodeproj/xcshareddata/xcschemes/AsyncDisplayKit-iOS.xcscheme

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<Scheme
3-
LastUpgradeVersion = "0630"
3+
LastUpgradeVersion = "0700"
44
version = "1.3">
55
<BuildAction
66
parallelizeBuildables = "YES"
@@ -14,7 +14,7 @@
1414
buildForAnalyzing = "YES">
1515
<BuildableReference
1616
BuildableIdentifier = "primary"
17-
BlueprintIdentifier = "2C5B669C1B3A796F005926A7"
17+
BlueprintIdentifier = "B35061D91B010EDF0018CF92"
1818
BuildableName = "AsyncDisplayKit.framework"
1919
BlueprintName = "AsyncDisplayKit-iOS"
2020
ReferencedContainer = "container:AsyncDisplayKit.xcodeproj">
@@ -23,26 +23,29 @@
2323
</BuildActionEntries>
2424
</BuildAction>
2525
<TestAction
26+
buildConfiguration = "Debug"
2627
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
2728
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
28-
shouldUseLaunchSchemeArgsEnv = "YES"
29-
buildConfiguration = "Debug">
29+
shouldUseLaunchSchemeArgsEnv = "YES">
3030
<Testables>
3131
</Testables>
32+
<AdditionalOptions>
33+
</AdditionalOptions>
3234
</TestAction>
3335
<LaunchAction
36+
buildConfiguration = "Debug"
3437
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
3538
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
3639
launchStyle = "0"
3740
useCustomWorkingDirectory = "NO"
38-
buildConfiguration = "Debug"
3941
ignoresPersistentStateOnLaunch = "NO"
4042
debugDocumentVersioning = "YES"
43+
debugServiceExtension = "internal"
4144
allowLocationSimulation = "YES">
4245
<MacroExpansion>
4346
<BuildableReference
4447
BuildableIdentifier = "primary"
45-
BlueprintIdentifier = "2C5B669C1B3A796F005926A7"
48+
BlueprintIdentifier = "B35061D91B010EDF0018CF92"
4649
BuildableName = "AsyncDisplayKit.framework"
4750
BlueprintName = "AsyncDisplayKit-iOS"
4851
ReferencedContainer = "container:AsyncDisplayKit.xcodeproj">
@@ -52,15 +55,15 @@
5255
</AdditionalOptions>
5356
</LaunchAction>
5457
<ProfileAction
58+
buildConfiguration = "Release"
5559
shouldUseLaunchSchemeArgsEnv = "YES"
5660
savedToolIdentifier = ""
5761
useCustomWorkingDirectory = "NO"
58-
buildConfiguration = "Release"
5962
debugDocumentVersioning = "YES">
6063
<MacroExpansion>
6164
<BuildableReference
6265
BuildableIdentifier = "primary"
63-
BlueprintIdentifier = "2C5B669C1B3A796F005926A7"
66+
BlueprintIdentifier = "B35061D91B010EDF0018CF92"
6467
BuildableName = "AsyncDisplayKit.framework"
6568
BlueprintName = "AsyncDisplayKit-iOS"
6669
ReferencedContainer = "container:AsyncDisplayKit.xcodeproj">

AsyncDisplayKit.xcodeproj/xcshareddata/xcschemes/AsyncDisplayKit.xcscheme

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<Scheme
3-
LastUpgradeVersion = "0600"
3+
LastUpgradeVersion = "0700"
44
version = "1.3">
55
<BuildAction
66
parallelizeBuildables = "YES"
@@ -37,10 +37,10 @@
3737
</BuildActionEntries>
3838
</BuildAction>
3939
<TestAction
40+
buildConfiguration = "Debug"
4041
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
4142
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
42-
shouldUseLaunchSchemeArgsEnv = "YES"
43-
buildConfiguration = "Debug">
43+
shouldUseLaunchSchemeArgsEnv = "YES">
4444
<Testables>
4545
<TestableReference
4646
skipped = "NO">
@@ -62,15 +62,18 @@
6262
ReferencedContainer = "container:AsyncDisplayKit.xcodeproj">
6363
</BuildableReference>
6464
</MacroExpansion>
65+
<AdditionalOptions>
66+
</AdditionalOptions>
6567
</TestAction>
6668
<LaunchAction
69+
buildConfiguration = "Debug"
6770
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
6871
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
6972
launchStyle = "0"
7073
useCustomWorkingDirectory = "NO"
71-
buildConfiguration = "Debug"
7274
ignoresPersistentStateOnLaunch = "NO"
7375
debugDocumentVersioning = "YES"
76+
debugServiceExtension = "internal"
7477
allowLocationSimulation = "YES">
7578
<MacroExpansion>
7679
<BuildableReference
@@ -85,10 +88,10 @@
8588
</AdditionalOptions>
8689
</LaunchAction>
8790
<ProfileAction
91+
buildConfiguration = "Release"
8892
shouldUseLaunchSchemeArgsEnv = "YES"
8993
savedToolIdentifier = ""
9094
useCustomWorkingDirectory = "NO"
91-
buildConfiguration = "Release"
9295
debugDocumentVersioning = "YES">
9396
<MacroExpansion>
9497
<BuildableReference

AsyncDisplayKit/ASCellNode.h

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,29 @@ NS_ASSUME_NONNULL_BEGIN
1515
*/
1616
@interface ASCellNode : ASDisplayNode
1717

18+
/**
19+
* @abstract When enabled, ensures that the cell is completely displayed before allowed onscreen.
20+
*
21+
* @default NO
22+
* @discussion Normally, ASCellNodes are preloaded and have finished display before they are onscreen.
23+
* However, if the Table or Collection's rangeTuningParameters are set to small values (or 0),
24+
* or if the user is scrolling rapidly on a slow device, it is possible for a cell's display to
25+
* be incomplete when it becomes visible.
26+
*
27+
* In this case, normally placeholder states are shown and scrolling continues uninterrupted.
28+
* The finished, drawn content is then shown as soon as it is ready.
29+
*
30+
* With this property set to YES, the main thread will be blocked until display is complete for
31+
* the cell. This is more similar to UIKit, and in fact makes AsyncDisplayKit scrolling visually
32+
* indistinguishible from UIKit's, except being faster.
33+
*
34+
* Using this option does not eliminate all of the performance advantages of AsyncDisplayKit.
35+
* Normally, a cell has been preloading and is almost done when it reaches the screen, so the
36+
* blocking time is very short. If the rangeTuningParameters are set to 0, still this option
37+
* outperforms UIKit: while the main thread is waiting, subnode display executes concurrently.
38+
*/
39+
@property (nonatomic, assign) BOOL neverShowPlaceholders;
40+
1841
/*
1942
* ASTableView uses these properties when configuring UITableViewCells that host ASCellNodes.
2043
*/

AsyncDisplayKit/ASCollectionView.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,15 @@ NS_ASSUME_NONNULL_BEGIN
213213
*/
214214
- (ASCellNode *)nodeForItemAtIndexPath:(NSIndexPath *)indexPath;
215215

216+
/**
217+
* Similar to -indexPathForCell:.
218+
*
219+
* @param cellNode a cellNode part of the table view
220+
*
221+
* @returns an indexPath for this cellNode
222+
*/
223+
- (NSIndexPath *)indexPathForNode:(ASCellNode *)cellNode;
224+
216225
/**
217226
* Similar to -visibleCells.
218227
*

AsyncDisplayKit/ASCollectionView.mm

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@
1717
#import "UICollectionViewLayout+ASConvenience.h"
1818
#import "ASInternalHelpers.h"
1919

20+
// FIXME: Temporary nonsense import until method names are finalized and exposed
21+
#import "ASDisplayNode+Subclasses.h"
22+
2023
const static NSUInteger kASCollectionViewAnimationNone = UITableViewRowAnimationNone;
2124

2225

@@ -234,7 +237,8 @@ - (void)reloadData
234237

235238
- (void)setDataSource:(id<UICollectionViewDataSource>)dataSource
236239
{
237-
ASDisplayNodeAssert(NO, @"ASCollectionView uses asyncDataSource, not UICollectionView's dataSource property.");
240+
// UIKit can internally generate a call to this method upon changing the asyncDataSource; only assert for non-nil.
241+
ASDisplayNodeAssert(dataSource == nil, @"ASCollectionView uses asyncDataSource, not UICollectionView's dataSource property.");
238242
}
239243

240244
- (void)setDelegate:(id<UICollectionViewDelegate>)delegate
@@ -314,6 +318,16 @@ - (CGSize)calculatedSizeForNodeAtIndexPath:(NSIndexPath *)indexPath
314318
return [[_dataController nodeAtIndexPath:indexPath] calculatedSize];
315319
}
316320

321+
- (ASCellNode *)nodeForItemAtIndexPath:(NSIndexPath *)indexPath
322+
{
323+
return [_dataController nodeAtIndexPath:indexPath];
324+
}
325+
326+
- (NSIndexPath *)indexPathForNode:(ASCellNode *)cellNode
327+
{
328+
return [_dataController indexPathForNode:cellNode];
329+
}
330+
317331
- (NSArray *)visibleNodes
318332
{
319333
NSArray *indexPaths = [self indexPathsForVisibleItems];
@@ -391,11 +405,6 @@ - (void)moveItemAtIndexPath:(NSIndexPath *)indexPath toIndexPath:(NSIndexPath *)
391405
[_dataController moveRowAtIndexPath:indexPath toIndexPath:newIndexPath withAnimationOptions:kASCollectionViewAnimationNone];
392406
}
393407

394-
- (ASCellNode *)nodeForItemAtIndexPath:(NSIndexPath *)indexPath
395-
{
396-
return [_dataController nodeAtIndexPath:indexPath];
397-
}
398-
399408
#pragma mark -
400409
#pragma mark Intercepted selectors.
401410

@@ -489,6 +498,11 @@ - (void)collectionView:(UICollectionView *)collectionView willDisplayCell:(UICol
489498
if ([_asyncDelegate respondsToSelector:@selector(collectionView:willDisplayNodeForItemAtIndexPath:)]) {
490499
[_asyncDelegate collectionView:self willDisplayNodeForItemAtIndexPath:indexPath];
491500
}
501+
502+
ASCellNode *cellNode = [self nodeForItemAtIndexPath:indexPath];
503+
if (cellNode.neverShowPlaceholders) {
504+
[cellNode recursivelyEnsureDisplay];
505+
}
492506
}
493507

494508
- (void)collectionView:(UICollectionView *)collectionView didEndDisplayingCell:(UICollectionViewCell *)cell forItemAtIndexPath:(NSIndexPath *)indexPath

0 commit comments

Comments
 (0)