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

Commit e318285

Browse files
committed
merged master
2 parents 4602e4e + d7492b3 commit e318285

92 files changed

Lines changed: 2763 additions & 126 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.

AsyncDisplayKit.podspec

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
Pod::Spec.new do |spec|
22
spec.name = 'AsyncDisplayKit'
3-
spec.version = '1.9.3'
3+
spec.version = '1.9.4'
44
spec.license = { :type => 'BSD' }
55
spec.homepage = 'http://asyncdisplaykit.org'
66
spec.authors = { 'Scott Goodson' => 'scottgoodson@gmail.com', 'Ryan Nystrom' => 'rnystrom@fb.com' }
77
spec.summary = 'Smooth asynchronous user interfaces for iOS apps.'
8-
spec.source = { :git => 'https://github.com/facebook/AsyncDisplayKit.git', :tag => '1.9.3' }
8+
spec.source = { :git => 'https://github.com/facebook/AsyncDisplayKit.git', :tag => '1.9.4' }
99

1010
spec.documentation_url = 'http://asyncdisplaykit.org/appledoc/'
1111

AsyncDisplayKit.xcodeproj/project.pbxproj

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,10 @@
190190
258FF4281C0D152600A83844 /* ASRangeHandlerVisible.mm in Sources */ = {isa = PBXBuildFile; fileRef = 258FF4261C0D152600A83844 /* ASRangeHandlerVisible.mm */; };
191191
25A977EF1C0D2A5500406B62 /* ASRangeHandlerVisible.mm in Sources */ = {isa = PBXBuildFile; fileRef = 258FF4261C0D152600A83844 /* ASRangeHandlerVisible.mm */; };
192192
25BAA16F1C0D18D2002747C7 /* ASRangeHandlerVisible.h in Headers */ = {isa = PBXBuildFile; fileRef = 258FF4251C0D152600A83844 /* ASRangeHandlerVisible.h */; };
193+
25E327561C16819500A2170C /* ASPagerNode.h in Headers */ = {isa = PBXBuildFile; fileRef = 25E327541C16819500A2170C /* ASPagerNode.h */; settings = {ATTRIBUTES = (Public, ); }; };
194+
25E327571C16819500A2170C /* ASPagerNode.h in Headers */ = {isa = PBXBuildFile; fileRef = 25E327541C16819500A2170C /* ASPagerNode.h */; settings = {ATTRIBUTES = (Public, ); }; };
195+
25E327581C16819500A2170C /* ASPagerNode.m in Sources */ = {isa = PBXBuildFile; fileRef = 25E327551C16819500A2170C /* ASPagerNode.m */; };
196+
25E327591C16819500A2170C /* ASPagerNode.m in Sources */ = {isa = PBXBuildFile; fileRef = 25E327551C16819500A2170C /* ASPagerNode.m */; };
193197
2767E9411BB19BD600EA9B77 /* ASViewController.h in Headers */ = {isa = PBXBuildFile; fileRef = ACC945A81BA9E7A0005E1FB8 /* ASViewController.h */; settings = {ATTRIBUTES = (Public, ); }; };
194198
2767E9421BB19BD600EA9B77 /* ASViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = ACC945AA1BA9E7C1005E1FB8 /* ASViewController.m */; };
195199
2911485C1A77147A005D0878 /* ASControlNodeTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 2911485B1A77147A005D0878 /* ASControlNodeTests.m */; };
@@ -647,6 +651,8 @@
647651
257754BD1BEE458E00737CA5 /* ASTextNodeWordKerner.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = ASTextNodeWordKerner.m; path = TextKit/ASTextNodeWordKerner.m; sourceTree = "<group>"; };
648652
258FF4251C0D152600A83844 /* ASRangeHandlerVisible.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ASRangeHandlerVisible.h; sourceTree = "<group>"; };
649653
258FF4261C0D152600A83844 /* ASRangeHandlerVisible.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = ASRangeHandlerVisible.mm; sourceTree = "<group>"; };
654+
25E327541C16819500A2170C /* ASPagerNode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ASPagerNode.h; sourceTree = "<group>"; };
655+
25E327551C16819500A2170C /* ASPagerNode.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ASPagerNode.m; sourceTree = "<group>"; };
650656
2911485B1A77147A005D0878 /* ASControlNodeTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ASControlNodeTests.m; sourceTree = "<group>"; };
651657
292C59991A956527007E5DD6 /* ASLayoutRangeType.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ASLayoutRangeType.h; sourceTree = "<group>"; };
652658
292C599A1A956527007E5DD6 /* ASRangeHandlerPreload.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ASRangeHandlerPreload.h; sourceTree = "<group>"; };
@@ -901,6 +907,8 @@
901907
0516FA3F1A1563D200B4EBED /* ASMultiplexImageNode.mm */,
902908
055B9FA61A1C154B00035D6D /* ASNetworkImageNode.h */,
903909
055B9FA71A1C154B00035D6D /* ASNetworkImageNode.mm */,
910+
25E327541C16819500A2170C /* ASPagerNode.h */,
911+
25E327551C16819500A2170C /* ASPagerNode.m */,
904912
D785F6601A74327E00291744 /* ASScrollNode.h */,
905913
D785F6611A74327E00291744 /* ASScrollNode.m */,
906914
B0F880581BEAEC7500D17647 /* ASTableNode.h */,
@@ -1255,6 +1263,7 @@
12551263
058D0A83195D060300B7D73C /* ASBaseDefines.h in Headers */,
12561264
054963491A1EA066000F8E56 /* ASBasicImageDownloader.h in Headers */,
12571265
2967F9E21AB0A5190072E4AB /* ASBasicImageDownloaderInternal.h in Headers */,
1266+
25E327561C16819500A2170C /* ASPagerNode.h in Headers */,
12581267
299DA1A91A828D2900162D41 /* ASBatchContext.h in Headers */,
12591268
251B8EF91BBB3D690087C538 /* ASCollectionViewFlowLayoutInspector.h in Headers */,
12601269
044285071BAA63FE00D16268 /* ASBatchFetching.h in Headers */,
@@ -1448,6 +1457,7 @@
14481457
B350622D1B010EFD0018CF92 /* ASScrollDirection.h in Headers */,
14491458
254C6B751BF94DF4003EC431 /* ASTextKitHelpers.h in Headers */,
14501459
B35062081B010EFD0018CF92 /* ASScrollNode.h in Headers */,
1460+
25E327571C16819500A2170C /* ASPagerNode.h in Headers */,
14511461
B35062551B010EFD0018CF92 /* ASSentinel.h in Headers */,
14521462
9C8221961BA237B80037F19A /* ASStackBaselinePositionedLayout.h in Headers */,
14531463
9C49C3701B853961000B0DD5 /* ASStackLayoutable.h in Headers */,
@@ -1524,6 +1534,7 @@
15241534
058D09BA195D04C000B7D73C /* Resources */,
15251535
3B9D88CDF51B429C8409E4B6 /* Copy Pods Resources */,
15261536
527A806066E1F4E2795090DF /* Embed Pods Frameworks */,
1537+
1B86F48711505F91D5FEF571 /* Embed Pods Frameworks */,
15271538
);
15281539
buildRules = (
15291540
);
@@ -1623,6 +1634,21 @@
16231634
/* End PBXResourcesBuildPhase section */
16241635

