Merge branch 'master' into update-objc

Conflicts:
	AsyncDisplayKit/ASDisplayNode.h
This commit is contained in:
Adlai Holler
2015-11-08 18:19:06 -08:00
15 changed files with 210 additions and 51 deletions

View File

@@ -293,6 +293,8 @@
ACF6ED611B178DC700DA7C62 /* ASOverlayLayoutSpecSnapshotTests.mm in Sources */ = {isa = PBXBuildFile; fileRef = ACF6ED591B178DC700DA7C62 /* ASOverlayLayoutSpecSnapshotTests.mm */; };
ACF6ED621B178DC700DA7C62 /* ASRatioLayoutSpecSnapshotTests.mm in Sources */ = {isa = PBXBuildFile; fileRef = ACF6ED5A1B178DC700DA7C62 /* ASRatioLayoutSpecSnapshotTests.mm */; };
ACF6ED631B178DC700DA7C62 /* ASStackLayoutSpecSnapshotTests.mm in Sources */ = {isa = PBXBuildFile; fileRef = ACF6ED5B1B178DC700DA7C62 /* ASStackLayoutSpecSnapshotTests.mm */; };
B0F8805A1BEAEC7500D17647 /* ASTableNode.h in Headers */ = {isa = PBXBuildFile; fileRef = B0F880581BEAEC7500D17647 /* ASTableNode.h */; };
B0F8805B1BEAEC7500D17647 /* ASTableNode.m in Sources */ = {isa = PBXBuildFile; fileRef = B0F880591BEAEC7500D17647 /* ASTableNode.m */; };
B35061F31B010EFD0018CF92 /* ASCellNode.h in Headers */ = {isa = PBXBuildFile; fileRef = 055F1A3A19ABD43F004DAFF1 /* ASCellNode.h */; settings = {ATTRIBUTES = (Public, ); }; };
B35061F51B010EFD0018CF92 /* ASCollectionView.h in Headers */ = {isa = PBXBuildFile; fileRef = AC3C4A4F1A1139C100143C57 /* ASCollectionView.h */; settings = {ATTRIBUTES = (Public, ); }; };
B35061F61B010EFD0018CF92 /* ASCollectionView.mm in Sources */ = {isa = PBXBuildFile; fileRef = AC3C4A501A1139C100143C57 /* ASCollectionView.mm */; };
@@ -661,6 +663,8 @@
ACF6ED591B178DC700DA7C62 /* ASOverlayLayoutSpecSnapshotTests.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = ASOverlayLayoutSpecSnapshotTests.mm; sourceTree = "<group>"; };
ACF6ED5A1B178DC700DA7C62 /* ASRatioLayoutSpecSnapshotTests.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = ASRatioLayoutSpecSnapshotTests.mm; sourceTree = "<group>"; };
ACF6ED5B1B178DC700DA7C62 /* ASStackLayoutSpecSnapshotTests.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = ASStackLayoutSpecSnapshotTests.mm; sourceTree = "<group>"; };
B0F880581BEAEC7500D17647 /* ASTableNode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ASTableNode.h; sourceTree = "<group>"; };
B0F880591BEAEC7500D17647 /* ASTableNode.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ASTableNode.m; sourceTree = "<group>"; };
B35061DA1B010EDF0018CF92 /* AsyncDisplayKit.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = AsyncDisplayKit.framework; sourceTree = BUILT_PRODUCTS_DIR; };
B35061DD1B010EDF0018CF92 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; name = Info.plist; path = "../AsyncDisplayKit-iOS/Info.plist"; sourceTree = "<group>"; };
CC7FD9DC1BB5E962005CCB2B /* ASPhotosFrameworkImageRequest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ASPhotosFrameworkImageRequest.h; sourceTree = "<group>"; };
@@ -810,6 +814,8 @@
055B9FA71A1C154B00035D6D /* ASNetworkImageNode.mm */,
D785F6601A74327E00291744 /* ASScrollNode.h */,
D785F6611A74327E00291744 /* ASScrollNode.m */,
B0F880581BEAEC7500D17647 /* ASTableNode.h */,
B0F880591BEAEC7500D17647 /* ASTableNode.m */,
055F1A3219ABD3E3004DAFF1 /* ASTableView.h */,
055F1A3319ABD3E3004DAFF1 /* ASTableView.mm */,
AC7A2C161BDE11DF0093FE1A /* ASTableViewInternal.h */,
@@ -1156,6 +1162,7 @@
251B8EFB1BBB3D690087C538 /* ASDataController+Subclasses.h in Headers */,
ACF6ED2A1B17843500DA7C62 /* ASLayoutable.h in Headers */,
9CDC18CC1B910E12004965E2 /* ASLayoutablePrivate.h in Headers */,
B0F8805A1BEAEC7500D17647 /* ASTableNode.h in Headers */,
464052241A3F83C40061C0BA /* ASLayoutController.h in Headers */,
9C5FA3511B8F6ADF00A62714 /* ASLayoutOptions.h in Headers */,
9C65A72A1BA8EA4D0084DA91 /* ASLayoutOptionsPrivate.h in Headers */,
@@ -1594,6 +1601,7 @@
058D0A1F195D050800B7D73C /* ASTextNodeTextKitHelpers.mm in Sources */,
058D0A20195D050800B7D73C /* ASTextNodeWordKerner.m in Sources */,
ACC945AB1BA9E7C1005E1FB8 /* ASViewController.m in Sources */,
B0F8805B1BEAEC7500D17647 /* ASTableNode.m in Sources */,
205F0E221B376416007741D0 /* CGRect+ASConvenience.m in Sources */,
058D0A21195D050800B7D73C /* NSMutableAttributedString+TextKitAdditions.m in Sources */,
205F0E101B371875007741D0 /* UICollectionViewLayout+ASConvenience.m in Sources */,

