Skip to content
This repository was archived by the owner on Feb 2, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 12 additions & 16 deletions AsyncDisplayKit.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -407,6 +407,10 @@
D785F6621A74327E00291744 /* ASScrollNode.h in Headers */ = {isa = PBXBuildFile; fileRef = D785F6601A74327E00291744 /* ASScrollNode.h */; settings = {ATTRIBUTES = (Public, ); }; };
D785F6631A74327E00291744 /* ASScrollNode.m in Sources */ = {isa = PBXBuildFile; fileRef = D785F6611A74327E00291744 /* ASScrollNode.m */; };
DB7121BCD50849C498C886FB /* libPods-AsyncDisplayKitTests.a in Frameworks */ = {isa = PBXBuildFile; fileRef = EFA731F0396842FF8AB635EE /* libPods-AsyncDisplayKitTests.a */; };
DE6D9E321C0AD9ED001A1DD3 /* ASRangeHandlerVisible.h in Headers */ = {isa = PBXBuildFile; fileRef = DE6D9E301C0AD9ED001A1DD3 /* ASRangeHandlerVisible.h */; };
DE6D9E331C0AD9ED001A1DD3 /* ASRangeHandlerVisible.h in Headers */ = {isa = PBXBuildFile; fileRef = DE6D9E301C0AD9ED001A1DD3 /* ASRangeHandlerVisible.h */; };
DE6D9E341C0AD9ED001A1DD3 /* ASRangeHandlerVisible.mm in Sources */ = {isa = PBXBuildFile; fileRef = DE6D9E311C0AD9ED001A1DD3 /* ASRangeHandlerVisible.mm */; };
DE6D9E351C0AD9ED001A1DD3 /* ASRangeHandlerVisible.mm in Sources */ = {isa = PBXBuildFile; fileRef = DE6D9E311C0AD9ED001A1DD3 /* ASRangeHandlerVisible.mm */; };
DECBD6E71BE56E1900CF4905 /* ASButtonNode.h in Headers */ = {isa = PBXBuildFile; fileRef = DECBD6E51BE56E1900CF4905 /* ASButtonNode.h */; settings = {ATTRIBUTES = (Public, ); }; };
DECBD6E81BE56E1900CF4905 /* ASButtonNode.h in Headers */ = {isa = PBXBuildFile; fileRef = DECBD6E51BE56E1900CF4905 /* ASButtonNode.h */; settings = {ATTRIBUTES = (Public, ); }; };
DECBD6E91BE56E1900CF4905 /* ASButtonNode.mm in Sources */ = {isa = PBXBuildFile; fileRef = DECBD6E61BE56E1900CF4905 /* ASButtonNode.mm */; };
Expand Down Expand Up @@ -675,6 +679,8 @@
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>"; };
D785F6601A74327E00291744 /* ASScrollNode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ASScrollNode.h; sourceTree = "<group>"; };
D785F6611A74327E00291744 /* ASScrollNode.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ASScrollNode.m; sourceTree = "<group>"; };
DE6D9E301C0AD9ED001A1DD3 /* ASRangeHandlerVisible.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ASRangeHandlerVisible.h; sourceTree = "<group>"; };
DE6D9E311C0AD9ED001A1DD3 /* ASRangeHandlerVisible.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = ASRangeHandlerVisible.mm; sourceTree = "<group>"; };
DECBD6E51BE56E1900CF4905 /* ASButtonNode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ASButtonNode.h; sourceTree = "<group>"; };
DECBD6E61BE56E1900CF4905 /* ASButtonNode.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = ASButtonNode.mm; sourceTree = "<group>"; };
EFA731F0396842FF8AB635EE /* libPods-AsyncDisplayKitTests.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-AsyncDisplayKitTests.a"; sourceTree = BUILT_PRODUCTS_DIR; };
Expand Down Expand Up @@ -938,6 +944,8 @@
055F1A3619ABD413004DAFF1 /* ASRangeController.h */,
055F1A3719ABD413004DAFF1 /* ASRangeController.mm */,
292C599C1A956527007E5DD6 /* ASRangeHandler.h */,
DE6D9E301C0AD9ED001A1DD3 /* ASRangeHandlerVisible.h */,
DE6D9E311C0AD9ED001A1DD3 /* ASRangeHandlerVisible.mm */,
292C599A1A956527007E5DD6 /* ASRangeHandlerPreload.h */,
292C599B1A956527007E5DD6 /* ASRangeHandlerPreload.mm */,
292C599D1A956527007E5DD6 /* ASRangeHandlerRender.h */,
Expand Down Expand Up @@ -1159,6 +1167,7 @@
05F20AA41A15733C00DCA68A /* ASImageProtocols.h in Headers */,
430E7C8F1B4C23F100697A4C /* ASIndexPath.h in Headers */,
ACF6ED221B17843500DA7C62 /* ASInsetLayoutSpec.h in Headers */,
DE6D9E321C0AD9ED001A1DD3 /* ASRangeHandlerVisible.h in Headers */,
ACF6ED4B1B17847A00DA7C62 /* ASInternalHelpers.h in Headers */,
ACF6ED241B17843500DA7C62 /* ASLayout.h in Headers */,
251B8EFB1BBB3D690087C538 /* ASDataController+Subclasses.h in Headers */,
Expand Down Expand Up @@ -1254,6 +1263,7 @@
B35062171B010EFD0018CF92 /* ASDataController.h in Headers */,
B35062191B010EFD0018CF92 /* ASDealloc2MainObject.h in Headers */,
34EFC75B1B701BAF00AD841F /* ASDimension.h in Headers */,
DE6D9E331C0AD9ED001A1DD3 /* ASRangeHandlerVisible.h in Headers */,
B350624F1B010EFD0018CF92 /* ASDisplayNode+DebugTiming.h in Headers */,
B35061FD1B010EFD0018CF92 /* ASDisplayNode+Subclasses.h in Headers */,
B35061FB1B010EFD0018CF92 /* ASDisplayNode.h in Headers */,
Expand Down Expand Up @@ -1373,7 +1383,6 @@
058D09B9195D04C000B7D73C /* Frameworks */,
058D09BA195D04C000B7D73C /* Resources */,
3B9D88CDF51B429C8409E4B6 /* Copy Pods Resources */,
6CC5F540055A48FCA8C12BF5 /* Embed Pods Frameworks */,
);
buildRules = (
);
Expand Down Expand Up @@ -1503,21 +1512,6 @@
shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-AsyncDisplayKitTests/Pods-AsyncDisplayKitTests-resources.sh\"\n";
showEnvVarsInLog = 0;
};
6CC5F540055A48FCA8C12BF5 /* Embed Pods Frameworks */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
);
name = "Embed Pods Frameworks";
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-AsyncDisplayKitTests/Pods-AsyncDisplayKitTests-frameworks.sh\"\n";
showEnvVarsInLog = 0;
};
/* End PBXShellScriptBuildPhase section */

