Merged branch 'master' into AVPlayerItem-construction

This commit is contained in:
Gareth Reese
2016-04-06 15:22:10 +01:00
194 changed files with 5456 additions and 2227 deletions

View File

@@ -1,3 +1,3 @@
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '8.0'
platform :ios, '7.1'
pod 'AsyncDisplayKit', :path => '../..'

View File

@@ -18,7 +18,6 @@
@implementation AppDelegate
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
// Override point for customization after application launch.
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
@@ -28,26 +27,4 @@
return YES;
}
- (void)applicationWillResignActive:(UIApplication *)application {
// Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
// Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game.
}
- (void)applicationDidEnterBackground:(UIApplication *)application {
// Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
// If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
}
- (void)applicationWillEnterForeground:(UIApplication *)application {
// Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background.
}
- (void)applicationDidBecomeActive:(UIApplication *)application {
// Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
}
- (void)applicationWillTerminate:(UIApplication *)application {
// Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
}
@end

View File

@@ -21,32 +21,33 @@
self = [super init];
if (self == nil) { return self; }
_imageNode = [ASNetworkImageNode new];
_imageNode = [[ASNetworkImageNode alloc] init];
_imageNode.backgroundColor = ASDisplayNodeDefaultPlaceholderColor();
[self addSubnode:_imageNode];
return self;
}
#pragma mark - ASDisplayNode
- (ASLayoutSpec *)layoutSpecThatFits:(ASSizeRange)constrainedSize
{
ASStaticLayoutSpec *staticSpec = [ASStaticLayoutSpec staticLayoutSpecWithChildren:@[self.imageNode]];
self.imageNode.position = CGPointZero;
self.imageNode.sizeRange = ASRelativeSizeRangeMakeWithExactCGSize(constrainedSize.max);
return staticSpec;
return [ASStaticLayoutSpec staticLayoutSpecWithChildren:@[self.imageNode]];
}
- (void)fetchData
- (void)layoutDidFinish
{
[super fetchData];
[super layoutDidFinish];
[self loadImage];
// In general set URL of ASNetworkImageNode as soon as possible. Ideally in init or a
// view model setter method.
// In this case as we need to know the size of the node the url is set in layoutDidFinish so
// we have the calculatedSize available
self.imageNode.URL = [self imageURL];
}
#pragma mark - Image
- (NSURL *)imageURL
@@ -56,9 +57,4 @@
return [NSURL URLWithString:imageURLString];
}
- (void)loadImage
{
self.imageNode.URL = self.imageURL;
}
@end

View File