View File

@@ -508,16 +508,6 @@ typedef void (^ASDisplayNodeDidLoadBlock)(ASDisplayNode *node);
*/
- (CGRect)convertRect:(CGRect)rect fromNode:(nullable ASDisplayNode *)node;
/** @name UIResponder methods */
// By default these fall through to the underlying view, but can be overridden.
- (BOOL)canBecomeFirstResponder; // default==NO
- (BOOL)becomeFirstResponder; // default==NO (no-op)
- (BOOL)canResignFirstResponder; // default==YES
- (BOOL)resignFirstResponder; // default==NO (no-op)
- (BOOL)isFirstResponder;
- (BOOL)canPerformAction:(SEL)action withSender:(nullable id)sender;
@end
@@ -616,6 +606,15 @@ typedef void (^ASDisplayNodeDidLoadBlock)(ASDisplayNode *node);
@property (atomic, assign) CGFloat borderWidth; // default=0
@property (atomic, assign) CGColorRef borderColor; // default=opaque rgb black
// UIResponder methods
// By default these fall through to the underlying view, but can be overridden.
- (BOOL)canBecomeFirstResponder; // default==NO
- (BOOL)becomeFirstResponder; // default==NO (no-op)
- (BOOL)canResignFirstResponder; // default==YES
- (BOOL)resignFirstResponder; // default==NO (no-op)
- (BOOL)isFirstResponder;
- (BOOL)canPerformAction:(SEL)action withSender:(id)sender;
// Accessibility support
@property (atomic, assign) BOOL isAccessibilityElement;
@property (nullable, atomic, copy) NSString *accessibilityLabel;

View File