16251636
/* Begin PBXShellScriptBuildPhase section */
1637+
1B86F48711505F91D5FEF571 /* Embed Pods Frameworks */ = {
1638+
isa = PBXShellScriptBuildPhase;
1639+
buildActionMask = 2147483647;
1640+
files = (
1641+
);
1642+
inputPaths = (
1643+
);
1644+
name = "Embed Pods Frameworks";
1645+
outputPaths = (
1646+
);
1647+
runOnlyForDeploymentPostprocessing = 0;
1648+
shellPath = /bin/sh;
1649+
shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-AsyncDisplayKitTests/Pods-AsyncDisplayKitTests-frameworks.sh\"\n";
1650+
showEnvVarsInLog = 0;
1651+
};
16261652
2E61B6A0DB0F436A9DDBE86F /* Check Pods Manifest.lock */ = {
16271653
isa = PBXShellScriptBuildPhase;
16281654
buildActionMask = 2147483647;
@@ -1713,6 +1739,7 @@
17131739
058D0A28195D050800B7D73C /* ASDisplayNode+AsyncDisplay.mm in Sources */,
17141740
058D0A29195D050800B7D73C /* ASDisplayNode+DebugTiming.mm in Sources */,
17151741
058D0A2A195D050800B7D73C /* ASDisplayNode+UIViewBridge.mm in Sources */,
1742+
25E327581C16819500A2170C /* ASPagerNode.m in Sources */,
17161743
058D0A14195D050800B7D73C /* ASDisplayNode.mm in Sources */,
17171744
058D0A15195D050800B7D73C /* ASDisplayNodeExtras.mm in Sources */,
17181745
AEEC47E21C20C2DD00EC1693 /* ASVideoNode.mm in Sources */,
@@ -1843,6 +1870,7 @@
18431870
B350621A1B010EFD0018CF92 /* ASDealloc2MainObject.m in Sources */,
18441871
34EFC75C1B701BD200AD841F /* ASDimension.mm in Sources */,
18451872
B350624E1B010EFD0018CF92 /* ASDisplayNode+AsyncDisplay.mm in Sources */,
1873+
25E327591C16819500A2170C /* ASPagerNode.m in Sources */,
18461874
B35062501B010EFD0018CF92 /* ASDisplayNode+DebugTiming.mm in Sources */,
18471875
254C6B891BF94F8A003EC431 /* ASTextKitRenderer+Positioning.mm in Sources */,
18481876
B35062511B010EFD0018CF92 /* ASDisplayNode+UIViewBridge.mm in Sources */,

AsyncDisplayKit/ASCellNode.h

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,18 @@ typedef NSUInteger ASCellNodeAnimation;
9393
*/
9494
- (void)setNeedsLayout;
9595

96+
/**
97+
* @abstract Initializes a cell with a given viewControllerBlock.
98+
*
99+
* @param viewBlock The block that will be used to create the backing view.
100+
* @param didLoadBlock The block that will be called after the view created by the viewBlock is loaded
101+
*
102+
* @return An ASCellNode created using the root view of the view controller provided by the viewControllerBlock.
103+
* The view controller's root view is resized to match the calcuated size produced during layout.
104+
*
105+
*/
106+
- (instancetype)initWithViewControllerBlock:(ASDisplayNodeViewControllerBlock)viewControllerBlock didLoadBlock:(ASDisplayNodeDidLoadBlock)didLoadBlock;
107+
96108
@end
97109

98110

AsyncDisplayKit/ASCellNode.m

Lines changed: 54 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,15 @@
1818
#pragma mark -
1919
#pragma mark ASCellNode
2020

21+
@interface ASCellNode ()
22+
{
23+
ASDisplayNodeDidLoadBlock _nodeLoadedBlock;
24+
UIViewController *_viewController;
25+
ASDisplayNode *_viewControllerNode;
26+
}
27+
28+
@end
29+
2130
@implementation ASCellNode
2231

2332
- (instancetype)init
@@ -32,6 +41,49 @@ - (instancetype)init
3241
return self;
3342
}
3443