@@ -31,38 +31,37 @@ static const NSInteger kImageHeight = 200;
if (self == nil) { return self; }
_imageCategory = imageCategory;
[self initNode];
return self;
}
- (void)initNode
{
// Create ASCollectionView. We don't have to add it explicitly as subnode as we will set usesImplicitHierarchyManagement to YES
UICollectionViewFlowLayout *layout = [[UICollectionViewFlowLayout alloc] init];
_collectionNode = [[ASCollectionNode alloc] initWithCollectionViewLayout:layout];
_collectionNode.delegate = self;
_collectionNode.dataSource = self;
_collectionNode.view.backgroundColor = [UIColor whiteColor];
_collectionNode.backgroundColor = [UIColor whiteColor];
// Enable usesImplicitHierarchyManagement so the first time the layout pass of the node is happening all nodes that are referenced
// in layouts within layoutSpecThatFits: will be added automatically
self.usesImplicitHierarchyManagement = YES;
return self;
}
- (void)dealloc
{
_collectionNode.delegate = nil;
_collectionNode.dataSource = nil;
}
#pragma mark -
#pragma mark - ASDisplayNode
- (ASLayoutSpec *)layoutSpecThatFits:(ASSizeRange)constrainedSize
{
ASStaticLayoutSpec *staticSpec = [ASStaticLayoutSpec staticLayoutSpecWithChildren:@[self.collectionNode]];
self.collectionNode.position = CGPointZero;
self.collectionNode.sizeRange = ASRelativeSizeRangeMakeWithExactCGSize(constrainedSize.max);
return staticSpec;
return [ASStaticLayoutSpec staticLayoutSpecWithChildren:@[self.collectionNode]];
}
#pragma mark -
#pragma mark - ASCollectionDataSource
- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section
{
@@ -73,7 +72,7 @@ static const NSInteger kImageHeight = 200;
{
NSString *imageCategory = self.imageCategory;
return ^{
DetailCellNode *node = [DetailCellNode new];
DetailCellNode *node = [[DetailCellNode alloc] init];
node.row = indexPath.row;
node.imageCategory = imageCategory;
return node;

View File

@@ -21,7 +21,7 @@
- (void)viewWillTransitionToSize:(CGSize)size withTransitionCoordinator:(id<UIViewControllerTransitionCoordinator>)coordinator
{
[super viewWillTransitionToSize:size withTransitionCoordinator:coordinator];
[self.node.collectionNode.view invalidateIntrinsicContentSize];
[self.node.collectionNode.view.collectionViewLayout invalidateLayout];
}
@end

View File

@@ -0,0 +1 @@
git "file:///build.sh/will/put/local/absolute/path/here" "master"

View File

@@ -0,0 +1,17 @@
//
// AppDelegate.h
// CarthageExample
//
// Created by Engin Kurutepe on 23/02/16.
// Copyright © 2016 Engin Kurutepe. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface AppDelegate : UIResponder <UIApplicationDelegate>
@property (strong, nonatomic) UIWindow *window;
@end

View File

@@ -0,0 +1,47 @@
//
// AppDelegate.m
// CarthageExample
//
// Created by Engin Kurutepe on 23/02/16.
// Copyright © 2016 Engin Kurutepe. All rights reserved.
//
@import AsyncDisplayKit;
#import "AppDelegate.h"
@interface AppDelegate ()
@end
@implementation AppDelegate
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
// Override point for customization after application launch.
return YES;
}
- (void)applicationWillResignActive:(UIApplication *)application {
// Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
// Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game.
}
- (void)applicationDidEnterBackground:(UIApplication *)application {
// Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
// If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
}
- (void)applicationWillEnterForeground:(UIApplication *)application {
// Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background.
}
- (void)applicationDidBecomeActive:(UIApplication *)application {
// Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
}
- (void)applicationWillTerminate:(UIApplication *)application {
// Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
}
@end

View File

@@ -0,0 +1,38 @@
{
"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"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}

View File

@@ -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>

View File

@@ -0,0 +1,25 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="6211" systemVersion="14A298i" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" initialViewController="BYZ-38-t0r">
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="6204"/>
</dependencies>
<scenes>
<!--View Controller-->
<scene sceneID="tne-QT-ifu">
<objects>
<viewController id="BYZ-38-t0r" customClass="ViewController" customModuleProvider="" sceneMemberID="viewController">
<layoutGuides>
<viewControllerLayoutGuide type="top" id="y3c-jy-aDJ"/>
<viewControllerLayoutGuide type="bottom" id="wfy-db-euE"/>
</layoutGuides>
<view key="view" contentMode="scaleToFill" id="8bC-Xf-vdC">
<rect key="frame" x="0.0" y="0.0" width="600" height="600"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
</view>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="dkx-z0-nzr" sceneMemberID="firstResponder"/>
</objects>
</scene>
</scenes>
</document>

View File

@@ -0,0 +1,40 @@
<?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>UILaunchStoryboardName</key>
<string>LaunchScreen</string>
<key>UIMainStoryboardFile</key>
<string>Main</string>
<key>UIRequiredDeviceCapabilities</key>
<array>
<string>armv7</string>
</array>
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
</dict>
</plist>

View File

@@ -0,0 +1,15 @@
//
// ViewController.h
// CarthageExample
//
// Created by Engin Kurutepe on 23/02/16.
// Copyright © 2016 Engin Kurutepe. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface ViewController : UIViewController
@end

View File

@@ -0,0 +1,36 @@
//
// ViewController.m
// CarthageExample
//
// Created by Engin Kurutepe on 23/02/16.
// Copyright © 2016 Engin Kurutepe. All rights reserved.
//
@import AsyncDisplayKit;
#import "ViewController.h"
@interface ViewController ()
@end
@implementation ViewController
- (void)viewWillAppear:(BOOL)animated {
[super viewWillAppear:animated];
CGSize screenSize = self.view.bounds.size;
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
ASTextNode *node = [[ASTextNode alloc] init];
node.attributedString = [[NSAttributedString alloc] initWithString:@"hello world"];
[node measure:(CGSize){.width = screenSize.width, .height = CGFLOAT_MAX}];
node.frame = (CGRect) {.origin = (CGPoint){.x = 100, .y = 100}, .size = node.calculatedSize };
dispatch_async(dispatch_get_main_queue(), ^{
[self.view addSubview:node.view];
});
});
}
@end