@@ -2043,35 +2043,6 @@ static void _recursivelySetDisplaySuspended(ASDisplayNode *node, CALayer *layer,
}
- (BOOL)canBecomeFirstResponder {
return NO;
}
- (BOOL)canResignFirstResponder {
return YES;
}
- (BOOL)isFirstResponder {
ASDisplayNodeAssertMainThread();
return _view != nil && [_view isFirstResponder];
}
// Note: this implicitly loads the view if it hasn't been loaded yet.
- (BOOL)becomeFirstResponder {
ASDisplayNodeAssertMainThread();
return !self.layerBacked && [self canBecomeFirstResponder] && [self.view becomeFirstResponder];
}
- (BOOL)resignFirstResponder {
ASDisplayNodeAssertMainThread();
return !self.layerBacked && [self canResignFirstResponder] && [_view resignFirstResponder];
}
- (BOOL)canPerformAction:(SEL)action withSender:(id)sender {
ASDisplayNodeAssertMainThread();
return !self.layerBacked && [self.view canPerformAction:action withSender:sender];
}
- (id<ASLayoutable>)finalLayoutable
{
return self;
@@ -2081,8 +2052,6 @@ static void _recursivelySetDisplaySuspended(ASDisplayNode *node, CALayer *layer,
@implementation ASDisplayNode (Debugging)
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wobjc-protocol-method-implementation"
- (NSString *)description
{
if (self.name) {
@@ -2091,7 +2060,6 @@ static void _recursivelySetDisplaySuspended(ASDisplayNode *node, CALayer *layer,
return [super description];
}
}
#pragma clang diagnostic pop
- (NSString *)debugDescription
{

View File

@@ -0,0 +1,21 @@
//
// ASTableNode.h
// AsyncDisplayKit
//
// Created by Steven Ramkumar on 11/4/15.
// Copyright © 2015 Facebook. All rights reserved.
//
#import <AsyncDisplayKit/AsyncDisplayKit.h>
/**
* ASTableNode is a node based class that wraps an ASTableView. It can be used
* as a subnode of another node, and provide room for many (great) features and improvements later on.
*/
@interface ASTableNode : ASDisplayNode
- (instancetype)initWithStyle:(UITableViewStyle)style NS_DESIGNATED_INITIALIZER;
@property (nonatomic, readonly) ASTableView *view;
@end

View File

@@ -0,0 +1,28 @@
//
// ASTableNode.m
// AsyncDisplayKit
//
// Created by Steven Ramkumar on 11/4/15.
// Copyright © 2015 Facebook. All rights reserved.
//
#import "ASTableNode.h"
@implementation ASTableNode
- (instancetype)initWithStyle:(UITableViewStyle)style
{
if (self = [super initWithViewBlock:^UIView *{
return [[ASTableView alloc] initWithFrame:CGRectZero style:style];
}]) {
return self;
}
return nil;
}
- (ASTableView *)view
{
return (ASTableView *)[super view];
}
@end

View File

@@ -37,6 +37,12 @@
ASDisplayNodeAssertMainThread();
ASDisplayNodeAssert(rangeType == ASLayoutRangeTypeRender, @"Render delegate should not handle other ranges");
// If a node had previously been onscreen but now is only in the working range,
// ensure its view is not orphaned in a UITableViewCell in the reuse pool.
if (![node isLayerBacked] && node.view.superview) {
[node.view removeFromSuperview];
}
[node recursivelySetDisplaySuspended:NO];
// Add the node's layer to an off-screen window to trigger display and mark its contents as non-volatile.

View File

@@ -67,6 +67,41 @@
*/
@implementation ASDisplayNode (UIViewBridge)
- (BOOL)canBecomeFirstResponder
{
return NO;
}
- (BOOL)canResignFirstResponder
{
return YES;
}
- (BOOL)isFirstResponder
{
ASDisplayNodeAssertMainThread();
return _view != nil && [_view isFirstResponder];
}
// Note: this implicitly loads the view if it hasn't been loaded yet.
- (BOOL)becomeFirstResponder
{
ASDisplayNodeAssertMainThread();
return !self.layerBacked && [self canBecomeFirstResponder] && [self.view becomeFirstResponder];
}
- (BOOL)resignFirstResponder
{
ASDisplayNodeAssertMainThread();
return !self.layerBacked && [self canResignFirstResponder] && [_view resignFirstResponder];
}
- (BOOL)canPerformAction:(SEL)action withSender:(id)sender
{
ASDisplayNodeAssertMainThread();
return !self.layerBacked && [self.view canPerformAction:action withSender:sender];
}
- (CGFloat)alpha
{
_bridge_prologue;

View File

@@ -91,7 +91,7 @@
case _ASHierarchyChangeTypeDelete:
return _deleteSectionChanges;
default:
NSAssert(NO, @"Request for section changes with invalid type: %lu", changeType);
NSAssert(NO, @"Request for section changes with invalid type: %lu", (long)changeType);
}
}
@@ -106,7 +106,7 @@
case _ASHierarchyChangeTypeDelete:
return _deleteItemChanges;
default:
NSAssert(NO, @"Request for item changes with invalid type: %lu", changeType);
NSAssert(NO, @"Request for item changes with invalid type: %lu", (long)changeType);
}
}

View File

@@ -7,8 +7,8 @@
objects = {
/* Begin PBXBuildFile section */
9B92C8811BC17D3000EE46B2 /* SupplementaryNode.m in Sources */ = {isa = PBXBuildFile; fileRef = 9B92C8801BC17D3000EE46B2 /* SupplementaryNode.m */; settings = {ASSET_TAGS = (); }; };
9BA2CEA11BB2579C00D18414 /* Launchboard.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 9BA2CEA01BB2579C00D18414 /* Launchboard.storyboard */; settings = {ASSET_TAGS = (); }; };
9B92C8811BC17D3000EE46B2 /* SupplementaryNode.m in Sources */ = {isa = PBXBuildFile; fileRef = 9B92C8801BC17D3000EE46B2 /* SupplementaryNode.m */; };
9BA2CEA11BB2579C00D18414 /* Launchboard.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 9BA2CEA01BB2579C00D18414 /* Launchboard.storyboard */; };
AC3C4A641A11F47200143C57 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = AC3C4A631A11F47200143C57 /* main.m */; };
AC3C4A671A11F47200143C57 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = AC3C4A661A11F47200143C57 /* AppDelegate.m */; };
AC3C4A6A1A11F47200143C57 /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = AC3C4A691A11F47200143C57 /* ViewController.m */; };
@@ -120,6 +120,7 @@
AC3C4A5B1A11F47200143C57 /* Frameworks */,
AC3C4A5C1A11F47200143C57 /* Resources */,
A6902C454C7661D0D277AC62 /* Copy Pods Resources */,
EC37EEC9933F5786936BFE7C /* Embed Pods Frameworks */,
);
buildRules = (
);
@@ -190,6 +191,21 @@
shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods/Pods-resources.sh\"\n";
showEnvVarsInLog = 0;
};
EC37EEC9933F5786936BFE7C /* 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/Pods-frameworks.sh\"\n";
showEnvVarsInLog = 0;
};
F868CFBB21824CC9521B6588 /* Check Pods Manifest.lock */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;

