From 13a35c5f2f7addb7a3ddfb1a188119e7eaf4d6e9 Mon Sep 17 00:00:00 2001 From: ricky Date: Fri, 3 Jun 2016 13:59:59 -0700 Subject: [PATCH] more comments * allow nil for setChild/children * moved examples out of examples/ --- AsyncDisplayKit/ASCollectionNode.mm | 1 + AsyncDisplayKit/ASTableNode.mm | 5 +- AsyncDisplayKit/Details/ASEnvironment.h | 2 +- AsyncDisplayKit/Layout/ASLayoutSpec.mm | 41 +- examples/ASTraitCollection/Podfile | 5 - .../Sample.xcodeproj/project.pbxproj | 385 ------------------ .../contents.xcworkspacedata | 7 - .../xcshareddata/xcschemes/Sample.xcscheme | 88 ---- .../contents.xcworkspacedata | 10 - .../ASTraitCollection/Sample/AppDelegate.h | 20 - .../ASTraitCollection/Sample/AppDelegate.m | 31 -- .../Sample/CollectionViewController.h | 15 - .../Sample/CollectionViewController.m | 73 ---- examples/ASTraitCollection/Sample/Info.plist | 39 -- .../ASTraitCollection/Sample/KittenNode.h | 23 -- .../ASTraitCollection/Sample/KittenNode.m | 168 -------- .../Sample/Launch Screen.storyboard | 50 --- .../Sample/OverrideViewController.h | 29 -- .../Sample/OverrideViewController.m | 97 ----- .../Sample/TableViewController.h | 16 - .../Sample/TableViewController.m | 62 --- .../ASTraitCollection/Sample/ViewController.h | 16 - .../ASTraitCollection/Sample/ViewController.m | 45 -- examples/ASTraitCollection/Sample/main.m | 20 - examples_extra/ASTraitCollection/Podfile | 6 +- .../Sample.xcodeproj/project.pbxproj | 36 +- .../ASTraitCollection/Sample/KittenNode.m | 6 +- 27 files changed, 59 insertions(+), 1237 deletions(-) delete mode 100644 examples/ASTraitCollection/Podfile delete mode 100644 examples/ASTraitCollection/Sample.xcodeproj/project.pbxproj delete mode 100644 examples/ASTraitCollection/Sample.xcodeproj/project.xcworkspace/contents.xcworkspacedata delete mode 100644 examples/ASTraitCollection/Sample.xcodeproj/xcshareddata/xcschemes/Sample.xcscheme delete mode 100644 examples/ASTraitCollection/Sample.xcworkspace/contents.xcworkspacedata delete mode 100644 examples/ASTraitCollection/Sample/AppDelegate.h delete mode 100644 examples/ASTraitCollection/Sample/AppDelegate.m delete mode 100644 examples/ASTraitCollection/Sample/CollectionViewController.h delete mode 100644 examples/ASTraitCollection/Sample/CollectionViewController.m delete mode 100644 examples/ASTraitCollection/Sample/Info.plist delete mode 100644 examples/ASTraitCollection/Sample/KittenNode.h delete mode 100644 examples/ASTraitCollection/Sample/KittenNode.m delete mode 100644 examples/ASTraitCollection/Sample/Launch Screen.storyboard delete mode 100644 examples/ASTraitCollection/Sample/OverrideViewController.h delete mode 100644 examples/ASTraitCollection/Sample/OverrideViewController.m delete mode 100644 examples/ASTraitCollection/Sample/TableViewController.h delete mode 100644 examples/ASTraitCollection/Sample/TableViewController.m delete mode 100644 examples/ASTraitCollection/Sample/ViewController.h delete mode 100644 examples/ASTraitCollection/Sample/ViewController.m delete mode 100644 examples/ASTraitCollection/Sample/main.m diff --git a/AsyncDisplayKit/ASCollectionNode.mm b/AsyncDisplayKit/ASCollectionNode.mm index e5c7880f48..a29ee08cf2 100644 --- a/AsyncDisplayKit/ASCollectionNode.mm +++ b/AsyncDisplayKit/ASCollectionNode.mm @@ -11,6 +11,7 @@ #import "ASCollectionViewLayoutFacilitatorProtocol.h" #import "ASDisplayNode+Subclasses.h" #import "ASEnvironmentInternal.h" +#import "ASInternalHelpers.h" #import "ASRangeControllerUpdateRangeProtocol+Beta.h" #include diff --git a/AsyncDisplayKit/ASTableNode.mm b/AsyncDisplayKit/ASTableNode.mm index 7b413bc588..1642478d2d 100644 --- a/AsyncDisplayKit/ASTableNode.mm +++ b/AsyncDisplayKit/ASTableNode.mm @@ -7,10 +7,11 @@ // #import "ASEnvironmentInternal.h" -#import "ASFlowLayoutController.h" -#import "ASTableViewInternal.h" #import "ASDisplayNode+Subclasses.h" +#import "ASFlowLayoutController.h" +#import "ASInternalHelpers.h" #import "ASRangeControllerUpdateRangeProtocol+Beta.h" +#import "ASTableViewInternal.h" @interface _ASTablePendingState : NSObject @property (weak, nonatomic) id delegate; diff --git a/AsyncDisplayKit/Details/ASEnvironment.h b/AsyncDisplayKit/Details/ASEnvironment.h index 5e0233a702..16b71a9b65 100644 --- a/AsyncDisplayKit/Details/ASEnvironment.h +++ b/AsyncDisplayKit/Details/ASEnvironment.h @@ -156,7 +156,7 @@ ASDISPLAYNODE_EXTERN_C_END [super setEnvironmentState:environmentState];\ ASEnvironmentTraitCollection currentTraits = environmentState.environmentTraitCollection;\ if (ASEnvironmentTraitCollectionIsEqualToASEnvironmentTraitCollection(currentTraits, oldTraits) == NO) {\ - dispatch_async(dispatch_get_main_queue(), ^{\ + ASPerformBlockOnMainThread(^{\ NSArray *> *completedNodes = [self.view.dataController completedNodes];\ for (NSArray *sectionArray in completedNodes) {\ for (ASCellNode *cellNode in sectionArray) {\ diff --git a/AsyncDisplayKit/Layout/ASLayoutSpec.mm b/AsyncDisplayKit/Layout/ASLayoutSpec.mm index 79194fa7a1..af46b53842 100644 --- a/AsyncDisplayKit/Layout/ASLayoutSpec.mm +++ b/AsyncDisplayKit/Layout/ASLayoutSpec.mm @@ -44,7 +44,7 @@ } _isMutable = YES; _environmentState = ASEnvironmentStateMakeDefault(); - + _children = [NSArray array]; return self; } @@ -115,24 +115,35 @@ - (void)setChild:(id)child { ASDisplayNodeAssert(self.isMutable, @"Cannot set properties when layout spec is not mutable"); - ASDisplayNodeAssertNotNil(child, @"Child cannot be nil"); - - id finalLayoutable = [self layoutableToAddFromLayoutable:child]; - if (finalLayoutable) { - _children = @[finalLayoutable]; - [self propagateUpLayoutable:finalLayoutable]; + if (child) { + id finalLayoutable = [self layoutableToAddFromLayoutable:child]; + if (finalLayoutable) { + _children = @[finalLayoutable]; + [self propagateUpLayoutable:finalLayoutable]; + } + } else { + // remove the only child + _children = [NSArray array]; } } - (void)setChild:(id)child forIdentifier:(NSString *)identifier { ASDisplayNodeAssert(self.isMutable, @"Cannot set properties when layout spec is not mutable"); - ASDisplayNodeAssertNotNil(child, @"Child cannot be nil"); - - id finalLayoutable = [self layoutableToAddFromLayoutable:child]; - self.childrenWithIdentifier[identifier] = finalLayoutable; - if (finalLayoutable) { - self.children = [self.children arrayByAddingObject:finalLayoutable]; + if (child) { + id finalLayoutable = [self layoutableToAddFromLayoutable:child]; + self.childrenWithIdentifier[identifier] = finalLayoutable; + if (finalLayoutable) { + _children = [_children arrayByAddingObject:finalLayoutable]; + } + } else { + id oldChild = self.childrenWithIdentifier[identifier]; + if (oldChild) { + self.childrenWithIdentifier[identifier] = nil; + NSMutableArray *mutableChildren = [_children mutableCopy]; + [mutableChildren removeObject:oldChild]; + _children = [mutableChildren copy]; + } } // TODO: Should we propagate up the layoutable at it could happen that multiple children will propagated up their @@ -152,6 +163,8 @@ _children = nil; if (finalChildren.size() > 0) { _children = [NSArray arrayWithObjects:&finalChildren[0] count:finalChildren.size()]; + } else { + _children = [NSArray array]; } } @@ -167,7 +180,7 @@ - (NSArray *)children { - return [_children copy]; + return _children; } - (void)setTraitCollection:(ASTraitCollection *)traitCollection diff --git a/examples/ASTraitCollection/Podfile b/examples/ASTraitCollection/Podfile deleted file mode 100644 index 919de4b311..0000000000 --- a/examples/ASTraitCollection/Podfile +++ /dev/null @@ -1,5 +0,0 @@ -source 'https://github.com/CocoaPods/Specs.git' -platform :ios, '7.0' -target 'Sample' do - pod 'AsyncDisplayKit', :path => '../..' -end diff --git a/examples/ASTraitCollection/Sample.xcodeproj/project.pbxproj b/examples/ASTraitCollection/Sample.xcodeproj/project.pbxproj deleted file mode 100644 index f9e679bb36..0000000000 --- a/examples/ASTraitCollection/Sample.xcodeproj/project.pbxproj +++ /dev/null @@ -1,385 +0,0 @@ -// !$*UTF8*$! -{ - archiveVersion = 1; - classes = { - }; - objectVersion = 46; - objects = { - -/* Begin PBXBuildFile section */ - 05E2128719D4DB510098F589 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 05E2128619D4DB510098F589 /* main.m */; }; - 05E2128A19D4DB510098F589 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 05E2128919D4DB510098F589 /* AppDelegate.m */; }; - 05E2128D19D4DB510098F589 /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 05E2128C19D4DB510098F589 /* ViewController.m */; }; - 1BEECAB53F4B61DCB949ED44 /* libPods-Sample.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 1EEDFC574739077BA65E0CF5 /* libPods-Sample.a */; }; - 9C37D01E1CC94BC9004C8BC1 /* Launch Screen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 9C37D01D1CC94BC9004C8BC1 /* Launch Screen.storyboard */; }; - 9CACC7811CCEAF9E009A1613 /* TableViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 9CACC7801CCEAF9E009A1613 /* TableViewController.m */; }; - 9CACC7841CCEAFAE009A1613 /* CollectionViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 9CACC7831CCEAFAE009A1613 /* CollectionViewController.m */; }; - 9CACC7871CCEBD3B009A1613 /* KittenNode.m in Sources */ = {isa = PBXBuildFile; fileRef = 9CACC7861CCEBD3B009A1613 /* KittenNode.m */; }; - 9CACC78A1CCEC82C009A1613 /* OverrideViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 9CACC7891CCEC82C009A1613 /* OverrideViewController.m */; }; -/* End PBXBuildFile section */ - -/* Begin PBXFileReference section */ - 056298286C03B7760575CC56 /* Pods-Sample.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Sample.debug.xcconfig"; path = "Pods/Target Support Files/Pods-Sample/Pods-Sample.debug.xcconfig"; sourceTree = ""; }; - 05E2128119D4DB510098F589 /* Sample.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Sample.app; sourceTree = BUILT_PRODUCTS_DIR; }; - 05E2128519D4DB510098F589 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; - 05E2128619D4DB510098F589 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; - 05E2128819D4DB510098F589 /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; - 05E2128919D4DB510098F589 /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; - 05E2128B19D4DB510098F589 /* ViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ViewController.h; sourceTree = ""; }; - 05E2128C19D4DB510098F589 /* ViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ViewController.m; sourceTree = ""; }; - 088AA6578212BE9BFBB07B70 /* Pods.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = Pods.release.xcconfig; path = "Pods/Target Support Files/Pods/Pods.release.xcconfig"; sourceTree = ""; }; - 1EEDFC574739077BA65E0CF5 /* libPods-Sample.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-Sample.a"; sourceTree = BUILT_PRODUCTS_DIR; }; - 3D24B17D1E4A4E7A9566C5E9 /* libPods.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libPods.a; sourceTree = BUILT_PRODUCTS_DIR; }; - 9C37D01D1CC94BC9004C8BC1 /* Launch Screen.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; path = "Launch Screen.storyboard"; sourceTree = ""; }; - 9CACC77F1CCEAF9E009A1613 /* TableViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TableViewController.h; sourceTree = ""; }; - 9CACC7801CCEAF9E009A1613 /* TableViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TableViewController.m; sourceTree = ""; }; - 9CACC7821CCEAFAE009A1613 /* CollectionViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CollectionViewController.h; sourceTree = ""; }; - 9CACC7831CCEAFAE009A1613 /* CollectionViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CollectionViewController.m; sourceTree = ""; }; - 9CACC7851CCEBD3B009A1613 /* KittenNode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = KittenNode.h; sourceTree = ""; }; - 9CACC7861CCEBD3B009A1613 /* KittenNode.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = KittenNode.m; sourceTree = ""; }; - 9CACC7881CCEC82C009A1613 /* OverrideViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OverrideViewController.h; sourceTree = ""; }; - 9CACC7891CCEC82C009A1613 /* OverrideViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = OverrideViewController.m; sourceTree = ""; }; - A7F0013FBBCBEA0C9FB68986 /* Pods-Sample.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Sample.release.xcconfig"; path = "Pods/Target Support Files/Pods-Sample/Pods-Sample.release.xcconfig"; sourceTree = ""; }; - C068F1D3F0CC317E895FCDAB /* Pods.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = Pods.debug.xcconfig; path = "Pods/Target Support Files/Pods/Pods.debug.xcconfig"; sourceTree = ""; }; -/* End PBXFileReference section */ - -/* Begin PBXFrameworksBuildPhase section */ - 05E2127E19D4DB510098F589 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - 1BEECAB53F4B61DCB949ED44 /* libPods-Sample.a in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXFrameworksBuildPhase section */ - -/* Begin PBXGroup section */ - 05E2127819D4DB510098F589 = { - isa = PBXGroup; - children = ( - 05E2128319D4DB510098F589 /* Sample */, - 05E2128219D4DB510098F589 /* Products */, - 1A943BF0259746F18D6E423F /* Frameworks */, - 1AE410B73DA5C3BD087ACDD7 /* Pods */, - ); - indentWidth = 2; - sourceTree = ""; - tabWidth = 2; - usesTabs = 0; - }; - 05E2128219D4DB510098F589 /* Products */ = { - isa = PBXGroup; - children = ( - 05E2128119D4DB510098F589 /* Sample.app */, - ); - name = Products; - sourceTree = ""; - }; - 05E2128319D4DB510098F589 /* Sample */ = { - isa = PBXGroup; - children = ( - 05E2128819D4DB510098F589 /* AppDelegate.h */, - 05E2128919D4DB510098F589 /* AppDelegate.m */, - 05E2128B19D4DB510098F589 /* ViewController.h */, - 05E2128C19D4DB510098F589 /* ViewController.m */, - 05E2128419D4DB510098F589 /* Supporting Files */, - 9CACC77F1CCEAF9E009A1613 /* TableViewController.h */, - 9CACC7801CCEAF9E009A1613 /* TableViewController.m */, - 9CACC7821CCEAFAE009A1613 /* CollectionViewController.h */, - 9CACC7831CCEAFAE009A1613 /* CollectionViewController.m */, - 9CACC7851CCEBD3B009A1613 /* KittenNode.h */, - 9CACC7861CCEBD3B009A1613 /* KittenNode.m */, - 9CACC7881CCEC82C009A1613 /* OverrideViewController.h */, - 9CACC7891CCEC82C009A1613 /* OverrideViewController.m */, - ); - path = Sample; - sourceTree = ""; - }; - 05E2128419D4DB510098F589 /* Supporting Files */ = { - isa = PBXGroup; - children = ( - 05E2128519D4DB510098F589 /* Info.plist */, - 05E2128619D4DB510098F589 /* main.m */, - 9C37D01D1CC94BC9004C8BC1 /* Launch Screen.storyboard */, - ); - name = "Supporting Files"; - sourceTree = ""; - }; - 1A943BF0259746F18D6E423F /* Frameworks */ = { - isa = PBXGroup; - children = ( - 3D24B17D1E4A4E7A9566C5E9 /* libPods.a */, - 1EEDFC574739077BA65E0CF5 /* libPods-Sample.a */, - ); - name = Frameworks; - sourceTree = ""; - }; - 1AE410B73DA5C3BD087ACDD7 /* Pods */ = { - isa = PBXGroup; - children = ( - C068F1D3F0CC317E895FCDAB /* Pods.debug.xcconfig */, - 088AA6578212BE9BFBB07B70 /* Pods.release.xcconfig */, - 056298286C03B7760575CC56 /* Pods-Sample.debug.xcconfig */, - A7F0013FBBCBEA0C9FB68986 /* Pods-Sample.release.xcconfig */, - ); - name = Pods; - sourceTree = ""; - }; -/* End PBXGroup section */ - -/* Begin PBXNativeTarget section */ - 05E2128019D4DB510098F589 /* Sample */ = { - isa = PBXNativeTarget; - buildConfigurationList = 05E212A419D4DB510098F589 /* Build configuration list for PBXNativeTarget "Sample" */; - buildPhases = ( - E080B80F89C34A25B3488E26 /* 📦 Check Pods Manifest.lock */, - 05E2127D19D4DB510098F589 /* Sources */, - 05E2127E19D4DB510098F589 /* Frameworks */, - 05E2127F19D4DB510098F589 /* Resources */, - F012A6F39E0149F18F564F50 /* 📦 Copy Pods Resources */, - FFF65E837E66ADA71296F0FF /* 📦 Embed Pods Frameworks */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = Sample; - productName = Sample; - productReference = 05E2128119D4DB510098F589 /* Sample.app */; - productType = "com.apple.product-type.application"; - }; -/* End PBXNativeTarget section */ - -/* Begin PBXProject section */ - 05E2127919D4DB510098F589 /* Project object */ = { - isa = PBXProject; - attributes = { - LastUpgradeCheck = 0600; - ORGANIZATIONNAME = Facebook; - TargetAttributes = { - 05E2128019D4DB510098F589 = { - CreatedOnToolsVersion = 6.0.1; - }; - }; - }; - buildConfigurationList = 05E2127C19D4DB510098F589 /* Build configuration list for PBXProject "Sample" */; - compatibilityVersion = "Xcode 3.2"; - developmentRegion = English; - hasScannedForEncodings = 0; - knownRegions = ( - en, - Base, - ); - mainGroup = 05E2127819D4DB510098F589; - productRefGroup = 05E2128219D4DB510098F589 /* Products */; - projectDirPath = ""; - projectRoot = ""; - targets = ( - 05E2128019D4DB510098F589 /* Sample */, - ); - }; -/* End PBXProject section */ - -/* Begin PBXResourcesBuildPhase section */ - 05E2127F19D4DB510098F589 /* Resources */ = { - isa = PBXResourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 9C37D01E1CC94BC9004C8BC1 /* Launch Screen.storyboard in Resources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXResourcesBuildPhase section */ - -/* Begin PBXShellScriptBuildPhase section */ - E080B80F89C34A25B3488E26 /* 📦 Check Pods Manifest.lock */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputPaths = ( - ); - name = "📦 Check Pods Manifest.lock"; - outputPaths = ( - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - 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; - }; - F012A6F39E0149F18F564F50 /* 📦 Copy Pods Resources */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputPaths = ( - ); - name = "📦 Copy Pods Resources"; - outputPaths = ( - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-Sample/Pods-Sample-resources.sh\"\n"; - showEnvVarsInLog = 0; - }; - FFF65E837E66ADA71296F0FF /* 📦 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-Sample/Pods-Sample-frameworks.sh\"\n"; - showEnvVarsInLog = 0; - }; -/* End PBXShellScriptBuildPhase section */ - -/* Begin PBXSourcesBuildPhase section */ - 05E2127D19D4DB510098F589 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 05E2128D19D4DB510098F589 /* ViewController.m in Sources */, - 9CACC78A1CCEC82C009A1613 /* OverrideViewController.m in Sources */, - 05E2128A19D4DB510098F589 /* AppDelegate.m in Sources */, - 05E2128719D4DB510098F589 /* main.m in Sources */, - 9CACC7841CCEAFAE009A1613 /* CollectionViewController.m in Sources */, - 9CACC7871CCEBD3B009A1613 /* KittenNode.m in Sources */, - 9CACC7811CCEAF9E009A1613 /* TableViewController.m in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXSourcesBuildPhase section */ - -/* Begin XCBuildConfiguration section */ - 05E212A219D4DB510098F589 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; - CLANG_CXX_LIBRARY = "libc++"; - CLANG_ENABLE_MODULES = YES; - CLANG_ENABLE_OBJC_ARC = YES; - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; - CLANG_WARN_UNREACHABLE_CODE = YES; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; - COPY_PHASE_STRIP = NO; - ENABLE_STRICT_OBJC_MSGSEND = YES; - GCC_C_LANGUAGE_STANDARD = gnu99; - GCC_DYNAMIC_NO_PIC = NO; - GCC_OPTIMIZATION_LEVEL = 0; - GCC_PREPROCESSOR_DEFINITIONS = ( - "DEBUG=1", - "$(inherited)", - ); - GCC_SYMBOLS_PRIVATE_EXTERN = NO; - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; - GCC_WARN_UNDECLARED_SELECTOR = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 8.0; - MTL_ENABLE_DEBUG_INFO = YES; - ONLY_ACTIVE_ARCH = YES; - SDKROOT = iphoneos; - }; - name = Debug; - }; - 05E212A319D4DB510098F589 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; - CLANG_CXX_LIBRARY = "libc++"; - CLANG_ENABLE_MODULES = YES; - CLANG_ENABLE_OBJC_ARC = YES; - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; - CLANG_WARN_UNREACHABLE_CODE = YES; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; - COPY_PHASE_STRIP = YES; - ENABLE_NS_ASSERTIONS = NO; - ENABLE_STRICT_OBJC_MSGSEND = YES; - GCC_C_LANGUAGE_STANDARD = gnu99; - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; - GCC_WARN_UNDECLARED_SELECTOR = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 8.0; - MTL_ENABLE_DEBUG_INFO = NO; - SDKROOT = iphoneos; - VALIDATE_PRODUCT = YES; - }; - name = Release; - }; - 05E212A519D4DB510098F589 /* Debug */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = 056298286C03B7760575CC56 /* Pods-Sample.debug.xcconfig */; - buildSettings = { - INFOPLIST_FILE = Sample/Info.plist; - IPHONEOS_DEPLOYMENT_TARGET = 9.0; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; - PRODUCT_NAME = "$(TARGET_NAME)"; - TARGETED_DEVICE_FAMILY = "1,2"; - }; - name = Debug; - }; - 05E212A619D4DB510098F589 /* Release */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = A7F0013FBBCBEA0C9FB68986 /* Pods-Sample.release.xcconfig */; - buildSettings = { - INFOPLIST_FILE = Sample/Info.plist; - IPHONEOS_DEPLOYMENT_TARGET = 9.0; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; - PRODUCT_NAME = "$(TARGET_NAME)"; - TARGETED_DEVICE_FAMILY = "1,2"; - }; - name = Release; - }; -/* End XCBuildConfiguration section */ - -/* Begin XCConfigurationList section */ - 05E2127C19D4DB510098F589 /* Build configuration list for PBXProject "Sample" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 05E212A219D4DB510098F589 /* Debug */, - 05E212A319D4DB510098F589 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - 05E212A419D4DB510098F589 /* Build configuration list for PBXNativeTarget "Sample" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 05E212A519D4DB510098F589 /* Debug */, - 05E212A619D4DB510098F589 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; -/* End XCConfigurationList section */ - }; - rootObject = 05E2127919D4DB510098F589 /* Project object */; -} diff --git a/examples/ASTraitCollection/Sample.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/examples/ASTraitCollection/Sample.xcodeproj/project.xcworkspace/contents.xcworkspacedata deleted file mode 100644 index a80c038249..0000000000 --- a/examples/ASTraitCollection/Sample.xcodeproj/project.xcworkspace/contents.xcworkspacedata +++ /dev/null @@ -1,7 +0,0 @@ - - - - - diff --git a/examples/ASTraitCollection/Sample.xcodeproj/xcshareddata/xcschemes/Sample.xcscheme b/examples/ASTraitCollection/Sample.xcodeproj/xcshareddata/xcschemes/Sample.xcscheme deleted file mode 100644 index 1e14aa0329..0000000000 --- a/examples/ASTraitCollection/Sample.xcodeproj/xcshareddata/xcschemes/Sample.xcscheme +++ /dev/null @@ -1,88 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/examples/ASTraitCollection/Sample.xcworkspace/contents.xcworkspacedata b/examples/ASTraitCollection/Sample.xcworkspace/contents.xcworkspacedata deleted file mode 100644 index 7b5a2f3050..0000000000 --- a/examples/ASTraitCollection/Sample.xcworkspace/contents.xcworkspacedata +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - diff --git a/examples/ASTraitCollection/Sample/AppDelegate.h b/examples/ASTraitCollection/Sample/AppDelegate.h deleted file mode 100644 index 85855277e9..0000000000 --- a/examples/ASTraitCollection/Sample/AppDelegate.h +++ /dev/null @@ -1,20 +0,0 @@ -/* This file provided by Facebook is for non-commercial testing and evaluation - * purposes only. Facebook reserves all rights not expressly granted. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN - * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - -#import - -#define UseAutomaticLayout 1 - -@interface AppDelegate : UIResponder - -@property (strong, nonatomic) UIWindow *window; - -@end diff --git a/examples/ASTraitCollection/Sample/AppDelegate.m b/examples/ASTraitCollection/Sample/AppDelegate.m deleted file mode 100644 index 63928f1c38..0000000000 --- a/examples/ASTraitCollection/Sample/AppDelegate.m +++ /dev/null @@ -1,31 +0,0 @@ -/* This file provided by Facebook is for non-commercial testing and evaluation - * purposes only. Facebook reserves all rights not expressly granted. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN - * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - -#import "AppDelegate.h" - -#import "ViewController.h" -#import "TableViewController.h" -#import "CollectionViewController.h" - -@implementation AppDelegate - -- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions -{ - self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; - self.window.backgroundColor = [UIColor whiteColor]; - UITabBarController *tabController = [[UITabBarController alloc] init]; - [tabController setViewControllers:@[[[ViewController alloc] init], [[TableViewController alloc] init], [[CollectionViewController alloc] init]]]; - self.window.rootViewController = tabController; - [self.window makeKeyAndVisible]; - return YES; -} - -@end diff --git a/examples/ASTraitCollection/Sample/CollectionViewController.h b/examples/ASTraitCollection/Sample/CollectionViewController.h deleted file mode 100644 index 613cf835e4..0000000000 --- a/examples/ASTraitCollection/Sample/CollectionViewController.h +++ /dev/null @@ -1,15 +0,0 @@ -/* This file provided by Facebook is for non-commercial testing and evaluation - * purposes only. Facebook reserves all rights not expressly granted. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN - * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - -#import - -@interface CollectionViewController : ASViewController -@end diff --git a/examples/ASTraitCollection/Sample/CollectionViewController.m b/examples/ASTraitCollection/Sample/CollectionViewController.m deleted file mode 100644 index 532b43e051..0000000000 --- a/examples/ASTraitCollection/Sample/CollectionViewController.m +++ /dev/null @@ -1,73 +0,0 @@ -/* This file provided by Facebook is for non-commercial testing and evaluation - * purposes only. Facebook reserves all rights not expressly granted. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN - * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - -#import "CollectionViewController.h" -#import "KittenNode.h" -#import - -@interface CollectionViewController () -@property (nonatomic, strong) ASCollectionNode *collectionNode; -@end - -@implementation CollectionViewController - -- (instancetype)init -{ - UICollectionViewFlowLayout *layout = [[UICollectionViewFlowLayout alloc] init]; - layout.minimumLineSpacing = 10; - layout.minimumInteritemSpacing = 10; - - ASCollectionNode *collectionNode = [[ASCollectionNode alloc] initWithCollectionViewLayout:layout]; - - if (!(self = [super initWithNode:collectionNode])) - return nil; - - self.title = @"Collection Node"; - _collectionNode = collectionNode; - collectionNode.dataSource = self; - collectionNode.delegate = self; - return self; -} - -- (void)viewDidLoad -{ - [super viewDidLoad]; - self.collectionNode.view.contentInset = UIEdgeInsetsMake(20, 10, CGRectGetHeight(self.tabBarController.tabBar.frame), 10); -} - -#pragma mark - ASCollectionDataSource - -- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section -{ - return 50; -} - -- (ASCellNode *)collectionView:(ASCollectionView *)collectionView nodeForItemAtIndexPath:(NSIndexPath *)indexPath -{ - KittenNode *cell = [[KittenNode alloc] init]; - cell.textNode.maximumNumberOfLines = 3; - cell.imageTappedBlock = ^{ - [KittenNode defaultImageTappedAction:self]; - }; - return cell; -} - -- (ASSizeRange)collectionView:(ASCollectionView *)collectionView constrainedSizeForNodeAtIndexPath:(NSIndexPath *)indexPath -{ - ASTraitCollection *traitCollection = [self.collectionNode asyncTraitCollection]; - - if (traitCollection.horizontalSizeClass == UIUserInterfaceSizeClassRegular) { - return ASSizeRangeMake(CGSizeMake(200, 120), CGSizeMake(200, 120)); - } - return ASSizeRangeMake(CGSizeMake(132, 180), CGSizeMake(132, 180)); -} - -@end diff --git a/examples/ASTraitCollection/Sample/Info.plist b/examples/ASTraitCollection/Sample/Info.plist deleted file mode 100644 index acc713cc71..0000000000 --- a/examples/ASTraitCollection/Sample/Info.plist +++ /dev/null @@ -1,39 +0,0 @@ - - - - - CFBundleDevelopmentRegion - en - CFBundleExecutable - $(EXECUTABLE_NAME) - CFBundleIdentifier - com.facebook.AsyncDisplayKit.$(PRODUCT_NAME:rfc1034identifier) - CFBundleInfoDictionaryVersion - 6.0 - CFBundleName - $(PRODUCT_NAME) - CFBundlePackageType - APPL - CFBundleShortVersionString - 1.0 - CFBundleSignature - ???? - CFBundleVersion - 1 - LSRequiresIPhoneOS - - UILaunchStoryboardName - Launch Screen - UIRequiredDeviceCapabilities - - armv7 - - UISupportedInterfaceOrientations - - UIInterfaceOrientationPortrait - UIInterfaceOrientationLandscapeLeft - UIInterfaceOrientationLandscapeRight - UIInterfaceOrientationPortraitUpsideDown - - - diff --git a/examples/ASTraitCollection/Sample/KittenNode.h b/examples/ASTraitCollection/Sample/KittenNode.h deleted file mode 100644 index ae73a8900b..0000000000 --- a/examples/ASTraitCollection/Sample/KittenNode.h +++ /dev/null @@ -1,23 +0,0 @@ -/* This file provided by Facebook is for non-commercial testing and evaluation - * purposes only. Facebook reserves all rights not expressly granted. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN - * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - -#import - -@interface KittenNode : ASCellNode -@property (nonatomic, strong, readonly) ASNetworkImageNode *imageNode; -@property (nonatomic, strong, readonly) ASTextNode *textNode; - -@property (nonatomic, copy) dispatch_block_t imageTappedBlock; - -// The default action when an image node is tapped. This action will create an -// OverrideVC and override its display traits to always be compact. -+ (void)defaultImageTappedAction:(ASViewController *)sourceViewController; -@end diff --git a/examples/ASTraitCollection/Sample/KittenNode.m b/examples/ASTraitCollection/Sample/KittenNode.m deleted file mode 100644 index 18babcdc36..0000000000 --- a/examples/ASTraitCollection/Sample/KittenNode.m +++ /dev/null @@ -1,168 +0,0 @@ -/* This file provided by Facebook is for non-commercial testing and evaluation - * purposes only. Facebook reserves all rights not expressly granted. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN - * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - -#import "KittenNode.h" -#import "OverrideViewController.h" - -#import - -static const CGFloat kOuterPadding = 16.0f; -static const CGFloat kInnerPadding = 10.0f; - -@interface KittenNode () -{ - CGSize _kittenSize; -} - -@end - - -@implementation KittenNode - -// lorem ipsum text courtesy https://kittyipsum.com/ <3 -+ (NSArray *)placeholders -{ - static NSArray *placeholders = nil; - - static dispatch_once_t once; - dispatch_once(&once, ^{ - placeholders = @[ - @"Kitty ipsum dolor sit amet, purr sleep on your face lay down in your way biting, sniff tincidunt a etiam fluffy fur judging you stuck in a tree kittens.", - @"Lick tincidunt a biting eat the grass, egestas enim ut lick leap puking climb the curtains lick.", - @"Lick quis nunc toss the mousie vel, tortor pellentesque sunbathe orci turpis non tail flick suscipit sleep in the sink.", - @"Orci turpis litter box et stuck in a tree, egestas ac tempus et aliquam elit.", - @"Hairball iaculis dolor dolor neque, nibh adipiscing vehicula egestas dolor aliquam.", - @"Sunbathe fluffy fur tortor faucibus pharetra jump, enim jump on the table I don't like that food catnip toss the mousie scratched.", - @"Quis nunc nam sleep in the sink quis nunc purr faucibus, chase the red dot consectetur bat sagittis.", - @"Lick tail flick jump on the table stretching purr amet, rhoncus scratched jump on the table run.", - @"Suspendisse aliquam vulputate feed me sleep on your keyboard, rip the couch faucibus sleep on your keyboard tristique give me fish dolor.", - @"Rip the couch hiss attack your ankles biting pellentesque puking, enim suspendisse enim mauris a.", - @"Sollicitudin iaculis vestibulum toss the mousie biting attack your ankles, puking nunc jump adipiscing in viverra.", - @"Nam zzz amet neque, bat tincidunt a iaculis sniff hiss bibendum leap nibh.", - @"Chase the red dot enim puking chuf, tristique et egestas sniff sollicitudin pharetra enim ut mauris a.", - @"Sagittis scratched et lick, hairball leap attack adipiscing catnip tail flick iaculis lick.", - @"Neque neque sleep in the sink neque sleep on your face, climb the curtains chuf tail flick sniff tortor non.", - @"Ac etiam kittens claw toss the mousie jump, pellentesque rhoncus litter box give me fish adipiscing mauris a.", - @"Pharetra egestas sunbathe faucibus ac fluffy fur, hiss feed me give me fish accumsan.", - @"Tortor leap tristique accumsan rutrum sleep in the sink, amet sollicitudin adipiscing dolor chase the red dot.", - @"Knock over the lamp pharetra vehicula sleep on your face rhoncus, jump elit cras nec quis quis nunc nam.", - @"Sollicitudin feed me et ac in viverra catnip, nunc eat I don't like that food iaculis give me fish.", - ]; - }); - - return placeholders; -} - -- (instancetype)init -{ - if (!(self = [super init])) - return nil; - - _kittenSize = CGSizeMake(100,100); - - // kitten image, with a solid background colour serving as placeholder - _imageNode = [[ASNetworkImageNode alloc] init]; - _imageNode.backgroundColor = ASDisplayNodeDefaultPlaceholderColor(); - _imageNode.preferredFrameSize = _kittenSize; - [_imageNode addTarget:self action:@selector(imageTapped:) forControlEvents:ASControlNodeEventTouchUpInside]; - - CGFloat scale = [UIScreen mainScreen].scale; - _imageNode.URL = [NSURL URLWithString:[NSString stringWithFormat:@"https://placekitten.com/%zd/%zd?image=%zd", - (NSInteger)roundl(_kittenSize.width * scale), - (NSInteger)roundl(_kittenSize.height * scale), - (NSInteger)arc4random_uniform(20)]]; - [self addSubnode:_imageNode]; - - // lorem ipsum text, plus some nice styling - _textNode = [[ASTextNode alloc] init]; - _textNode.attributedString = [[NSAttributedString alloc] initWithString:[self kittyIpsum] - attributes:[self textStyle]]; - _textNode.flexShrink = YES; - _textNode.flexGrow = YES; - [self addSubnode:_textNode]; - - return self; -} - -- (void)imageTapped:(id)sender -{ - if (self.imageTappedBlock) { - self.imageTappedBlock(); - } -} - -- (NSString *)kittyIpsum -{ - NSArray *placeholders = [KittenNode placeholders]; - u_int32_t ipsumCount = (u_int32_t)[placeholders count]; - u_int32_t location = arc4random_uniform(ipsumCount); - u_int32_t length = arc4random_uniform(ipsumCount - location); - - NSMutableString *string = [placeholders[location] mutableCopy]; - for (u_int32_t i = location + 1; i < location + length; i++) { - [string appendString:(i % 2 == 0) ? @"\n" : @" "]; - [string appendString:placeholders[i]]; - } - - return string; -} - -- (NSDictionary *)textStyle -{ - UIFont *font = [UIFont fontWithName:@"HelveticaNeue" size:12.0f]; - - NSMutableParagraphStyle *style = [[NSParagraphStyle defaultParagraphStyle] mutableCopy]; - style.paragraphSpacing = 0.5 * font.lineHeight; - style.hyphenationFactor = 1.0; - - return @{ NSFontAttributeName: font, - NSParagraphStyleAttributeName: style, - ASTextNodeWordKerningAttributeName : @.5}; -} - -- (ASLayoutSpec *)layoutSpecThatFits:(ASSizeRange)constrainedSize -{ - ASStackLayoutSpec *stackSpec = [[ASStackLayoutSpec alloc] init]; - stackSpec.spacing = kInnerPadding; - [stackSpec setChildren:@[_imageNode, _textNode]]; - - if (self.asyncTraitCollection.horizontalSizeClass == UIUserInterfaceSizeClassRegular) { - _imageNode.alignSelf = ASStackLayoutAlignSelfStart; - stackSpec.direction = ASStackLayoutDirectionHorizontal; - } else { - _imageNode.alignSelf = ASStackLayoutAlignSelfCenter; - stackSpec.direction = ASStackLayoutDirectionVertical; - } - - return [ASInsetLayoutSpec insetLayoutSpecWithInsets:UIEdgeInsetsMake(kOuterPadding, kOuterPadding, kOuterPadding, kOuterPadding) child:stackSpec]; -} - -+ (void)defaultImageTappedAction:(ASViewController *)sourceViewController -{ - OverrideViewController *overrideVC = [[OverrideViewController alloc] init]; - - overrideVC.overrideDisplayTraitsWithTraitCollection = ^(UITraitCollection *traitCollection) { - ASTraitCollection *asyncTraitCollection = [ASTraitCollection traitCollectionWithDisplayScale:traitCollection.displayScale - userInterfaceIdiom:traitCollection.userInterfaceIdiom - horizontalSizeClass:UIUserInterfaceSizeClassCompact - verticalSizeClass:UIUserInterfaceSizeClassCompact - forceTouchCapability:traitCollection.forceTouchCapability - traitCollectionContext:nil]; - return asyncTraitCollection; - }; - - [sourceViewController presentViewController:overrideVC animated:YES completion:nil]; - overrideVC.closeBlock = ^{ - [sourceViewController dismissViewControllerAnimated:YES completion:nil]; - }; -} - -@end diff --git a/examples/ASTraitCollection/Sample/Launch Screen.storyboard b/examples/ASTraitCollection/Sample/Launch Screen.storyboard deleted file mode 100644 index 95c8ef474d..0000000000 --- a/examples/ASTraitCollection/Sample/Launch Screen.storyboard +++ /dev/null @@ -1,50 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/examples/ASTraitCollection/Sample/OverrideViewController.h b/examples/ASTraitCollection/Sample/OverrideViewController.h deleted file mode 100644 index 9d9e69d839..0000000000 --- a/examples/ASTraitCollection/Sample/OverrideViewController.h +++ /dev/null @@ -1,29 +0,0 @@ -/* This file provided by Facebook is for non-commercial testing and evaluation - * purposes only. Facebook reserves all rights not expressly granted. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN - * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - -#import - -/* - * A simple node that displays the attribution for the kitties in the app. Note that - * for a regular horizontal size class it does something stupid and sets the font size to 100. - * It's VC, OverrideViewController, will have its display traits overridden such that - * it will always have a compact horizontal size class. - */ -@interface OverrideNode : ASDisplayNode -@end - -/* - * This is a fairly stupid VC that's main purpose is to show how to override ASDisplayTraits. - * Take a look at `defaultImageTappedAction` in KittenNode to see how this is accomplished. - */ -@interface OverrideViewController : ASViewController -@property (nonatomic, copy) dispatch_block_t closeBlock; -@end diff --git a/examples/ASTraitCollection/Sample/OverrideViewController.m b/examples/ASTraitCollection/Sample/OverrideViewController.m deleted file mode 100644 index e9f2b957f1..0000000000 --- a/examples/ASTraitCollection/Sample/OverrideViewController.m +++ /dev/null @@ -1,97 +0,0 @@ -/* This file provided by Facebook is for non-commercial testing and evaluation - * purposes only. Facebook reserves all rights not expressly granted. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN - * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - -#import "OverrideViewController.h" -#import - -static NSString *kLinkAttributeName = @"PlaceKittenNodeLinkAttributeName"; - -@interface OverrideNode() -@property (nonatomic, strong) ASTextNode *textNode; -@property (nonatomic, strong) ASButtonNode *buttonNode; -@end - -@implementation OverrideNode - -- (instancetype)init -{ - if (!(self = [super init])) - return nil; - - _textNode = [[ASTextNode alloc] init]; - _textNode.flexGrow = YES; - _textNode.flexShrink = YES; - _textNode.maximumNumberOfLines = 3; - [self addSubnode:_textNode]; - - _buttonNode = [[ASButtonNode alloc] init]; - [_buttonNode setAttributedTitle:[[NSAttributedString alloc] initWithString:@"Close"] forState:ASControlStateNormal]; - [self addSubnode:_buttonNode]; - - self.backgroundColor = [UIColor lightGrayColor]; - - return self; -} - -- (ASLayoutSpec *)layoutSpecThatFits:(ASSizeRange)constrainedSize -{ - CGFloat pointSize = 16.f; - ASTraitCollection *traitCollection = [self asyncTraitCollection]; - if (traitCollection.horizontalSizeClass == UIUserInterfaceSizeClassRegular) { - // This should never happen because we override the VC's display traits to always be compact. - pointSize = 100; - } - - NSString *blurb = @"kittens courtesy placekitten.com"; - NSMutableAttributedString *string = [[NSMutableAttributedString alloc] initWithString:blurb]; - [string addAttribute:NSFontAttributeName value:[UIFont fontWithName:@"HelveticaNeue" size:pointSize] range:NSMakeRange(0, blurb.length)]; - [string addAttributes:@{ - kLinkAttributeName: [NSURL URLWithString:@"http://placekitten.com/"], - NSForegroundColorAttributeName: [UIColor grayColor], - NSUnderlineStyleAttributeName: @(NSUnderlineStyleSingle | NSUnderlinePatternDot), - } - range:[blurb rangeOfString:@"placekitten.com"]]; - - _textNode.attributedString = string; - - ASStackLayoutSpec *stackSpec = [ASStackLayoutSpec verticalStackLayoutSpec]; - [stackSpec setChildren:@[_textNode, _buttonNode]]; - stackSpec.spacing = 10; - return [ASInsetLayoutSpec insetLayoutSpecWithInsets:UIEdgeInsetsMake(40, 20, 20, 20) child:stackSpec]; -} - -@end - -@interface OverrideViewController () - -@end - -@implementation OverrideViewController - -- (instancetype)init -{ - OverrideNode *overrideNode = [[OverrideNode alloc] init]; - - if (!(self = [super initWithNode:overrideNode])) - return nil; - - [overrideNode.buttonNode addTarget:self action:@selector(closeTapped:) forControlEvents:ASControlNodeEventTouchUpInside]; - return self; -} - -- (void)closeTapped:(id)sender -{ - if (self.closeBlock) { - self.closeBlock(); - } -} - -@end diff --git a/examples/ASTraitCollection/Sample/TableViewController.h b/examples/ASTraitCollection/Sample/TableViewController.h deleted file mode 100644 index 364dde8597..0000000000 --- a/examples/ASTraitCollection/Sample/TableViewController.h +++ /dev/null @@ -1,16 +0,0 @@ -/* This file provided by Facebook is for non-commercial testing and evaluation - * purposes only. Facebook reserves all rights not expressly granted. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN - * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - -#import - -@interface TableViewController : ASViewController - -@end diff --git a/examples/ASTraitCollection/Sample/TableViewController.m b/examples/ASTraitCollection/Sample/TableViewController.m deleted file mode 100644 index bd897a7c75..0000000000 --- a/examples/ASTraitCollection/Sample/TableViewController.m +++ /dev/null @@ -1,62 +0,0 @@ -/* This file provided by Facebook is for non-commercial testing and evaluation - * purposes only. Facebook reserves all rights not expressly granted. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN - * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - -#import "TableViewController.h" -#import "KittenNode.h" - -@interface TableViewController () -@property (nonatomic, strong) ASTableNode *tableNode; -@end - -@implementation TableViewController - -- (instancetype)init -{ - ASTableNode *tableNode = [[ASTableNode alloc] init]; - if (!(self = [super initWithNode:tableNode])) - return nil; - - _tableNode = tableNode; - tableNode.delegate = self; - tableNode.dataSource = self; - self.title = @"Table Node"; - return self; -} - -- (void)viewDidLoad -{ - [super viewDidLoad]; - self.tableNode.view.contentInset = UIEdgeInsetsMake(CGRectGetHeight([[UIApplication sharedApplication] statusBarFrame]), 0, CGRectGetHeight(self.tabBarController.tabBar.frame), 0); -} - -#pragma mark - -#pragma mark ASTableView. - -- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath -{ - [tableView deselectRowAtIndexPath:indexPath animated:YES]; -} - -- (ASCellNode *)tableView:(ASTableView *)tableView nodeForRowAtIndexPath:(NSIndexPath *)indexPath -{ - KittenNode *cell = [[KittenNode alloc] init]; - cell.imageTappedBlock = ^{ - [KittenNode defaultImageTappedAction:self]; - }; - return cell; -} - -- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section -{ - return 15; -} - -@end diff --git a/examples/ASTraitCollection/Sample/ViewController.h b/examples/ASTraitCollection/Sample/ViewController.h deleted file mode 100644 index aa1d583729..0000000000 --- a/examples/ASTraitCollection/Sample/ViewController.h +++ /dev/null @@ -1,16 +0,0 @@ -/* This file provided by Facebook is for non-commercial testing and evaluation - * purposes only. Facebook reserves all rights not expressly granted. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN - * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - -#import - -@interface ViewController : ASViewController - -@end diff --git a/examples/ASTraitCollection/Sample/ViewController.m b/examples/ASTraitCollection/Sample/ViewController.m deleted file mode 100644 index 42e9cb9a4a..0000000000 --- a/examples/ASTraitCollection/Sample/ViewController.m +++ /dev/null @@ -1,45 +0,0 @@ -/* This file provided by Facebook is for non-commercial testing and evaluation - * purposes only. Facebook reserves all rights not expressly granted. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN - * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - -#import "ViewController.h" -#import "KittenNode.h" -#import "OverrideViewController.h" - -#import -#import - -@interface ViewController () -@end - -@implementation ViewController - -#pragma mark - -#pragma mark UIViewController. - -- (instancetype)init -{ - KittenNode *displayNode = [[KittenNode alloc] init]; - if (!(self = [super initWithNode:displayNode])) - return nil; - - self.title = @"Display Node"; - displayNode.imageTappedBlock = ^{ - [KittenNode defaultImageTappedAction:self]; - }; - return self; -} - -- (void)viewWillLayoutSubviews -{ - [super viewWillLayoutSubviews]; -} - -@end diff --git a/examples/ASTraitCollection/Sample/main.m b/examples/ASTraitCollection/Sample/main.m deleted file mode 100644 index ae9488711c..0000000000 --- a/examples/ASTraitCollection/Sample/main.m +++ /dev/null @@ -1,20 +0,0 @@ -/* This file provided by Facebook is for non-commercial testing and evaluation - * purposes only. Facebook reserves all rights not expressly granted. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN - * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - -#import - -#import "AppDelegate.h" - -int main(int argc, char * argv[]) { - @autoreleasepool { - return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); - } -} diff --git a/examples_extra/ASTraitCollection/Podfile b/examples_extra/ASTraitCollection/Podfile index 6c012e3c04..919de4b311 100644 --- a/examples_extra/ASTraitCollection/Podfile +++ b/examples_extra/ASTraitCollection/Podfile @@ -1,3 +1,5 @@ source 'https://github.com/CocoaPods/Specs.git' -platform :ios, '8.0' -pod 'AsyncDisplayKit', :path => '../..' +platform :ios, '7.0' +target 'Sample' do + pod 'AsyncDisplayKit', :path => '../..' +end diff --git a/examples_extra/ASTraitCollection/Sample.xcodeproj/project.pbxproj b/examples_extra/ASTraitCollection/Sample.xcodeproj/project.pbxproj index b46865ed75..f9e679bb36 100644 --- a/examples_extra/ASTraitCollection/Sample.xcodeproj/project.pbxproj +++ b/examples_extra/ASTraitCollection/Sample.xcodeproj/project.pbxproj @@ -10,7 +10,7 @@ 05E2128719D4DB510098F589 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 05E2128619D4DB510098F589 /* main.m */; }; 05E2128A19D4DB510098F589 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 05E2128919D4DB510098F589 /* AppDelegate.m */; }; 05E2128D19D4DB510098F589 /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 05E2128C19D4DB510098F589 /* ViewController.m */; }; - 3EC0CDCBA10D483D9F386E5E /* libPods.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 3D24B17D1E4A4E7A9566C5E9 /* libPods.a */; }; + 1BEECAB53F4B61DCB949ED44 /* libPods-Sample.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 1EEDFC574739077BA65E0CF5 /* libPods-Sample.a */; }; 9C37D01E1CC94BC9004C8BC1 /* Launch Screen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 9C37D01D1CC94BC9004C8BC1 /* Launch Screen.storyboard */; }; 9CACC7811CCEAF9E009A1613 /* TableViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 9CACC7801CCEAF9E009A1613 /* TableViewController.m */; }; 9CACC7841CCEAFAE009A1613 /* CollectionViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 9CACC7831CCEAFAE009A1613 /* CollectionViewController.m */; }; @@ -19,6 +19,7 @@ /* End PBXBuildFile section */ /* Begin PBXFileReference section */ + 056298286C03B7760575CC56 /* Pods-Sample.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Sample.debug.xcconfig"; path = "Pods/Target Support Files/Pods-Sample/Pods-Sample.debug.xcconfig"; sourceTree = ""; }; 05E2128119D4DB510098F589 /* Sample.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Sample.app; sourceTree = BUILT_PRODUCTS_DIR; }; 05E2128519D4DB510098F589 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 05E2128619D4DB510098F589 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; @@ -27,6 +28,7 @@ 05E2128B19D4DB510098F589 /* ViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ViewController.h; sourceTree = ""; }; 05E2128C19D4DB510098F589 /* ViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ViewController.m; sourceTree = ""; }; 088AA6578212BE9BFBB07B70 /* Pods.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = Pods.release.xcconfig; path = "Pods/Target Support Files/Pods/Pods.release.xcconfig"; sourceTree = ""; }; + 1EEDFC574739077BA65E0CF5 /* libPods-Sample.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-Sample.a"; sourceTree = BUILT_PRODUCTS_DIR; }; 3D24B17D1E4A4E7A9566C5E9 /* libPods.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libPods.a; sourceTree = BUILT_PRODUCTS_DIR; }; 9C37D01D1CC94BC9004C8BC1 /* Launch Screen.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; path = "Launch Screen.storyboard"; sourceTree = ""; }; 9CACC77F1CCEAF9E009A1613 /* TableViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TableViewController.h; sourceTree = ""; }; @@ -37,6 +39,7 @@ 9CACC7861CCEBD3B009A1613 /* KittenNode.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = KittenNode.m; sourceTree = ""; }; 9CACC7881CCEC82C009A1613 /* OverrideViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OverrideViewController.h; sourceTree = ""; }; 9CACC7891CCEC82C009A1613 /* OverrideViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = OverrideViewController.m; sourceTree = ""; }; + A7F0013FBBCBEA0C9FB68986 /* Pods-Sample.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Sample.release.xcconfig"; path = "Pods/Target Support Files/Pods-Sample/Pods-Sample.release.xcconfig"; sourceTree = ""; }; C068F1D3F0CC317E895FCDAB /* Pods.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = Pods.debug.xcconfig; path = "Pods/Target Support Files/Pods/Pods.debug.xcconfig"; sourceTree = ""; }; /* End PBXFileReference section */ @@ -45,7 +48,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - 3EC0CDCBA10D483D9F386E5E /* libPods.a in Frameworks */, + 1BEECAB53F4B61DCB949ED44 /* libPods-Sample.a in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -107,6 +110,7 @@ isa = PBXGroup; children = ( 3D24B17D1E4A4E7A9566C5E9 /* libPods.a */, + 1EEDFC574739077BA65E0CF5 /* libPods-Sample.a */, ); name = Frameworks; sourceTree = ""; @@ -116,6 +120,8 @@ children = ( C068F1D3F0CC317E895FCDAB /* Pods.debug.xcconfig */, 088AA6578212BE9BFBB07B70 /* Pods.release.xcconfig */, + 056298286C03B7760575CC56 /* Pods-Sample.debug.xcconfig */, + A7F0013FBBCBEA0C9FB68986 /* Pods-Sample.release.xcconfig */, ); name = Pods; sourceTree = ""; @@ -127,12 +133,12 @@ isa = PBXNativeTarget; buildConfigurationList = 05E212A419D4DB510098F589 /* Build configuration list for PBXNativeTarget "Sample" */; buildPhases = ( - E080B80F89C34A25B3488E26 /* Check Pods Manifest.lock */, + E080B80F89C34A25B3488E26 /* 📦 Check Pods Manifest.lock */, 05E2127D19D4DB510098F589 /* Sources */, 05E2127E19D4DB510098F589 /* Frameworks */, 05E2127F19D4DB510098F589 /* Resources */, - F012A6F39E0149F18F564F50 /* Copy Pods Resources */, - FFF65E837E66ADA71296F0FF /* Embed Pods Frameworks */, + F012A6F39E0149F18F564F50 /* 📦 Copy Pods Resources */, + FFF65E837E66ADA71296F0FF /* 📦 Embed Pods Frameworks */, ); buildRules = ( ); @@ -187,14 +193,14 @@ /* End PBXResourcesBuildPhase section */ /* Begin PBXShellScriptBuildPhase section */ - E080B80F89C34A25B3488E26 /* Check Pods Manifest.lock */ = { + E080B80F89C34A25B3488E26 /* 📦 Check Pods Manifest.lock */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; files = ( ); inputPaths = ( ); - name = "Check Pods Manifest.lock"; + name = "📦 Check Pods Manifest.lock"; outputPaths = ( ); runOnlyForDeploymentPostprocessing = 0; @@ -202,34 +208,34 @@ 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; }; - F012A6F39E0149F18F564F50 /* Copy Pods Resources */ = { + F012A6F39E0149F18F564F50 /* 📦 Copy Pods Resources */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; files = ( ); inputPaths = ( ); - name = "Copy Pods Resources"; + name = "📦 Copy Pods Resources"; outputPaths = ( ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods/Pods-resources.sh\"\n"; + shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-Sample/Pods-Sample-resources.sh\"\n"; showEnvVarsInLog = 0; }; - FFF65E837E66ADA71296F0FF /* Embed Pods Frameworks */ = { + FFF65E837E66ADA71296F0FF /* 📦 Embed Pods Frameworks */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; files = ( ); inputPaths = ( ); - name = "Embed Pods Frameworks"; + name = "📦 Embed Pods Frameworks"; outputPaths = ( ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods/Pods-frameworks.sh\"\n"; + shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-Sample/Pods-Sample-frameworks.sh\"\n"; showEnvVarsInLog = 0; }; /* End PBXShellScriptBuildPhase section */ @@ -330,7 +336,7 @@ }; 05E212A519D4DB510098F589 /* Debug */ = { isa = XCBuildConfiguration; - baseConfigurationReference = C068F1D3F0CC317E895FCDAB /* Pods.debug.xcconfig */; + baseConfigurationReference = 056298286C03B7760575CC56 /* Pods-Sample.debug.xcconfig */; buildSettings = { INFOPLIST_FILE = Sample/Info.plist; IPHONEOS_DEPLOYMENT_TARGET = 9.0; @@ -342,7 +348,7 @@ }; 05E212A619D4DB510098F589 /* Release */ = { isa = XCBuildConfiguration; - baseConfigurationReference = 088AA6578212BE9BFBB07B70 /* Pods.release.xcconfig */; + baseConfigurationReference = A7F0013FBBCBEA0C9FB68986 /* Pods-Sample.release.xcconfig */; buildSettings = { INFOPLIST_FILE = Sample/Info.plist; IPHONEOS_DEPLOYMENT_TARGET = 9.0; diff --git a/examples_extra/ASTraitCollection/Sample/KittenNode.m b/examples_extra/ASTraitCollection/Sample/KittenNode.m index 98771a8cb8..18babcdc36 100644 --- a/examples_extra/ASTraitCollection/Sample/KittenNode.m +++ b/examples_extra/ASTraitCollection/Sample/KittenNode.m @@ -130,13 +130,11 @@ static const CGFloat kInnerPadding = 10.0f; - (ASLayoutSpec *)layoutSpecThatFits:(ASSizeRange)constrainedSize { - ASTraitCollection *traitCollection = [self asyncTraitCollection]; - ASStackLayoutSpec *stackSpec = [[ASStackLayoutSpec alloc] init]; stackSpec.spacing = kInnerPadding; - stackSpec.children = @[_imageNode, _textNode]; + [stackSpec setChildren:@[_imageNode, _textNode]]; - if (traitCollection.horizontalSizeClass == UIUserInterfaceSizeClassRegular) { + if (self.asyncTraitCollection.horizontalSizeClass == UIUserInterfaceSizeClassRegular) { _imageNode.alignSelf = ASStackLayoutAlignSelfStart; stackSpec.direction = ASStackLayoutDirectionHorizontal; } else {