mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-24 07:05:35 +00:00
Initial commit for AsyncDisplayKitOverview
This commit is contained in:
10
examples/AsyncDisplayKitOverview/Podfile
Normal file
10
examples/AsyncDisplayKitOverview/Podfile
Normal file
@@ -0,0 +1,10 @@
|
||||
# Uncomment this line to define a global platform for your project
|
||||
platform :ios, '7.0'
|
||||
|
||||
# Uncomment this line if you're using Swift
|
||||
# use_frameworks!
|
||||
|
||||
target 'Sample' do
|
||||
pod 'AsyncDisplayKit', :path => '../..'
|
||||
end
|
||||
|
||||
@@ -0,0 +1,409 @@
|
||||
// !$*UTF8*$!
|
||||
{
|
||||
archiveVersion = 1;
|
||||
classes = {
|
||||
};
|
||||
objectVersion = 46;
|
||||
objects = {
|
||||
|
||||
/* Begin PBXBuildFile section */
|
||||
697216351CCD8FB300122312 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 697216341CCD8FB300122312 /* main.m */; };
|
||||
697216381CCD8FB300122312 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 697216371CCD8FB300122312 /* AppDelegate.m */; };
|
||||
697216401CCD8FB300122312 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 6972163F1CCD8FB300122312 /* Assets.xcassets */; };
|
||||
697216431CCD8FB300122312 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 697216411CCD8FB300122312 /* LaunchScreen.storyboard */; };
|
||||
6972164E1CCD938A00122312 /* OverviewComponentsViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 6972164B1CCD938A00122312 /* OverviewComponentsViewController.m */; };
|
||||
6972164F1CCD938A00122312 /* OverviewDetailViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 6972164D1CCD938A00122312 /* OverviewDetailViewController.m */; };
|
||||
697216571CCD939000122312 /* OverviewASCollectionNode.m in Sources */ = {isa = PBXBuildFile; fileRef = 697216521CCD939000122312 /* OverviewASCollectionNode.m */; };
|
||||
697216581CCD939000122312 /* OverviewASPagerNode.m in Sources */ = {isa = PBXBuildFile; fileRef = 697216541CCD939000122312 /* OverviewASPagerNode.m */; };
|
||||
697216591CCD939000122312 /* OverviewASTableNode.m in Sources */ = {isa = PBXBuildFile; fileRef = 697216561CCD939000122312 /* OverviewASTableNode.m */; };
|
||||
D06F1FFA9226EAB58D090CD4 /* libPods-Sample.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 70BE04668F29651A74A0DDDC /* libPods-Sample.a */; };
|
||||
/* End PBXBuildFile section */
|
||||
|
||||
/* Begin PBXFileReference section */
|
||||
697216301CCD8FB300122312 /* Sample.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Sample.app; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
697216341CCD8FB300122312 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = "<group>"; };
|
||||
697216361CCD8FB300122312 /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = "<group>"; };
|
||||
697216371CCD8FB300122312 /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = "<group>"; };
|
||||
6972163F1CCD8FB300122312 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
|
||||
697216421CCD8FB300122312 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; };
|
||||
697216441CCD8FB300122312 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
|
||||
6972164A1CCD938A00122312 /* OverviewComponentsViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OverviewComponentsViewController.h; sourceTree = "<group>"; };
|
||||
6972164B1CCD938A00122312 /* OverviewComponentsViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = OverviewComponentsViewController.m; sourceTree = "<group>"; };
|
||||
6972164C1CCD938A00122312 /* OverviewDetailViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OverviewDetailViewController.h; sourceTree = "<group>"; };
|
||||
6972164D1CCD938A00122312 /* OverviewDetailViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = OverviewDetailViewController.m; sourceTree = "<group>"; };
|
||||
697216511CCD939000122312 /* OverviewASCollectionNode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OverviewASCollectionNode.h; sourceTree = "<group>"; };
|
||||
697216521CCD939000122312 /* OverviewASCollectionNode.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = OverviewASCollectionNode.m; sourceTree = "<group>"; };
|
||||
697216531CCD939000122312 /* OverviewASPagerNode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OverviewASPagerNode.h; sourceTree = "<group>"; };
|
||||
697216541CCD939000122312 /* OverviewASPagerNode.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = OverviewASPagerNode.m; sourceTree = "<group>"; };
|
||||
697216551CCD939000122312 /* OverviewASTableNode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OverviewASTableNode.h; sourceTree = "<group>"; };
|
||||
697216561CCD939000122312 /* OverviewASTableNode.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = OverviewASTableNode.m; sourceTree = "<group>"; };
|
||||
70BE04668F29651A74A0DDDC /* libPods-Sample.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-Sample.a"; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
77E10F80392B14772BED991F /* 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 = "<group>"; };
|
||||
9C0C5C6BF9E5B05EEF57DB2A /* 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 = "<group>"; };
|
||||
/* End PBXFileReference section */
|
||||
|
||||
/* Begin PBXFrameworksBuildPhase section */
|
||||
6972162D1CCD8FB300122312 /* Frameworks */ = {
|
||||
isa = PBXFrameworksBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
D06F1FFA9226EAB58D090CD4 /* libPods-Sample.a in Frameworks */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXFrameworksBuildPhase section */
|
||||
|
||||
/* Begin PBXGroup section */
|
||||
2BEE2DA0B40FBAF7BD30B7C2 /* Frameworks */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
70BE04668F29651A74A0DDDC /* libPods-Sample.a */,
|
||||
);
|
||||
name = Frameworks;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
697216271CCD8FB300122312 = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
697216321CCD8FB300122312 /* Sample */,
|
||||
697216311CCD8FB300122312 /* Products */,
|
||||
7DAA9CC1331AADE28CA32C05 /* Pods */,
|
||||
2BEE2DA0B40FBAF7BD30B7C2 /* Frameworks */,
|
||||
);
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
697216311CCD8FB300122312 /* Products */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
697216301CCD8FB300122312 /* Sample.app */,
|
||||
);
|
||||
name = Products;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
697216321CCD8FB300122312 /* Sample */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
697216501CCD939000122312 /* Node Containers */,
|
||||
697216361CCD8FB300122312 /* AppDelegate.h */,
|
||||
697216371CCD8FB300122312 /* AppDelegate.m */,
|
||||
6972164A1CCD938A00122312 /* OverviewComponentsViewController.h */,
|
||||
6972164B1CCD938A00122312 /* OverviewComponentsViewController.m */,
|
||||
6972164C1CCD938A00122312 /* OverviewDetailViewController.h */,
|
||||
6972164D1CCD938A00122312 /* OverviewDetailViewController.m */,
|
||||
6972163F1CCD8FB300122312 /* Assets.xcassets */,
|
||||
697216411CCD8FB300122312 /* LaunchScreen.storyboard */,
|
||||
697216441CCD8FB300122312 /* Info.plist */,
|
||||
697216331CCD8FB300122312 /* Supporting Files */,
|
||||
);
|
||||
path = Sample;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
697216331CCD8FB300122312 /* Supporting Files */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
697216341CCD8FB300122312 /* main.m */,
|
||||
);
|
||||
name = "Supporting Files";
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
697216501CCD939000122312 /* Node Containers */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
697216511CCD939000122312 /* OverviewASCollectionNode.h */,
|
||||
697216521CCD939000122312 /* OverviewASCollectionNode.m */,
|
||||
697216531CCD939000122312 /* OverviewASPagerNode.h */,
|
||||
697216541CCD939000122312 /* OverviewASPagerNode.m */,
|
||||
697216551CCD939000122312 /* OverviewASTableNode.h */,
|
||||
697216561CCD939000122312 /* OverviewASTableNode.m */,
|
||||
);
|
||||
path = "Node Containers";
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
7DAA9CC1331AADE28CA32C05 /* Pods */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
77E10F80392B14772BED991F /* Pods-Sample.debug.xcconfig */,
|
||||
9C0C5C6BF9E5B05EEF57DB2A /* Pods-Sample.release.xcconfig */,
|
||||
);
|
||||
name = Pods;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
/* End PBXGroup section */
|
||||
|
||||
/* Begin PBXNativeTarget section */
|
||||
6972162F1CCD8FB300122312 /* Sample */ = {
|
||||
isa = PBXNativeTarget;
|
||||
buildConfigurationList = 697216471CCD8FB300122312 /* Build configuration list for PBXNativeTarget "Sample" */;
|
||||
buildPhases = (
|
||||
78A0D09A94A74B3737920EA7 /* Check Pods Manifest.lock */,
|
||||
6972162C1CCD8FB300122312 /* Sources */,
|
||||
6972162D1CCD8FB300122312 /* Frameworks */,
|
||||
6972162E1CCD8FB300122312 /* Resources */,
|
||||
267658CA53A0F4A2D24A8438 /* Embed Pods Frameworks */,
|
||||
84F93825AFB1CA7FBB116BA4 /* Copy Pods Resources */,
|
||||
);
|
||||
buildRules = (
|
||||
);
|
||||
dependencies = (
|
||||
);
|
||||
name = Sample;
|
||||
productName = Sample;
|
||||
productReference = 697216301CCD8FB300122312 /* Sample.app */;
|
||||
productType = "com.apple.product-type.application";
|
||||
};
|
||||
/* End PBXNativeTarget section */
|
||||
|
||||
/* Begin PBXProject section */
|
||||
697216281CCD8FB300122312 /* Project object */ = {
|
||||
isa = PBXProject;
|
||||
attributes = {
|
||||
LastUpgradeCheck = 0730;
|
||||
ORGANIZATIONNAME = Facebook;
|
||||
TargetAttributes = {
|
||||
6972162F1CCD8FB300122312 = {
|
||||
CreatedOnToolsVersion = 7.3;
|
||||
};
|
||||
};
|
||||
};
|
||||
buildConfigurationList = 6972162B1CCD8FB300122312 /* Build configuration list for PBXProject "Sample" */;
|
||||
compatibilityVersion = "Xcode 3.2";
|
||||
developmentRegion = English;
|
||||
hasScannedForEncodings = 0;
|
||||
knownRegions = (
|
||||
en,
|
||||
Base,
|
||||
);
|
||||
mainGroup = 697216271CCD8FB300122312;
|
||||
productRefGroup = 697216311CCD8FB300122312 /* Products */;
|
||||
projectDirPath = "";
|
||||
projectRoot = "";
|
||||
targets = (
|
||||
6972162F1CCD8FB300122312 /* Sample */,
|
||||
);
|
||||
};
|
||||
/* End PBXProject section */
|
||||
|
||||
/* Begin PBXResourcesBuildPhase section */
|
||||
6972162E1CCD8FB300122312 /* Resources */ = {
|
||||
isa = PBXResourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
697216431CCD8FB300122312 /* LaunchScreen.storyboard in Resources */,
|
||||
697216401CCD8FB300122312 /* Assets.xcassets in Resources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXResourcesBuildPhase section */
|
||||
|
||||
/* Begin PBXShellScriptBuildPhase section */
|
||||
267658CA53A0F4A2D24A8438 /* 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;
|
||||
};
|
||||
78A0D09A94A74B3737920EA7 /* 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;
|
||||
};
|
||||
84F93825AFB1CA7FBB116BA4 /* 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;
|
||||
};
|
||||
/* End PBXShellScriptBuildPhase section */
|
||||
|
||||
/* Begin PBXSourcesBuildPhase section */
|
||||
6972162C1CCD8FB300122312 /* Sources */ = {
|
||||
isa = PBXSourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
697216581CCD939000122312 /* OverviewASPagerNode.m in Sources */,
|
||||
697216381CCD8FB300122312 /* AppDelegate.m in Sources */,
|
||||
697216351CCD8FB300122312 /* main.m in Sources */,
|
||||
697216571CCD939000122312 /* OverviewASCollectionNode.m in Sources */,
|
||||
697216591CCD939000122312 /* OverviewASTableNode.m in Sources */,
|
||||
6972164F1CCD938A00122312 /* OverviewDetailViewController.m in Sources */,
|
||||
6972164E1CCD938A00122312 /* OverviewComponentsViewController.m in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXSourcesBuildPhase section */
|
||||
|
||||
/* Begin PBXVariantGroup section */
|
||||
697216411CCD8FB300122312 /* LaunchScreen.storyboard */ = {
|
||||
isa = PBXVariantGroup;
|
||||
children = (
|
||||
697216421CCD8FB300122312 /* Base */,
|
||||
);
|
||||
name = LaunchScreen.storyboard;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
/* End PBXVariantGroup section */
|
||||
|
||||
/* Begin XCBuildConfiguration section */
|
||||
697216451CCD8FB300122312 /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ALWAYS_SEARCH_USER_PATHS = NO;
|
||||
CLANG_ANALYZER_NONNULL = YES;
|
||||
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;
|
||||
DEBUG_INFORMATION_FORMAT = dwarf;
|
||||
ENABLE_STRICT_OBJC_MSGSEND = YES;
|
||||
ENABLE_TESTABILITY = YES;
|
||||
GCC_C_LANGUAGE_STANDARD = gnu99;
|
||||
GCC_DYNAMIC_NO_PIC = NO;
|
||||
GCC_NO_COMMON_BLOCKS = YES;
|
||||
GCC_OPTIMIZATION_LEVEL = 0;
|
||||
GCC_PREPROCESSOR_DEFINITIONS = (
|
||||
"DEBUG=1",
|
||||
"$(inherited)",
|
||||
);
|
||||
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 = 9.3;
|
||||
MTL_ENABLE_DEBUG_INFO = YES;
|
||||
ONLY_ACTIVE_ARCH = YES;
|
||||
SDKROOT = iphoneos;
|
||||
TARGETED_DEVICE_FAMILY = "1,2";
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
697216461CCD8FB300122312 /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ALWAYS_SEARCH_USER_PATHS = NO;
|
||||
CLANG_ANALYZER_NONNULL = YES;
|
||||
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;
|
||||
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
|
||||
ENABLE_NS_ASSERTIONS = NO;
|
||||
ENABLE_STRICT_OBJC_MSGSEND = YES;
|
||||
GCC_C_LANGUAGE_STANDARD = gnu99;
|
||||
GCC_NO_COMMON_BLOCKS = YES;
|
||||
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 = 9.3;
|
||||
MTL_ENABLE_DEBUG_INFO = NO;
|
||||
SDKROOT = iphoneos;
|
||||
TARGETED_DEVICE_FAMILY = "1,2";
|
||||
VALIDATE_PRODUCT = YES;
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
697216481CCD8FB300122312 /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
baseConfigurationReference = 77E10F80392B14772BED991F /* Pods-Sample.debug.xcconfig */;
|
||||
buildSettings = {
|
||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||
INFOPLIST_FILE = Sample/Info.plist;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 7.0;
|
||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.facebook.AsyncDisplayKit.Sample;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
697216491CCD8FB300122312 /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
baseConfigurationReference = 9C0C5C6BF9E5B05EEF57DB2A /* Pods-Sample.release.xcconfig */;
|
||||
buildSettings = {
|
||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||
INFOPLIST_FILE = Sample/Info.plist;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 7.0;
|
||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.facebook.AsyncDisplayKit.Sample;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
/* End XCBuildConfiguration section */
|
||||
|
||||
/* Begin XCConfigurationList section */
|
||||
6972162B1CCD8FB300122312 /* Build configuration list for PBXProject "Sample" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
697216451CCD8FB300122312 /* Debug */,
|
||||
697216461CCD8FB300122312 /* Release */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
697216471CCD8FB300122312 /* Build configuration list for PBXNativeTarget "Sample" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
697216481CCD8FB300122312 /* Debug */,
|
||||
697216491CCD8FB300122312 /* Release */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
/* End XCConfigurationList section */
|
||||
};
|
||||
rootObject = 697216281CCD8FB300122312 /* Project object */;
|
||||
}
|
||||
17
examples/AsyncDisplayKitOverview/Sample/AppDelegate.h
Normal file
17
examples/AsyncDisplayKitOverview/Sample/AppDelegate.h
Normal file
@@ -0,0 +1,17 @@
|
||||
//
|
||||
// AppDelegate.h
|
||||
// Sample
|
||||
//
|
||||
// Created by Michael Schneider on 4/24/16.
|
||||
// Copyright © 2016 Facebook. All rights reserved.
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
@interface AppDelegate : UIResponder <UIApplicationDelegate>
|
||||
|
||||
@property (strong, nonatomic) UIWindow *window;
|
||||
|
||||
|
||||
@end
|
||||
|
||||
32
examples/AsyncDisplayKitOverview/Sample/AppDelegate.m
Normal file
32
examples/AsyncDisplayKitOverview/Sample/AppDelegate.m
Normal file
@@ -0,0 +1,32 @@
|
||||
//
|
||||
// AppDelegate.m
|
||||
// Sample
|
||||
//
|
||||
// Created by Michael Schneider on 4/24/16.
|
||||
// Copyright © 2016 Facebook. All rights reserved.
|
||||
//
|
||||
|
||||
#import "AppDelegate.h"
|
||||
#import "OverviewComponentsViewController.h"
|
||||
|
||||
@interface AppDelegate ()
|
||||
|
||||
@end
|
||||
|
||||
@implementation AppDelegate
|
||||
|
||||
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
|
||||
{
|
||||
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
|
||||
self.window.rootViewController = [[UINavigationController alloc] initWithRootViewController:[OverviewComponentsViewController new]];
|
||||
self.window.backgroundColor = [UIColor whiteColor];
|
||||
[self.window makeKeyAndVisible];
|
||||
|
||||
[[UINavigationBar appearance] setBarTintColor:[UIColor colorWithRed:47/255.0 green:184/255.0 blue:253/255.0 alpha:1.0]];
|
||||
[[UINavigationBar appearance] setTintColor:[UIColor whiteColor]];
|
||||
[[UINavigationBar appearance] setTitleTextAttributes:@{NSForegroundColorAttributeName : [UIColor whiteColor]}];;
|
||||
|
||||
return YES;
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -0,0 +1,73 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"idiom" : "iphone",
|
||||
"size" : "29x29",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"idiom" : "iphone",
|
||||
"size" : "29x29",
|
||||
"scale" : "3x"
|
||||
},
|
||||
{
|
||||
"idiom" : "iphone",
|
||||
"size" : "40x40",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"idiom" : "iphone",
|
||||
"size" : "40x40",
|
||||
"scale" : "3x"
|
||||
},
|
||||
{
|
||||
"idiom" : "iphone",
|
||||
"size" : "60x60",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"idiom" : "iphone",
|
||||
"size" : "60x60",
|
||||
"scale" : "3x"
|
||||
},
|
||||
{
|
||||
"idiom" : "ipad",
|
||||
"size" : "29x29",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"idiom" : "ipad",
|
||||
"size" : "29x29",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"idiom" : "ipad",
|
||||
"size" : "40x40",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"idiom" : "ipad",
|
||||
"size" : "40x40",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"idiom" : "ipad",
|
||||
"size" : "76x76",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"idiom" : "ipad",
|
||||
"size" : "76x76",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"idiom" : "ipad",
|
||||
"size" : "83.5x83.5",
|
||||
"scale" : "2x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"version" : 1,
|
||||
"author" : "xcode"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"info" : {
|
||||
"version" : 1,
|
||||
"author" : "xcode"
|
||||
}
|
||||
}
|
||||
21
examples/AsyncDisplayKitOverview/Sample/Assets.xcassets/image.imageset/Contents.json
vendored
Normal file
21
examples/AsyncDisplayKitOverview/Sample/Assets.xcassets/image.imageset/Contents.json
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"filename" : "image.jpg",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "3x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"version" : 1,
|
||||
"author" : "xcode"
|
||||
}
|
||||
}
|
||||
BIN
examples/AsyncDisplayKitOverview/Sample/Assets.xcassets/image.imageset/image.jpg
vendored
Normal file
BIN
examples/AsyncDisplayKitOverview/Sample/Assets.xcassets/image.imageset/image.jpg
vendored
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 621 KiB |
@@ -0,0 +1,27 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="8150" systemVersion="15A204g" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES" initialViewController="01J-lp-oVM">
|
||||
<dependencies>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="8122"/>
|
||||
</dependencies>
|
||||
<scenes>
|
||||
<!--View Controller-->
|
||||
<scene sceneID="EHf-IW-A2E">
|
||||
<objects>
|
||||
<viewController id="01J-lp-oVM" sceneMemberID="viewController">
|
||||
<layoutGuides>
|
||||
<viewControllerLayoutGuide type="top" id="Llm-lL-Icb"/>
|
||||
<viewControllerLayoutGuide type="bottom" id="xb3-aO-Qok"/>
|
||||
</layoutGuides>
|
||||
<view key="view" contentMode="scaleToFill" id="Ze5-6b-2t3">
|
||||
<rect key="frame" x="0.0" y="0.0" width="600" height="600"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<animations/>
|
||||
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
|
||||
</view>
|
||||
</viewController>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="iYj-Kq-Ea1" userLabel="First Responder" sceneMemberID="firstResponder"/>
|
||||
</objects>
|
||||
<point key="canvasLocation" x="53" y="375"/>
|
||||
</scene>
|
||||
</scenes>
|
||||
</document>
|
||||
50
examples/AsyncDisplayKitOverview/Sample/Info.plist
Normal file
50
examples/AsyncDisplayKitOverview/Sample/Info.plist
Normal file
@@ -0,0 +1,50 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>CFBundleDevelopmentRegion</key>
|
||||
<string>en</string>
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>$(EXECUTABLE_NAME)</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
|
||||
<key>CFBundleInfoDictionaryVersion</key>
|
||||
<string>6.0</string>
|
||||
<key>CFBundleName</key>
|
||||
<string>$(PRODUCT_NAME)</string>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>APPL</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>1.0</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>????</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>1</string>
|
||||
<key>LSRequiresIPhoneOS</key>
|
||||
<true/>
|
||||
<key>NSAppTransportSecurity</key>
|
||||
<dict>
|
||||
<key>NSAllowsArbitraryLoads</key>
|
||||
<true/>
|
||||
</dict>
|
||||
<key>UILaunchStoryboardName</key>
|
||||
<string>LaunchScreen</string>
|
||||
<key>UIRequiredDeviceCapabilities</key>
|
||||
<array>
|
||||
<string>armv7</string>
|
||||
</array>
|
||||
<key>UISupportedInterfaceOrientations</key>
|
||||
<array>
|
||||
<string>UIInterfaceOrientationPortrait</string>
|
||||
<string>UIInterfaceOrientationLandscapeLeft</string>
|
||||
<string>UIInterfaceOrientationLandscapeRight</string>
|
||||
</array>
|
||||
<key>UISupportedInterfaceOrientations~ipad</key>
|
||||
<array>
|
||||
<string>UIInterfaceOrientationPortrait</string>
|
||||
<string>UIInterfaceOrientationPortraitUpsideDown</string>
|
||||
<string>UIInterfaceOrientationLandscapeLeft</string>
|
||||
<string>UIInterfaceOrientationLandscapeRight</string>
|
||||
</array>
|
||||
</dict>
|
||||
</plist>
|
||||
@@ -0,0 +1,13 @@
|
||||
//
|
||||
// OverviewASCollectionViewNode.h
|
||||
// AsyncDisplayKitOverview
|
||||
//
|
||||
// Created by Michael Schneider on 4/17/16.
|
||||
// Copyright © 2016 Facebook. All rights reserved.
|
||||
//
|
||||
|
||||
#import "ASDisplayNode.h"
|
||||
|
||||
@interface OverviewASCollectionNode : ASDisplayNode
|
||||
|
||||
@end
|
||||
@@ -0,0 +1,63 @@
|
||||
//
|
||||
// OverviewASCollectionViewNode.m
|
||||
// AsyncDisplayKitOverview
|
||||
//
|
||||
// Created by Michael Schneider on 4/17/16.
|
||||
// Copyright © 2016 Facebook. All rights reserved.
|
||||
//
|
||||
|
||||
#import "OverviewASCollectionNode.h"
|
||||
|
||||
#import <AsyncDisplayKit/AsyncDisplayKit.h>
|
||||
|
||||
@interface OverviewASCollectionNode () <ASCollectionDataSource, ASCollectionDelegate>
|
||||
@property (nonatomic, strong) ASCollectionNode *node;
|
||||
@end
|
||||
|
||||
@implementation OverviewASCollectionNode
|
||||
|
||||
#pragma mark - Lifecycle
|
||||
|
||||
- (instancetype)init
|
||||
{
|
||||
self = [super init];
|
||||
if (self == nil) { return self; }
|
||||
|
||||
UICollectionViewFlowLayout *flowLayout = [UICollectionViewFlowLayout new];
|
||||
_node = [[ASCollectionNode alloc] initWithCollectionViewLayout:flowLayout];
|
||||
_node.dataSource = self;
|
||||
_node.delegate = self;
|
||||
[self addSubnode:_node];;
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
- (ASLayoutSpec *)layoutSpecThatFits:(ASSizeRange)constrainedSize
|
||||
{
|
||||
self.node.sizeRange = ASRelativeSizeRangeMakeWithExactCGSize(constrainedSize.max);
|
||||
return [ASStaticLayoutSpec staticLayoutSpecWithChildren:@[self.node]];
|
||||
}
|
||||
|
||||
#pragma mark - <ASCollectionDataSource, ASCollectionDelegate>
|
||||
|
||||
- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section
|
||||
{
|
||||
return 100;
|
||||
}
|
||||
|
||||
- (ASCellNodeBlock)collectionView:(ASCollectionView *)collectionView nodeBlockForItemAtIndexPath:(NSIndexPath *)indexPath
|
||||
{
|
||||
return ^{
|
||||
ASTextCellNode *cellNode = [ASTextCellNode new];
|
||||
cellNode.backgroundColor = [UIColor lightGrayColor];
|
||||
cellNode.text = [NSString stringWithFormat:@"Row: %ld", indexPath.row];
|
||||
return cellNode;
|
||||
};
|
||||
}
|
||||
|
||||
- (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout sizeForItemAtIndexPath:(NSIndexPath *)indexPath
|
||||
{
|
||||
return CGSizeMake(100, 100);
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -0,0 +1,13 @@
|
||||
//
|
||||
// OverviewASPagerNode.h
|
||||
// AsyncDisplayKitOverview
|
||||
//
|
||||
// Created by Michael Schneider on 4/17/16.
|
||||
// Copyright © 2016 Facebook. All rights reserved.
|
||||
//
|
||||
|
||||
#import <AsyncDisplayKit/AsyncDisplayKit.h>
|
||||
|
||||
@interface OverviewASPagerNode : ASDisplayNode
|
||||
|
||||
@end
|
||||
@@ -0,0 +1,77 @@
|
||||
//
|
||||
// OverviewASPagerNode.m
|
||||
// AsyncDisplayKitOverview
|
||||
//
|
||||
// Created by Michael Schneider on 4/17/16.
|
||||
// Copyright © 2016 Facebook. All rights reserved.
|
||||
//
|
||||
|
||||
#import "OverviewASPagerNode.h"
|
||||
|
||||
#pragma mark - Helper
|
||||
|
||||
static UIColor *OverViewASPagerNodeRandomColor() {
|
||||
CGFloat hue = ( arc4random() % 256 / 256.0 ); // 0.0 to 1.0
|
||||
CGFloat saturation = ( arc4random() % 128 / 256.0 ) + 0.5; // 0.5 to 1.0, away from white
|
||||
CGFloat brightness = ( arc4random() % 128 / 256.0 ) + 0.5; // 0.5 to 1.0, away from black
|
||||
return [UIColor colorWithHue:hue saturation:saturation brightness:brightness alpha:1];
|
||||
}
|
||||
|
||||
|
||||
#pragma mark - OverviewASPageNode
|
||||
|
||||
@interface OverviewASPageNode : ASCellNode @end
|
||||
|
||||
@implementation OverviewASPageNode
|
||||
|
||||
- (ASLayout *)calculateLayoutThatFits:(ASSizeRange)constrainedSize
|
||||
{
|
||||
return [ASLayout layoutWithLayoutableObject:self size:constrainedSize.max];
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
|
||||
#pragma mark - OverviewASPagerNode
|
||||
|
||||
@interface OverviewASPagerNode () <ASPagerNodeDataSource>
|
||||
@property (nonatomic, strong) ASPagerNode *node;
|
||||
@property (nonatomic, copy) NSArray *data;
|
||||
@end
|
||||
|
||||
@implementation OverviewASPagerNode
|
||||
|
||||
- (instancetype)init
|
||||
{
|
||||
self = [super init];
|
||||
if (self == nil) { return self; }
|
||||
|
||||
_node = [ASPagerNode new];
|
||||
_node.dataSource = self;
|
||||
[self addSubnode:_node];
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
- (ASLayoutSpec *)layoutSpecThatFits:(ASSizeRange)constrainedSize
|
||||
{
|
||||
_node.sizeRange = ASRelativeSizeRangeMakeWithExactCGSize(constrainedSize.max);
|
||||
return [ASStaticLayoutSpec staticLayoutSpecWithChildren:@[_node]];
|
||||
}
|
||||
|
||||
- (NSInteger)numberOfPagesInPagerNode:(ASPagerNode *)pagerNode
|
||||
{
|
||||
return 4;
|
||||
}
|
||||
|
||||
- (ASCellNodeBlock)pagerNode:(ASPagerNode *)pagerNode nodeBlockAtIndex:(NSInteger)index
|
||||
{
|
||||
return ^{
|
||||
ASCellNode *cellNode = [OverviewASPageNode new];
|
||||
cellNode.backgroundColor = OverViewASPagerNodeRandomColor();
|
||||
return cellNode;
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@end
|
||||
@@ -0,0 +1,13 @@
|
||||
//
|
||||
// OverviewASTableNode.h
|
||||
// AsyncDisplayKitOverview
|
||||
//
|
||||
// Created by Michael Schneider on 4/17/16.
|
||||
// Copyright © 2016 Facebook. All rights reserved.
|
||||
//
|
||||
|
||||
#import <AsyncDisplayKit/AsyncDisplayKit.h>
|
||||
|
||||
@interface OverviewASTableNode : ASDisplayNode
|
||||
|
||||
@end
|
||||
@@ -0,0 +1,55 @@
|
||||
//
|
||||
// OverviewASTableNode.m
|
||||
// AsyncDisplayKitOverview
|
||||
//
|
||||
// Created by Michael Schneider on 4/17/16.
|
||||
// Copyright © 2016 Facebook. All rights reserved.
|
||||
//
|
||||
|
||||
#import "OverviewASTableNode.h"
|
||||
|
||||
@interface OverviewASTableNode () <ASTableDataSource, ASTableDelegate>
|
||||
@property (nonatomic, strong) ASTableNode *node;
|
||||
@end
|
||||
|
||||
@implementation OverviewASTableNode
|
||||
|
||||
#pragma mark - Lifecycle
|
||||
|
||||
- (instancetype)init
|
||||
{
|
||||
self = [super init];
|
||||
if (self == nil) { return self; }
|
||||
|
||||
_node = [ASTableNode new];
|
||||
_node.dataSource = self;
|
||||
_node.delegate = self;
|
||||
[self addSubnode:_node];
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
- (ASLayoutSpec *)layoutSpecThatFits:(ASSizeRange)constrainedSize
|
||||
{
|
||||
_node.sizeRange = ASRelativeSizeRangeMakeWithExactCGSize(constrainedSize.max);
|
||||
return [ASStaticLayoutSpec staticLayoutSpecWithChildren:@[_node]];
|
||||
}
|
||||
|
||||
|
||||
#pragma mark - <ASCollectionDataSource, ASCollectionDelegate>
|
||||
|
||||
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
|
||||
{
|
||||
return 100;
|
||||
}
|
||||
|
||||
- (ASCellNodeBlock)tableView:(ASTableView *)tableView nodeBlockForRowAtIndexPath:(NSIndexPath *)indexPath
|
||||
{
|
||||
return ^{
|
||||
ASTextCellNode *cellNode = [ASTextCellNode new];
|
||||
cellNode.text = [NSString stringWithFormat:@"Row: %ld", indexPath.row];
|
||||
return cellNode;
|
||||
};
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -0,0 +1,23 @@
|
||||
//
|
||||
// LayoutSpecsOverviewViewController.h
|
||||
// AsyncDisplayKitOverview
|
||||
//
|
||||
// Created by Michael Schneider on 4/15/16.
|
||||
// Copyright © 2016 Facebook. All rights reserved.
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
|
||||
@protocol ASLayoutSpecListEntry <NSObject>
|
||||
|
||||
- (NSString *)entryTitle;
|
||||
- (NSString *)entryDescription;
|
||||
|
||||
@end
|
||||
|
||||
@interface OverviewComponentsViewController : UIViewController
|
||||
|
||||
|
||||
@end
|
||||
|
||||
@@ -0,0 +1,539 @@
|
||||
//
|
||||
// LayoutSpecsOverviewViewController.m
|
||||
// AsyncDisplayKitOverview
|
||||
//
|
||||
// Created by Michael Schneider on 4/15/16.
|
||||
// Copyright © 2016 Facebook. All rights reserved.
|
||||
//
|
||||
|
||||
#import "OverviewComponentsViewController.h"
|
||||
|
||||
#import "OverviewDetailViewController.h"
|
||||
#import "OverviewASCollectionNode.h"
|
||||
#import "OverviewASTableNode.h"
|
||||
#import "OverviewASPagerNode.h"
|
||||
|
||||
#import <AsyncDisplayKit/AsyncDisplayKit.h>
|
||||
|
||||
|
||||
#pragma mark - ASCenterLayoutSpecSizeThatFitsBlock
|
||||
|
||||
typedef ASLayoutSpec *(^OverviewDisplayNodeSizeThatFitsBlock)(ASSizeRange constrainedSize);
|
||||
|
||||
#pragma mark - OverviewDisplayNodeWithSizeBlock
|
||||
|
||||
@interface OverviewDisplayNodeWithSizeBlock : ASDisplayNode<ASLayoutSpecListEntry>
|
||||
@property (nonatomic, copy) NSString *entryTitle;
|
||||
@property (nonatomic, copy) NSString *entryDescription;
|
||||
@property (nonatomic, copy) OverviewDisplayNodeSizeThatFitsBlock sizeThatFitsBlock;
|
||||
@end
|
||||
|
||||
@implementation OverviewDisplayNodeWithSizeBlock
|
||||
|
||||
// FIXME: Use new ASDisplayNodeAPI (layoutSpecBlock) API if shipped
|
||||
- (ASLayoutSpec *)layoutSpecThatFits:(ASSizeRange)constrainedSize
|
||||
{
|
||||
OverviewDisplayNodeSizeThatFitsBlock block = self.sizeThatFitsBlock;
|
||||
if (block != nil) {
|
||||
return block(constrainedSize);
|
||||
}
|
||||
|
||||
return [super layoutSpecThatFits:constrainedSize];
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
#pragma mark - OverviewTitleDescriptionCellNode
|
||||
|
||||
@interface OverviewTitleDescriptionCellNode : ASCellNode
|
||||
@property (nonatomic, strong) ASTextNode *titleNode;
|
||||
@property (nonatomic, strong) ASTextNode *descriptionNode;
|
||||
@end
|
||||
|
||||
@implementation OverviewTitleDescriptionCellNode
|
||||
|
||||
- (instancetype)init
|
||||
{
|
||||
self = [super init];
|
||||
if (self == nil) { return self; }
|
||||
|
||||
_titleNode = [[ASTextNode alloc] init];
|
||||
_descriptionNode = [[ASTextNode alloc] init];
|
||||
|
||||
[self addSubnode:_titleNode];
|
||||
[self addSubnode:_descriptionNode];
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
- (ASLayoutSpec *)layoutSpecThatFits:(ASSizeRange)constrainedSize
|
||||
{
|
||||
BOOL hasDescription = self.descriptionNode.attributedString.length > 0;
|
||||
|
||||
ASStackLayoutSpec *verticalStackLayoutSpec = [ASStackLayoutSpec verticalStackLayoutSpec];
|
||||
verticalStackLayoutSpec.spacing = 5.0;
|
||||
verticalStackLayoutSpec.children = hasDescription ? @[self.titleNode, self.descriptionNode] : @[self.titleNode];
|
||||
|
||||
return [ASInsetLayoutSpec insetLayoutSpecWithInsets:UIEdgeInsetsMake(10, 16, 10, 10) child:verticalStackLayoutSpec];
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
#pragma mark - OverviewComponentsViewController
|
||||
|
||||
@interface OverviewComponentsViewController ()
|
||||
@property (nonatomic, copy) NSArray *data;
|
||||
@property (nonatomic, strong) ASTableNode *tableNode;
|
||||
@end
|
||||
|
||||
@implementation OverviewComponentsViewController
|
||||
|
||||
#pragma mark - UIViewController
|
||||
|
||||
- (void)viewDidLoad
|
||||
{
|
||||
[super viewDidLoad];
|
||||
|
||||
self.title = @"AsyncDisplayKit";
|
||||
|
||||
[self setupData];
|
||||
[self setupTableNode];
|
||||
}
|
||||
|
||||
- (void)viewWillAppear:(BOOL)animated
|
||||
{
|
||||
[super viewWillAppear:animated];
|
||||
|
||||
ASTableView *tableView = self.tableNode.view;
|
||||
[tableView deselectRowAtIndexPath:tableView.indexPathForSelectedRow animated:YES];
|
||||
}
|
||||
|
||||
#pragma mark - Setup
|
||||
|
||||
- (void)setupData
|
||||
{
|
||||
OverviewDisplayNodeWithSizeBlock *parentNode = nil;
|
||||
ASDisplayNode *childNode = nil;
|
||||
|
||||
|
||||
// Setup Nodes Container
|
||||
// ---------------------------------------------------------------------------------------------------------
|
||||
NSMutableArray *mutableNodesContainerData = [NSMutableArray array];
|
||||
|
||||
#pragma mark ASCollectionNode
|
||||
childNode = [OverviewASCollectionNode new];
|
||||
|
||||
parentNode = [self centeringParentNodeWithInset:UIEdgeInsetsZero child:childNode];
|
||||
parentNode.entryTitle = @"ASCollectionNode";
|
||||
parentNode.entryDescription = @"ASCollectionNode is a node based class that wraps an ASCollectionView. It can be used as a subnode of another node, and provide room for many (great) features and improvements later on.";
|
||||
[mutableNodesContainerData addObject:parentNode];
|
||||
|
||||
#pragma mark ASTableNode
|
||||
childNode = [OverviewASTableNode new];
|
||||
|
||||
parentNode = [self centeringParentNodeWithInset:UIEdgeInsetsZero child:childNode];
|
||||
parentNode.entryTitle = @"ASTableNode";
|
||||
parentNode.entryDescription = @"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.";
|
||||
[mutableNodesContainerData addObject:parentNode];
|
||||
|
||||
#pragma mark ASPagerNode
|
||||
childNode = [OverviewASPagerNode new];
|
||||
|
||||
parentNode = [self centeringParentNodeWithInset:UIEdgeInsetsZero child:childNode];
|
||||
parentNode.entryTitle = @"ASPagerNode";
|
||||
parentNode.entryDescription = @"ASPagerNode is a specialized subclass of ASCollectionNode. Using it allows you to produce a page style UI similar to what you'd create with a UIPageViewController with UIKit. Luckily, the API is quite a bit simpler than UIPageViewController's.";
|
||||
[mutableNodesContainerData addObject:parentNode];
|
||||
|
||||
|
||||
// Setup Nodes
|
||||
// ---------------------------------------------------------------------------------------------------------
|
||||
NSMutableArray *mutableNodesData = [NSMutableArray array];
|
||||
|
||||
#pragma mark ASDisplayNode
|
||||
ASDisplayNode *displayNode = [self childNode];
|
||||
|
||||
parentNode = [self centeringParentNodeWithChild:displayNode];
|
||||
parentNode.entryTitle = @"ASDisplayNode";
|
||||
parentNode.entryDescription = @"ASDisplayNode is the main view abstraction over UIView and CALayer. It initializes and owns a UIView in the same way UIViews create and own their own backing CALayers.";
|
||||
[mutableNodesData addObject:parentNode];
|
||||
|
||||
#pragma mark ASButtonNode
|
||||
ASButtonNode *buttonNode = [ASButtonNode new];
|
||||
|
||||
// Set title for button node with a given font or color. If you pass in nil for font or color the default system
|
||||
// font and black as color will be used
|
||||
[buttonNode setTitle:@"Button Title Normal" withFont:nil withColor:[UIColor blueColor] forState:ASControlStateNormal];
|
||||
[buttonNode setTitle:@"Button Title Highlighted" withFont:[UIFont systemFontOfSize:14] withColor:nil forState:ASControlStateHighlighted];
|
||||
[buttonNode addTarget:self action:@selector(buttonPressed:) forControlEvents:ASControlNodeEventTouchUpInside];
|
||||
|
||||
parentNode = [self centeringParentNodeWithChild:buttonNode];
|
||||
parentNode.entryTitle = @"ASButtonNode";
|
||||
parentNode.entryDescription = @"ASButtonNode (a subclass of ASControlNode) supports simple buttons, with multiple states for a text label and an image with a few different layout options. Enables layerBacking for subnodes to significantly lighten main thread impact relative to UIButton (though async preparation is the bigger win).";
|
||||
[mutableNodesData addObject:parentNode];
|
||||
|
||||
#pragma mark ASTextNode
|
||||
ASTextNode *textNode = [ASTextNode new];
|
||||
textNode.attributedString = [[NSAttributedString alloc] initWithString:@"Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum varius nisi quis mattis dignissim. Proin convallis odio nec ipsum molestie, in porta quam viverra. Fusce ornare dapibus velit, nec malesuada mauris pretium vitae. Etiam malesuada ligula magna."];
|
||||
|
||||
parentNode = [self centeringParentNodeWithChild:textNode];
|
||||
parentNode.entryTitle = @"ASTextNode";
|
||||
parentNode.entryDescription = @"Like UITextView — built on TextKit with full-featured rich text support.";
|
||||
[mutableNodesData addObject:parentNode];
|
||||
|
||||
#pragma mark ASEditableTextNode
|
||||
ASEditableTextNode *editableTextNode = [ASEditableTextNode new];
|
||||
editableTextNode.backgroundColor = [UIColor lightGrayColor];
|
||||
editableTextNode.attributedText = [[NSAttributedString alloc] initWithString:@"Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum varius nisi quis mattis dignissim. Proin convallis odio nec ipsum molestie, in porta quam viverra. Fusce ornare dapibus velit, nec malesuada mauris pretium vitae. Etiam malesuada ligula magna."];
|
||||
|
||||
parentNode = [self centeringParentNodeWithChild:editableTextNode];
|
||||
parentNode.entryTitle = @"ASEditableTextNode";
|
||||
parentNode.entryDescription = @"ASEditableTextNode provides a flexible, efficient, and animation-friendly editable text component.";
|
||||
[mutableNodesData addObject:parentNode];
|
||||
|
||||
#pragma mark ASImageNode
|
||||
ASImageNode *imageNode = [ASImageNode new];
|
||||
imageNode.image = [UIImage imageNamed:@"image"];
|
||||
imageNode.preferredFrameSize = CGSizeMake(imageNode.image.size.width / 7, imageNode.image.size.height / 7);
|
||||
|
||||
parentNode = [self centeringParentNodeWithChild:imageNode];
|
||||
parentNode.entryTitle = @"ASImageNode";
|
||||
parentNode.entryDescription = @"Like UIImageView — decodes images asynchronously.";
|
||||
[mutableNodesData addObject:parentNode];
|
||||
|
||||
#pragma mark ASNetworkImageNode
|
||||
ASNetworkImageNode *networkImageNode = [ASNetworkImageNode new];
|
||||
networkImageNode.URL = [NSURL URLWithString:@"http://i.imgur.com/FjOR9kX.jpg"];
|
||||
networkImageNode.preferredFrameSize = CGSizeMake(imageNode.image.size.width / 7, imageNode.image.size.height / 7);
|
||||
|
||||
parentNode = [self centeringParentNodeWithChild:networkImageNode];
|
||||
parentNode.entryTitle = @"ASNetworkImageNode";
|
||||
parentNode.entryDescription = @"ASNetworkImageNode is a simple image node that can download and display an image from the network, with support for a placeholder image.";
|
||||
[mutableNodesData addObject:parentNode];
|
||||
|
||||
#pragma mark ASMapNode
|
||||
ASMapNode *mapNode = [ASMapNode new];
|
||||
mapNode.preferredFrameSize = CGSizeMake(300.0, 300.0);
|
||||
|
||||
// San Francisco
|
||||
CLLocationCoordinate2D coord = CLLocationCoordinate2DMake(37.7749, -122.4194);
|
||||
mapNode.region = MKCoordinateRegionMakeWithDistance(coord, 20000, 20000);
|
||||
|
||||
parentNode = [self centeringParentNodeWithChild:mapNode];
|
||||
parentNode.entryTitle = @"ASMapNode";
|
||||
parentNode.entryDescription = @"ASMapNode offers completely asynchronous preparation, automatic preloading, and efficient memory handling. Its standard mode is a fully asynchronous snapshot, with liveMap mode loading automatically triggered by any ASTableView or ASCollectionView; its .liveMap mode can be flipped on with ease (even on a background thread) to provide a cached, fully interactive map when necessary.";
|
||||
[mutableNodesData addObject:parentNode];
|
||||
|
||||
#pragma mark ASVideoNode
|
||||
ASVideoNode *videoNode = [ASVideoNode new];
|
||||
videoNode.preferredFrameSize = CGSizeMake(300.0, 400.0);
|
||||
|
||||
AVAsset *asset = [AVAsset assetWithURL:[NSURL URLWithString:@"http://www.w3schools.com/html/mov_bbb.mp4"]];
|
||||
videoNode.asset = asset;
|
||||
|
||||
parentNode = [self centeringParentNodeWithChild:videoNode];
|
||||
parentNode.entryTitle = @"ASVideoNode";
|
||||
parentNode.entryDescription = @"ASVideoNode is a newer class that exposes a relatively full-featured API, and is designed for both efficient and convenient implementation of embedded videos in scrolling views.";
|
||||
[mutableNodesData addObject:parentNode];
|
||||
|
||||
#pragma mark ASScrollNode
|
||||
UIImage *scrollNodeImage = [UIImage imageNamed:@"image"];
|
||||
|
||||
ASScrollNode *scrollNode = [ASScrollNode new];
|
||||
scrollNode.preferredFrameSize = CGSizeMake(300.0, 400.0);
|
||||
|
||||
UIScrollView *scrollNodeView = scrollNode.view;
|
||||
[scrollNodeView addSubview:[[UIImageView alloc] initWithImage:scrollNodeImage]];
|
||||
scrollNodeView.contentSize = scrollNodeImage.size;
|
||||
|
||||
parentNode = [self centeringParentNodeWithChild:scrollNode];
|
||||
parentNode.entryTitle = @"ASScrollNode";
|
||||
parentNode.entryDescription = @"Simple node that wraps UIScrollView.";
|
||||
[mutableNodesData addObject:parentNode];
|
||||
|
||||
|
||||
// Layout Specs
|
||||
// ---------------------------------------------------------------------------------------------------------
|
||||
NSMutableArray *mutableLayoutSpecData = [NSMutableArray array];
|
||||
|
||||
#pragma mark ASInsetLayoutSpec
|
||||
childNode = [self childNode];
|
||||
|
||||
parentNode = [self parentNodeWithChild:childNode];
|
||||
parentNode.entryTitle = @"ASInsetLayoutSpec";
|
||||
parentNode.entryDescription = @"Applies an inset margin around a component.";
|
||||
parentNode.sizeThatFitsBlock = ^ASLayoutSpec *(ASSizeRange constrainedSize) {
|
||||
return [ASInsetLayoutSpec insetLayoutSpecWithInsets:UIEdgeInsetsMake(20, 10, 0, 0) child:childNode];
|
||||
};
|
||||
[parentNode addSubnode:childNode];
|
||||
[mutableLayoutSpecData addObject:parentNode];
|
||||
|
||||
|
||||
#pragma mark ASBackgroundLayoutSpec
|
||||
ASDisplayNode *backgroundNode = [ASDisplayNode new];
|
||||
backgroundNode.backgroundColor = [UIColor greenColor];
|
||||
|
||||
childNode = [self childNode];
|
||||
childNode.backgroundColor = [childNode.backgroundColor colorWithAlphaComponent:0.5];
|
||||
|
||||
parentNode = [self parentNodeWithChild:childNode];
|
||||
parentNode.entryTitle = @"ASBackgroundLayoutSpec";
|
||||
parentNode.entryDescription = @"Lays out a component, stretching another component behind it as a backdrop.";
|
||||
parentNode.sizeThatFitsBlock = ^ASLayoutSpec *(ASSizeRange constrainedSize) {
|
||||
return [ASBackgroundLayoutSpec backgroundLayoutSpecWithChild:childNode background:backgroundNode];
|
||||
};
|
||||
[parentNode addSubnode:backgroundNode];
|
||||
[parentNode addSubnode:childNode];
|
||||
[mutableLayoutSpecData addObject:parentNode];
|
||||
|
||||
|
||||
#pragma mark ASOverlayLayoutSpec
|
||||
ASDisplayNode *overlayNode = [ASDisplayNode new];
|
||||
overlayNode.backgroundColor = [[UIColor greenColor] colorWithAlphaComponent:0.5];
|
||||
|
||||
childNode = [self childNode];
|
||||
|
||||
parentNode = [self parentNodeWithChild:childNode];
|
||||
parentNode.entryTitle = @"ASOverlayLayoutSpec";
|
||||
parentNode.entryDescription = @"Lays out a component, stretching another component on top of it as an overlay.";
|
||||
parentNode.sizeThatFitsBlock = ^ASLayoutSpec *(ASSizeRange constrainedSize) {
|
||||
return [ASOverlayLayoutSpec overlayLayoutSpecWithChild:childNode overlay:overlayNode];
|
||||
};
|
||||
[parentNode addSubnode:childNode];
|
||||
[parentNode addSubnode:overlayNode];
|
||||
[mutableLayoutSpecData addObject:parentNode];
|
||||
|
||||
|
||||
#pragma mark ASCenterLayoutSpec
|
||||
childNode = [self childNode];
|
||||
|
||||
parentNode = [self parentNodeWithChild:childNode];
|
||||
parentNode.entryTitle = @"ASCenterLayoutSpec";
|
||||
parentNode.entryDescription = @"Centers a component in the available space.";
|
||||
parentNode.sizeThatFitsBlock = ^ASLayoutSpec *(ASSizeRange constrainedSize) {
|
||||
return [ASCenterLayoutSpec centerLayoutSpecWithCenteringOptions:ASCenterLayoutSpecCenteringXY
|
||||
sizingOptions:ASCenterLayoutSpecSizingOptionDefault
|
||||
child:childNode];
|
||||
};
|
||||
[parentNode addSubnode:childNode];
|
||||
[mutableLayoutSpecData addObject:parentNode];
|
||||
|
||||
#pragma mark ASRatioLayoutSpec
|
||||
childNode = [self childNode];
|
||||
|
||||
parentNode = [self parentNodeWithChild:childNode];
|
||||
parentNode.entryTitle = @"ASRatioLayoutSpec";
|
||||
parentNode.entryDescription = @"Lays out a component at a fixed aspect ratio. Great for images, gifs and videos.";
|
||||
parentNode.sizeThatFitsBlock = ^ASLayoutSpec *(ASSizeRange constrainedSize) {
|
||||
return [ASRatioLayoutSpec ratioLayoutSpecWithRatio:0.25 child:childNode];
|
||||
};
|
||||
[parentNode addSubnode:childNode];
|
||||
[mutableLayoutSpecData addObject:parentNode];
|
||||
|
||||
#pragma mark ASRelativeLayoutSpec
|
||||
childNode = [self childNode];
|
||||
|
||||
parentNode = [self parentNodeWithChild:childNode];
|
||||
parentNode.entryTitle = @"ASRelativeLayoutSpec";
|
||||
parentNode.entryDescription = @"Lays out a component and positions it within the layout bounds according to vertical and horizontal positional specifiers. Similar to the “9-part” image areas, a child can be positioned at any of the 4 corners, or the middle of any of the 4 edges, as well as the center.";
|
||||
parentNode.sizeThatFitsBlock = ^ASLayoutSpec *(ASSizeRange constrainedSize) {
|
||||
return [ASRelativeLayoutSpec relativePositionLayoutSpecWithHorizontalPosition:ASRelativeLayoutSpecPositionEnd
|
||||
verticalPosition:ASRelativeLayoutSpecPositionCenter
|
||||
sizingOption:ASRelativeLayoutSpecSizingOptionDefault
|
||||
child:childNode];
|
||||
};
|
||||
[parentNode addSubnode:childNode];
|
||||
[mutableLayoutSpecData addObject:parentNode];
|
||||
|
||||
#pragma mark ASStaticLayoutSpec
|
||||
childNode = [self childNode];
|
||||
// Add a layout position to the child node that the static layout spec will pick up and place it on that position
|
||||
childNode.layoutPosition = CGPointMake(10.0, 10.0);
|
||||
|
||||
parentNode = [self parentNodeWithChild:childNode];
|
||||
parentNode.entryTitle = @"ASStaticLayoutSpec";
|
||||
parentNode.entryDescription = @"Allows positioning children at fixed offsets.";
|
||||
parentNode.sizeThatFitsBlock = ^ASLayoutSpec *(ASSizeRange constrainedSize) {
|
||||
return [ASStaticLayoutSpec staticLayoutSpecWithChildren:@[childNode]];
|
||||
};
|
||||
[parentNode addSubnode:childNode];
|
||||
[mutableLayoutSpecData addObject:parentNode];
|
||||
|
||||
|
||||
#pragma mark Vertical ASStackLayoutSpec
|
||||
ASDisplayNode *childNode1 = [self childNode];
|
||||
childNode1.backgroundColor = [UIColor greenColor];
|
||||
|
||||
ASDisplayNode *childNode2 = [self childNode];
|
||||
childNode2.backgroundColor = [UIColor blueColor];
|
||||
|
||||
ASDisplayNode *childNode3 = [self childNode];
|
||||
childNode3.backgroundColor = [UIColor yellowColor];
|
||||
|
||||
// If we just would add the childrent to the stack layout the layout would be to tall and run out of the edge of
|
||||
// the node as 50+50+50 = 150 but the parent node is only 100 height. To prevent that we set flexShrink on 2 of the
|
||||
// children to let the stack layout know it should shrink these children in case the layout will run over the edge
|
||||
childNode2.flexShrink = YES;
|
||||
childNode3.flexShrink = YES;
|
||||
|
||||
parentNode = [self parentNodeWithChild:childNode];
|
||||
parentNode.entryTitle = @"Vertical ASStackLayoutSpec";
|
||||
parentNode.entryDescription = @"Is based on a simplified version of CSS flexbox. It allows you to stack components vertically or horizontally and specify how they should be flexed and aligned to fit in the available space.";
|
||||
parentNode.sizeThatFitsBlock = ^ASLayoutSpec *(ASSizeRange constrainedSize) {
|
||||
ASStackLayoutSpec *verticalStackLayoutSpec = [ASStackLayoutSpec verticalStackLayoutSpec];
|
||||
verticalStackLayoutSpec.children = @[childNode1, childNode2, childNode3];
|
||||
return verticalStackLayoutSpec;
|
||||
};
|
||||
[parentNode addSubnode:childNode1];
|
||||
[parentNode addSubnode:childNode2];
|
||||
[parentNode addSubnode:childNode3];
|
||||
[mutableLayoutSpecData addObject:parentNode];
|
||||
|
||||
#pragma mark Horizontal ASStackLayoutSpec
|
||||
childNode1 = [ASDisplayNode new];
|
||||
childNode1.preferredFrameSize = CGSizeMake(10.0, 20);
|
||||
childNode1.flexGrow = YES;
|
||||
childNode1.backgroundColor = [UIColor greenColor];
|
||||
|
||||
childNode2 = [ASDisplayNode new];
|
||||
childNode2.preferredFrameSize = CGSizeMake(10.0, 20.0);
|
||||
childNode2.alignSelf = ASStackLayoutAlignSelfStretch;
|
||||
childNode2.backgroundColor = [UIColor blueColor];
|
||||
|
||||
childNode3 = [ASDisplayNode new];
|
||||
childNode3.preferredFrameSize = CGSizeMake(10.0, 20.0);
|
||||
childNode3.backgroundColor = [UIColor yellowColor];
|
||||
|
||||
parentNode = [self parentNodeWithChild:childNode];
|
||||
parentNode.entryTitle = @"Horizontal ASStackLayoutSpec";
|
||||
parentNode.entryDescription = @"Is based on a simplified version of CSS flexbox. It allows you to stack components vertically or horizontally and specify how they should be flexed and aligned to fit in the available space.";
|
||||
parentNode.sizeThatFitsBlock = ^ASLayoutSpec *(ASSizeRange constrainedSize) {
|
||||
|
||||
// Create stack alyout spec to layout children
|
||||
ASStackLayoutSpec *verticalStackLayoutSpec = [ASStackLayoutSpec horizontalStackLayoutSpec];
|
||||
verticalStackLayoutSpec.children = @[childNode1, childNode2, childNode3];
|
||||
verticalStackLayoutSpec.spacing = 5.0; // Spacing between children
|
||||
|
||||
// Layout the stack layout with 100% width and 100% height of the parent node
|
||||
ASRelativeSizeRange sizeRange = ASRelativeSizeRangeMakeWithExactRelativeDimensions(ASRelativeDimensionMakeWithPercent(1),
|
||||
ASRelativeDimensionMakeWithPercent(1));
|
||||
verticalStackLayoutSpec.sizeRange = sizeRange;
|
||||
|
||||
// Wrap the static stack layout in a static spec so it will grow to the whole parent node size
|
||||
ASStaticLayoutSpec *staticLayoutSpec = [ASStaticLayoutSpec staticLayoutSpecWithChildren:@[verticalStackLayoutSpec]];
|
||||
|
||||
// Add a bit of inset
|
||||
return [ASInsetLayoutSpec insetLayoutSpecWithInsets:UIEdgeInsetsMake(0.0, 5.0, 0.0, 5.0) child:staticLayoutSpec];
|
||||
};
|
||||
[parentNode addSubnode:childNode1];
|
||||
[parentNode addSubnode:childNode2];
|
||||
[parentNode addSubnode:childNode3];
|
||||
[mutableLayoutSpecData addObject:parentNode];
|
||||
|
||||
|
||||
// Setup Data
|
||||
// ---------------------------------------------------------------------------------------------------------
|
||||
NSMutableArray *mutableData = [NSMutableArray array];
|
||||
[mutableData addObject:@{@"title" : @"Node Containers", @"data" : mutableNodesContainerData}];
|
||||
[mutableData addObject:@{@"title" : @"Nodes", @"data" : mutableNodesData}];
|
||||
[mutableData addObject:@{@"title" : @"Layout Specs", @"data" : [mutableLayoutSpecData copy]}];
|
||||
self.data = mutableData;
|
||||
}
|
||||
|
||||
- (void)setupTableNode
|
||||
{
|
||||
_tableNode = [ASTableNode new];
|
||||
_tableNode.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
|
||||
_tableNode.frame = self.view.bounds;
|
||||
_tableNode.delegate = (id<ASTableDelegate>)self;
|
||||
_tableNode.dataSource = (id<ASTableDataSource>)self;
|
||||
[self.view addSubnode:_tableNode];
|
||||
}
|
||||
|
||||
#pragma mark - Parent / Child Helper
|
||||
|
||||
- (OverviewDisplayNodeWithSizeBlock *)parentNodeWithChild:(ASDisplayNode *)child
|
||||
{
|
||||
OverviewDisplayNodeWithSizeBlock *parentNode = [OverviewDisplayNodeWithSizeBlock new];
|
||||
parentNode.preferredFrameSize = CGSizeMake(100, 100);
|
||||
parentNode.backgroundColor = [UIColor redColor];
|
||||
return parentNode;
|
||||
}
|
||||
|
||||
- (OverviewDisplayNodeWithSizeBlock *)centeringParentNodeWithChild:(ASDisplayNode *)child
|
||||
{
|
||||
return [self centeringParentNodeWithInset:UIEdgeInsetsMake(10, 10, 10, 10) child:child];
|
||||
}
|
||||
|
||||
- (OverviewDisplayNodeWithSizeBlock *)centeringParentNodeWithInset:(UIEdgeInsets)insets child:(ASDisplayNode *)child
|
||||
{
|
||||
OverviewDisplayNodeWithSizeBlock *parentNode = [OverviewDisplayNodeWithSizeBlock new];
|
||||
[parentNode addSubnode:child];
|
||||
parentNode.sizeThatFitsBlock = ^ASLayoutSpec *(ASSizeRange constrainedSize) {
|
||||
ASCenterLayoutSpec *centerLayoutSpec = [ASCenterLayoutSpec centerLayoutSpecWithCenteringOptions:ASCenterLayoutSpecCenteringXY sizingOptions:ASCenterLayoutSpecSizingOptionDefault child:child];
|
||||
return [ASInsetLayoutSpec insetLayoutSpecWithInsets:insets child:centerLayoutSpec];
|
||||
};
|
||||
return parentNode;
|
||||
}
|
||||
|
||||
- (ASDisplayNode *)childNode
|
||||
{
|
||||
ASDisplayNode *childNode = [ASDisplayNode new];
|
||||
childNode.preferredFrameSize = CGSizeMake(50, 50);
|
||||
childNode.backgroundColor = [UIColor blueColor];
|
||||
return childNode;
|
||||
}
|
||||
|
||||
#pragma mark - Actions
|
||||
|
||||
- (void)buttonPressed:(ASButtonNode *)buttonNode
|
||||
{
|
||||
NSLog(@"Button Pressed");
|
||||
}
|
||||
|
||||
#pragma mark - <ASTableDataSource / ASTableDelegate>
|
||||
|
||||
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
|
||||
{
|
||||
return self.data.count;
|
||||
}
|
||||
|
||||
- (nullable NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section
|
||||
{
|
||||
return self.data[section][@"title"];
|
||||
}
|
||||
|
||||
- (NSInteger)tableView:(ASTableView *)tableView numberOfRowsInSection:(NSInteger)section
|
||||
{
|
||||
return [self.data[section][@"data"] count];
|
||||
}
|
||||
|
||||
- (ASCellNodeBlock)tableView:(ASTableView *)tableView nodeBlockForRowAtIndexPath:(NSIndexPath *)indexPath
|
||||
{
|
||||
// You should get the node or data you want to pass to the cell node outside of the ASCellNodeBlock
|
||||
ASDisplayNode<ASLayoutSpecListEntry> *node = self.data[indexPath.section][@"data"][indexPath.row];
|
||||
return ^{
|
||||
OverviewTitleDescriptionCellNode *cellNode = [OverviewTitleDescriptionCellNode new];
|
||||
|
||||
NSDictionary *titleNodeAttributes = @{
|
||||
NSFontAttributeName : [UIFont boldSystemFontOfSize:14.0],
|
||||
NSForegroundColorAttributeName : [UIColor blackColor]
|
||||
};
|
||||
cellNode.titleNode.attributedString = [[NSAttributedString alloc] initWithString:node.entryTitle attributes:titleNodeAttributes];
|
||||
|
||||
if (node.entryDescription) {
|
||||
NSDictionary *descriptionNodeAttributes = @{NSForegroundColorAttributeName : [UIColor lightGrayColor]};
|
||||
cellNode.descriptionNode.attributedString = [[NSAttributedString alloc] initWithString:node.entryDescription attributes:descriptionNodeAttributes];
|
||||
}
|
||||
|
||||
return cellNode;
|
||||
};
|
||||
}
|
||||
|
||||
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
|
||||
{
|
||||
ASDisplayNode *node = self.data[indexPath.section][@"data"][indexPath.row];
|
||||
OverviewDetailViewController *detail = [[OverviewDetailViewController alloc] initWithNode:node];
|
||||
[self.navigationController pushViewController:detail animated:YES];
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -0,0 +1,15 @@
|
||||
//
|
||||
// OverviewDetailViewController.h
|
||||
// AsyncDisplayKitOverview
|
||||
//
|
||||
// Created by Michael Schneider on 4/15/16.
|
||||
// Copyright © 2016 Facebook. All rights reserved.
|
||||
//
|
||||
|
||||
#import <AsyncDisplayKit/AsyncDisplayKit.h>
|
||||
|
||||
@class ASDisplayNode;
|
||||
|
||||
@interface OverviewDetailViewController : UIViewController
|
||||
- (instancetype)initWithNode:(ASDisplayNode *)node;
|
||||
@end
|
||||
@@ -0,0 +1,51 @@
|
||||
//
|
||||
// OverviewDetailViewController.m
|
||||
// AsyncDisplayKitOverview
|
||||
//
|
||||
// Created by Michael Schneider on 4/15/16.
|
||||
// Copyright © 2016 Facebook. All rights reserved.
|
||||
//
|
||||
|
||||
#import "OverviewDetailViewController.h"
|
||||
|
||||
@interface OverviewDetailViewController ()
|
||||
@property (nonatomic, strong) ASDisplayNode *node;
|
||||
@end
|
||||
|
||||
@implementation OverviewDetailViewController
|
||||
|
||||
#pragma mark - Lifecycle
|
||||
|
||||
- (instancetype)initWithNode:(ASDisplayNode *)node
|
||||
{
|
||||
self = [super initWithNibName:nil bundle:nil];
|
||||
if (self == nil) { return self; }
|
||||
_node = node;
|
||||
return self;
|
||||
}
|
||||
|
||||
#pragma mark - UIViewController
|
||||
|
||||
- (void)viewDidLoad
|
||||
{
|
||||
[super viewDidLoad];
|
||||
|
||||
self.view.backgroundColor = [UIColor whiteColor];
|
||||
[self.view addSubnode:self.node];
|
||||
}
|
||||
|
||||
- (void)viewDidLayoutSubviews
|
||||
{
|
||||
[super viewDidLayoutSubviews];
|
||||
|
||||
// Center node frame
|
||||
CGRect bounds = self.view.bounds;
|
||||
CGSize nodeSize = self.node.preferredFrameSize;
|
||||
if (CGSizeEqualToSize(nodeSize, CGSizeZero)) {
|
||||
nodeSize = self.view.bounds.size;
|
||||
}
|
||||
self.node.frame = CGRectMake(CGRectGetMidX(bounds) - (nodeSize.width / 2.0), CGRectGetMidY(bounds) - (nodeSize.height / 2.0), nodeSize.width, nodeSize.height);
|
||||
[self.node measure:self.node.bounds.size];
|
||||
}
|
||||
|
||||
@end
|
||||
16
examples/AsyncDisplayKitOverview/Sample/main.m
Normal file
16
examples/AsyncDisplayKitOverview/Sample/main.m
Normal file
@@ -0,0 +1,16 @@
|
||||
//
|
||||
// main.m
|
||||
// Sample
|
||||
//
|
||||
// Created by Michael Schneider on 4/24/16.
|
||||
// Copyright © 2016 Facebook. All rights reserved.
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
#import "AppDelegate.h"
|
||||
|
||||
int main(int argc, char * argv[]) {
|
||||
@autoreleasepool {
|
||||
return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user