diff --git a/AsyncDisplayKit.xcodeproj/project.pbxproj b/AsyncDisplayKit.xcodeproj/project.pbxproj index 4c73e0d2a5..c8aa1f228b 100644 --- a/AsyncDisplayKit.xcodeproj/project.pbxproj +++ b/AsyncDisplayKit.xcodeproj/project.pbxproj @@ -220,6 +220,7 @@ 69E100701CA89CB600D88C1B /* ASEnvironmentInternal.mm in Sources */ = {isa = PBXBuildFile; fileRef = 69E1006A1CA89CB600D88C1B /* ASEnvironmentInternal.mm */; }; 69EEA0A11D9AB43900B46420 /* ASLayoutSpecPrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = 69EEA0A01D9AB43900B46420 /* ASLayoutSpecPrivate.h */; }; 69F10C871C84C35D0026140C /* ASRangeControllerUpdateRangeProtocol+Beta.h in Headers */ = {isa = PBXBuildFile; fileRef = 69F10C851C84C35D0026140C /* ASRangeControllerUpdateRangeProtocol+Beta.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 69F381A51DA4630D00CF2278 /* NSArray+Diffing.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = DBC452D91C5BF64600B16017 /* NSArray+Diffing.h */; }; 69FEE53D1D95A9AF0086F066 /* ASLayoutElementStyleTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 69FEE53C1D95A9AF0086F066 /* ASLayoutElementStyleTests.m */; }; 7630FFA81C9E267E007A7C0E /* ASVideoNode.h in Headers */ = {isa = PBXBuildFile; fileRef = AEEC47DF1C20C2DD00EC1693 /* ASVideoNode.h */; settings = {ATTRIBUTES = (Public, ); }; }; 764D83D51C8EA515009B4FB8 /* AsyncDisplayKit+Debug.h in Headers */ = {isa = PBXBuildFile; fileRef = 764D83D21C8EA515009B4FB8 /* AsyncDisplayKit+Debug.h */; settings = {ATTRIBUTES = (Public, ); }; }; @@ -649,6 +650,7 @@ dstPath = "include/$(PRODUCT_NAME)"; dstSubfolderSpec = 16; files = ( + 69F381A51DA4630D00CF2278 /* NSArray+Diffing.h in CopyFiles */, CC4C2A7A1D8902350039ACAB /* ASTraceEvent.h in CopyFiles */, CC88F7AE1D80AF5E000D6D4E /* ASObjectDescriptionHelpers.h in CopyFiles */, ACE87A331D73726300D7FF06 /* ASSectionContext.h in CopyFiles */, diff --git a/AsyncDisplayKit/ASDisplayNode.mm b/AsyncDisplayKit/ASDisplayNode.mm index 3a6fcae555..fc46fbb148 100644 --- a/AsyncDisplayKit/ASDisplayNode.mm +++ b/AsyncDisplayKit/ASDisplayNode.mm @@ -191,8 +191,8 @@ static ASDisplayNodeMethodOverrides GetASDisplayNodeMethodOverrides(Class c) [super initialize]; if (self != [ASDisplayNode class]) { - // Subclasses should never override these - NSString *classString = NSStringFromClass(self); + // Subclasses should never override these. Use unused to prevent warnings + __unused NSString *classString = NSStringFromClass(self); ASDisplayNodeAssert(!ASDisplayNodeSubclassOverridesSelector(self, @selector(calculatedSize)), @"Subclass %@ must not override calculatedSize method", classString); ASDisplayNodeAssert(!ASDisplayNodeSubclassOverridesSelector(self, @selector(calculatedLayout)), @"Subclass %@ must not override calculatedLayout method", classString); diff --git a/AsyncDisplayKit/AsyncDisplayKit.h b/AsyncDisplayKit/AsyncDisplayKit.h index 316ce912c6..c267e852b3 100644 --- a/AsyncDisplayKit/AsyncDisplayKit.h +++ b/AsyncDisplayKit/AsyncDisplayKit.h @@ -83,12 +83,14 @@ #import #import #import +#import #import #import #import #import #import +#import #import diff --git a/AsyncDisplayKit/Private/ASDisplayNode+AsyncDisplay.mm b/AsyncDisplayKit/Private/ASDisplayNode+AsyncDisplay.mm index 680ffd41f0..6e2b84c061 100644 --- a/AsyncDisplayKit/Private/ASDisplayNode+AsyncDisplay.mm +++ b/AsyncDisplayKit/Private/ASDisplayNode+AsyncDisplay.mm @@ -275,12 +275,12 @@ if (asynchronously) { uint displaySentinelValue = ++_displaySentinel; __weak ASDisplayNode *weakSelf = self; - isCancelledBlock = ^{ + isCancelledBlock = ^BOOL{ __strong ASDisplayNode *self = weakSelf; return self == nil || (displaySentinelValue != self->_displaySentinel.load()); }; } else { - isCancelledBlock = ^{ + isCancelledBlock = ^BOOL{ return NO; }; } diff --git a/build.sh b/build.sh index 1985b3f865..d936cf1760 100755 --- a/build.sh +++ b/build.sh @@ -51,7 +51,7 @@ if [ "$MODE" = "examples" ]; then fi rm -rf "$example/Pods" pod install --project-directory=$example - + set -o pipefail && xcodebuild \ -workspace "${example}/Sample.xcworkspace" \ -scheme Sample \ @@ -64,17 +64,17 @@ if [ "$MODE" = "examples" ]; then local_repo=`pwd` current_branch=`git rev-parse --abbrev-ref HEAD` cd $example - + echo "git \"file://${local_repo}\" \"${current_branch}\"" > "Cartfile" carthage update --platform iOS - + set -o pipefail && xcodebuild \ -project "Sample.xcodeproj" \ -scheme Sample \ -sdk "$SDK" \ -destination "$PLATFORM" \ build | xcpretty $FORMATTER - + cd ../.. fi done @@ -97,7 +97,7 @@ if [ "$MODE" = "examples-pt1" ]; then fi rm -rf "$example/Pods" pod install --project-directory=$example - + set -o pipefail && xcodebuild \ -workspace "${example}/Sample.xcworkspace" \ -scheme Sample \ @@ -110,17 +110,17 @@ if [ "$MODE" = "examples-pt1" ]; then local_repo=`pwd` current_branch=`git rev-parse --abbrev-ref HEAD` cd $example - + echo "git \"file://${local_repo}\" \"${current_branch}\"" > "Cartfile" carthage update --platform iOS - + set -o pipefail && xcodebuild \ -project "Sample.xcodeproj" \ -scheme Sample \ -sdk "$SDK" \ -destination "$PLATFORM" \ build | xcpretty $FORMATTER - + cd ../.. fi done @@ -143,7 +143,7 @@ if [ "$MODE" = "examples-pt2" ]; then fi rm -rf "$example/Pods" pod install --project-directory=$example - + set -o pipefail && xcodebuild \ -workspace "${example}/Sample.xcworkspace" \ -scheme Sample \ @@ -156,17 +156,17 @@ if [ "$MODE" = "examples-pt2" ]; then local_repo=`pwd` current_branch=`git rev-parse --abbrev-ref HEAD` cd $example - + echo "git \"file://${local_repo}\" \"${current_branch}\"" > "Cartfile" carthage update --platform iOS - + set -o pipefail && xcodebuild \ -project "Sample.xcodeproj" \ -scheme Sample \ -sdk "$SDK" \ -destination "$PLATFORM" \ build | xcpretty $FORMATTER - + cd ../.. fi done @@ -189,7 +189,7 @@ if [ "$MODE" = "examples-pt3" ]; then fi rm -rf "$example/Pods" pod install --project-directory=$example - + set -o pipefail && xcodebuild \ -workspace "${example}/Sample.xcworkspace" \ -scheme Sample \ @@ -202,17 +202,63 @@ if [ "$MODE" = "examples-pt3" ]; then local_repo=`pwd` current_branch=`git rev-parse --abbrev-ref HEAD` cd $example - + echo "git \"file://${local_repo}\" \"${current_branch}\"" > "Cartfile" carthage update --platform iOS - + set -o pipefail && xcodebuild \ -project "Sample.xcodeproj" \ -scheme Sample \ -sdk "$SDK" \ -destination "$PLATFORM" \ build | xcpretty $FORMATTER - + + cd ../.. + fi + done + trap - EXIT + exit 0 +fi + +if [ "$MODE" = "examples-extra" ]; then + echo "Verifying that all AsyncDisplayKit examples compile." + #Update cocoapods repo + pod repo update master + + for example in $((find ./examples_extra -type d -maxdepth 1 \( ! -iname ".*" \)) | head -7 | head); do + echo "Building $example (examples-extra)." + + if [ -f "${example}/Podfile" ]; then + echo "Using CocoaPods" + if [ -f "${example}/Podfile.lock" ]; then + rm "$example/Podfile.lock" + fi + rm -rf "$example/Pods" + pod install --project-directory=$example + + set -o pipefail && xcodebuild \ + -workspace "${example}/Sample.xcworkspace" \ + -scheme Sample \ + -sdk "$SDK" \ + -destination "$PLATFORM" \ + -derivedDataPath ~/ \ + build | xcpretty $FORMATTER + elif [ -f "${example}/Cartfile" ]; then + echo "Using Carthage" + local_repo=`pwd` + current_branch=`git rev-parse --abbrev-ref HEAD` + cd $example + + echo "git \"file://${local_repo}\" \"${current_branch}\"" > "Cartfile" + carthage update --platform iOS + + set -o pipefail && xcodebuild \ + -project "Sample.xcodeproj" \ + -scheme Sample \ + -sdk "$SDK" \ + -destination "$PLATFORM" \ + build | xcpretty $FORMATTER + cd ../.. fi done diff --git a/examples_extra/ASTableViewStressTest/Sample/ViewController.m b/examples_extra/ASTableViewStressTest/Sample/ViewController.m index b16630ecb1..4dfeca76ab 100644 --- a/examples_extra/ASTableViewStressTest/Sample/ViewController.m +++ b/examples_extra/ASTableViewStressTest/Sample/ViewController.m @@ -47,7 +47,7 @@ typedef enum : NSUInteger { if (!(self = [super init])) return nil; - _tableView = [[ASTableView alloc] initWithFrame:CGRectZero style:UITableViewStylePlain asyncDataFetching:YES]; + _tableView = [[ASTableView alloc] initWithFrame:CGRectZero style:UITableViewStylePlain]; _tableView.asyncDataSource = self; _tableView.asyncDelegate = self; _tableView.separatorStyle = UITableViewCellSeparatorStyleNone; diff --git a/examples_extra/ASTraitCollection/Sample/KittenNode.m b/examples_extra/ASTraitCollection/Sample/KittenNode.m index 630db76b1a..70cb9de1ce 100644 --- a/examples_extra/ASTraitCollection/Sample/KittenNode.m +++ b/examples_extra/ASTraitCollection/Sample/KittenNode.m @@ -77,7 +77,7 @@ static const CGFloat kInnerPadding = 10.0f; // kitten image, with a solid background colour serving as placeholder _imageNode = [[ASNetworkImageNode alloc] init]; _imageNode.backgroundColor = ASDisplayNodeDefaultPlaceholderColor(); - _imageNode.style.size = (ASLayoutableSize){ .width = ASDimensionMake(_kittenSize.width), .height = ASDimensionMake(_kittenSize.height) }; + _imageNode.style.preferredSize = _kittenSize; [_imageNode addTarget:self action:@selector(imageTapped:) forControlEvents:ASControlNodeEventTouchUpInside]; CGFloat scale = [UIScreen mainScreen].scale; diff --git a/examples_extra/BackgroundPropertySetting/Sample.xcodeproj/project.pbxproj b/examples_extra/BackgroundPropertySetting/Sample.xcodeproj/project.pbxproj index 31e73d7e61..6a163e01f2 100644 --- a/examples_extra/BackgroundPropertySetting/Sample.xcodeproj/project.pbxproj +++ b/examples_extra/BackgroundPropertySetting/Sample.xcodeproj/project.pbxproj @@ -274,6 +274,7 @@ ONLY_ACTIVE_ARCH = YES; SDKROOT = iphoneos; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + SWIFT_VERSION = 2.3; }; name = Debug; }; @@ -310,6 +311,7 @@ IPHONEOS_DEPLOYMENT_TARGET = 9.2; MTL_ENABLE_DEBUG_INFO = NO; SDKROOT = iphoneos; + SWIFT_VERSION = 2.3; VALIDATE_PRODUCT = YES; }; name = Release; diff --git a/examples_extra/BackgroundPropertySetting/Sample/DemoCellNode.swift b/examples_extra/BackgroundPropertySetting/Sample/DemoCellNode.swift index 1f4ae0e344..a6611b0a7f 100644 --- a/examples_extra/BackgroundPropertySetting/Sample/DemoCellNode.swift +++ b/examples_extra/BackgroundPropertySetting/Sample/DemoCellNode.swift @@ -27,16 +27,16 @@ final class DemoCellNode: ASCellNode { override init() { super.init() - usesImplicitHierarchyManagement = true + automaticallyManagesSubnodes = true } override func layoutSpecThatFits(constrainedSize: ASSizeRange) -> ASLayoutSpec { let specA = ASRatioLayoutSpec(ratio: 1, child: childA) - specA.flexBasis = ASDimensionMakeWithPoints(1) - specA.flexGrow = true + specA.style.flexBasis = ASDimensionMakeWithPoints(1) + specA.style.flexGrow = 1 let specB = ASRatioLayoutSpec(ratio: 1, child: childB) - specB.flexBasis = ASDimensionMakeWithPoints(1) - specB.flexGrow = true + specB.style.flexBasis = ASDimensionMakeWithPoints(1) + specB.style.flexGrow = 1 let children = state.isReverse ? [ specB, specA ] : [ specA, specB ] let direction: ASStackLayoutDirection = state.isVertical ? .Vertical : .Horizontal return ASStackLayoutSpec(direction: direction, @@ -46,7 +46,7 @@ final class DemoCellNode: ASCellNode { children: children) } - override func animateLayoutTransition(context: ASContextTransitioning!) { + override func animateLayoutTransition(context: ASContextTransitioning) { childA.frame = context.initialFrameForNode(childA) childB.frame = context.initialFrameForNode(childB) let tinyDelay = drand48() / 10 diff --git a/examples_extra/CarthageBuildTest/CarthageExample/ViewController.m b/examples_extra/CarthageBuildTest/CarthageExample/ViewController.m index 91ae544fdd..6c48850bbb 100644 --- a/examples_extra/CarthageBuildTest/CarthageExample/ViewController.m +++ b/examples_extra/CarthageBuildTest/CarthageExample/ViewController.m @@ -17,9 +17,8 @@ // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // -@import AsyncDisplayKit; - #import "ViewController.h" +#import @interface ViewController () @@ -35,7 +34,7 @@ dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{ ASTextNode *node = [[ASTextNode alloc] init]; node.attributedText = [[NSAttributedString alloc] initWithString:@"hello world"]; - [node measure:(CGSize){.width = screenSize.width, .height = CGFLOAT_MAX}]; + [node layoutThatFits:ASSizeRangeMake(CGSizeZero, (CGSize){.width = screenSize.width, .height = CGFLOAT_MAX})]; node.frame = (CGRect) {.origin = (CGPoint){.x = 100, .y = 100}, .size = node.calculatedSize }; dispatch_async(dispatch_get_main_queue(), ^{ diff --git a/examples_extra/SynchronousKittens/Sample/ViewController.m b/examples_extra/SynchronousKittens/Sample/ViewController.m index 1eebe66646..f10b60edbe 100644 --- a/examples_extra/SynchronousKittens/Sample/ViewController.m +++ b/examples_extra/SynchronousKittens/Sample/ViewController.m @@ -55,7 +55,7 @@ static const NSInteger kMaxLitterSize = 100; // max number of kitten cell if (!(self = [super init])) return nil; - _tableView = [[ASTableView alloc] initWithFrame:CGRectZero style:UITableViewStylePlain asyncDataFetching:YES]; + _tableView = [[ASTableView alloc] initWithFrame:CGRectZero style:UITableViewStylePlain]; _tableView.separatorStyle = UITableViewCellSeparatorStyleNone; // KittenNode has its own separator _tableView.asyncDataSource = self; _tableView.asyncDelegate = self; diff --git a/examples_extra/VideoTableView/Sample/ViewController.m b/examples_extra/VideoTableView/Sample/ViewController.m index fd8d2851ca..a57e3b2094 100644 --- a/examples_extra/VideoTableView/Sample/ViewController.m +++ b/examples_extra/VideoTableView/Sample/ViewController.m @@ -54,7 +54,7 @@ static const NSInteger kMaxCageSize = 100; // max number of Cage cells al if (!(self = [super init])) return nil; - _tableView = [[ASTableView alloc] initWithFrame:CGRectZero style:UITableViewStylePlain asyncDataFetching:YES]; + _tableView = [[ASTableView alloc] initWithFrame:CGRectZero style:UITableViewStylePlain]; _tableView.separatorStyle = UITableViewCellSeparatorStyleNone; // KittenNode has its own separator _tableView.asyncDataSource = self; _tableView.asyncDelegate = self;