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