View File

@@ -0,0 +1,16 @@
//
// main.m
// CarthageExample
//
// Created by Engin Kurutepe on 23/02/16.
// Copyright © 2016 Engin Kurutepe. 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]));
}
}

View File

@@ -0,0 +1,7 @@
This project is supposed to test that the `AsyncDisplayKit.framework` built by Carthage from the master branch can be imported as a module without causing any warnings and errors.
Steps to verify:
- Run `carthage update --platform iOS`
- Build `CarthageExample.xcodeproj`
- Verify that there are 0 Errors and 0 Warnings

View File

@@ -0,0 +1,349 @@
// !$*UTF8*$!
{
archiveVersion = 1;
classes = {
};
objectVersion = 46;
objects = {
/* Begin PBXBuildFile section */
871BB34E1C7C98B1005CF62A /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 871BB34D1C7C98B1005CF62A /* main.m */; };
871BB3511C7C98B1005CF62A /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 871BB3501C7C98B1005CF62A /* AppDelegate.m */; };
871BB3541C7C98B1005CF62A /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 871BB3531C7C98B1005CF62A /* ViewController.m */; };
871BB3571C7C98B1005CF62A /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 871BB3551C7C98B1005CF62A /* Main.storyboard */; };
871BB3591C7C98B1005CF62A /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 871BB3581C7C98B1005CF62A /* Assets.xcassets */; };
871BB35C1C7C98B1005CF62A /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 871BB35A1C7C98B1005CF62A /* LaunchScreen.storyboard */; };
871BB3651C7C99B0005CF62A /* AsyncDisplayKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 871BB3641C7C99B0005CF62A /* AsyncDisplayKit.framework */; };
/* End PBXBuildFile section */
/* Begin PBXFileReference section */
871BB3491C7C98B1005CF62A /* CarthageExample.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = CarthageExample.app; sourceTree = BUILT_PRODUCTS_DIR; };
871BB34D1C7C98B1005CF62A /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = "<group>"; };
871BB34F1C7C98B1005CF62A /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = "<group>"; };
871BB3501C7C98B1005CF62A /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = "<group>"; };
871BB3521C7C98B1005CF62A /* ViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ViewController.h; sourceTree = "<group>"; };
871BB3531C7C98B1005CF62A /* ViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ViewController.m; sourceTree = "<group>"; };
871BB3561C7C98B1005CF62A /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = "<group>"; };
871BB3581C7C98B1005CF62A /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
871BB35B1C7C98B1005CF62A /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; };
871BB35D1C7C98B1005CF62A /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
871BB3641C7C99B0005CF62A /* AsyncDisplayKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AsyncDisplayKit.framework; path = Carthage/Build/iOS/AsyncDisplayKit.framework; sourceTree = SOURCE_ROOT; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
871BB3461C7C98B1005CF62A /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
871BB3651C7C99B0005CF62A /* AsyncDisplayKit.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXFrameworksBuildPhase section */
/* Begin PBXGroup section */
871BB3401C7C98B1005CF62A = {
isa = PBXGroup;
children = (
871BB34B1C7C98B1005CF62A /* CarthageExample */,
871BB34A1C7C98B1005CF62A /* Products */,
);
sourceTree = "<group>";
};
871BB34A1C7C98B1005CF62A /* Products */ = {
isa = PBXGroup;
children = (
871BB3491C7C98B1005CF62A /* CarthageExample.app */,
);
name = Products;
sourceTree = "<group>";
};
871BB34B1C7C98B1005CF62A /* CarthageExample */ = {
isa = PBXGroup;
children = (
871BB34F1C7C98B1005CF62A /* AppDelegate.h */,
871BB3501C7C98B1005CF62A /* AppDelegate.m */,
871BB3581C7C98B1005CF62A /* Assets.xcassets */,
871BB3631C7C9994005CF62A /* Frameworks */,
871BB35D1C7C98B1005CF62A /* Info.plist */,
871BB35A1C7C98B1005CF62A /* LaunchScreen.storyboard */,
871BB3551C7C98B1005CF62A /* Main.storyboard */,
871BB34C1C7C98B1005CF62A /* Supporting Files */,
871BB3521C7C98B1005CF62A /* ViewController.h */,
871BB3531C7C98B1005CF62A /* ViewController.m */,
);
path = CarthageExample;
sourceTree = "<group>";
};
871BB34C1C7C98B1005CF62A /* Supporting Files */ = {
isa = PBXGroup;
children = (
871BB34D1C7C98B1005CF62A /* main.m */,
);
name = "Supporting Files";
sourceTree = "<group>";
};
871BB3631C7C9994005CF62A /* Frameworks */ = {
isa = PBXGroup;
children = (
871BB3641C7C99B0005CF62A /* AsyncDisplayKit.framework */,
);
name = Frameworks;
sourceTree = "<group>";
};
/* End PBXGroup section */
/* Begin PBXNativeTarget section */
871BB3481C7C98B1005CF62A /* CarthageExample */ = {
isa = PBXNativeTarget;
buildConfigurationList = 871BB3601C7C98B1005CF62A /* Build configuration list for PBXNativeTarget "CarthageExample" */;
buildPhases = (
871BB3451C7C98B1005CF62A /* Sources */,
871BB3461C7C98B1005CF62A /* Frameworks */,
871BB3471C7C98B1005CF62A /* Resources */,
871BB3661C7C99B8005CF62A /* Copy Framworks */,
);
buildRules = (
);
dependencies = (
);
name = CarthageExample;
productName = CarthageExample;
productReference = 871BB3491C7C98B1005CF62A /* CarthageExample.app */;
productType = "com.apple.product-type.application";
};
/* End PBXNativeTarget section */
/* Begin PBXProject section */
871BB3411C7C98B1005CF62A /* Project object */ = {
isa = PBXProject;
attributes = {
LastUpgradeCheck = 0720;
ORGANIZATIONNAME = "Engin Kurutepe";
TargetAttributes = {
871BB3481C7C98B1005CF62A = {
CreatedOnToolsVersion = 7.2.1;
};
};
};
buildConfigurationList = 871BB3441C7C98B1005CF62A /* Build configuration list for PBXProject "CarthageExample" */;
compatibilityVersion = "Xcode 3.2";
developmentRegion = English;
hasScannedForEncodings = 0;
knownRegions = (
en,
Base,
);
mainGroup = 871BB3401C7C98B1005CF62A;
productRefGroup = 871BB34A1C7C98B1005CF62A /* Products */;
projectDirPath = "";
projectRoot = "";
targets = (
871BB3481C7C98B1005CF62A /* CarthageExample */,
);
};
/* End PBXProject section */
/* Begin PBXResourcesBuildPhase section */
871BB3471C7C98B1005CF62A /* Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
871BB35C1C7C98B1005CF62A /* LaunchScreen.storyboard in Resources */,
871BB3591C7C98B1005CF62A /* Assets.xcassets in Resources */,
871BB3571C7C98B1005CF62A /* Main.storyboard in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXResourcesBuildPhase section */
/* Begin PBXShellScriptBuildPhase section */
871BB3661C7C99B8005CF62A /* Copy Framworks */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
"$(SRCROOT)/Carthage/Build/iOS/AsyncDisplayKit.framework",
);
name = "Copy Framworks";
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "/usr/local/bin/carthage copy-frameworks";
};
/* End PBXShellScriptBuildPhase section */
/* Begin PBXSourcesBuildPhase section */
871BB3451C7C98B1005CF62A /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
871BB3541C7C98B1005CF62A /* ViewController.m in Sources */,
871BB3511C7C98B1005CF62A /* AppDelegate.m in Sources */,
871BB34E1C7C98B1005CF62A /* main.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXSourcesBuildPhase section */
/* Begin PBXVariantGroup section */
871BB3551C7C98B1005CF62A /* Main.storyboard */ = {
isa = PBXVariantGroup;
children = (
871BB3561C7C98B1005CF62A /* Base */,
);
name = Main.storyboard;
sourceTree = "<group>";
};
871BB35A1C7C98B1005CF62A /* LaunchScreen.storyboard */ = {
isa = PBXVariantGroup;
children = (
871BB35B1C7C98B1005CF62A /* Base */,
);
name = LaunchScreen.storyboard;
sourceTree = "<group>";
};
/* End PBXVariantGroup section */
/* Begin XCBuildConfiguration section */
871BB35E1C7C98B1005CF62A /* 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;
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.2;
MTL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos;
};
name = Debug;
};
871BB35F1C7C98B1005CF62A /* 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 = 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.2;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
VALIDATE_PRODUCT = YES;
};
name = Release;
};
871BB3611C7C98B1005CF62A /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
"$(PROJECT_DIR)/Carthage/Build/iOS",
);
GCC_TREAT_WARNINGS_AS_ERRORS = YES;
INFOPLIST_FILE = CarthageExample/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = org.asyncdisplaykit.CarthageExample;
PRODUCT_NAME = "$(TARGET_NAME)";
};
name = Debug;
};
871BB3621C7C98B1005CF62A /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
"$(PROJECT_DIR)/Carthage/Build/iOS",
);
GCC_TREAT_WARNINGS_AS_ERRORS = YES;
INFOPLIST_FILE = CarthageExample/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = org.asyncdisplaykit.CarthageExample;
PRODUCT_NAME = "$(TARGET_NAME)";
};
name = Release;
};
/* End XCBuildConfiguration section */
/* Begin XCConfigurationList section */
871BB3441C7C98B1005CF62A /* Build configuration list for PBXProject "CarthageExample" */ = {
isa = XCConfigurationList;
buildConfigurations = (
871BB35E1C7C98B1005CF62A /* Debug */,
871BB35F1C7C98B1005CF62A /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
871BB3601C7C98B1005CF62A /* Build configuration list for PBXNativeTarget "CarthageExample" */ = {
isa = XCConfigurationList;
buildConfigurations = (
871BB3611C7C98B1005CF62A /* Debug */,
871BB3621C7C98B1005CF62A /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
/* End XCConfigurationList section */
};
rootObject = 871BB3411C7C98B1005CF62A /* Project object */;
}

View File

@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<Workspace
version = "1.0">
<FileRef
location = "self:CarthageExample.xcodeproj">
</FileRef>
</Workspace>

View File

@@ -0,0 +1,8 @@
<?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>IDEWorkspaceSharedSettings_AutocreateContextsIfNeeded</key>
<false/>
</dict>
</plist>

View File

@@ -0,0 +1,80 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0720"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "871BB3481C7C98B1005CF62A"
BuildableName = "CarthageExample.app"
BlueprintName = "CarthageExample"
ReferencedContainer = "container:Sample.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
</Testables>
<AdditionalOptions>
</AdditionalOptions>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "871BB3481C7C98B1005CF62A"
BuildableName = "CarthageExample.app"
BlueprintName = "CarthageExample"
ReferencedContainer = "container:Sample.xcodeproj">
</BuildableReference>
</MacroExpansion>
<AdditionalOptions>
</AdditionalOptions>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "871BB3481C7C98B1005CF62A"
BuildableName = "CarthageExample.app"
BlueprintName = "CarthageExample"
ReferencedContainer = "container:Sample.xcodeproj">
</BuildableReference>
</MacroExpansion>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>

View File

@@ -119,7 +119,7 @@
- (BOOL)shouldInvalidateLayoutForBoundsChange:(CGRect)newBounds
{
if (!CGRectEqualToRect(self.collectionView.bounds, newBounds)) {
if (!CGSizeEqualToSize(self.collectionView.bounds.size, newBounds.size)) {
return YES;
}
return NO;

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<Workspace
version = "1.0">
<FileRef
location = "group:Sample.xcodeproj">
</FileRef>
<FileRef
location = "group:Pods/Pods.xcodeproj">
</FileRef>
</Workspace>

View File

@@ -17,6 +17,10 @@
@interface ViewController () <ASEditableTextNodeDelegate>
{
ASEditableTextNode *_textNode;
// These elements are a test case for ASTextNode truncation.
UILabel *_label;
ASTextNode *_node;
}
@end
@@ -44,6 +48,24 @@
// the usual delegate methods are available; see ASEditableTextNodeDelegate
_textNode.delegate = self;
// Do any additional setup after loading the view, typically from a nib.
NSDictionary *attrs = @{ NSFontAttributeName: [UIFont fontWithName:@"HelveticaNeue" size:12.0f] };
NSAttributedString *string = [[NSAttributedString alloc] initWithString:@"1\n2\n3\n4\n5" attributes:attrs];
_label = [[UILabel alloc] init];
_label.attributedText = string;
_label.backgroundColor = [UIColor lightGrayColor];
_label.numberOfLines = 3;
_label.frame = CGRectMake(20, 400, 40, 100);
_node = [[ASTextNode alloc] init];
_node.maximumNumberOfLines = 3;
_node.backgroundColor = [UIColor lightGrayColor];
_node.attributedString = string;
_node.frame = CGRectMake(70, 400, 40, 100);
// [_node measure:CGSizeMake(40, 50)]; No longer needed now that https://github.com/facebook/AsyncDisplayKit/issues/1295 is fixed.
return self;
}
@@ -53,6 +75,8 @@
[super viewDidLoad];
[self.view addSubnode:_textNode];
[self.view addSubnode:_node];
[self.view addSubview:_label];
[self.view addGestureRecognizer:[[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tap:)]];
}

View File

@@ -5,6 +5,178 @@
Run `pod install` in each sample project directory to set up their
dependencies.
## Example Catalog
### ASCollectionView [ObjC]
![ASCollectionView Example App Screenshot](./Screenshots/ASCollectionView.png?raw=true)
Featuring:
- ASCollectionView with header/footer supplementary node support
- ASCollectionView batch API
- ASDelegateProxy
### ASTableViewStressTest [ObjC]
![ASTableViewStressTest Example App Screenshot](./Screenshots/ASTableViewStressTest.png?raw=true)
### ASViewController [ObjC]
![ASViewController Example App Screenshot](./Screenshots/ASViewController.png?raw=true)
Featuring:
- ASViewController
- ASTableView
- ASMultiplexImageNode
- ASLayoutSpec
### BackgroundPropertySetting [Swift]
![BackgroundPropertySetting Example App gif](./Screenshots/BackgroundPropertySetting.gif?raw=true)
Featuring:
- ASDK Swift compatibility
- ASViewController
- ASCollectionView
- thread affinity
- ASLayoutSpec
### CarthageBuildTest
### CatDealsCollectionView [ObjC]
![CatDealsCollectionView Example App Screenshot](./Screenshots/CatDealsCollectionView.png?raw=true)
Featuring:
- ASCollectionView
- ASRangeTuningParameters
- Placeholder Images
- ASLayoutSpec
### CollectionViewWithViewControllerCells [ObjC]
![CollectionViewWithViewControllerCells Example App Screenshot](./Screenshots/CollectionViewWithViewControllerCells.png?raw=true)
Featuring:
- custom collection view layout
- ASLayoutSpec
- ASMultiplexImageNode
### CustomCollectionView [ObjC]
![CustomCollectionView Example App gif](./Screenshots/CustomCollectionView.gif?raw=true)
Featuring:
- custom collection view layout
- ASCollectionView with sections
### EditableText [ObjC]
![EditableText Example App Screenshot](./Screenshots/EditableText.png?raw=true)
Featuring:
- ASEditableTextNode
### HorizontalwithinVerticalScrolling [ObjC]
![HorizontalwithinVerticalScrolling Example App gif](./Screenshots/HorizontalwithinVerticalScrolling.gif?raw=true)
Featuring:
- UIViewController with ASTableView
- ASCollectionView
- ASCellNode
### Kittens [ObjC]
![Kittens Example App Screenshot](./Screenshots/Kittens.png?raw=true)
Featuring:
- UIViewController with ASTableView
- ASCellNodes with ASNetworkImageNode and ASTextNode
### Multiplex [ObjC]
![Multiplex Example App gif](./Screenshots/Multiplex.gif?raw=true)
Featuring:
- ASMultiplexImageNode (with artificial delay inserted)
- ASLayoutSpec
### PagerNode [ObjC]
Featuring:
- ASPagerNode
### Placeholders [ObjC]
Featuring:
- ASDisplayNodes now have an overidable method -placeholderImage that lets you provide a custom UIImage to display while a node is displaying asyncronously. The default implementation of this method returns nil and thus does nothing. A provided example project also demonstrates using the placeholder API.
### SocialAppLayout [ObjC]
![SocialAppLayout Example App Screenshot](./Screenshots/SocialAppLayout.png?raw=true)
Featuring:
- ASLayoutSpec
- UIViewController with ASTableView
### Swift [Swift]
![Swift Example App Screenshot](./Screenshots/Swift.png?raw=true)
Featuring:
- ASViewController with ASTableNode
### SynchronousConcurrency [ObjC]
![SynchronousConcurrency Example App Screenshot](./Screenshots/SynchronousConcurrency.png?raw=true)
Implementation of Synchronous Concurrency features for AsyncDisplayKit 2.0
This provides internal features on _ASAsyncTransaction and ASDisplayNode to facilitate
implementing public API that allows clients to choose if they would prefer to block
on the completion of unfinished rendering, rather than allow a placeholder state to
become visible.
The internal features are:
-[_ASAsyncTransaction waitUntilComplete]
-[ASDisplayNode recursivelyEnsureDisplay]
Also provided are two such implementations:
-[ASCellNode setNeverShowPlaceholders:], which integrates with both Tables and Collections
-[ASViewController setNeverShowPlaceholders:], which should work with Nav and Tab controllers.
Lastly, on ASDisplayNode, a new property .shouldBypassEnsureDisplay allows individual node types
to exempt themselves from blocking the main thread on their display.
By implementing the feature at the ASCellNode level rather than ASTableView & ASCollectionView,
developers can retain fine-grained control on display characteristics. For example, certain
cell types may be appropriate to display to the user with placeholders, whereas others may not.
### SynchronousKittens [ObjC]
### VerticalWithinHorizontalScrolling [ObjC]
![VerticalWithinHorizontalScrolling Example App Screenshot](./Screenshots/VerticalWithinHorizontalScrolling.png?raw=true)
Features:
- UIViewController containing ASPagerNode containing ASTableNodes
### Videos [ObjC]
![VideoTableView Example App gif](./Screenshots/Videos.gif?raw=true)
Featuring:
- ASVideoNode
### VideoTableView [ObjC]
![VideoTableView Example App Screenshot](./Screenshots/VideoTableView.png?raw=true)
Featuring:
- ASVideoNode
- ASTableView
- ASCellNode
## License
This file provided by Facebook is for non-commercial testing and evaluation

Binary file not shown.

After

Width:  |  Height:  |  Size: 64 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 116 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 53 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.0 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 314 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 731 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.6 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 43 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 195 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 147 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 141 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 82 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 285 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.0 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 150 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.3 MiB

File diff suppressed because it is too large Load Diff

View File

@@ -15,6 +15,4 @@
@property (strong, nonatomic) UIWindow *window;
@end

View File

@@ -10,23 +10,17 @@
*/
#import "AppDelegate.h"
#import "ViewController.h"
@interface AppDelegate ()
@end
@implementation AppDelegate
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
self.window.backgroundColor = [UIColor whiteColor];
self.window.rootViewController = [[UINavigationController alloc] initWithRootViewController:[[ViewController alloc] init]];
[self.window makeKeyAndVisible];
return YES;
}
@end

View File

@@ -20,8 +20,8 @@
@implementation CommentsNode
- (instancetype)initWithCommentsCount:(NSInteger)comentsCount {
- (instancetype)initWithCommentsCount:(NSInteger)comentsCount
{
self = [super init];
if (self) {
_commentsCount = comentsCount;
@@ -44,8 +44,8 @@
}
- (ASLayoutSpec *)layoutSpecThatFits:(ASSizeRange)constrainedSize {
- (ASLayoutSpec *)layoutSpecThatFits:(ASSizeRange)constrainedSize
{
ASStackLayoutSpec *mainStack = [ASStackLayoutSpec stackLayoutSpecWithDirection:ASStackLayoutDirectionHorizontal spacing:6.0 justifyContent:ASStackLayoutJustifyContentStart alignItems:ASStackLayoutAlignItemsCenter children:@[self.iconNode, self.countNode]];
// set sizeRange to make width fixed to 60
@@ -55,5 +55,4 @@
return [ASStaticLayoutSpec staticLayoutSpecWithChildren:@[mainStack]];
}
@end

View File

@@ -21,8 +21,8 @@
@implementation LikesNode
- (instancetype)initWithLikesCount:(NSInteger)likesCount {
- (instancetype)initWithLikesCount:(NSInteger)likesCount
{
self = [super init];
if (self) {
_likesCount = likesCount;
@@ -49,7 +49,7 @@
}
+ (BOOL) getYesOrNo
+ (BOOL)getYesOrNo
{
int tmp = (arc4random() % 30)+1;
if (tmp % 5 == 0) {
@@ -58,8 +58,8 @@
return NO;
}
- (ASLayoutSpec *)layoutSpecThatFits:(ASSizeRange)constrainedSize {
- (ASLayoutSpec *)layoutSpecThatFits:(ASSizeRange)constrainedSize
{
ASStackLayoutSpec *mainStack = [ASStackLayoutSpec stackLayoutSpecWithDirection:ASStackLayoutDirectionHorizontal spacing:6.0 justifyContent:ASStackLayoutJustifyContentStart alignItems:ASStackLayoutAlignItemsCenter children:@[_iconNode, _countNode]];
// set sizeRange to make width fixed to 60
@@ -67,7 +67,6 @@
ASRelativeSize max = ASRelativeSizeMake(ASRelativeDimensionMakeWithPoints(60.0), ASRelativeDimensionMakeWithPoints(40.0));
mainStack.sizeRange = ASRelativeSizeRangeMake(min, max);
return [ASStaticLayoutSpec staticLayoutSpecWithChildren:@[mainStack]];
}
@end

View File

@@ -12,5 +12,4 @@
#import "Post.h"
@implementation Post
@end

View File

@@ -34,8 +34,8 @@
@implementation PostNode
- (instancetype)initWithPost:(Post *)post {
- (instancetype)initWithPost:(Post *)post
{
self = [super init];
if (self) {
_post = post;
@@ -89,6 +89,7 @@
_postNode.userInteractionEnabled = YES;
_postNode.linkAttributeNames = @[ kLinkAttributeName ];
_postNode.attributedString = attrString;
_postNode.passthroughNonlinkTouches = YES; // passes touches through when they aren't on a link
}
@@ -180,14 +181,19 @@
[super didLoad];
}
- (ASLayoutSpec *)layoutSpecThatFits:(ASSizeRange)constrainedSize {
- (ASLayoutSpec *)layoutSpecThatFits:(ASSizeRange)constrainedSize
{
// Flexible spacer between username and time
ASLayoutSpec *spacer = [[ASLayoutSpec alloc] init];
spacer.flexGrow = YES;
// NOTE: This inset is not actually required by the layout, but is an example of the upward propogation of layoutable
// properties. Specifically, .flexGrow from the child is transferred to the inset spec so they can expand together.
// Without this capability, it would be required to set insetSpacer.flexGrow = YES;
ASInsetLayoutSpec *insetSpacer = [ASInsetLayoutSpec insetLayoutSpecWithInsets:UIEdgeInsetsMake(0, 0, 0, 0) child:spacer];
// Horizontal stack for name, username, via icon and time
NSMutableArray *layoutSpecChildren = [@[_nameNode, _usernameNode, spacer] mutableCopy];
NSMutableArray *layoutSpecChildren = [@[_nameNode, _usernameNode, insetSpacer] mutableCopy];
if (_post.via != 0) {
[layoutSpecChildren addObject:_viaNode];
}

View File

@@ -54,16 +54,16 @@
};
}
+ (NSDictionary *)cellControlStyle {
+ (NSDictionary *)cellControlStyle
{
return @{
NSFontAttributeName : [UIFont systemFontOfSize:13.0],
NSForegroundColorAttributeName: [UIColor lightGrayColor]
};
}
+ (NSDictionary *)cellControlColoredStyle {
+ (NSDictionary *)cellControlColoredStyle
{
return @{
NSFontAttributeName : [UIFont systemFontOfSize:13.0],
NSForegroundColorAttributeName: [UIColor colorWithRed:59.0/255.0 green:89.0/255.0 blue:152.0/255.0 alpha:1.0]

View File

@@ -12,7 +12,4 @@
#import <UIKit/UIKit.h>
@interface ViewController : UIViewController
@end

View File

@@ -45,8 +45,8 @@
_tableView.asyncDelegate = nil;
}
- (void)viewDidLoad {
- (void)viewDidLoad
{
[super viewDidLoad];
self.tableView = [[ASTableView alloc] initWithFrame:self.view.bounds style:UITableViewStylePlain asyncDataFetching:YES];
@@ -57,8 +57,8 @@
[self.view addSubview:self.tableView];
}
- (void)createSocialAppDataSource {
- (void)createSocialAppDataSource
{
_socialAppDataSource = [[NSMutableArray alloc] init];
Post *newPost = [[Post alloc] init];