/* Begin PBXSourcesBuildPhase section */
Expand Down Expand Up @@ -1599,6 +1593,7 @@
055F1A3519ABD3E3004DAFF1 /* ASTableView.mm in Sources */,
058D0A17195D050800B7D73C /* ASTextNode.mm in Sources */,
058D0A1C195D050800B7D73C /* ASTextNodeCoreTextAdditions.m in Sources */,
DE6D9E341C0AD9ED001A1DD3 /* ASRangeHandlerVisible.mm in Sources */,
058D0A1D195D050800B7D73C /* ASTextNodeRenderer.mm in Sources */,
058D0A1E195D050800B7D73C /* ASTextNodeShadower.m in Sources */,
058D0A1F195D050800B7D73C /* ASTextNodeTextKitHelpers.mm in Sources */,
Expand Down Expand Up @@ -1717,6 +1712,7 @@
34EFC7741B701D0A00AD841F /* ASStaticLayoutSpec.mm in Sources */,
B350620B1B010EFD0018CF92 /* ASTableView.mm in Sources */,
B350620E1B010EFD0018CF92 /* ASTextNode.mm in Sources */,
DE6D9E351C0AD9ED001A1DD3 /* ASRangeHandlerVisible.mm in Sources */,
B350622F1B010EFD0018CF92 /* ASTextNodeCoreTextAdditions.m in Sources */,
B35062311B010EFD0018CF92 /* ASTextNodeRenderer.mm in Sources */,
B35062331B010EFD0018CF92 /* ASTextNodeShadower.m in Sources */,
Expand Down
14 changes: 10 additions & 4 deletions AsyncDisplayKit/ASCollectionView.mm
Original file line number Diff line number Diff line change
Expand Up @@ -115,13 +115,22 @@ @interface _ASCollectionViewCell : UICollectionViewCell