44+
- (instancetype)initWithViewControllerBlock:(ASDisplayNodeViewControllerBlock)viewControllerBlock didLoadBlock:(ASDisplayNodeDidLoadBlock)didLoadBlock
45+
{
46+
if (!(self = [super init]))
47+
return nil;
48+
49+
ASDisplayNodeAssertNotNil(viewControllerBlock, @"should initialize with a valid block that returns a UIViewController");
50+
51+
if (viewControllerBlock) {
52+
_viewController = viewControllerBlock();
53+
54+
__weak UIViewController *weakViewController = _viewController;
55+
_viewControllerNode = [[ASDisplayNode alloc] initWithViewBlock:^UIView *{
56+
return weakViewController.view;
57+
} didLoadBlock:didLoadBlock];
58+
59+
[self addSubnode:_viewControllerNode];
60+
_nodeLoadedBlock = didLoadBlock;
61+
}
62+
63+
return self;
64+
}
65+
66+
//- (ASLayoutSpec *)layoutSpecThatFits:(ASSizeRange)constrainedSize
67+
//{
68+
// _viewControllerNode.frame = (CGRect){{0,0}, constrainedSize.max};
69+
// NSLog(@"%f %f", constrainedSize.max.width, constrainedSize.max.height);
70+
// return [super layoutSpecThatFits:constrainedSize];
71+
//}
72+
73+
- (void)layout
74+
{
75+
[super layout];
76+
77+
_viewControllerNode.frame = self.bounds;
78+
}
79+
80+
- (void)layoutDidFinish
81+
{
82+
[super layoutDidFinish];
83+
84+
_viewControllerNode.frame = self.bounds;
85+
}
86+
3587
- (instancetype)initWithLayerBlock:(ASDisplayNodeLayerBlock)viewBlock didLoadBlock:(ASDisplayNodeDidLoadBlock)didLoadBlock
3688
{
3789
ASDisplayNodeAssertNotSupported();
@@ -98,7 +150,8 @@ - (void)touchesCancelled:(NSSet *)touches withEvent:(UIEvent *)event
98150
#pragma mark -
99151
#pragma mark ASTextCellNode
100152

101-
@interface ASTextCellNode () {
153+
@interface ASTextCellNode ()
154+
{
102155
NSString *_text;
103156
ASTextNode *_textNode;
104157
}

AsyncDisplayKit/ASCollectionNode.h

Lines changed: 45 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
// Copyright (c) 2015 Facebook. All rights reserved.
77
//
88

9-
#import <AsyncDisplayKit/AsyncDisplayKit.h>
9+
#import <AsyncDisplayKit/ASCollectionView.h>
1010

1111
/**
1212
* ASCollectionNode is a node based class that wraps an ASCollectionView. It can be used
@@ -18,4 +18,48 @@
1818

1919
@property (nonatomic, readonly) ASCollectionView *view;
2020

21+
/**
22+
* Tuning parameters for a range type.
23+
*
24+
* @param rangeType The range type to get the tuning parameters for.
25+
*
26+
* @returns A tuning parameter value for the given range type.
27+
*
28+
* Defaults to the render range having one sceenful both leading and trailing and the preload range having two
29+
* screenfuls in both directions.
30+
*/
31+
- (ASRangeTuningParameters)tuningParametersForRangeType:(ASLayoutRangeType)rangeType;
32+
33+
/**
34+
* Set the tuning parameters for a range type.
35+
*
36+
* @param tuningParameters The tuning parameters to store for a range type.
37+
* @param rangeType The range type to set the tuning parameters for.
38+
*/
39+
- (void)setTuningParameters:(ASRangeTuningParameters)tuningParameters forRangeType:(ASLayoutRangeType)rangeType;
40+
41+
/**
42+
* Reload everything from scratch, destroying the working range and all cached nodes.
43+
*
44+
* @param completion block to run on completion of asynchronous loading or nil. If supplied, the block is run on
45+
* the main thread.
46+
* @warning This method is substantially more expensive than UICollectionView's version.
47+
*/
48+
- (void)reloadDataWithCompletion:(void (^)())completion;
49+
50+
/**
51+
* Reload everything from scratch, destroying the working range and all cached nodes.
52+
*
53+
* @warning This method is substantially more expensive than UICollectionView's version.
54+
*/
55+
- (void)reloadData;
56+
57+
/**
58+
* Reload everything from scratch entirely on the main thread, destroying the working range and all cached nodes.
59+
*
60+
* @warning This method is substantially more expensive than UICollectionView's version and will block the main thread
61+
* while all the cells load.
62+
*/
63+
- (void)reloadDataImmediately;
64+
2165
@end

AsyncDisplayKit/ASCollectionNode.m

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
//
88

99
#import "ASCollectionNode.h"
10+
#import "ASDisplayNode+Subclasses.h"
1011

1112
@implementation ASCollectionNode
1213

@@ -42,4 +43,31 @@ - (void)clearFetchedData
4243
[self.view clearFetchedData];
4344
}
4445

46+
#pragma mark - ASCollectionView Forwards
47+
48+
- (ASRangeTuningParameters)tuningParametersForRangeType:(ASLayoutRangeType)rangeType
49+
{
50+
return [self.view tuningParametersForRangeType:rangeType];
51+
}
52+
53+
- (void)setTuningParameters:(ASRangeTuningParameters)tuningParameters forRangeType:(ASLayoutRangeType)rangeType
54+
{
55+
return [self.view setTuningParameters:tuningParameters forRangeType:rangeType];
56+
}
57+
58+
- (void)reloadDataWithCompletion:(void (^)())completion
59+
{
60+
[self.view reloadDataWithCompletion:completion];
61+
}
62+
63+
- (void)reloadData
64+
{
65+
[self.view reloadData];
66+
}
67+
68+
- (void)reloadDataImmediately
69+
{
70+
[self.view reloadDataImmediately];
71+
}
72+
4573
@end

AsyncDisplayKit/ASDisplayNode.h

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,11 @@
2222
*/
2323
typedef UIView *(^ASDisplayNodeViewBlock)();
2424

25+
/**
26+
* UIView creation block. Used to create the backing view of a new display node.
27+
*/
28+
typedef UIViewController *(^ASDisplayNodeViewControllerBlock)();
29+
2530
/**
2631
* CALayer creation block. Used to create the backing layer of a new display node.
2732
*/
@@ -685,7 +690,6 @@ typedef NS_OPTIONS(NSUInteger, ASInterfaceState)
685690
* @param node The node to be added.
686691
*/
687692
- (void)addSubnode:(ASDisplayNode *)node;
688-
- (NSString *)name;
689693
@end
690694

691695
/** CALayer(AsyncDisplayKit) defines convenience method for adding sub-ASDisplayNode to a CALayer. */
@@ -696,7 +700,6 @@ typedef NS_OPTIONS(NSUInteger, ASInterfaceState)
696700
* @param node The node to be added.
697701
*/
698702
- (void)addSubnode:(ASDisplayNode *)node;
699-
- (NSString *)name;
700703
@end
701704

702705
@interface ASDisplayNode (Deprecated)

0 commit comments

Comments
 (0)