mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-17 11:50:56 +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 */; };
|
69E100701CA89CB600D88C1B /* ASEnvironmentInternal.mm in Sources */ = {isa = PBXBuildFile; fileRef = 69E1006A1CA89CB600D88C1B /* ASEnvironmentInternal.mm */; };
|
||||||
69EEA0A11D9AB43900B46420 /* ASLayoutSpecPrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = 69EEA0A01D9AB43900B46420 /* ASLayoutSpecPrivate.h */; };
|
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, ); }; };
|
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 */; };
|
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, ); }; };
|
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, ); }; };
|
764D83D51C8EA515009B4FB8 /* AsyncDisplayKit+Debug.h in Headers */ = {isa = PBXBuildFile; fileRef = 764D83D21C8EA515009B4FB8 /* AsyncDisplayKit+Debug.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||||
@ -649,6 +650,7 @@
|
|||||||
dstPath = "include/$(PRODUCT_NAME)";
|
dstPath = "include/$(PRODUCT_NAME)";
|
||||||
dstSubfolderSpec = 16;
|
dstSubfolderSpec = 16;
|
||||||
files = (
|
files = (
|
||||||
|
69F381A51DA4630D00CF2278 /* NSArray+Diffing.h in CopyFiles */,
|
||||||
CC4C2A7A1D8902350039ACAB /* ASTraceEvent.h in CopyFiles */,
|
CC4C2A7A1D8902350039ACAB /* ASTraceEvent.h in CopyFiles */,
|
||||||
CC88F7AE1D80AF5E000D6D4E /* ASObjectDescriptionHelpers.h in CopyFiles */,
|
CC88F7AE1D80AF5E000D6D4E /* ASObjectDescriptionHelpers.h in CopyFiles */,
|
||||||
ACE87A331D73726300D7FF06 /* ASSectionContext.h in CopyFiles */,
|
ACE87A331D73726300D7FF06 /* ASSectionContext.h in CopyFiles */,
|
||||||
|
|||||||
@ -191,8 +191,8 @@ static ASDisplayNodeMethodOverrides GetASDisplayNodeMethodOverrides(Class c)
|
|||||||
[super initialize];
|
[super initialize];
|
||||||
if (self != [ASDisplayNode class]) {
|
if (self != [ASDisplayNode class]) {
|
||||||
|
|
||||||
// Subclasses should never override these
|
// Subclasses should never override these. Use unused to prevent warnings
|
||||||
NSString *classString = NSStringFromClass(self);
|
__unused NSString *classString = NSStringFromClass(self);
|
||||||
|
|
||||||
ASDisplayNodeAssert(!ASDisplayNodeSubclassOverridesSelector(self, @selector(calculatedSize)), @"Subclass %@ must not override calculatedSize method", classString);
|
ASDisplayNodeAssert(!ASDisplayNodeSubclassOverridesSelector(self, @selector(calculatedSize)), @"Subclass %@ must not override calculatedSize method", classString);
|
||||||
ASDisplayNodeAssert(!ASDisplayNodeSubclassOverridesSelector(self, @selector(calculatedLayout)), @"Subclass %@ must not override calculatedLayout method", classString);
|
ASDisplayNodeAssert(!ASDisplayNodeSubclassOverridesSelector(self, @selector(calculatedLayout)), @"Subclass %@ must not override calculatedLayout method", classString);
|
||||||
|
|||||||
@ -83,12 +83,14 @@
|
|||||||
#import <AsyncDisplayKit/ASTextKitComponents.h>
|
#import <AsyncDisplayKit/ASTextKitComponents.h>
|
||||||
#import <AsyncDisplayKit/ASTraitCollection.h>
|
#import <AsyncDisplayKit/ASTraitCollection.h>
|
||||||
#import <AsyncDisplayKit/ASVisibilityProtocols.h>
|
#import <AsyncDisplayKit/ASVisibilityProtocols.h>
|
||||||
|
#import <AsyncDisplayKit/ASWeakSet.h>
|
||||||
|
|
||||||
#import <AsyncDisplayKit/CGRect+ASConvenience.h>
|
#import <AsyncDisplayKit/CGRect+ASConvenience.h>
|
||||||
#import <AsyncDisplayKit/NSMutableAttributedString+TextKitAdditions.h>
|
#import <AsyncDisplayKit/NSMutableAttributedString+TextKitAdditions.h>
|
||||||
#import <AsyncDisplayKit/UICollectionViewLayout+ASConvenience.h>
|
#import <AsyncDisplayKit/UICollectionViewLayout+ASConvenience.h>
|
||||||
#import <AsyncDisplayKit/UIView+ASConvenience.h>
|
#import <AsyncDisplayKit/UIView+ASConvenience.h>
|
||||||
#import <AsyncDisplayKit/UIImage+ASConvenience.h>
|
#import <AsyncDisplayKit/UIImage+ASConvenience.h>
|
||||||
|
#import <AsyncDisplayKit/NSArray+Diffing.h>
|
||||||
|
|
||||||
#import <AsyncDisplayKit/AsyncDisplayKit+Debug.h>
|
#import <AsyncDisplayKit/AsyncDisplayKit+Debug.h>
|
||||||
|
|
||||||
|
|||||||
@ -275,12 +275,12 @@
|
|||||||
if (asynchronously) {
|
if (asynchronously) {
|
||||||
uint displaySentinelValue = ++_displaySentinel;
|
uint displaySentinelValue = ++_displaySentinel;
|
||||||
__weak ASDisplayNode *weakSelf = self;
|
__weak ASDisplayNode *weakSelf = self;
|
||||||
isCancelledBlock = ^{
|
isCancelledBlock = ^BOOL{
|
||||||
__strong ASDisplayNode *self = weakSelf;
|
__strong ASDisplayNode *self = weakSelf;
|
||||||
return self == nil || (displaySentinelValue != self->_displaySentinel.load());
|
return self == nil || (displaySentinelValue != self->_displaySentinel.load());
|
||||||
};
|
};
|
||||||
} else {
|
} else {
|
||||||
isCancelledBlock = ^{
|
isCancelledBlock = ^BOOL{
|
||||||
return NO;
|
return NO;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
46
build.sh
46
build.sh
@ -220,6 +220,52 @@ if [ "$MODE" = "examples-pt3" ]; then
|
|||||||
exit 0
|
exit 0
|
||||||
fi
|
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
|
||||||
|
trap - EXIT
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
if [ "$MODE" = "life-without-cocoapods" ]; then
|
if [ "$MODE" = "life-without-cocoapods" ]; then
|
||||||
echo "Verifying that AsyncDisplayKit functions as a static library."
|
echo "Verifying that AsyncDisplayKit functions as a static library."
|
||||||
|
|
||||||
|
|||||||
@ -47,7 +47,7 @@ typedef enum : NSUInteger {
|
|||||||
if (!(self = [super init]))
|
if (!(self = [super init]))
|
||||||
return nil;
|
return nil;
|
||||||
|
|
||||||
_tableView = [[ASTableView alloc] initWithFrame:CGRectZero style:UITableViewStylePlain asyncDataFetching:YES];
|
_tableView = [[ASTableView alloc] initWithFrame:CGRectZero style:UITableViewStylePlain];
|
||||||
_tableView.asyncDataSource = self;
|
_tableView.asyncDataSource = self;
|
||||||
_tableView.asyncDelegate = self;
|
_tableView.asyncDelegate = self;
|
||||||
_tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
|
_tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
|
||||||
|
|||||||
@ -77,7 +77,7 @@ static const CGFloat kInnerPadding = 10.0f;
|
|||||||
// kitten image, with a solid background colour serving as placeholder
|
// kitten image, with a solid background colour serving as placeholder
|
||||||
_imageNode = [[ASNetworkImageNode alloc] init];
|
_imageNode = [[ASNetworkImageNode alloc] init];
|
||||||
_imageNode.backgroundColor = ASDisplayNodeDefaultPlaceholderColor();
|
_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];
|
[_imageNode addTarget:self action:@selector(imageTapped:) forControlEvents:ASControlNodeEventTouchUpInside];
|
||||||
|
|
||||||
CGFloat scale = [UIScreen mainScreen].scale;
|
CGFloat scale = [UIScreen mainScreen].scale;
|
||||||
|
|||||||
@ -274,6 +274,7 @@
|
|||||||
ONLY_ACTIVE_ARCH = YES;
|
ONLY_ACTIVE_ARCH = YES;
|
||||||
SDKROOT = iphoneos;
|
SDKROOT = iphoneos;
|
||||||
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
|
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
|
||||||
|
SWIFT_VERSION = 2.3;
|
||||||
};
|
};
|
||||||
name = Debug;
|
name = Debug;
|
||||||
};
|
};
|
||||||
@ -310,6 +311,7 @@
|
|||||||
IPHONEOS_DEPLOYMENT_TARGET = 9.2;
|
IPHONEOS_DEPLOYMENT_TARGET = 9.2;
|
||||||
MTL_ENABLE_DEBUG_INFO = NO;
|
MTL_ENABLE_DEBUG_INFO = NO;
|
||||||
SDKROOT = iphoneos;
|
SDKROOT = iphoneos;
|
||||||
|
SWIFT_VERSION = 2.3;
|
||||||
VALIDATE_PRODUCT = YES;
|
VALIDATE_PRODUCT = YES;
|
||||||
};
|
};
|
||||||
name = Release;
|
name = Release;
|
||||||
|
|||||||
@ -27,16 +27,16 @@ final class DemoCellNode: ASCellNode {
|
|||||||
|
|
||||||
override init() {
|
override init() {
|
||||||
super.init()
|
super.init()
|
||||||
usesImplicitHierarchyManagement = true
|
automaticallyManagesSubnodes = true
|
||||||
}
|
}
|
||||||
|
|
||||||
override func layoutSpecThatFits(constrainedSize: ASSizeRange) -> ASLayoutSpec {
|
override func layoutSpecThatFits(constrainedSize: ASSizeRange) -> ASLayoutSpec {
|
||||||
let specA = ASRatioLayoutSpec(ratio: 1, child: childA)
|
let specA = ASRatioLayoutSpec(ratio: 1, child: childA)
|
||||||
specA.flexBasis = ASDimensionMakeWithPoints(1)
|
specA.style.flexBasis = ASDimensionMakeWithPoints(1)
|
||||||
specA.flexGrow = true
|
specA.style.flexGrow = 1
|
||||||
let specB = ASRatioLayoutSpec(ratio: 1, child: childB)
|
let specB = ASRatioLayoutSpec(ratio: 1, child: childB)
|
||||||
specB.flexBasis = ASDimensionMakeWithPoints(1)
|
specB.style.flexBasis = ASDimensionMakeWithPoints(1)
|
||||||
specB.flexGrow = true
|
specB.style.flexGrow = 1
|
||||||
let children = state.isReverse ? [ specB, specA ] : [ specA, specB ]
|
let children = state.isReverse ? [ specB, specA ] : [ specA, specB ]
|
||||||
let direction: ASStackLayoutDirection = state.isVertical ? .Vertical : .Horizontal
|
let direction: ASStackLayoutDirection = state.isVertical ? .Vertical : .Horizontal
|
||||||
return ASStackLayoutSpec(direction: direction,
|
return ASStackLayoutSpec(direction: direction,
|
||||||
@ -46,7 +46,7 @@ final class DemoCellNode: ASCellNode {
|
|||||||
children: children)
|
children: children)
|
||||||
}
|
}
|
||||||
|
|
||||||
override func animateLayoutTransition(context: ASContextTransitioning!) {
|
override func animateLayoutTransition(context: ASContextTransitioning) {
|
||||||
childA.frame = context.initialFrameForNode(childA)
|
childA.frame = context.initialFrameForNode(childA)
|
||||||
childB.frame = context.initialFrameForNode(childB)
|
childB.frame = context.initialFrameForNode(childB)
|
||||||
let tinyDelay = drand48() / 10
|
let tinyDelay = drand48() / 10
|
||||||
|
|||||||
@ -17,9 +17,8 @@
|
|||||||
// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
//
|
//
|
||||||
|
|
||||||
@import AsyncDisplayKit;
|
|
||||||
|
|
||||||
#import "ViewController.h"
|
#import "ViewController.h"
|
||||||
|
#import <AsyncDisplayKit/AsyncDisplayKit.h>
|
||||||
|
|
||||||
@interface ViewController ()
|
@interface ViewController ()
|
||||||
|
|
||||||
@ -35,7 +34,7 @@
|
|||||||
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
|
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
|
||||||
ASTextNode *node = [[ASTextNode alloc] init];
|
ASTextNode *node = [[ASTextNode alloc] init];
|
||||||
node.attributedText = [[NSAttributedString alloc] initWithString:@"hello world"];
|
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 };
|
node.frame = (CGRect) {.origin = (CGPoint){.x = 100, .y = 100}, .size = node.calculatedSize };
|
||||||
|
|
||||||
dispatch_async(dispatch_get_main_queue(), ^{
|
dispatch_async(dispatch_get_main_queue(), ^{
|
||||||
|
|||||||
@ -55,7 +55,7 @@ static const NSInteger kMaxLitterSize = 100; // max number of kitten cell
|
|||||||
if (!(self = [super init]))
|
if (!(self = [super init]))
|
||||||
return nil;
|
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.separatorStyle = UITableViewCellSeparatorStyleNone; // KittenNode has its own separator
|
||||||
_tableView.asyncDataSource = self;
|
_tableView.asyncDataSource = self;
|
||||||
_tableView.asyncDelegate = self;
|
_tableView.asyncDelegate = self;
|
||||||
|
|||||||
@ -54,7 +54,7 @@ static const NSInteger kMaxCageSize = 100; // max number of Cage cells al
|
|||||||
if (!(self = [super init]))
|
if (!(self = [super init]))
|
||||||
return nil;
|
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.separatorStyle = UITableViewCellSeparatorStyleNone; // KittenNode has its own separator
|
||||||
_tableView.asyncDataSource = self;
|
_tableView.asyncDataSource = self;
|
||||||
_tableView.asyncDelegate = self;
|
_tableView.asyncDelegate = self;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user