@implementation _ASCollectionViewCell

- (void)setNode:(ASCellNode *)node
{
_node = node;
node.selected = self.selected;
node.highlighted = self.highlighted;
}

- (void)setSelected:(BOOL)selected
{
[super setSelected:selected];
_node.selected = selected;
}

- (void)setHighlighted:(BOOL)highlighted
{
[super setHighlighted:highlighted];
_node.highlighted = highlighted;
}

Expand Down Expand Up @@ -479,11 +488,8 @@ - (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cell
_ASCollectionViewCell *cell = [self dequeueReusableCellWithReuseIdentifier:reuseIdentifier forIndexPath:indexPath];

ASCellNode *node = [_dataController nodeAtIndexPath:indexPath];

[_rangeController configureContentView:cell.contentView forCellNode:node];

cell.node = node;

[_rangeController configureContentView:cell.contentView forCellNode:node];
return cell;
}

Expand Down
31 changes: 29 additions & 2 deletions AsyncDisplayKit/ASDisplayNode.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,27 @@ typedef CALayer *(^ASDisplayNodeLayerBlock)();
*/
typedef void (^ASDisplayNodeDidLoadBlock)(ASDisplayNode *node);

/**
Interface state is available on ASDisplayNode and ASViewController, and
allows checking whether a node is in an interface situation where it is prudent to trigger certain
actions: measurement, data fetching, display, and visibility (the latter for animations or other onscreen-only effects).
*/

typedef NS_OPTIONS(NSUInteger, ASInterfaceState)
{
/** The element is not predicted to be onscreen soon and preloading should not be performed */
ASInterfaceStateNone = 1 << 0,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we have this be raw value 0? That way when it's imported into Swift, both [] and .None will correspond to the same value.

/** The element may be added to a view soon that could become visible. Measure the layout, including size calculation. */
ASInterfaceStateMeasureLayout = 1 << 1,
/** The element is likely enough to come onscreen that disk and/or network data required for display should be fetched. */
ASInterfaceStateFetchData = 1 << 2,
/** The element is very likely to become visible, and concurrent rendering should be executed for any -setNeedsDisplay. */
ASInterfaceStateDisplay = 1 << 3,
/** The element is physically onscreen by at least 1 pixel.
In practice, all other bit fields should also be set when this flag is set. */
ASInterfaceStateVisible = 1 << 4,
};

/**
* An `ASDisplayNode` is an abstraction over `UIView` and `CALayer` that allows you to perform calculations about a view
* hierarchy off the main thread, and could do rendering off the main thread as well.
Expand Down Expand Up @@ -123,7 +144,6 @@ typedef void (^ASDisplayNodeDidLoadBlock)(ASDisplayNode *node);

/** @name Getting view and layer */


/**
* @abstract Returns a view.
*
Expand Down Expand Up @@ -160,10 +180,17 @@ typedef void (^ASDisplayNodeDidLoadBlock)(ASDisplayNode *node);
*/
@property (nonatomic, readonly, retain) CALayer *layer;

/**
* @abstract Returns the Interface State of the node.
*
* @return The current ASInterfaceState of the node, indicating whether it is visible and other situational properties.
*
* @see ASInterfaceState
*/
@property (nonatomic, readonly) ASInterfaceState interfaceState;

/** @name Managing dimensions */


/**
* @abstract Asks the node to measure and return the size that best fits its subnodes.
*
Expand Down
Loading