View File

@@ -15,12 +15,32 @@
@implementation AppDelegate
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
self.window.backgroundColor = [UIColor whiteColor];
self.window.rootViewController = [[ViewController alloc] init];
self.window.rootViewController = [[UINavigationController alloc] init];
[self pushNewViewControllerAnimated:NO];
[self.window makeKeyAndVisible];
return YES;
}
- (void)pushNewViewControllerAnimated:(BOOL)animated
{
UINavigationController *navController = (UINavigationController *)self.window.rootViewController;
UIViewController *viewController = [[ViewController alloc] init];
viewController.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:@"Push Another Copy" style:UIBarButtonItemStylePlain target:self action:@selector(pushNewViewController)];
[navController pushViewController:viewController animated:animated];
}
- (void)pushNewViewController
{
[self pushNewViewControllerAnimated:YES];
}
@end

View File

@@ -44,6 +44,9 @@
[_collectionView registerSupplementaryNodeOfKind:UICollectionElementKindSectionHeader];
[_collectionView registerSupplementaryNodeOfKind:UICollectionElementKindSectionFooter];
self.navigationItem.leftItemsSupplementBackButton = YES;
self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemRefresh target:self action:@selector(reloadTapped)];
return self;
}
@@ -64,6 +67,10 @@
return YES;
}
- (void)reloadTapped
{
[_collectionView reloadData];
}
#pragma mark -
#pragma mark ASCollectionView data source.

View File

@@ -118,6 +118,7 @@
05E2127E19D4DB510098F589 /* Frameworks */,
05E2127F19D4DB510098F589 /* Resources */,
F012A6F39E0149F18F564F50 /* Copy Pods Resources */,
E671F9E92DFB9088485E493B /* Embed Pods Frameworks */,
);
buildRules = (
);
@@ -189,6 +190,21 @@
shellScript = "diff \"${PODS_ROOT}/../Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [[ $? != 0 ]] ; then\n cat << EOM\nerror: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\nEOM\n exit 1\nfi\n";
showEnvVarsInLog = 0;
};
E671F9E92DFB9088485E493B /* 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/Pods-frameworks.sh\"\n";
showEnvVarsInLog = 0;
};
F012A6F39E0149F18F564F50 /* Copy Pods Resources */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;

View File

@@ -19,9 +19,28 @@
{
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
self.window.backgroundColor = [UIColor whiteColor];
self.window.rootViewController = [[ViewController alloc] init];
self.window.rootViewController = [[UINavigationController alloc] init];
[self pushNewViewControllerAnimated:NO];
[self.window makeKeyAndVisible];
return YES;
}
- (void)pushNewViewControllerAnimated:(BOOL)animated
{
UINavigationController *navController = (UINavigationController *)self.window.rootViewController;
UIViewController *viewController = [[ViewController alloc] init];
viewController.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:@"Push Another Copy" style:UIBarButtonItemStylePlain target:self action:@selector(pushNewViewController)];
[navController pushViewController:viewController animated:animated];
}
- (void)pushNewViewController
{
[self pushNewViewControllerAnimated:YES];
}
@end

View File

@@ -16,7 +16,7 @@
#define NumberOfSections 10
#define NumberOfRowsPerSection 20
#define NumberOfReloadIterations 500
#define NumberOfReloadIterations 50
@interface ViewController () <ASTableViewDataSource, ASTableViewDelegate>
{

View File

@@ -128,6 +128,7 @@
05E2127E19D4DB510098F589 /* Frameworks */,
05E2127F19D4DB510098F589 /* Resources */,
F012A6F39E0149F18F564F50 /* Copy Pods Resources */,
54296444B3B4D82560F3906E /* Embed Pods Frameworks */,
);
buildRules = (
);
@@ -184,6 +185,21 @@
/* End PBXResourcesBuildPhase section */
/* Begin PBXShellScriptBuildPhase section */
54296444B3B4D82560F3906E /* 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/Pods-frameworks.sh\"\n";
showEnvVarsInLog = 0;
};
E080B80F89C34A25B3488E26 /* Check Pods Manifest.lock */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;