diff --git a/.gitignore b/.gitignore index daf3d5c3e9..c94428a8d5 100644 --- a/.gitignore +++ b/.gitignore @@ -31,7 +31,6 @@ Project.xcodeproj/* Watch/Watch.xcodeproj/* AppBundle.xcworkspace/* *.xcworkspace -tools/buck *.xcodeproj !*_Xcode.xcodeproj .idea diff --git a/Config/configs.bzl b/Config/configs.bzl index 75fa2d15c3..b3806e01c1 100644 --- a/Config/configs.bzl +++ b/Config/configs.bzl @@ -298,6 +298,7 @@ def watch_extension_info_plist_substitutions(): "CURRENT_PROJECT_VERSION": "1", "BUILD_NUMBER": get_build_number(), "PRODUCT_BUNDLE_SHORT_VERSION": get_short_version(), + "MinimumOSVersion": "5.0", } return substitutions @@ -312,5 +313,6 @@ def watch_info_plist_substitutions(): "CURRENT_PROJECT_VERSION": "1", "BUILD_NUMBER": get_build_number(), "PRODUCT_BUNDLE_SHORT_VERSION": get_short_version(), + "MinimumOSVersion": "5.0", } return substitutions diff --git a/NotificationService/NotificationService.h b/NotificationService/NotificationService.h index f8e94caf66..c7b6906685 100644 --- a/NotificationService/NotificationService.h +++ b/NotificationService/NotificationService.h @@ -6,7 +6,7 @@ NS_ASSUME_NONNULL_BEGIN @interface NotificationServiceImpl : NSObject -- (instancetype)initWithCountIncomingMessage:(void (^)(NSString *, int64_t, DeviceSpecificEncryptionParameters *, int64_t, int32_t))countIncomingMessage isLocked:(bool (^)(NSString *))isLocked lockedMessageText:(NSString *(^)(NSString *))lockedMessageText; +- (instancetype)initWithSerialDispatch:(void (^)(dispatch_block_t))serialDispatch countIncomingMessage:(void (^)(NSString *, int64_t, DeviceSpecificEncryptionParameters *, int64_t, int32_t))countIncomingMessage isLocked:(bool (^)(NSString *))isLocked lockedMessageText:(NSString *(^)(NSString *))lockedMessageText; - (void)updateUnreadCount:(int32_t)unreadCount; - (void)didReceiveNotificationRequest:(UNNotificationRequest *)request withContentHandler:(void (^)(UNNotificationContent * _Nonnull))contentHandler; diff --git a/NotificationService/NotificationService.m b/NotificationService/NotificationService.m index b194d85da2..955b2c13ff 100644 --- a/NotificationService/NotificationService.m +++ b/NotificationService/NotificationService.m @@ -51,6 +51,7 @@ static void reportMemory() { #endif @interface NotificationServiceImpl () { + void (^_serialDispatch)(dispatch_block_t); void (^_countIncomingMessage)(NSString *, int64_t, DeviceSpecificEncryptionParameters *, int64_t, int32_t); NSString * _Nullable _rootPath; @@ -70,13 +71,14 @@ static void reportMemory() { @implementation NotificationServiceImpl -- (instancetype)initWithCountIncomingMessage:(void (^)(NSString *, int64_t, DeviceSpecificEncryptionParameters *, int64_t, int32_t))countIncomingMessage isLocked:(nonnull bool (^)(NSString * _Nonnull))isLocked lockedMessageText:(NSString *(^)(NSString *))lockedMessageText { +- (instancetype)initWithSerialDispatch:(void (^)(dispatch_block_t))serialDispatch countIncomingMessage:(void (^)(NSString *, int64_t, DeviceSpecificEncryptionParameters *, int64_t, int32_t))countIncomingMessage isLocked:(nonnull bool (^)(NSString * _Nonnull))isLocked lockedMessageText:(NSString *(^)(NSString *))lockedMessageText { self = [super init]; if (self != nil) { #if DEBUG reportMemory(); #endif + _serialDispatch = [serialDispatch copy]; _countIncomingMessage = [countIncomingMessage copy]; NSString *appBundleIdentifier = [NSBundle mainBundle].bundleIdentifier; @@ -127,27 +129,32 @@ static void reportMemory() { reportMemory(); #endif - #ifdef __IPHONE_13_0 - if (_baseAppBundleId != nil) { - BGAppRefreshTaskRequest *request = [[BGAppRefreshTaskRequest alloc] initWithIdentifier:[_baseAppBundleId stringByAppendingString:@".refresh"]]; - request.earliestBeginDate = nil; - NSError *error = nil; - [[BGTaskScheduler sharedScheduler] submitTaskRequest:request error:&error]; - if (error != nil) { - NSLog(@"Error: %@", error); - } - } - #endif + NSString *baseAppBundleId = _baseAppBundleId; + void (^contentHandler)(UNNotificationContent *) = [_contentHandler copy]; + UNMutableNotificationContent *bestAttemptContent = _bestAttemptContent; + NSNumber *updatedUnreadCount = updatedUnreadCount; - if (_bestAttemptContent && _contentHandler) { - if (_updatedUnreadCount != nil) { - int32_t unreadCount = (int32_t)[_updatedUnreadCount intValue]; - if (unreadCount > 0) { - _bestAttemptContent.badge = @(unreadCount); + dispatch_async(dispatch_get_main_queue(), ^{ + #ifdef __IPHONE_13_0 + if (baseAppBundleId != nil && false) { + BGAppRefreshTaskRequest *request = [[BGAppRefreshTaskRequest alloc] initWithIdentifier:[baseAppBundleId stringByAppendingString:@".refresh"]]; + request.earliestBeginDate = nil; + NSError *error = nil; + [[BGTaskScheduler sharedScheduler] submitTaskRequest:request error:&error]; + if (error != nil) { + NSLog(@"Error: %@", error); } } - _contentHandler(_bestAttemptContent); - } + #endif + + if (updatedUnreadCount != nil) { + int32_t unreadCount = (int32_t)[updatedUnreadCount intValue]; + if (unreadCount > 0) { + bestAttemptContent.badge = @(unreadCount); + } + } + contentHandler(bestAttemptContent); + }); } - (void)didReceiveNotificationRequest:(UNNotificationRequest *)request withContentHandler:(void (^)(UNNotificationContent * _Nonnull))contentHandler { @@ -321,7 +328,7 @@ static void reportMemory() { if (_lockedMessageTextValue != nil) { _bestAttemptContent.body = _lockedMessageTextValue; } else { - _bestAttemptContent.body = @"You have a new message"; + _bestAttemptContent.body = @"^You have a new message"; } } else { _bestAttemptContent.subtitle = subtitle; @@ -334,7 +341,7 @@ static void reportMemory() { if (_lockedMessageTextValue != nil) { _bestAttemptContent.body = _lockedMessageTextValue; } else { - _bestAttemptContent.body = @"You have a new message"; + _bestAttemptContent.body = @"^You have a new message"; } } else { _bestAttemptContent.body = alert; @@ -402,9 +409,11 @@ static void reportMemory() { } else { BuildConfig *buildConfig = [[BuildConfig alloc] initWithBaseAppBundleId:_baseAppBundleId]; + void (^serialDispatch)(dispatch_block_t) = _serialDispatch; + __weak typeof(self) weakSelf = self; _cancelFetch = fetchImage(buildConfig, accountInfos.proxy, account, inputFileLocation, fileDatacenterId, ^(NSData * _Nullable data) { - dispatch_async(dispatch_get_main_queue(), ^{ + serialDispatch(^{ __strong typeof(weakSelf) strongSelf = weakSelf; if (strongSelf == nil) { return; diff --git a/NotificationService/NotificationService.swift b/NotificationService/NotificationService.swift index 410dc9a59b..b40349579e 100644 --- a/NotificationService/NotificationService.swift +++ b/NotificationService/NotificationService.swift @@ -1,35 +1,52 @@ import Foundation import UserNotifications +import SwiftSignalKit + +private let queue = Queue() @available(iOSApplicationExtension 10.0, *) @objc(NotificationService) final class NotificationService: UNNotificationServiceExtension { - private let impl: NotificationServiceImpl + private let impl: QueueLocalObject override init() { - var completion: ((Int32) -> Void)? - self.impl = NotificationServiceImpl(countIncomingMessage: { rootPath, accountId, encryptionParameters, peerId, messageId in - SyncProviderImpl.addIncomingMessage(withRootPath: rootPath, accountId: accountId, encryptionParameters: encryptionParameters, peerId: peerId, messageId: messageId, completion: { count in - completion?(count) + self.impl = QueueLocalObject(queue: queue, generate: { + var completion: ((Int32) -> Void)? + let impl = NotificationServiceImpl(serialDispatch: { f in + queue.async { + f() + } + }, countIncomingMessage: { rootPath, accountId, encryptionParameters, peerId, messageId in + SyncProviderImpl.addIncomingMessage(queue: queue, withRootPath: rootPath, accountId: accountId, encryptionParameters: encryptionParameters, peerId: peerId, messageId: messageId, completion: { count in + completion?(count) + }) + }, isLocked: { rootPath in + return SyncProviderImpl.isLocked(withRootPath: rootPath) + }, lockedMessageText: { rootPath in + return SyncProviderImpl.lockedMessageText(withRootPath: rootPath) }) - }, isLocked: { rootPath in - return SyncProviderImpl.isLocked(withRootPath: rootPath) - }, lockedMessageText: { rootPath in - return SyncProviderImpl.lockedMessageText(withRootPath: rootPath) + + completion = { [weak impl] count in + queue.async { + impl?.updateUnreadCount(count) + } + } + + return impl }) super.init() - - completion = { [weak self] count in - self?.impl.updateUnreadCount(count) - } } override func didReceive(_ request: UNNotificationRequest, withContentHandler contentHandler: @escaping (UNNotificationContent) -> Void) { - self.impl.didReceive(request, withContentHandler: contentHandler) + self.impl.with { impl in + impl.didReceive(request, withContentHandler: contentHandler) + } } override func serviceExtensionTimeWillExpire() { - self.impl.serviceExtensionTimeWillExpire() + self.impl.with { impl in + impl.serviceExtensionTimeWillExpire() + } } } diff --git a/NotificationService/Sync.swift b/NotificationService/Sync.swift index 9565046ad6..21a93f439b 100644 --- a/NotificationService/Sync.swift +++ b/NotificationService/Sync.swift @@ -42,17 +42,17 @@ enum SyncProviderImpl { } } - static func addIncomingMessage(withRootPath rootPath: String, accountId: Int64, encryptionParameters: DeviceSpecificEncryptionParameters, peerId: Int64, messageId: Int32, completion: @escaping (Int32) -> Void) { - Queue.mainQueue().async { + static func addIncomingMessage(queue: Queue, withRootPath rootPath: String, accountId: Int64, encryptionParameters: DeviceSpecificEncryptionParameters, peerId: Int64, messageId: Int32, completion: @escaping (Int32) -> Void) { + queue.async { let _ = registeredTypes let sharedBasePath = rootPath + "/accounts-metadata" let basePath = rootPath + "/" + accountRecordIdPathName(accountId) + "/postbox" - let sharedValueBox = SqliteValueBox(basePath: sharedBasePath + "/db", queue: Queue.mainQueue(), logger: ValueBoxLoggerImpl(), encryptionParameters: nil, disableCache: true, upgradeProgress: { _ in + let sharedValueBox = SqliteValueBox(basePath: sharedBasePath + "/db", queue: queue, logger: ValueBoxLoggerImpl(), encryptionParameters: nil, disableCache: true, upgradeProgress: { _ in }) - let valueBox = SqliteValueBox(basePath: basePath + "/db", queue: Queue.mainQueue(), logger: ValueBoxLoggerImpl(), encryptionParameters: ValueBoxEncryptionParameters(forceEncryptionIfNoSet: false, key: ValueBoxEncryptionParameters.Key(data: encryptionParameters.key)!, salt: ValueBoxEncryptionParameters.Salt(data: encryptionParameters.salt)!), disableCache: true, upgradeProgress: { _ in + let valueBox = SqliteValueBox(basePath: basePath + "/db", queue: queue, logger: ValueBoxLoggerImpl(), encryptionParameters: ValueBoxEncryptionParameters(forceEncryptionIfNoSet: false, key: ValueBoxEncryptionParameters.Key(data: encryptionParameters.key)!, salt: ValueBoxEncryptionParameters.Salt(data: encryptionParameters.salt)!), disableCache: true, upgradeProgress: { _ in }) let metadataTable = MessageHistoryMetadataTable(valueBox: valueBox, table: MessageHistoryMetadataTable.tableSpec(10)) diff --git a/Wallet/README.md b/Wallet/README.md index 23ca7b3a47..792e3695d6 100644 --- a/Wallet/README.md +++ b/Wallet/README.md @@ -1,4 +1,6 @@ -# TON Wallet iOS Source Code Compilation Guide +# Test Gram Wallet (iOS) + +This is the source code and build instructions for a TON Testnet Wallet implementation for iOS. 1. Install Xcode 11.1 ``` @@ -31,12 +33,31 @@ sh ./prepare_buck_source.sh $HOME/buck_source 5. Now you can build Wallet application (IPA) Note: -It is recommended to use an artifact cache to optimize build speed. Prepend any of the following commands with BUCK_DIR_CACHE="path/to/existing/directory" +It is recommended to use an artifact cache to optimize build speed. Prepend any of the following commands with +``` +BUCK_DIR_CACHE="path/to/existing/directory" +``` -```BUCK="$HOME/buck_source/buck/buck-out/gen/programs/buck.pex" DISTRIBUTION_CODE_SIGN_IDENTITY="iPhone Distribution: XXXXXXX (XXXXXXXXXX)" DEVELOPMENT_TEAM="XXXXXXXXXX" WALLET_BUNDLE_ID="wallet.bundle.id" BUILD_NUMBER=30 WALLET_DISTRIBUTION_PROVISIONING_PROFILE_APP="wallet provisioning profile name" CODESIGNING_SOURCE_DATA_PATH="$HOME/wallet_codesigning" sh Wallet/example_wallet_env.sh make -f Wallet.makefile wallet_app +``` +BUCK="$HOME/buck_source/buck/buck-out/gen/programs/buck.pex" \ + BUILD_NUMBER=30 \ + DISTRIBUTION_CODE_SIGN_IDENTITY="iPhone Distribution: XXXXXXX (XXXXXXXXXX)" \ + DEVELOPMENT_TEAM="XXXXXXXXXX" WALLET_BUNDLE_ID="wallet.bundle.id" \ + WALLET_DISTRIBUTION_PROVISIONING_PROFILE_APP="wallet distribution provisioning profile name" \ + CODESIGNING_SOURCE_DATA_PATH="$HOME/wallet_codesigning" \ + sh Wallet/example_wallet_env.sh make -f Wallet.makefile wallet_app ``` 6. If needed, generate Xcode project ``` -BUCK="$HOME/buck_source/buck/buck-out/gen/programs/buck.pex" DISTRIBUTION_CODE_SIGN_IDENTITY="iPhone Distribution: XXXXXXX (XXXXXXXXXX)" DEVELOPMENT_TEAM="XXXXXXXXXX" WALLET_BUNDLE_ID="wallet.bundle.id" BUILD_NUMBER=30 WALLET_DISTRIBUTION_PROVISIONING_PROFILE_APP="wallet provisioning profile name" CODESIGNING_SOURCE_DATA_PATH="$HOME/wallet_codesigning" sh Wallet/example_wallet_env.sh make -f Wallet.makefile wallet_project +BUCK="$HOME/buck_source/buck/buck-out/gen/programs/buck.pex" \ + BUILD_NUMBER=30 \ + DEVELOPMENT_CODE_SIGN_IDENTITY="iPhone Developer: XXXXXXX (XXXXXXXXXX)" \ + DISTRIBUTION_CODE_SIGN_IDENTITY="iPhone Distribution: XXXXXXX (XXXXXXXXXX)" \ + DEVELOPMENT_TEAM="XXXXXXXXXX" WALLET_BUNDLE_ID="wallet.bundle.id" \ + WALLET_DEVELOPMENT_PROVISIONING_PROFILE_APP="wallet development provisioning profile name" \ + WALLET_DISTRIBUTION_PROVISIONING_PROFILE_APP="wallet distribution provisioning profile name" \ + CODESIGNING_SOURCE_DATA_PATH="$HOME/wallet_codesigning" \ + sh Wallet/example_wallet_env.sh make -f Wallet.makefile wallet_project ``` + diff --git a/Wallet/example_wallet_env.sh b/Wallet/example_wallet_env.sh index e466204623..ed087692a5 100755 --- a/Wallet/example_wallet_env.sh +++ b/Wallet/example_wallet_env.sh @@ -23,7 +23,9 @@ export APP_SPECIFIC_URL_SCHEME="" export API_ID="0" export API_HASH="" -export DEVELOPMENT_CODE_SIGN_IDENTITY="iPhone Developer: AAAAA AAAAA (XXXXXXXXXX)" +if [ -z "$DEVELOPMENT_CODE_SIGN_IDENTITY" ]; then + export DEVELOPMENT_CODE_SIGN_IDENTITY="iPhone Developer: AAAAA AAAAA (XXXXXXXXXX)" +fi if [ -z "$DISTRIBUTION_CODE_SIGN_IDENTITY" ]; then export DISTRIBUTION_CODE_SIGN_IDENTITY="iPhone Distribution: AAAAA AAAAA (XXXXXXXXXX)" fi @@ -41,7 +43,9 @@ if [ -z "$BUILD_NUMBER" ]; then fi export WALLET_ENTITLEMENTS_APP="Wallet.entitlements" -export WALLET_DEVELOPMENT_PROVISIONING_PROFILE_APP="development profile name" +if [ -z "$WALLET_DEVELOPMENT_PROVISIONING_PROFILE_APP" ]; then + export WALLET_DEVELOPMENT_PROVISIONING_PROFILE_APP="development profile name" +fi if [ -z "$WALLET_DISTRIBUTION_PROVISIONING_PROFILE_APP" ]; then export WALLET_DISTRIBUTION_PROVISIONING_PROFILE_APP="distribution profile name" fi @@ -55,10 +59,9 @@ if [ -z "$CODESIGNING_SOURCE_DATA_PATH" ]; then exit 1 fi -if [ ! -d "$CODESIGNING_SOURCE_DATA_PATH/profiles" ] || [ ! -d "$CODESIGNING_SOURCE_DATA_PATH/certs" ]; then +if [ ! -d "$CODESIGNING_SOURCE_DATA_PATH/profiles" ]; then echo "Expected codesigning directory layout:" echo "$CODESIGNING_SOURCE_DATA_PATH/profiles/appstore/*.mobileprovision" - echo "$CODESIGNING_SOURCE_DATA_PATH/certs/distribution/*.{cer,p12}" exit 1 fi diff --git a/extract_wallet_source.py b/extract_wallet_source.py index 857a345ac2..948f2ee18d 100644 --- a/extract_wallet_source.py +++ b/extract_wallet_source.py @@ -76,6 +76,7 @@ shutil.copytree('Config', destination + '/' + 'Config') shutil.copytree('tools/buck', destination + '/' + 'tools/buck') shutil.copy('Wallet/README.md', destination + '/' + 'README.md') +os.remove(destination + '/Wallet/' + 'README.md') copy_files = [ '.buckconfig', diff --git a/submodules/AsyncDisplayKit/.buckconfig b/submodules/AsyncDisplayKit/.buckconfig deleted file mode 100644 index 821cb2c82f..0000000000 --- a/submodules/AsyncDisplayKit/.buckconfig +++ /dev/null @@ -1,22 +0,0 @@ -[cxx] - default_platform = iphonesimulator-x86_64 - combined_preprocess_and_compile = true - -[apple] - iphonesimulator_target_sdk_version = 8.0 - iphoneos_target_sdk_version = 8.0 - xctool_default_destination_specifier = platform=iOS Simulator, name=iPhone 6, OS=10.2 - -[alias] - lib = //:AsyncDisplayKit - tests = //:Tests - -[httpserver] - port = 8080 - -[project] - ide = xcode - ignore = .buckd, \ - .hg, \ - .git, \ - buck-out, \ diff --git a/submodules/AsyncDisplayKit/.buckversion b/submodules/AsyncDisplayKit/.buckversion deleted file mode 100644 index 437aedac09..0000000000 --- a/submodules/AsyncDisplayKit/.buckversion +++ /dev/null @@ -1 +0,0 @@ -f399f484bf13b47bcc2bf0f2e092ab5d8de9f6e6 diff --git a/submodules/AsyncDisplayKit/.editorconfig b/submodules/AsyncDisplayKit/.editorconfig deleted file mode 100644 index 0605feef2a..0000000000 --- a/submodules/AsyncDisplayKit/.editorconfig +++ /dev/null @@ -1,19 +0,0 @@ -# http://editorconfig.org -root = true - -[*] -charset = utf-8 -end_of_line = lf -insert_final_newline = true -trim_trailing_whitespace = true - -[**.{h,cc,mm,m}] -indent_style = space -indent_size = 2 - -[*.{md,markdown}] -trim_trailing_whitespace = false - -# Makefiles always use tabs for indentation -[Makefile] -indent_style = tab \ No newline at end of file diff --git a/submodules/AsyncDisplayKit/.github/ISSUE_TEMPLATE.md b/submodules/AsyncDisplayKit/.github/ISSUE_TEMPLATE.md deleted file mode 100644 index c5ab71942b..0000000000 --- a/submodules/AsyncDisplayKit/.github/ISSUE_TEMPLATE.md +++ /dev/null @@ -1,7 +0,0 @@ -// If you're looking for help, please consider joining our slack channel: -// http://asyncdisplaykit.org/slack (we'll be updating the name to Texture soon) - -// The more information you include, the faster we can help you out! -// Please include: a sample project or screenshots, code snippets -// Texture version, and/or backtraces for any crashes (> bt all). -// Please delete these lines before posting. Thanks! diff --git a/submodules/AsyncDisplayKit/.github_changelog_generator b/submodules/AsyncDisplayKit/.github_changelog_generator deleted file mode 100644 index 5b1ccea517..0000000000 --- a/submodules/AsyncDisplayKit/.github_changelog_generator +++ /dev/null @@ -1,3 +0,0 @@ -issues=false -since-tag=2.8 -future-release=2.9 diff --git a/submodules/AsyncDisplayKit/.slather.yml b/submodules/AsyncDisplayKit/.slather.yml deleted file mode 100644 index ef84e32dea..0000000000 --- a/submodules/AsyncDisplayKit/.slather.yml +++ /dev/null @@ -1,5 +0,0 @@ -ci_service: travis_ci -coverage_service: coveralls -xcodeproj: AsyncDisplayKit.xcodeproj -source_directory: AsyncDisplayKit - diff --git a/submodules/AsyncDisplayKit/.travis.yml b/submodules/AsyncDisplayKit/.travis.yml deleted file mode 100644 index b493cff43c..0000000000 --- a/submodules/AsyncDisplayKit/.travis.yml +++ /dev/null @@ -1,34 +0,0 @@ -language: objective-c -cache: - - bundler - - cocoapods -osx_image: xcode8.1 -git: - depth: 10 -before_install: - - brew update - - brew outdated xctool || brew upgrade xctool - - brew outdated carthage || brew upgrade carthage - - gem install cocoapods -v 1.0.1 - - gem install xcpretty -v 0.2.2 - - gem install xcpretty-travis-formatter -# - gem install slather - - xcrun simctl list -install: echo "<3" -env: - - MODE=tests - - MODE=tests_listkit - - MODE=examples-pt1 - - MODE=examples-pt2 - - MODE=examples-pt3 - - MODE=life-without-cocoapods - - MODE=framework -script: ./build.sh $MODE - -#after_success: -# - slather - -# whitelist -branches: - only: - - master diff --git a/submodules/AsyncDisplayKit/CI/build.sh b/submodules/AsyncDisplayKit/CI/build.sh deleted file mode 100755 index 058cef0542..0000000000 --- a/submodules/AsyncDisplayKit/CI/build.sh +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/bash -set -eo pipefail - -./build.sh all \ No newline at end of file diff --git a/submodules/AsyncDisplayKit/CI/exclude-from-build.json b/submodules/AsyncDisplayKit/CI/exclude-from-build.json deleted file mode 100644 index 999e736a52..0000000000 --- a/submodules/AsyncDisplayKit/CI/exclude-from-build.json +++ /dev/null @@ -1,6 +0,0 @@ -[ - "^plans/", - "^docs/", - "^CI/exclude-from-build.json$", - "^**/*.md$" -] diff --git a/submodules/AsyncDisplayKit/Tests/ASAbsoluteLayoutSpecSnapshotTests.mm b/submodules/AsyncDisplayKit/Tests/ASAbsoluteLayoutSpecSnapshotTests.mm deleted file mode 100644 index a1b9b94596..0000000000 --- a/submodules/AsyncDisplayKit/Tests/ASAbsoluteLayoutSpecSnapshotTests.mm +++ /dev/null @@ -1,70 +0,0 @@ -// -// ASAbsoluteLayoutSpecSnapshotTests.mm -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import "ASLayoutSpecSnapshotTestsHelper.h" - -#import -#import - -@interface ASAbsoluteLayoutSpecSnapshotTests : ASLayoutSpecSnapshotTestCase -@end - -@implementation ASAbsoluteLayoutSpecSnapshotTests - -- (void)testSizingBehaviour -{ - [self testWithSizeRange:ASSizeRangeMake(CGSizeMake(150, 200), CGSizeMake(INFINITY, INFINITY)) - identifier:@"underflowChildren"]; - [self testWithSizeRange:ASSizeRangeMake(CGSizeZero, CGSizeMake(50, 100)) - identifier:@"overflowChildren"]; - // Expect the spec to wrap its content because children sizes are between constrained size - [self testWithSizeRange:ASSizeRangeMake(CGSizeZero, CGSizeMake(INFINITY / 2, INFINITY / 2)) - identifier:@"wrappedChildren"]; -} - -- (void)testChildrenMeasuredWithAutoMaxSize -{ - ASDisplayNode *firstChild = ASDisplayNodeWithBackgroundColor([UIColor redColor], (CGSize){50, 50}); - firstChild.style.layoutPosition = CGPointMake(0, 0); - - ASDisplayNode *secondChild = ASDisplayNodeWithBackgroundColor([UIColor blueColor], (CGSize){100, 100}); - secondChild.style.layoutPosition = CGPointMake(10, 60); - - ASSizeRange sizeRange = ASSizeRangeMake(CGSizeMake(10, 10), CGSizeMake(110, 160)); - [self testWithChildren:@[firstChild, secondChild] sizeRange:sizeRange identifier:nil]; -} - -- (void)testWithSizeRange:(ASSizeRange)sizeRange identifier:(NSString *)identifier -{ - ASDisplayNode *firstChild = ASDisplayNodeWithBackgroundColor([UIColor redColor], (CGSize){50, 50}); - firstChild.style.layoutPosition = CGPointMake(0, 0); - - ASDisplayNode *secondChild = ASDisplayNodeWithBackgroundColor([UIColor blueColor], (CGSize){100, 100}); - secondChild.style.layoutPosition = CGPointMake(0, 50); - - [self testWithChildren:@[firstChild, secondChild] sizeRange:sizeRange identifier:identifier]; -} - -- (void)testWithChildren:(NSArray *)children sizeRange:(ASSizeRange)sizeRange identifier:(NSString *)identifier -{ - ASDisplayNode *backgroundNode = ASDisplayNodeWithBackgroundColor([UIColor whiteColor]); - - NSMutableArray *subnodes = [NSMutableArray arrayWithArray:children]; - [subnodes insertObject:backgroundNode atIndex:0]; - - ASLayoutSpec *layoutSpec = - [ASBackgroundLayoutSpec backgroundLayoutSpecWithChild: - [ASAbsoluteLayoutSpec - absoluteLayoutSpecWithChildren:children] - background:backgroundNode]; - - [self testLayoutSpec:layoutSpec sizeRange:sizeRange subnodes:subnodes identifier:identifier]; -} - -@end diff --git a/submodules/AsyncDisplayKit/Tests/ASBackgroundLayoutSpecSnapshotTests.mm b/submodules/AsyncDisplayKit/Tests/ASBackgroundLayoutSpecSnapshotTests.mm deleted file mode 100644 index 1a6b4fc7c8..0000000000 --- a/submodules/AsyncDisplayKit/Tests/ASBackgroundLayoutSpecSnapshotTests.mm +++ /dev/null @@ -1,40 +0,0 @@ -// -// ASBackgroundLayoutSpecSnapshotTests.mm -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import "ASLayoutSpecSnapshotTestsHelper.h" - -#import -#import - -static const ASSizeRange kSize = {{320, 320}, {320, 320}}; - -@interface ASBackgroundLayoutSpecSnapshotTests : ASLayoutSpecSnapshotTestCase - -@end - -@implementation ASBackgroundLayoutSpecSnapshotTests - -- (void)testBackground -{ - ASDisplayNode *backgroundNode = ASDisplayNodeWithBackgroundColor([UIColor blueColor]); - ASDisplayNode *foregroundNode = ASDisplayNodeWithBackgroundColor([UIColor blackColor], {20, 20}); - - ASLayoutSpec *layoutSpec = - [ASBackgroundLayoutSpec - backgroundLayoutSpecWithChild: - [ASCenterLayoutSpec - centerLayoutSpecWithCenteringOptions:ASCenterLayoutSpecCenteringXY - sizingOptions:{} - child:foregroundNode] - background:backgroundNode]; - - [self testLayoutSpec:layoutSpec sizeRange:kSize subnodes:@[backgroundNode, foregroundNode] identifier: nil]; -} - -@end diff --git a/submodules/AsyncDisplayKit/Tests/ASBasicImageDownloaderContextTests.mm b/submodules/AsyncDisplayKit/Tests/ASBasicImageDownloaderContextTests.mm deleted file mode 100644 index 701174b7dd..0000000000 --- a/submodules/AsyncDisplayKit/Tests/ASBasicImageDownloaderContextTests.mm +++ /dev/null @@ -1,75 +0,0 @@ -// -// ASBasicImageDownloaderContextTests.mm -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import -#import - -#import - -#import - - -@interface ASBasicImageDownloaderContextTests : XCTestCase - -@end - -@implementation ASBasicImageDownloaderContextTests - -- (NSURL *)randomURL -{ - // random URL for each test, doesn't matter that this is not really a URL - return [NSURL URLWithString:[NSUUID UUID].UUIDString]; -} - -- (void)testContextCreation -{ - NSURL *url = [self randomURL]; - ASBasicImageDownloaderContext *c1 = [ASBasicImageDownloaderContext contextForURL:url]; - ASBasicImageDownloaderContext *c2 = [ASBasicImageDownloaderContext contextForURL:url]; - XCTAssert(c1 == c2, @"Context objects are not the same"); -} - -- (void)testContextInvalidation -{ - NSURL *url = [self randomURL]; - ASBasicImageDownloaderContext *context = [ASBasicImageDownloaderContext contextForURL:url]; - [context cancel]; - XCTAssert([context isCancelled], @"Context should be cancelled"); -} - -/* This test is currently unreliable. See https://github.com/facebook/AsyncDisplayKit/issues/459 -- (void)testAsyncContextInvalidation -{ - NSURL *url = [self randomURL]; - ASBasicImageDownloaderContext *context = [ASBasicImageDownloaderContext contextForURL:url]; - XCTestExpectation *expectation = [self expectationWithDescription:@"Context invalidation"]; - - dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{ - [expectation fulfill]; - XCTAssert([context isCancelled], @"Context should be cancelled"); - }); - - [context cancel]; - [self waitForExpectationsWithTimeout:30.0 handler:nil]; -} -*/ - -- (void)testContextSessionCanceled -{ - NSURL *url = [self randomURL]; - id task = [OCMockObject mockForClass:[NSURLSessionTask class]]; - ASBasicImageDownloaderContext *context = [ASBasicImageDownloaderContext contextForURL:url]; - context.sessionTask = task; - - [[task expect] cancel]; - - [context cancel]; -} - -@end diff --git a/submodules/AsyncDisplayKit/Tests/ASBasicImageDownloaderTests.mm b/submodules/AsyncDisplayKit/Tests/ASBasicImageDownloaderTests.mm deleted file mode 100644 index 8268dfcd64..0000000000 --- a/submodules/AsyncDisplayKit/Tests/ASBasicImageDownloaderTests.mm +++ /dev/null @@ -1,45 +0,0 @@ -// -// ASBasicImageDownloaderTests.mm -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -#import - -@interface ASBasicImageDownloaderTests : XCTestCase - -@end - -@implementation ASBasicImageDownloaderTests - -- (void)testAsynchronouslyDownloadTheSameURLTwice -{ - XCTestExpectation *firstExpectation = [self expectationWithDescription:@"First ASBasicImageDownloader completion handler should be called within 3 seconds"]; - XCTestExpectation *secondExpectation = [self expectationWithDescription:@"Second ASBasicImageDownloader completion handler should be called within 3 seconds"]; - - ASBasicImageDownloader *downloader = [ASBasicImageDownloader sharedImageDownloader]; - NSURL *URL = [NSURL URLWithString:@"http://wrongPath/wrongResource.png"]; - - [downloader downloadImageWithURL:URL - callbackQueue:dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0) - downloadProgress:nil - completion:^(id _Nullable image, NSError * _Nullable error, id _Nullable downloadIdentifier, id _Nullable userInfo) { - [firstExpectation fulfill]; - }]; - - [downloader downloadImageWithURL:URL - callbackQueue:dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0) - downloadProgress:nil - completion:^(id _Nullable image, NSError * _Nullable error, id _Nullable downloadIdentifier, id _Nullable userInfo) { - [secondExpectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:30 handler:nil]; -} - -@end diff --git a/submodules/AsyncDisplayKit/Tests/ASBatchFetchingTests.mm b/submodules/AsyncDisplayKit/Tests/ASBatchFetchingTests.mm deleted file mode 100644 index 99b67f05c0..0000000000 --- a/submodules/AsyncDisplayKit/Tests/ASBatchFetchingTests.mm +++ /dev/null @@ -1,120 +0,0 @@ -// -// ASBatchFetchingTests.mm -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -#import -#import - -@interface ASBatchFetchingTests : XCTestCase - -@end - -@implementation ASBatchFetchingTests - -#define PASSING_RECT CGRectMake(0,0,1,1) -#define PASSING_SIZE CGSizeMake(1,1) -#define PASSING_POINT CGPointMake(1,1) -#define VERTICAL_RECT(h) CGRectMake(0,0,1,h) -#define VERTICAL_SIZE(h) CGSizeMake(0,h) -#define VERTICAL_OFFSET(y) CGPointMake(0,y) -#define HORIZONTAL_RECT(w) CGRectMake(0,0,w,1) -#define HORIZONTAL_SIZE(w) CGSizeMake(w,0) -#define HORIZONTAL_OFFSET(x) CGPointMake(x,0) - -- (void)testBatchNullState { - ASBatchContext *context = [[ASBatchContext alloc] init]; - BOOL shouldFetch = ASDisplayShouldFetchBatchForContext(context, ASScrollDirectionDown, ASScrollDirectionVerticalDirections, CGRectZero, CGSizeZero, CGPointZero, 0.0, YES, CGPointZero, nil); - XCTAssert(shouldFetch == NO, @"Should not fetch in the null state"); -} - -- (void)testBatchAlreadyFetching { - ASBatchContext *context = [[ASBatchContext alloc] init]; - [context beginBatchFetching]; - BOOL shouldFetch = ASDisplayShouldFetchBatchForContext(context, ASScrollDirectionDown, ASScrollDirectionVerticalDirections, PASSING_RECT, PASSING_SIZE, PASSING_POINT, 1.0, YES, CGPointZero, nil); - XCTAssert(shouldFetch == NO, @"Should not fetch when context is already fetching"); -} - -- (void)testUnsupportedScrollDirections { - ASBatchContext *context = [[ASBatchContext alloc] init]; - BOOL fetchRight = ASDisplayShouldFetchBatchForContext(context, ASScrollDirectionRight, ASScrollDirectionHorizontalDirections, PASSING_RECT, PASSING_SIZE, PASSING_POINT, 1.0, YES, CGPointZero, nil); - XCTAssert(fetchRight == YES, @"Should fetch for scrolling right"); - BOOL fetchDown = ASDisplayShouldFetchBatchForContext(context, ASScrollDirectionDown, ASScrollDirectionVerticalDirections, PASSING_RECT, PASSING_SIZE, PASSING_POINT, 1.0, YES, CGPointZero, nil); - XCTAssert(fetchDown == YES, @"Should fetch for scrolling down"); - BOOL fetchUp = ASDisplayShouldFetchBatchForContext(context, ASScrollDirectionUp, ASScrollDirectionVerticalDirections, PASSING_RECT, PASSING_SIZE, PASSING_POINT, 1.0, YES, CGPointZero, nil); - XCTAssert(fetchUp == NO, @"Should not fetch for scrolling up"); - BOOL fetchLeft = ASDisplayShouldFetchBatchForContext(context, ASScrollDirectionLeft, ASScrollDirectionHorizontalDirections, PASSING_RECT, PASSING_SIZE, PASSING_POINT, 1.0, YES, CGPointZero, nil); - XCTAssert(fetchLeft == NO, @"Should not fetch for scrolling left"); -} - -- (void)testVerticalScrollToExactLeading { - CGFloat screen = 1.0; - ASBatchContext *context = [[ASBatchContext alloc] init]; - // scroll to 1-screen top offset, height is 1 screen, so bottom is 1 screen away from end of content - BOOL shouldFetch = ASDisplayShouldFetchBatchForContext(context, ASScrollDirectionDown, ASScrollDirectionVerticalDirections, VERTICAL_RECT(screen), VERTICAL_SIZE(screen * 3.0), VERTICAL_OFFSET(screen * 1.0), 1.0, YES, CGPointZero, nil); - XCTAssert(shouldFetch == YES, @"Fetch should begin when vertically scrolling to exactly 1 leading screen away"); -} - -- (void)testVerticalScrollToLessThanLeading { - CGFloat screen = 1.0; - ASBatchContext *context = [[ASBatchContext alloc] init]; - // 3 screens of content, scroll only 1/2 of one screen - BOOL shouldFetch = ASDisplayShouldFetchBatchForContext(context, ASScrollDirectionDown, ASScrollDirectionVerticalDirections, VERTICAL_RECT(screen), VERTICAL_SIZE(screen * 3.0), VERTICAL_OFFSET(screen * 0.5), 1.0, YES, CGPointZero, nil); - XCTAssert(shouldFetch == NO, @"Fetch should not begin when vertically scrolling less than the leading distance away"); -} - -- (void)testVerticalScrollingPastContentSize { - CGFloat screen = 1.0; - ASBatchContext *context = [[ASBatchContext alloc] init]; - // 3 screens of content, top offset to 3-screens, height 1 screen, so its 1 screen past the leading - BOOL shouldFetch = ASDisplayShouldFetchBatchForContext(context, ASScrollDirectionDown, ASScrollDirectionVerticalDirections, VERTICAL_RECT(screen), VERTICAL_SIZE(screen * 3.0), VERTICAL_OFFSET(screen * 3.0), 1.0, YES, CGPointZero, nil); - XCTAssert(shouldFetch == YES, @"Fetch should begin when vertically scrolling past the content size"); -} - -- (void)testHorizontalScrollToExactLeading { - CGFloat screen = 1.0; - ASBatchContext *context = [[ASBatchContext alloc] init]; - // scroll to 1-screen left offset, width is 1 screen, so right is 1 screen away from end of content - BOOL shouldFetch = ASDisplayShouldFetchBatchForContext(context, ASScrollDirectionRight, ASScrollDirectionVerticalDirections, HORIZONTAL_RECT(screen), HORIZONTAL_SIZE(screen * 3.0), HORIZONTAL_OFFSET(screen * 1.0), 1.0, YES, CGPointZero, nil); - XCTAssert(shouldFetch == YES, @"Fetch should begin when horizontally scrolling to exactly 1 leading screen away"); -} - -- (void)testHorizontalScrollToLessThanLeading { - CGFloat screen = 1.0; - ASBatchContext *context = [[ASBatchContext alloc] init]; - // 3 screens of content, scroll only 1/2 of one screen - BOOL shouldFetch = ASDisplayShouldFetchBatchForContext(context, ASScrollDirectionLeft, ASScrollDirectionHorizontalDirections, HORIZONTAL_RECT(screen), HORIZONTAL_SIZE(screen * 3.0), HORIZONTAL_OFFSET(screen * 0.5), 1.0, YES, CGPointZero, nil); - XCTAssert(shouldFetch == NO, @"Fetch should not begin when horizontally scrolling less than the leading distance away"); -} - -- (void)testHorizontalScrollingPastContentSize { - CGFloat screen = 1.0; - ASBatchContext *context = [[ASBatchContext alloc] init]; - // 3 screens of content, left offset to 3-screens, width 1 screen, so its 1 screen past the leading - BOOL shouldFetch = ASDisplayShouldFetchBatchForContext(context, ASScrollDirectionDown, ASScrollDirectionHorizontalDirections, HORIZONTAL_RECT(screen), HORIZONTAL_SIZE(screen * 3.0), HORIZONTAL_OFFSET(screen * 3.0), 1.0, YES, CGPointZero, nil); - XCTAssert(shouldFetch == YES, @"Fetch should begin when vertically scrolling past the content size"); -} - -- (void)testVerticalScrollingSmallContentSize { - CGFloat screen = 1.0; - ASBatchContext *context = [[ASBatchContext alloc] init]; - // when the content size is < screen size, the target offset will always be 0 - BOOL shouldFetch = ASDisplayShouldFetchBatchForContext(context, ASScrollDirectionDown, ASScrollDirectionVerticalDirections, VERTICAL_RECT(screen), VERTICAL_SIZE(screen * 0.5), VERTICAL_OFFSET(0.0), 1.0, YES, CGPointZero, nil); - XCTAssert(shouldFetch == YES, @"Fetch should begin when the target is 0 and the content size is smaller than the scree"); -} - -- (void)testHorizontalScrollingSmallContentSize { - CGFloat screen = 1.0; - ASBatchContext *context = [[ASBatchContext alloc] init]; - // when the content size is < screen size, the target offset will always be 0 - BOOL shouldFetch = ASDisplayShouldFetchBatchForContext(context, ASScrollDirectionRight, ASScrollDirectionHorizontalDirections, HORIZONTAL_RECT(screen), HORIZONTAL_SIZE(screen * 0.5), HORIZONTAL_OFFSET(0.0), 1.0, YES, CGPointZero, nil); - XCTAssert(shouldFetch == YES, @"Fetch should begin when the target is 0 and the content size is smaller than the scree"); -} - -@end diff --git a/submodules/AsyncDisplayKit/Tests/ASBridgedPropertiesTests.mm b/submodules/AsyncDisplayKit/Tests/ASBridgedPropertiesTests.mm deleted file mode 100644 index 8e4a202eb8..0000000000 --- a/submodules/AsyncDisplayKit/Tests/ASBridgedPropertiesTests.mm +++ /dev/null @@ -1,231 +0,0 @@ -// -// ASBridgedPropertiesTests.mm -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import -#import -#import -#import -#import -#import -#import - -@interface ASPendingStateController (Testing) -- (BOOL)test_isFlushScheduled; -@end - -@interface ASBridgedPropertiesTestView : UIView -@property (nonatomic, readonly) BOOL receivedSetNeedsLayout; -@end - -@implementation ASBridgedPropertiesTestView - -- (void)setNeedsLayout -{ - _receivedSetNeedsLayout = YES; - [super setNeedsLayout]; -} - -@end - -@interface ASBridgedPropertiesTestNode : ASDisplayNode -@property (nullable, nonatomic, copy) dispatch_block_t onDealloc; -@end - -@implementation ASBridgedPropertiesTestNode - -- (void)dealloc { - _onDealloc(); -} - -@end - -@interface ASBridgedPropertiesTests : XCTestCase -@end - -/// Dispatches the given block synchronously onto a different thread. -/// This is useful for testing non-main-thread behavior because `dispatch_sync` -/// will often use the current thread. -static inline void ASDispatchSyncOnOtherThread(dispatch_block_t block) { - dispatch_group_t group = dispatch_group_create(); - dispatch_queue_t q = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0); - dispatch_group_enter(group); - dispatch_async(q, ^{ - ASDisplayNodeCAssertNotMainThread(); - block(); - dispatch_group_leave(group); - }); - dispatch_group_wait(group, DISPATCH_TIME_FOREVER); -} - -@implementation ASBridgedPropertiesTests - -- (void)testTheresASharedInstance -{ - XCTAssertNotNil([ASPendingStateController sharedInstance]); -} - -/// FIXME: This test is unreliable for an as-yet unknown reason -/// but that being intermittent, and this test being so strict, it's -/// reasonable to assume for now the failures don't reflect a framework bug. -/// See https://github.com/facebook/AsyncDisplayKit/pull/1048 -- (void)DISABLED_testThatDirtyNodesAreNotRetained -{ - ASPendingStateController *ctrl = [ASPendingStateController sharedInstance]; - __block BOOL didDealloc = NO; - @autoreleasepool { - __attribute__((objc_precise_lifetime)) ASBridgedPropertiesTestNode *node = [ASBridgedPropertiesTestNode new]; - node.onDealloc = ^{ - didDealloc = YES; - }; - [node view]; - XCTAssertEqual(node.alpha, 1); - ASDispatchSyncOnOtherThread(^{ - node.alpha = 0; - }); - XCTAssertEqual(node.alpha, 1); - XCTAssert(ctrl.test_isFlushScheduled); - } - XCTAssertTrue(didDealloc); -} - -- (void)testThatSettingABridgedViewPropertyInBackgroundGetsFlushedOnNextRunLoop -{ - ASDisplayNode *node = [ASDisplayNode new]; - [node view]; - XCTAssertEqual(node.alpha, 1); - ASDispatchSyncOnOtherThread(^{ - node.alpha = 0; - }); - XCTAssertEqual(node.alpha, 1); - [self waitForMainDispatchQueueToFlush]; - XCTAssertEqual(node.alpha, 0); -} - -- (void)testThatSettingABridgedLayerPropertyInBackgroundGetsFlushedOnNextRunLoop -{ - ASDisplayNode *node = [ASDisplayNode new]; - [node view]; - XCTAssertEqual(node.shadowOpacity, 0); - ASDispatchSyncOnOtherThread(^{ - node.shadowOpacity = 1; - }); - XCTAssertEqual(node.shadowOpacity, 0); - [self waitForMainDispatchQueueToFlush]; - XCTAssertEqual(node.shadowOpacity, 1); -} - -- (void)testThatReadingABridgedViewPropertyInBackgroundThrowsAnException -{ - ASDisplayNode *node = [ASDisplayNode new]; - [node view]; - ASDispatchSyncOnOtherThread(^{ - XCTAssertThrows(node.alpha); - }); -} - -- (void)testThatReadingABridgedLayerPropertyInBackgroundThrowsAnException -{ - ASDisplayNode *node = [ASDisplayNode new]; - [node view]; - ASDispatchSyncOnOtherThread(^{ - XCTAssertThrows(node.contentsScale); - }); -} - -- (void)testThatManuallyFlushingTheSyncControllerImmediatelyAppliesChanges -{ - ASPendingStateController *ctrl = [ASPendingStateController sharedInstance]; - ASDisplayNode *node = [ASDisplayNode new]; - [node view]; - XCTAssertEqual(node.alpha, 1); - ASDispatchSyncOnOtherThread(^{ - node.alpha = 0; - }); - XCTAssertEqual(node.alpha, 1); - [ctrl flush]; - XCTAssertEqual(node.alpha, 0); - XCTAssertFalse(ctrl.test_isFlushScheduled); -} - -- (void)testThatFlushingTheControllerInBackgroundThrows -{ - ASPendingStateController *ctrl = [ASPendingStateController sharedInstance]; - ASDisplayNode *node = [ASDisplayNode new]; - [node view]; - XCTAssertEqual(node.alpha, 1); - ASDispatchSyncOnOtherThread(^{ - node.alpha = 0; - XCTAssertThrows([ctrl flush]); - }); -} - -- (void)testThatSettingABridgedPropertyOnMainThreadPassesDirectlyToView -{ - ASPendingStateController *ctrl = [ASPendingStateController sharedInstance]; - ASDisplayNode *node = [ASDisplayNode new]; - XCTAssertFalse(ASDisplayNodeGetPendingState(node).hasChanges); - [node view]; - XCTAssertEqual(node.alpha, 1); - node.alpha = 0; - XCTAssertEqual(node.view.alpha, 0); - XCTAssertEqual(node.alpha, 0); - XCTAssertFalse(ASDisplayNodeGetPendingState(node).hasChanges); - XCTAssertFalse(ctrl.test_isFlushScheduled); -} - -- (void)testThatCallingSetNeedsLayoutFromBackgroundCausesItToHappenLater -{ - ASDisplayNode *node = [[ASDisplayNode alloc] initWithViewClass:ASBridgedPropertiesTestView.class]; - ASBridgedPropertiesTestView *view = (ASBridgedPropertiesTestView *)node.view; - XCTAssertFalse(view.receivedSetNeedsLayout); - ASDispatchSyncOnOtherThread(^{ - XCTAssertNoThrow([node setNeedsLayout]); - }); - XCTAssertFalse(view.receivedSetNeedsLayout); - [self waitForMainDispatchQueueToFlush]; - XCTAssertTrue(view.receivedSetNeedsLayout); -} - -- (void)testThatCallingSetNeedsLayoutOnACellNodeFromBackgroundIsSafe -{ - ASCellNode *node = [ASCellNode new]; - [node view]; - ASDispatchSyncOnOtherThread(^{ - XCTAssertNoThrow([node setNeedsLayout]); - }); -} - -- (void)testThatCallingSetNeedsDisplayFromBackgroundCausesItToHappenLater -{ - ASDisplayNode *node = [ASDisplayNode new]; - [node.layer displayIfNeeded]; - XCTAssertFalse(node.layer.needsDisplay); - ASDispatchSyncOnOtherThread(^{ - XCTAssertNoThrow([node setNeedsDisplay]); - }); - XCTAssertFalse(node.layer.needsDisplay); - [self waitForMainDispatchQueueToFlush]; - XCTAssertTrue(node.layer.needsDisplay); -} - -/// [XCTExpectation expectationWithPredicate:] should handle this -/// but under Xcode 7.2.1 its polling interval is 1 second -/// which makes the tests really slow and I'm impatient. -- (void)waitForMainDispatchQueueToFlush -{ - __block BOOL done = NO; - dispatch_async(dispatch_get_main_queue(), ^{ - done = YES; - }); - while (!done) { - [NSRunLoop.mainRunLoop runMode:NSDefaultRunLoopMode beforeDate:[NSDate distantFuture]]; - } -} - -@end diff --git a/submodules/AsyncDisplayKit/Tests/ASButtonNodeTests.mm b/submodules/AsyncDisplayKit/Tests/ASButtonNodeTests.mm deleted file mode 100644 index 244edd1f0e..0000000000 --- a/submodules/AsyncDisplayKit/Tests/ASButtonNodeTests.mm +++ /dev/null @@ -1,54 +0,0 @@ -// -// ASButtonNodeTests.mm -// Texture -// -// Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -#import -#import - -@interface ASButtonNodeTests : XCTestCase -@end - -@implementation ASButtonNodeTests - -- (void)testAccessibility -{ - // Setup a button with some title. - ASButtonNode *buttonNode = nil; - buttonNode = [[ASButtonNode alloc] init]; - NSString *title = @"foo"; - [buttonNode setTitle:title withFont:nil withColor:nil forState:UIControlStateNormal]; - - // Verify accessibility properties. - XCTAssertTrue(buttonNode.accessibilityTraits == UIAccessibilityTraitButton, - @"Should have button accessibility trait, instead has %llu", - buttonNode.accessibilityTraits); - XCTAssertTrue(buttonNode.defaultAccessibilityTraits == UIAccessibilityTraitButton, - @"Default accessibility traits should return button accessibility trait, instead " - @"returns %llu", - buttonNode.defaultAccessibilityTraits); - XCTAssertTrue([buttonNode.accessibilityLabel isEqualToString:title], - @"Accessibility label is incorrectly set to \n%@\n when it should be \n%@\n", - buttonNode.accessibilityLabel, title); - XCTAssertTrue([buttonNode.defaultAccessibilityLabel isEqualToString:title], - @"Default accessibility label incorrectly returns \n%@\n when it should be \n%@\n", - buttonNode.defaultAccessibilityLabel, title); - - // Disable the button and verify that accessibility traits has been updated correctly. - buttonNode.enabled = NO; - UIAccessibilityTraits disabledButtonTrait = UIAccessibilityTraitButton | UIAccessibilityTraitNotEnabled; - XCTAssertTrue(buttonNode.accessibilityTraits == disabledButtonTrait, - @"Should have disabled button accessibility trait, instead has %llu", - buttonNode.accessibilityTraits); - XCTAssertTrue(buttonNode.defaultAccessibilityTraits == disabledButtonTrait, - @"Default accessibility traits should return disabled button accessibility trait, " - @"instead returns %llu", - buttonNode.defaultAccessibilityTraits); -} - -@end diff --git a/submodules/AsyncDisplayKit/Tests/ASCALayerTests.mm b/submodules/AsyncDisplayKit/Tests/ASCALayerTests.mm deleted file mode 100644 index 2b30da28fc..0000000000 --- a/submodules/AsyncDisplayKit/Tests/ASCALayerTests.mm +++ /dev/null @@ -1,107 +0,0 @@ -// -// ASCALayerTests.mm -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -#import - -/** - * Tests that confirm what we know about Core Animation behavior. - * - * These tests are not run during the normal test action. You can run them yourself - * to investigate and confirm CA behavior. - */ -@interface ASCALayerTests : XCTestCase - -@end - -#define DeclareLayerAndSublayer() \ - CALayer *realSublayer = [CALayer layer]; \ - id layer = [OCMockObject partialMockForObject:[CALayer layer]]; \ - id sublayer = [OCMockObject partialMockForObject:realSublayer]; \ - [layer addSublayer:realSublayer]; - -@implementation ASCALayerTests - -- (void)testThatLayerBeginsWithCleanLayout -{ - XCTAssertFalse([CALayer layer].needsLayout); -} - -- (void)testThatAddingSublayersDirtysLayout -{ - CALayer *layer = [CALayer layer]; - [layer addSublayer:[CALayer layer]]; - XCTAssertTrue([layer needsLayout]); -} - -- (void)testThatRemovingSublayersDirtysLayout -{ - DeclareLayerAndSublayer(); - [layer layoutIfNeeded]; - XCTAssertFalse([layer needsLayout]); - [sublayer removeFromSuperlayer]; - XCTAssertTrue([layer needsLayout]); -} - -- (void)testDirtySublayerLayoutDoesntDirtySuperlayer -{ - DeclareLayerAndSublayer(); - [layer layoutIfNeeded]; - - // Dirtying sublayer doesn't dirty superlayer. - [sublayer setNeedsLayout]; - XCTAssertTrue([sublayer needsLayout]); - XCTAssertFalse([layer needsLayout]); - [[[sublayer expect] andForwardToRealObject] layoutSublayers]; - // NOTE: We specifically don't expect layer to get -layoutSublayers - [sublayer layoutIfNeeded]; - [sublayer verify]; - [layer verify]; -} - -- (void)testDirtySuperlayerLayoutDoesntDirtySublayerLayout -{ - DeclareLayerAndSublayer(); - [layer layoutIfNeeded]; - - // Dirtying superlayer doesn't dirty sublayer. - [layer setNeedsLayout]; - XCTAssertTrue([layer needsLayout]); - XCTAssertFalse([sublayer needsLayout]); - [[[layer expect] andForwardToRealObject] layoutSublayers]; - // NOTE: We specifically don't expect sublayer to get -layoutSublayers - [layer layoutIfNeeded]; - [sublayer verify]; - [layer verify]; -} - -- (void)testDirtyHierarchyIsLaidOutTopDown -{ - DeclareLayerAndSublayer(); - [sublayer setNeedsLayout]; - - XCTAssertTrue([layer needsLayout]); - XCTAssertTrue([sublayer needsLayout]); - - __block BOOL superlayerLaidOut = NO; - [[[[layer expect] andDo:^(NSInvocation *i) { - superlayerLaidOut = YES; - }] andForwardToRealObject] layoutSublayers]; - - [[[[sublayer expect] andDo:^(NSInvocation *i) { - XCTAssertTrue(superlayerLaidOut); - }] andForwardToRealObject] layoutSublayers]; - - [layer layoutIfNeeded]; - [sublayer verify]; - [layer verify]; -} - -@end diff --git a/submodules/AsyncDisplayKit/Tests/ASCenterLayoutSpecSnapshotTests.mm b/submodules/AsyncDisplayKit/Tests/ASCenterLayoutSpecSnapshotTests.mm deleted file mode 100644 index d0352bb446..0000000000 --- a/submodules/AsyncDisplayKit/Tests/ASCenterLayoutSpecSnapshotTests.mm +++ /dev/null @@ -1,112 +0,0 @@ -// -// ASCenterLayoutSpecSnapshotTests.mm -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import "ASLayoutSpecSnapshotTestsHelper.h" - -#import -#import -#import - -static const ASSizeRange kSize = {{100, 120}, {320, 160}}; - -@interface ASCenterLayoutSpecSnapshotTests : ASLayoutSpecSnapshotTestCase -@end - -@implementation ASCenterLayoutSpecSnapshotTests - -- (void)testWithOptions -{ - [self testWithCenteringOptions:ASCenterLayoutSpecCenteringNone sizingOptions:{}]; - [self testWithCenteringOptions:ASCenterLayoutSpecCenteringXY sizingOptions:{}]; - [self testWithCenteringOptions:ASCenterLayoutSpecCenteringX sizingOptions:{}]; - [self testWithCenteringOptions:ASCenterLayoutSpecCenteringY sizingOptions:{}]; -} - -- (void)testWithSizingOptions -{ - [self testWithCenteringOptions:ASCenterLayoutSpecCenteringNone - sizingOptions:ASCenterLayoutSpecSizingOptionDefault]; - [self testWithCenteringOptions:ASCenterLayoutSpecCenteringNone - sizingOptions:ASCenterLayoutSpecSizingOptionMinimumX]; - [self testWithCenteringOptions:ASCenterLayoutSpecCenteringNone - sizingOptions:ASCenterLayoutSpecSizingOptionMinimumY]; - [self testWithCenteringOptions:ASCenterLayoutSpecCenteringNone - sizingOptions:ASCenterLayoutSpecSizingOptionMinimumXY]; -} - -- (void)testWithCenteringOptions:(ASCenterLayoutSpecCenteringOptions)options - sizingOptions:(ASCenterLayoutSpecSizingOptions)sizingOptions -{ - ASDisplayNode *backgroundNode = ASDisplayNodeWithBackgroundColor([UIColor redColor]); - ASDisplayNode *foregroundNode = ASDisplayNodeWithBackgroundColor([UIColor greenColor], CGSizeMake(70, 100)); - - ASLayoutSpec *layoutSpec = - [ASBackgroundLayoutSpec - backgroundLayoutSpecWithChild: - [ASCenterLayoutSpec - centerLayoutSpecWithCenteringOptions:options - sizingOptions:sizingOptions - child:foregroundNode] - background:backgroundNode]; - - [self testLayoutSpec:layoutSpec - sizeRange:kSize - subnodes:@[backgroundNode, foregroundNode] - identifier:suffixForCenteringOptions(options, sizingOptions)]; -} - -static NSString *suffixForCenteringOptions(ASCenterLayoutSpecCenteringOptions centeringOptions, - ASCenterLayoutSpecSizingOptions sizingOptinos) -{ - NSMutableString *suffix = [NSMutableString string]; - - if ((centeringOptions & ASCenterLayoutSpecCenteringX) != 0) { - [suffix appendString:@"CenteringX"]; - } - - if ((centeringOptions & ASCenterLayoutSpecCenteringY) != 0) { - [suffix appendString:@"CenteringY"]; - } - - if ((sizingOptinos & ASCenterLayoutSpecSizingOptionMinimumX) != 0) { - [suffix appendString:@"SizingMinimumX"]; - } - - if ((sizingOptinos & ASCenterLayoutSpecSizingOptionMinimumY) != 0) { - [suffix appendString:@"SizingMinimumY"]; - } - - return suffix; -} - -- (void)testMinimumSizeRangeIsGivenToChildWhenNotCentering -{ - ASDisplayNode *backgroundNode = ASDisplayNodeWithBackgroundColor([UIColor redColor]); - ASDisplayNode *foregroundNode = ASDisplayNodeWithBackgroundColor([UIColor redColor], CGSizeMake(10, 10)); - foregroundNode.style.flexGrow = 1; - - ASCenterLayoutSpec *layoutSpec = - [ASCenterLayoutSpec - centerLayoutSpecWithCenteringOptions:ASCenterLayoutSpecCenteringNone - sizingOptions:{} - child: - [ASBackgroundLayoutSpec - backgroundLayoutSpecWithChild: - [ASStackLayoutSpec - stackLayoutSpecWithDirection:ASStackLayoutDirectionVertical - spacing:0 - justifyContent:ASStackLayoutJustifyContentStart - alignItems:ASStackLayoutAlignItemsStart - children:@[foregroundNode]] - background:backgroundNode]]; - - [self testLayoutSpec:layoutSpec sizeRange:kSize subnodes:@[backgroundNode, foregroundNode] identifier:nil]; -} - -@end diff --git a/submodules/AsyncDisplayKit/Tests/ASCollectionModernDataSourceTests.mm b/submodules/AsyncDisplayKit/Tests/ASCollectionModernDataSourceTests.mm deleted file mode 100644 index 5d0a77899a..0000000000 --- a/submodules/AsyncDisplayKit/Tests/ASCollectionModernDataSourceTests.mm +++ /dev/null @@ -1,363 +0,0 @@ -// -// ASCollectionModernDataSourceTests.mm -// Texture -// -// Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import -#import -#import -#import -#import "OCMockObject+ASAdditions.h" -#import "ASTestCase.h" - -@interface ASCollectionModernDataSourceTests : ASTestCase -@end - -@interface ASTestCellNode : ASCellNode -@end - -@interface ASTestSection : NSObject -@property (nonatomic, readonly) NSMutableArray *nodeModels; -@end - -@implementation ASCollectionModernDataSourceTests { -@private - id mockDataSource; - UIWindow *window; - UIViewController *viewController; - ASCollectionNode *collectionNode; - NSMutableArray *sections; -} - -- (void)setUp { - [super setUp]; - // Default is 2 sections: 2 items in first, 1 item in second. - sections = [NSMutableArray array]; - [sections addObject:[ASTestSection new]]; - [sections[0].nodeModels addObject:[NSObject new]]; - [sections[0].nodeModels addObject:[NSObject new]]; - [sections addObject:[ASTestSection new]]; - [sections[1].nodeModels addObject:[NSObject new]]; - window = [[UIWindow alloc] initWithFrame:CGRectMake(0, 0, 100, 100)]; - viewController = [[UIViewController alloc] init]; - - window.rootViewController = viewController; - [window makeKeyAndVisible]; - collectionNode = [[ASCollectionNode alloc] initWithCollectionViewLayout:[UICollectionViewFlowLayout new]]; - collectionNode.frame = viewController.view.bounds; - collectionNode.view.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight; - [viewController.view addSubnode:collectionNode]; - - mockDataSource = OCMStrictProtocolMock(@protocol(ASCollectionDataSource)); - [mockDataSource addImplementedOptionalProtocolMethods: - @selector(numberOfSectionsInCollectionNode:), - @selector(collectionNode:numberOfItemsInSection:), - @selector(collectionNode:nodeBlockForItemAtIndexPath:), - @selector(collectionNode:nodeModelForItemAtIndexPath:), - @selector(collectionNode:contextForSection:), - nil]; - [mockDataSource setExpectationOrderMatters:YES]; - - // NOTE: Adding optionally-implemented methods after this point won't work due to ASCollectionNode selector caching. - collectionNode.dataSource = mockDataSource; -} - -- (void)tearDown -{ - [collectionNode waitUntilAllUpdatesAreProcessed]; - [super tearDown]; -} - -#pragma mark - Test Methods - -- (void)testInitialDataLoading -{ - [self loadInitialData]; -} - -- (void)testReloadingAnItem -{ - [self loadInitialData]; - - // Reload at (0, 0) - NSIndexPath *reloadedPath = [NSIndexPath indexPathForItem:0 inSection:0]; - - [self performUpdateReloadingSections:nil - reloadingItems:@{ reloadedPath: [NSObject new] } - reloadMappings:@{ reloadedPath: reloadedPath } - insertingItems:nil - deletingItems:nil - skippedReloadIndexPaths:nil]; -} - -- (void)testInsertingAnItem -{ - [self loadInitialData]; - - // Insert at (1, 0) - NSIndexPath *insertedPath = [NSIndexPath indexPathForItem:0 inSection:1]; - - [self performUpdateReloadingSections:nil - reloadingItems:nil - reloadMappings:nil - insertingItems:@{ insertedPath: [NSObject new] } - deletingItems:nil - skippedReloadIndexPaths:nil]; -} - -- (void)testReloadingAnItemWithACompatibleNodeModel -{ - [self loadInitialData]; - - // Reload and delete together, for good measure. - NSIndexPath *reloadedPath = [NSIndexPath indexPathForItem:1 inSection:0]; - NSIndexPath *deletedPath = [NSIndexPath indexPathForItem:0 inSection:0]; - - id nodeModel = [NSObject new]; - - // Cell node should get -canUpdateToNodeModel: - id mockCellNode = [collectionNode nodeForItemAtIndexPath:reloadedPath]; - OCMExpect([mockCellNode canUpdateToNodeModel:nodeModel]) - .andReturn(YES); - - [self performUpdateReloadingSections:nil - reloadingItems:@{ reloadedPath: nodeModel } - reloadMappings:@{ reloadedPath: [NSIndexPath indexPathForItem:0 inSection:0] } - insertingItems:nil - deletingItems:@[ deletedPath ] - skippedReloadIndexPaths:@[ reloadedPath ]]; -} - -- (void)testReloadingASection -{ - [self loadInitialData]; - - [self performUpdateReloadingSections:@{ @0: [ASTestSection new] } - reloadingItems:nil - reloadMappings:nil - insertingItems:nil - deletingItems:nil - skippedReloadIndexPaths:nil]; -} - -#pragma mark - Helpers - -- (void)loadInitialData -{ - // Count methods are called twice in a row for first data load. - // Since -reloadData is routed through our batch update system, - // the batch update latches the "old data source counts" if needed at -beginUpdates time - // and then verifies them against the "new data source counts" after the updates. - // This isn't ideal, but the cost is very small and the system works well. - for (int i = 0; i < 2; i++) { - // It reads all the counts - [self expectDataSourceCountMethods]; - } - - // It reads each section object. - for (NSInteger section = 0; section < sections.count; section++) { - [self expectContextMethodForSection:section]; - } - - // It reads the contents for each item. - for (NSInteger section = 0; section < sections.count; section++) { - NSArray *nodeModels = sections[section].nodeModels; - - // For each item: - for (NSInteger i = 0; i < nodeModels.count; i++) { - NSIndexPath *indexPath = [NSIndexPath indexPathForItem:i inSection:section]; - [self expectNodeModelMethodForItemAtIndexPath:indexPath nodeModel:nodeModels[i]]; - [self expectNodeBlockMethodForItemAtIndexPath:indexPath]; - } - } - - [window layoutIfNeeded]; - - // Assert item counts & content: - [self assertCollectionNodeContent]; -} - -/** - * Adds expectations for the sequence: - * - * numberOfSectionsInCollectionNode: - * for section in countsArray - * numberOfItemsInSection: - */ -- (void)expectDataSourceCountMethods -{ - // -numberOfSectionsInCollectionNode - OCMExpect([mockDataSource numberOfSectionsInCollectionNode:collectionNode]) - .andReturn(sections.count); - - // For each section: - // Note: Skip fast enumeration for readability. - for (NSInteger section = 0; section < sections.count; section++) { - OCMExpect([mockDataSource collectionNode:collectionNode numberOfItemsInSection:section]) - .andReturn(sections[section].nodeModels.count); - } -} - -- (void)expectNodeModelMethodForItemAtIndexPath:(NSIndexPath *)indexPath nodeModel:(id)nodeModel -{ - OCMExpect([mockDataSource collectionNode:collectionNode nodeModelForItemAtIndexPath:indexPath]) - .andReturn(nodeModel); -} - -- (void)expectContextMethodForSection:(NSInteger)section -{ - OCMExpect([mockDataSource collectionNode:collectionNode contextForSection:section]) - .andReturn(sections[section]); -} - -- (void)expectNodeBlockMethodForItemAtIndexPath:(NSIndexPath *)indexPath -{ - OCMExpect([mockDataSource collectionNode:collectionNode nodeBlockForItemAtIndexPath:indexPath]) - .andReturn((ASCellNodeBlock)^{ - ASCellNode *node = [ASTestCellNode new]; - // Generating multiple partial mocks of the same class is not thread-safe. - id mockNode; - @synchronized (NSNull.null) { - mockNode = OCMPartialMock(node); - } - [mockNode setExpectationOrderMatters:YES]; - return mockNode; - }); -} - -/// Asserts that counts match and all view-models are up-to-date between us and collectionNode. -- (void)assertCollectionNodeContent -{ - // Assert section count - XCTAssertEqual(collectionNode.numberOfSections, sections.count); - - for (NSInteger section = 0; section < sections.count; section++) { - ASTestSection *sectionObject = sections[section]; - NSArray *nodeModels = sectionObject.nodeModels; - - // Assert section object - XCTAssertEqualObjects([collectionNode contextForSection:section], sectionObject); - - // Assert item count - XCTAssertEqual([collectionNode numberOfItemsInSection:section], nodeModels.count); - for (NSInteger item = 0; item < nodeModels.count; item++) { - // Assert node model - // Could use pointer equality but the error message is less readable. - NSIndexPath *indexPath = [NSIndexPath indexPathForItem:item inSection:section]; - id nodeModel = nodeModels[indexPath.item]; - XCTAssertEqualObjects(nodeModel, [collectionNode nodeModelForItemAtIndexPath:indexPath]); - ASCellNode *node = [collectionNode nodeForItemAtIndexPath:indexPath]; - XCTAssertEqualObjects(node.nodeModel, nodeModel); - } - } -} - -/** - * Updates the collection node, with expectations and assertions about the call-order and the correctness of the - * new data. You should update the data source _before_ calling this method. - * - * skippedReloadIndexPaths are the old index paths for nodes that should use -canUpdateToNodeModel: instead of being refetched. - */ -- (void)performUpdateReloadingSections:(NSDictionary *)reloadedSections - reloadingItems:(NSDictionary *)reloadedItems - reloadMappings:(NSDictionary *)reloadMappings - insertingItems:(NSDictionary *)insertedItems - deletingItems:(NSArray *)deletedItems - skippedReloadIndexPaths:(NSArray *)skippedReloadIndexPaths -{ - [collectionNode performBatchUpdates:^{ - // First update our data source. - [reloadedItems enumerateKeysAndObjectsUsingBlock:^(NSIndexPath * _Nonnull key, id _Nonnull obj, BOOL * _Nonnull stop) { - sections[key.section].nodeModels[key.item] = obj; - }]; - [reloadedSections enumerateKeysAndObjectsUsingBlock:^(NSNumber * _Nonnull key, id _Nonnull obj, BOOL * _Nonnull stop) { - sections[key.integerValue] = obj; - }]; - - // Deletion paths, sorted descending - for (NSIndexPath *indexPath in [deletedItems sortedArrayUsingSelector:@selector(compare:)].reverseObjectEnumerator) { - [sections[indexPath.section].nodeModels removeObjectAtIndex:indexPath.item]; - } - - // Insertion paths, sorted ascending. - NSArray *insertionsSortedAcending = [insertedItems.allKeys sortedArrayUsingSelector:@selector(compare:)]; - for (NSIndexPath *indexPath in insertionsSortedAcending) { - [sections[indexPath.section].nodeModels insertObject:insertedItems[indexPath] atIndex:indexPath.item]; - } - - // Then update the collection node. - NSMutableIndexSet *reloadedSectionIndexes = [NSMutableIndexSet indexSet]; - for (NSNumber *i in reloadedSections) { - [reloadedSectionIndexes addIndex:i.integerValue]; - } - [collectionNode reloadSections:reloadedSectionIndexes]; - [collectionNode reloadItemsAtIndexPaths:reloadedItems.allKeys]; - [collectionNode deleteItemsAtIndexPaths:deletedItems]; - [collectionNode insertItemsAtIndexPaths:insertedItems.allKeys]; - - // Before the commit, lay out our expectations. - - // Expect it to load the new counts. - [self expectDataSourceCountMethods]; - - // Combine reloads + inserts and expect them to load content for all of them, in ascending order. - NSMutableDictionary *insertsPlusReloads = [[NSMutableDictionary alloc] initWithDictionary:insertedItems]; - - // Go through reloaded sections and add all their items into `insertsPlusReloads` - [reloadedSectionIndexes enumerateIndexesUsingBlock:^(NSUInteger section, BOOL * _Nonnull stop) { - [self expectContextMethodForSection:section]; - NSArray *nodeModels = sections[section].nodeModels; - for (NSInteger i = 0; i < nodeModels.count; i++) { - NSIndexPath *indexPath = [NSIndexPath indexPathForItem:i inSection:section]; - insertsPlusReloads[indexPath] = nodeModels[i]; - } - }]; - - [reloadedItems enumerateKeysAndObjectsUsingBlock:^(NSIndexPath * _Nonnull key, id _Nonnull obj, BOOL * _Nonnull stop) { - insertsPlusReloads[reloadMappings[key]] = obj; - }]; - - for (NSIndexPath *indexPath in [insertsPlusReloads.allKeys sortedArrayUsingSelector:@selector(compare:)]) { - [self expectNodeModelMethodForItemAtIndexPath:indexPath nodeModel:insertsPlusReloads[indexPath]]; - NSIndexPath *oldIndexPath = [reloadMappings allKeysForObject:indexPath].firstObject; - BOOL isSkippedReload = oldIndexPath && [skippedReloadIndexPaths containsObject:oldIndexPath]; - if (!isSkippedReload) { - [self expectNodeBlockMethodForItemAtIndexPath:indexPath]; - } - } - } completion:nil]; - - // Assert that the counts and node models are all correct now. - [self assertCollectionNodeContent]; -} - -@end - -#pragma mark - Other Objects - -@implementation ASTestCellNode - -- (BOOL)canUpdateToNodeModel:(id)nodeModel -{ - // Our tests default to NO for migrating node models. We use OCMExpect to return YES when we specifically want to. - return NO; -} - -@end - -@implementation ASTestSection -@synthesize collectionView; -@synthesize sectionName; - -- (instancetype)init -{ - if (self = [super init]) { - _nodeModels = [NSMutableArray array]; - } - return self; -} - -@end diff --git a/submodules/AsyncDisplayKit/Tests/ASCollectionViewFlowLayoutInspectorTests.mm b/submodules/AsyncDisplayKit/Tests/ASCollectionViewFlowLayoutInspectorTests.mm deleted file mode 100644 index 555fe21134..0000000000 --- a/submodules/AsyncDisplayKit/Tests/ASCollectionViewFlowLayoutInspectorTests.mm +++ /dev/null @@ -1,428 +0,0 @@ -// -// ASCollectionViewFlowLayoutInspectorTests.mm -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import -#import -#import -#import "ASXCTExtensions.h" - -#import -#import -#import -#import -#import - -@interface ASCollectionView (Private) - -- (instancetype)initWithFrame:(CGRect)frame collectionViewLayout:(UICollectionViewLayout *)layout; - -@end - -/** - * Test Data Source - */ -@interface InspectorTestDataSource : NSObject -@end - -@implementation InspectorTestDataSource - -- (ASCellNode *)collectionView:(ASCollectionView *)collectionView nodeForItemAtIndexPath:(NSIndexPath *)indexPath -{ - return [[ASCellNode alloc] init]; -} - -- (ASCellNodeBlock)collectionView:(ASCollectionView *)collectionView nodeBlockForItemAtIndexPath:(NSIndexPath *)indexPath -{ - return ^{ return [[ASCellNode alloc] init]; }; -} - -- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section -{ - return 0; -} - -- (NSInteger)numberOfSectionsInCollectionView:(UICollectionView *)collectionView -{ - return 2; -} - -@end - -@protocol InspectorTestDataSourceDelegateProtocol - -@end - -@interface InspectorTestDataSourceDelegateWithoutNodeConstrainedSize : NSObject -@end - -@implementation InspectorTestDataSourceDelegateWithoutNodeConstrainedSize - -- (ASCellNodeBlock)collectionView:(ASCollectionView *)collectionView nodeBlockForItemAtIndexPath:(NSIndexPath *)indexPath -{ - return ^{ return [[ASCellNode alloc] init]; }; -} - -- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section -{ - return 0; -} - -@end - -@interface ASCollectionViewFlowLayoutInspectorTests : XCTestCase - -@end - -/** - * Test Delegate for Header Reference Size Implementation - */ -@interface HeaderReferenceSizeTestDelegate : NSObject - -@end - -@implementation HeaderReferenceSizeTestDelegate - -- (CGSize)collectionView:(ASCollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout referenceSizeForHeaderInSection:(NSInteger)section -{ - return CGSizeMake(125.0, 125.0); -} - -@end - -/** - * Test Delegate for Footer Reference Size Implementation - */ -@interface FooterReferenceSizeTestDelegate : NSObject - -@end - -@implementation FooterReferenceSizeTestDelegate - -- (CGSize)collectionView:(ASCollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout referenceSizeForFooterInSection:(NSInteger)section -{ - return CGSizeMake(125.0, 125.0); -} - -@end - -@implementation ASCollectionViewFlowLayoutInspectorTests - -- (void)setUp { - [super setUp]; - // Put setup code here. This method is called before the invocation of each test method in the class. -} - -- (void)tearDown { - // Put teardown code here. This method is called after the invocation of each test method in the class. - [super tearDown]; -} - -#pragma mark - #collectionView:constrainedSizeForSupplementaryNodeOfKind:atIndexPath: - -// Vertical - -// Delegate implementation - -- (void)testThatItReturnsAVerticalConstrainedSizeFromTheHeaderDelegateImplementation -{ - InspectorTestDataSource *dataSource = [[InspectorTestDataSource alloc] init]; - HeaderReferenceSizeTestDelegate *delegate = [[HeaderReferenceSizeTestDelegate alloc] init]; - - UICollectionViewFlowLayout *layout = [[UICollectionViewFlowLayout alloc] init]; - layout.scrollDirection = UICollectionViewScrollDirectionVertical; - - CGRect rect = CGRectMake(0, 0, 100.0, 100.0); - ASCollectionView *collectionView = [[ASCollectionView alloc] initWithFrame:rect collectionViewLayout:layout]; - collectionView.asyncDataSource = dataSource; - collectionView.asyncDelegate = delegate; - - ASCollectionViewFlowLayoutInspector *inspector = ASDynamicCast(collectionView.layoutInspector, ASCollectionViewFlowLayoutInspector); - ASSizeRange size = [inspector collectionView:collectionView constrainedSizeForSupplementaryNodeOfKind:UICollectionElementKindSectionHeader atIndexPath:[NSIndexPath indexPathForItem:0 inSection:0]]; - ASSizeRange sizeCompare = ASSizeRangeMake(CGSizeMake(collectionView.bounds.size.width, 125.0)); - - ASXCTAssertEqualSizeRanges(size, sizeCompare, @"should have a size constrained by the values returned in the delegate implementation"); - - collectionView.asyncDataSource = nil; - collectionView.asyncDelegate = nil; -} - -- (void)testThatItReturnsAVerticalConstrainedSizeFromTheFooterDelegateImplementation -{ - InspectorTestDataSource *dataSource = [[InspectorTestDataSource alloc] init]; - FooterReferenceSizeTestDelegate *delegate = [[FooterReferenceSizeTestDelegate alloc] init]; - - UICollectionViewFlowLayout *layout = [[UICollectionViewFlowLayout alloc] init]; - layout.scrollDirection = UICollectionViewScrollDirectionVertical; - - CGRect rect = CGRectMake(0, 0, 100.0, 100.0); - ASCollectionView *collectionView = [[ASCollectionView alloc] initWithFrame:rect collectionViewLayout:layout]; - collectionView.asyncDataSource = dataSource; - collectionView.asyncDelegate = delegate; - - ASCollectionViewFlowLayoutInspector *inspector = ASDynamicCast(collectionView.layoutInspector, ASCollectionViewFlowLayoutInspector); - ASSizeRange size = [inspector collectionView:collectionView constrainedSizeForSupplementaryNodeOfKind:UICollectionElementKindSectionFooter atIndexPath:[NSIndexPath indexPathForItem:0 inSection:0]]; - ASSizeRange sizeCompare = ASSizeRangeMake(CGSizeMake(collectionView.bounds.size.width, 125.0)); - ASXCTAssertEqualSizeRanges(size, sizeCompare, @"should have a size constrained by the values returned in the delegate implementation"); - - collectionView.asyncDataSource = nil; - collectionView.asyncDelegate = nil; -} - -// Size implementation - -- (void)testThatItReturnsAVerticalConstrainedSizeFromTheHeaderProperty -{ - InspectorTestDataSource *dataSource = [[InspectorTestDataSource alloc] init]; - - UICollectionViewFlowLayout *layout = [[UICollectionViewFlowLayout alloc] init]; - layout.scrollDirection = UICollectionViewScrollDirectionVertical; - layout.headerReferenceSize = CGSizeMake(125.0, 125.0); - - CGRect rect = CGRectMake(0, 0, 100.0, 100.0); - ASCollectionView *collectionView = [[ASCollectionView alloc] initWithFrame:rect collectionViewLayout:layout]; - collectionView.asyncDataSource = dataSource; - - ASCollectionViewFlowLayoutInspector *inspector = ASDynamicCast(collectionView.layoutInspector, ASCollectionViewFlowLayoutInspector); - ASSizeRange size = [inspector collectionView:collectionView constrainedSizeForSupplementaryNodeOfKind:UICollectionElementKindSectionHeader atIndexPath:[NSIndexPath indexPathForItem:0 inSection:0]]; - ASSizeRange sizeCompare = ASSizeRangeMake(CGSizeMake(collectionView.bounds.size.width, 125.0)); - ASXCTAssertEqualSizeRanges(size, sizeCompare, @"should have a size constrained by the size set on the layout"); - - collectionView.asyncDataSource = nil; - collectionView.asyncDelegate = nil; -} - -- (void)testThatItReturnsAVerticalConstrainedSizeFromTheFooterProperty -{ - InspectorTestDataSource *dataSource = [[InspectorTestDataSource alloc] init]; - - UICollectionViewFlowLayout *layout = [[UICollectionViewFlowLayout alloc] init]; - layout.scrollDirection = UICollectionViewScrollDirectionVertical; - layout.footerReferenceSize = CGSizeMake(125.0, 125.0); - - CGRect rect = CGRectMake(0, 0, 100.0, 100.0); - ASCollectionView *collectionView = [[ASCollectionView alloc] initWithFrame:rect collectionViewLayout:layout]; - collectionView.asyncDataSource = dataSource; - - ASCollectionViewFlowLayoutInspector *inspector = ASDynamicCast(collectionView.layoutInspector, ASCollectionViewFlowLayoutInspector); - ASSizeRange size = [inspector collectionView:collectionView constrainedSizeForSupplementaryNodeOfKind:UICollectionElementKindSectionFooter atIndexPath:[NSIndexPath indexPathForItem:0 inSection:0]]; - ASSizeRange sizeCompare = ASSizeRangeMake(CGSizeMake(collectionView.bounds.size.width, 125.0)); - ASXCTAssertEqualSizeRanges(size, sizeCompare, @"should have a size constrained by the size set on the layout"); - - collectionView.asyncDataSource = nil; - collectionView.asyncDelegate = nil; -} - -// Horizontal - -- (void)testThatItReturnsAHorizontalConstrainedSizeFromTheHeaderDelegateImplementation -{ - InspectorTestDataSource *dataSource = [[InspectorTestDataSource alloc] init]; - HeaderReferenceSizeTestDelegate *delegate = [[HeaderReferenceSizeTestDelegate alloc] init]; - - UICollectionViewFlowLayout *layout = [[UICollectionViewFlowLayout alloc] init]; - layout.scrollDirection = UICollectionViewScrollDirectionHorizontal; - - CGRect rect = CGRectMake(0, 0, 100.0, 100.0); - ASCollectionView *collectionView = [[ASCollectionView alloc] initWithFrame:rect collectionViewLayout:layout]; - collectionView.asyncDataSource = dataSource; - collectionView.asyncDelegate = delegate; - - ASCollectionViewFlowLayoutInspector *inspector = ASDynamicCast(collectionView.layoutInspector, ASCollectionViewFlowLayoutInspector); - ASSizeRange size = [inspector collectionView:collectionView constrainedSizeForSupplementaryNodeOfKind:UICollectionElementKindSectionHeader atIndexPath:[NSIndexPath indexPathForItem:0 inSection:0]]; - ASSizeRange sizeCompare = ASSizeRangeMake(CGSizeMake(125.0, collectionView.bounds.size.height)); - ASXCTAssertEqualSizeRanges(size, sizeCompare, @"should have a size constrained by the values returned in the delegate implementation"); - - collectionView.asyncDataSource = nil; - collectionView.asyncDelegate = nil; -} - -- (void)testThatItReturnsAHorizontalConstrainedSizeFromTheFooterDelegateImplementation -{ - InspectorTestDataSource *dataSource = [[InspectorTestDataSource alloc] init]; - FooterReferenceSizeTestDelegate *delegate = [[FooterReferenceSizeTestDelegate alloc] init]; - - UICollectionViewFlowLayout *layout = [[UICollectionViewFlowLayout alloc] init]; - layout.scrollDirection = UICollectionViewScrollDirectionHorizontal; - - CGRect rect = CGRectMake(0, 0, 100.0, 100.0); - ASCollectionView *collectionView = [[ASCollectionView alloc] initWithFrame:rect collectionViewLayout:layout]; - collectionView.asyncDataSource = dataSource; - collectionView.asyncDelegate = delegate; - - ASCollectionViewFlowLayoutInspector *inspector = ASDynamicCast(collectionView.layoutInspector, ASCollectionViewFlowLayoutInspector); - ASSizeRange size = [inspector collectionView:collectionView constrainedSizeForSupplementaryNodeOfKind:UICollectionElementKindSectionFooter atIndexPath:[NSIndexPath indexPathForItem:0 inSection:0]]; - ASSizeRange sizeCompare = ASSizeRangeMake(CGSizeMake(125.0, collectionView.bounds.size.height)); - ASXCTAssertEqualSizeRanges(size, sizeCompare, @"should have a size constrained by the values returned in the delegate implementation"); - - collectionView.asyncDataSource = nil; - collectionView.asyncDelegate = nil; -} - -// Size implementation - -- (void)testThatItReturnsAHorizontalConstrainedSizeFromTheHeaderProperty -{ - InspectorTestDataSource *dataSource = [[InspectorTestDataSource alloc] init]; - - UICollectionViewFlowLayout *layout = [[UICollectionViewFlowLayout alloc] init]; - layout.scrollDirection = UICollectionViewScrollDirectionHorizontal; - layout.headerReferenceSize = CGSizeMake(125.0, 125.0); - - CGRect rect = CGRectMake(0, 0, 100.0, 100.0); - ASCollectionView *collectionView = [[ASCollectionView alloc] initWithFrame:rect collectionViewLayout:layout]; - collectionView.asyncDataSource = dataSource; - - ASCollectionViewFlowLayoutInspector *inspector = ASDynamicCast(collectionView.layoutInspector, ASCollectionViewFlowLayoutInspector); - ASSizeRange size = [inspector collectionView:collectionView constrainedSizeForSupplementaryNodeOfKind:UICollectionElementKindSectionHeader atIndexPath:[NSIndexPath indexPathForItem:0 inSection:0]]; - ASSizeRange sizeCompare = ASSizeRangeMake(CGSizeMake(125.0, collectionView.bounds.size.width)); - ASXCTAssertEqualSizeRanges(size, sizeCompare, @"should have a size constrained by the size set on the layout"); - - collectionView.asyncDataSource = nil; - collectionView.asyncDelegate = nil; -} - -- (void)testThatItReturnsAHorizontalConstrainedSizeFromTheFooterProperty -{ - InspectorTestDataSource *dataSource = [[InspectorTestDataSource alloc] init]; - - UICollectionViewFlowLayout *layout = [[UICollectionViewFlowLayout alloc] init]; - layout.scrollDirection = UICollectionViewScrollDirectionHorizontal; - layout.footerReferenceSize = CGSizeMake(125.0, 125.0); - - CGRect rect = CGRectMake(0, 0, 100.0, 100.0); - ASCollectionView *collectionView = [[ASCollectionView alloc] initWithFrame:rect collectionViewLayout:layout]; - collectionView.asyncDataSource = dataSource; - - ASCollectionViewFlowLayoutInspector *inspector = ASDynamicCast(collectionView.layoutInspector, ASCollectionViewFlowLayoutInspector); - ASSizeRange size = [inspector collectionView:collectionView constrainedSizeForSupplementaryNodeOfKind:UICollectionElementKindSectionFooter atIndexPath:[NSIndexPath indexPathForItem:0 inSection:0]]; - ASSizeRange sizeCompare = ASSizeRangeMake(CGSizeMake(125.0, collectionView.bounds.size.height)); - ASXCTAssertEqualSizeRanges(size, sizeCompare, @"should have a size constrained by the size set on the layout"); - - collectionView.asyncDataSource = nil; - collectionView.asyncDelegate = nil; -} - -- (void)testThatItReturnsZeroSizeWhenNoReferenceSizeIsImplemented -{ - InspectorTestDataSource *dataSource = [[InspectorTestDataSource alloc] init]; - HeaderReferenceSizeTestDelegate *delegate = [[HeaderReferenceSizeTestDelegate alloc] init]; - UICollectionViewFlowLayout *layout = [[UICollectionViewFlowLayout alloc] init]; - ASCollectionView *collectionView = [[ASCollectionView alloc] initWithFrame:CGRectZero collectionViewLayout:layout]; - collectionView.asyncDataSource = dataSource; - collectionView.asyncDelegate = delegate; - ASCollectionViewFlowLayoutInspector *inspector = ASDynamicCast(collectionView.layoutInspector, ASCollectionViewFlowLayoutInspector); - ASSizeRange size = [inspector collectionView:collectionView constrainedSizeForSupplementaryNodeOfKind:UICollectionElementKindSectionFooter atIndexPath:[NSIndexPath indexPathForItem:0 inSection:0]]; - ASSizeRange sizeCompare = ASSizeRangeMake(CGSizeZero, CGSizeZero); - XCTAssert(CGSizeEqualToSize(size.min, sizeCompare.min) && CGSizeEqualToSize(size.max, sizeCompare.max), @"should have a zero size"); - - collectionView.asyncDataSource = nil; - collectionView.asyncDelegate = nil; -} - -#pragma mark - #collectionView:supplementaryNodesOfKind:inSection: - -- (void)testThatItReturnsOneWhenAValidSizeIsImplementedOnTheDelegate -{ - InspectorTestDataSource *dataSource = [[InspectorTestDataSource alloc] init]; - HeaderReferenceSizeTestDelegate *delegate = [[HeaderReferenceSizeTestDelegate alloc] init]; - UICollectionViewFlowLayout *layout = [[UICollectionViewFlowLayout alloc] init]; - ASCollectionView *collectionView = [[ASCollectionView alloc] initWithFrame:CGRectZero collectionViewLayout:layout]; - collectionView.asyncDataSource = dataSource; - collectionView.asyncDelegate = delegate; - ASCollectionViewFlowLayoutInspector *inspector = ASDynamicCast(collectionView.layoutInspector, ASCollectionViewFlowLayoutInspector); - NSUInteger count = [inspector collectionView:collectionView supplementaryNodesOfKind:UICollectionElementKindSectionHeader inSection:0]; - XCTAssert(count == 1, @"should have a header supplementary view"); - - collectionView.asyncDataSource = nil; - collectionView.asyncDelegate = nil; -} - -- (void)testThatItReturnsOneWhenAValidSizeIsImplementedOnTheLayout -{ - InspectorTestDataSource *dataSource = [[InspectorTestDataSource alloc] init]; - HeaderReferenceSizeTestDelegate *delegate = [[HeaderReferenceSizeTestDelegate alloc] init]; - UICollectionViewFlowLayout *layout = [[UICollectionViewFlowLayout alloc] init]; - layout.footerReferenceSize = CGSizeMake(125.0, 125.0); - ASCollectionView *collectionView = [[ASCollectionView alloc] initWithFrame:CGRectZero collectionViewLayout:layout]; - collectionView.asyncDataSource = dataSource; - collectionView.asyncDelegate = delegate; - ASCollectionViewFlowLayoutInspector *inspector = ASDynamicCast(collectionView.layoutInspector, ASCollectionViewFlowLayoutInspector); - NSUInteger count = [inspector collectionView:collectionView supplementaryNodesOfKind:UICollectionElementKindSectionFooter inSection:0]; - XCTAssert(count == 1, @"should have a footer supplementary view"); - - collectionView.asyncDataSource = nil; - collectionView.asyncDelegate = nil; -} - -- (void)testThatItReturnsNoneWhenNoReferenceSizeIsImplemented -{ - InspectorTestDataSource *dataSource = [[InspectorTestDataSource alloc] init]; - HeaderReferenceSizeTestDelegate *delegate = [[HeaderReferenceSizeTestDelegate alloc] init]; - UICollectionViewFlowLayout *layout = [[UICollectionViewFlowLayout alloc] init]; - ASCollectionView *collectionView = [[ASCollectionView alloc] initWithFrame:CGRectZero collectionViewLayout:layout]; - collectionView.asyncDataSource = dataSource; - collectionView.asyncDelegate = delegate; - ASCollectionViewFlowLayoutInspector *inspector = ASDynamicCast(collectionView.layoutInspector, ASCollectionViewFlowLayoutInspector); - NSUInteger count = [inspector collectionView:collectionView supplementaryNodesOfKind:UICollectionElementKindSectionFooter inSection:0]; - XCTAssert(count == 0, @"should not have a footer supplementary view"); - - collectionView.asyncDataSource = nil; - collectionView.asyncDelegate = nil; -} - -- (void)testThatItThrowsIfNodeConstrainedSizeIsImplementedOnDataSourceButNotOnDelegateLayoutInspector -{ - UICollectionViewFlowLayout *layout = [[UICollectionViewFlowLayout alloc] init]; - ASCollectionNode *node = [[ASCollectionNode alloc] initWithCollectionViewLayout:layout]; - ASCollectionView *collectionView = node.view; - - id dataSourceAndDelegate = [OCMockObject mockForProtocol:@protocol(InspectorTestDataSourceDelegateProtocol)]; - ASSizeRange constrainedSize = ASSizeRangeMake(CGSizeZero, CGSizeZero); - NSIndexPath *indexPath = [NSIndexPath indexPathForItem:0 inSection:0]; - NSValue *value = [NSValue value:&constrainedSize withObjCType:@encode(ASSizeRange)]; - [[[dataSourceAndDelegate stub] andReturnValue:value] collectionNode:node constrainedSizeForItemAtIndexPath:indexPath]; - node.dataSource = dataSourceAndDelegate; - - id delegate = [InspectorTestDataSourceDelegateWithoutNodeConstrainedSize new]; - node.delegate = delegate; - - ASCollectionViewLayoutInspector *inspector = [[ASCollectionViewLayoutInspector alloc] init]; - - collectionView.layoutInspector = inspector; - XCTAssertThrows([inspector collectionView:collectionView constrainedSizeForNodeAtIndexPath:indexPath]); - - node.delegate = dataSourceAndDelegate; - XCTAssertNoThrow([inspector collectionView:collectionView constrainedSizeForNodeAtIndexPath:indexPath]); -} - -- (void)testThatItThrowsIfNodeConstrainedSizeIsImplementedOnDataSourceButNotOnDelegateFlowLayoutInspector -{ - UICollectionViewFlowLayout *layout = [[UICollectionViewFlowLayout alloc] init]; - - ASCollectionNode *node = [[ASCollectionNode alloc] initWithCollectionViewLayout:layout]; - ASCollectionView *collectionView = node.view; - id dataSourceAndDelegate = [OCMockObject mockForProtocol:@protocol(InspectorTestDataSourceDelegateProtocol)]; - ASSizeRange constrainedSize = ASSizeRangeMake(CGSizeZero, CGSizeZero); - NSIndexPath *indexPath = [NSIndexPath indexPathForItem:0 inSection:0]; - NSValue *value = [NSValue value:&constrainedSize withObjCType:@encode(ASSizeRange)]; - - [[[dataSourceAndDelegate stub] andReturnValue:value] collectionNode:node constrainedSizeForItemAtIndexPath:indexPath]; - node.dataSource = dataSourceAndDelegate; - id delegate = [InspectorTestDataSourceDelegateWithoutNodeConstrainedSize new]; - - node.delegate = delegate; - ASCollectionViewFlowLayoutInspector *inspector = collectionView.layoutInspector; - - XCTAssertThrows([inspector collectionView:collectionView constrainedSizeForNodeAtIndexPath:indexPath]); - - node.delegate = dataSourceAndDelegate; - XCTAssertNoThrow([inspector collectionView:collectionView constrainedSizeForNodeAtIndexPath:indexPath]); -} - -@end diff --git a/submodules/AsyncDisplayKit/Tests/ASCollectionViewTests.mm b/submodules/AsyncDisplayKit/Tests/ASCollectionViewTests.mm deleted file mode 100644 index 3ff5af4409..0000000000 --- a/submodules/AsyncDisplayKit/Tests/ASCollectionViewTests.mm +++ /dev/null @@ -1,1173 +0,0 @@ -// -// ASCollectionViewTests.mm -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import "ASDisplayNodeTestsHelper.h" - -@interface ASTextCellNodeWithSetSelectedCounter : ASTextCellNode - -@property (nonatomic) NSUInteger setSelectedCounter; -@property (nonatomic) NSUInteger applyLayoutAttributesCount; - -@end - -@implementation ASTextCellNodeWithSetSelectedCounter - -- (void)setSelected:(BOOL)selected -{ - [super setSelected:selected]; - _setSelectedCounter++; -} - -- (void)applyLayoutAttributes:(UICollectionViewLayoutAttributes *)layoutAttributes -{ - _applyLayoutAttributesCount++; -} - -@end - -@interface ASTestSectionContext : NSObject - -@property (nonatomic) NSInteger sectionIndex; -@property (nonatomic) NSInteger sectionGeneration; - -@end - -@implementation ASTestSectionContext - -@synthesize sectionName = _sectionName, collectionView = _collectionView; - -@end - -@interface ASCollectionViewTestDelegate : NSObject - -@property (nonatomic) NSInteger sectionGeneration; -@property (nonatomic) void(^willBeginBatchFetch)(ASBatchContext *); - -@end - -@implementation ASCollectionViewTestDelegate { - @package - std::vector _itemCounts; -} - -- (id)initWithNumberOfSections:(NSInteger)numberOfSections numberOfItemsInSection:(NSInteger)numberOfItemsInSection { - if (self = [super init]) { - for (NSInteger i = 0; i < numberOfSections; i++) { - _itemCounts.push_back(numberOfItemsInSection); - } - _sectionGeneration = 1; - } - - return self; -} - -- (ASCellNode *)collectionView:(ASCollectionView *)collectionView nodeForItemAtIndexPath:(NSIndexPath *)indexPath { - ASTextCellNodeWithSetSelectedCounter *textCellNode = [ASTextCellNodeWithSetSelectedCounter new]; - textCellNode.text = indexPath.description; - - return textCellNode; -} - - -- (ASCellNodeBlock)collectionView:(ASCollectionView *)collectionView nodeBlockForItemAtIndexPath:(NSIndexPath *)indexPath { - return ^{ - ASTextCellNodeWithSetSelectedCounter *textCellNode = [ASTextCellNodeWithSetSelectedCounter new]; - textCellNode.text = indexPath.description; - return textCellNode; - }; -} - -- (NSInteger)numberOfSectionsInCollectionView:(UICollectionView *)collectionView { - return _itemCounts.size(); -} - -- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section { - return _itemCounts[section]; -} - -- (id)collectionNode:(ASCollectionNode *)collectionNode contextForSection:(NSInteger)section -{ - ASTestSectionContext *context = [[ASTestSectionContext alloc] init]; - context.sectionGeneration = _sectionGeneration; - context.sectionIndex = section; - return context; -} - -- (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout referenceSizeForHeaderInSection:(NSInteger)section -{ - return CGSizeMake(100, 100); -} - -- (ASCellNode *)collectionView:(ASCollectionView *)collectionView nodeForSupplementaryElementOfKind:(NSString *)kind atIndexPath:(NSIndexPath *)indexPath -{ - return [[ASTextCellNodeWithSetSelectedCounter alloc] init]; -} - -- (void)collectionNode:(ASCollectionNode *)collectionNode willBeginBatchFetchWithContext:(ASBatchContext *)context -{ - if (_willBeginBatchFetch != nil) { - _willBeginBatchFetch(context); - } else { - [context cancelBatchFetching]; - } -} - -@end - -@interface ASCollectionViewTestController: UIViewController - -@property (nonatomic) ASCollectionViewTestDelegate *asyncDelegate; -@property (nonatomic) ASCollectionView *collectionView; -@property (nonatomic) ASCollectionNode *collectionNode; - -@end - -@implementation ASCollectionViewTestController - -- (instancetype)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil { - self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]; - if (self) { - // Populate these immediately so that they're not unexpectedly nil during tests. - self.asyncDelegate = [[ASCollectionViewTestDelegate alloc] initWithNumberOfSections:10 numberOfItemsInSection:10]; - id realLayout = [UICollectionViewFlowLayout new]; - id mockLayout = [OCMockObject partialMockForObject:realLayout]; - self.collectionNode = [[ASCollectionNode alloc] initWithFrame:self.view.bounds collectionViewLayout:mockLayout]; - self.collectionView = self.collectionNode.view; - self.collectionView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight; - self.collectionNode.dataSource = self.asyncDelegate; - self.collectionNode.delegate = self.asyncDelegate; - - [self.collectionNode registerSupplementaryNodeOfKind:UICollectionElementKindSectionHeader]; - [self.view addSubview:self.collectionView]; - } - return self; -} - -@end - -@interface ASCollectionView (InternalTesting) - -- (NSArray *)dataController:(ASDataController *)dataController supplementaryNodeKindsInSections:(NSIndexSet *)sections; - -@end - -@interface ASCollectionViewTests : XCTestCase - -@end - -@implementation ASCollectionViewTests - -- (void)tearDown -{ - // We can't prevent the system from retaining windows, but we can at least clear them out to avoid - // pollution between test cases. - for (UIWindow *window in [UIApplication sharedApplication].windows) { - for (UIView *subview in window.subviews) { - [subview removeFromSuperview]; - } - } - [super tearDown]; -} - -- (void)testDataSourceImplementsNecessaryMethods -{ - UICollectionViewFlowLayout *layout = [[UICollectionViewFlowLayout alloc] init]; - ASCollectionView *collectionView = [[ASCollectionView alloc] initWithFrame:CGRectZero collectionViewLayout:layout]; - - id dataSource = [NSObject new]; - XCTAssertThrows((collectionView.asyncDataSource = dataSource)); - - dataSource = [OCMockObject niceMockForProtocol:@protocol(ASCollectionDataSource)]; - XCTAssertNoThrow((collectionView.asyncDataSource = dataSource)); -} - -- (void)testThatItSetsALayoutInspectorForFlowLayouts -{ - UICollectionViewFlowLayout *layout = [[UICollectionViewFlowLayout alloc] init]; - ASCollectionView *collectionView = [[ASCollectionView alloc] initWithFrame:CGRectZero collectionViewLayout:layout]; - XCTAssert(collectionView.layoutInspector != nil, @"should automatically set a layout delegate for flow layouts"); - XCTAssert([collectionView.layoutInspector isKindOfClass:[ASCollectionViewFlowLayoutInspector class]], @"should have a flow layout inspector by default"); -} - -- (void)testThatADefaultLayoutInspectorIsProvidedForCustomLayouts -{ - UICollectionViewLayout *layout = [[UICollectionViewLayout alloc] init]; - ASCollectionView *collectionView = [[ASCollectionView alloc] initWithFrame:CGRectZero collectionViewLayout:layout]; - XCTAssert(collectionView.layoutInspector != nil, @"should automatically set a layout delegate for flow layouts"); - XCTAssert([collectionView.layoutInspector isKindOfClass:[ASCollectionViewLayoutInspector class]], @"should have a default layout inspector by default"); -} - -- (void)testThatRegisteringASupplementaryNodeStoresItForIntrospection -{ - UICollectionViewFlowLayout *layout = [[UICollectionViewFlowLayout alloc] init]; - ASCollectionView *collectionView = [[ASCollectionView alloc] initWithFrame:CGRectZero collectionViewLayout:layout]; - [collectionView registerSupplementaryNodeOfKind:UICollectionElementKindSectionHeader]; - XCTAssertEqualObjects([collectionView dataController:nil supplementaryNodeKindsInSections:[NSIndexSet indexSetWithIndex:0]], @[UICollectionElementKindSectionHeader]); -} - -- (void)testReloadIfNeeded -{ - __block ASCollectionViewTestController *testController = [[ASCollectionViewTestController alloc] initWithNibName:nil bundle:nil]; - __block ASCollectionViewTestDelegate *del = testController.asyncDelegate; - __block ASCollectionNode *cn = testController.collectionNode; - - void (^reset)() = ^void() { - testController = [[ASCollectionViewTestController alloc] initWithNibName:nil bundle:nil]; - del = testController.asyncDelegate; - cn = testController.collectionNode; - }; - - // Check if the number of sections matches the data source - XCTAssertEqual(cn.numberOfSections, del->_itemCounts.size(), @"Section count doesn't match the data source"); - - // Reset everything and then check if numberOfItemsInSection matches the data source - reset(); - XCTAssertEqual([cn numberOfItemsInSection:0], del->_itemCounts[0], @"Number of items in Section doesn't match the data source"); - - // Reset and check if we can get the node corresponding to a specific indexPath - reset(); - NSIndexPath *indexPath = [NSIndexPath indexPathForItem:0 inSection:0]; - ASTextCellNodeWithSetSelectedCounter *node = (ASTextCellNodeWithSetSelectedCounter*)[cn nodeForItemAtIndexPath:indexPath]; - XCTAssertTrue([node.text isEqualToString:indexPath.description], @"Node's text should match the initial text it was created with"); -} - -- (void)testSelection -{ - ASCollectionViewTestController *testController = [[ASCollectionViewTestController alloc] initWithNibName:nil bundle:nil]; - UIWindow *window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; - [window setRootViewController:testController]; - [window makeKeyAndVisible]; - - [testController.collectionNode reloadData]; - [testController.collectionNode waitUntilAllUpdatesAreProcessed]; - [testController.collectionView layoutIfNeeded]; - - NSIndexPath *indexPath = [NSIndexPath indexPathForItem:0 inSection:0]; - ASCellNode *node = [testController.collectionView nodeForItemAtIndexPath:indexPath]; - - NSInteger setSelectedCount = 0; - // selecting node should select cell - node.selected = YES; - ++setSelectedCount; - XCTAssertTrue([[testController.collectionView indexPathsForSelectedItems] containsObject:indexPath], @"Selecting node should update cell selection."); - - // deselecting node should deselect cell - node.selected = NO; - ++setSelectedCount; - XCTAssertTrue([[testController.collectionView indexPathsForSelectedItems] isEqualToArray:@[]], @"Deselecting node should update cell selection."); - - // selecting cell via collectionNode should select node - ++setSelectedCount; - [testController.collectionNode selectItemAtIndexPath:indexPath animated:NO scrollPosition:UICollectionViewScrollPositionNone]; - XCTAssertTrue(node.isSelected == YES, @"Selecting cell should update node selection."); - - // deselecting cell via collectionNode should deselect node - ++setSelectedCount; - [testController.collectionNode deselectItemAtIndexPath:indexPath animated:NO]; - XCTAssertTrue(node.isSelected == NO, @"Deselecting cell should update node selection."); - - // select the cell again, scroll down and back up, and check that the state persisted - [testController.collectionNode selectItemAtIndexPath:indexPath animated:NO scrollPosition:UICollectionViewScrollPositionNone]; - ++setSelectedCount; - XCTAssertTrue(node.isSelected == YES, @"Selecting cell should update node selection."); - - testController.collectionNode.allowsMultipleSelection = YES; - - NSIndexPath *indexPath2 = [NSIndexPath indexPathForItem:1 inSection:0]; - ASCellNode *node2 = [testController.collectionView nodeForItemAtIndexPath:indexPath2]; - - // selecting cell via collectionNode should select node - [testController.collectionNode selectItemAtIndexPath:indexPath2 animated:NO scrollPosition:UICollectionViewScrollPositionNone]; - XCTAssertTrue(node2.isSelected == YES, @"Selecting cell should update node selection."); - - XCTAssertTrue([[testController.collectionView indexPathsForSelectedItems] containsObject:indexPath] && - [[testController.collectionView indexPathsForSelectedItems] containsObject:indexPath2], - @"Selecting multiple cells should result in those cells being in the array of selectedItems."); - - // deselecting node should deselect cell - node.selected = NO; - ++setSelectedCount; - XCTAssertTrue(![[testController.collectionView indexPathsForSelectedItems] containsObject:indexPath] && - [[testController.collectionView indexPathsForSelectedItems] containsObject:indexPath2], @"Deselecting node should update array of selectedItems."); - - node.selected = YES; - ++setSelectedCount; - XCTAssertTrue([[testController.collectionView indexPathsForSelectedItems] containsObject:indexPath], @"Selecting node should update cell selection."); - - node2.selected = NO; - XCTAssertTrue([[testController.collectionView indexPathsForSelectedItems] containsObject:indexPath] && - ![[testController.collectionView indexPathsForSelectedItems] containsObject:indexPath2], @"Deselecting node should update array of selectedItems."); - - // reload cell (-prepareForReuse is called) & check that selected state is preserved - [testController.collectionView setContentOffset:CGPointMake(0,testController.collectionView.bounds.size.height)]; - [testController.collectionView layoutIfNeeded]; - [testController.collectionView setContentOffset:CGPointMake(0,0)]; - [testController.collectionView layoutIfNeeded]; - XCTAssertTrue(node.isSelected == YES, @"Reloaded cell should preserve state."); - - // deselecting cell should deselect node - UICollectionViewCell *cell = [testController.collectionView cellForItemAtIndexPath:indexPath]; - cell.selected = NO; - XCTAssertTrue(node.isSelected == NO, @"Deselecting cell should update node selection."); - - // check setSelected not called extra times - XCTAssertTrue([(ASTextCellNodeWithSetSelectedCounter *)node setSelectedCounter] == (setSelectedCount + 1), @"setSelected: should not be called on node multiple times."); -} - -- (void)testTuningParametersWithExplicitRangeMode -{ - UICollectionViewFlowLayout *layout = [[UICollectionViewFlowLayout alloc] init]; - ASCollectionNode *collectionNode = [[ASCollectionNode alloc] initWithCollectionViewLayout:layout]; - - ASRangeTuningParameters minimumRenderParams = { .leadingBufferScreenfuls = 0.1, .trailingBufferScreenfuls = 0.1 }; - ASRangeTuningParameters minimumPreloadParams = { .leadingBufferScreenfuls = 0.1, .trailingBufferScreenfuls = 0.1 }; - ASRangeTuningParameters fullRenderParams = { .leadingBufferScreenfuls = 0.5, .trailingBufferScreenfuls = 0.5 }; - ASRangeTuningParameters fullPreloadParams = { .leadingBufferScreenfuls = 1, .trailingBufferScreenfuls = 0.5 }; - - [collectionNode setTuningParameters:minimumRenderParams forRangeMode:ASLayoutRangeModeMinimum rangeType:ASLayoutRangeTypeDisplay]; - [collectionNode setTuningParameters:minimumPreloadParams forRangeMode:ASLayoutRangeModeMinimum rangeType:ASLayoutRangeTypePreload]; - [collectionNode setTuningParameters:fullRenderParams forRangeMode:ASLayoutRangeModeFull rangeType:ASLayoutRangeTypeDisplay]; - [collectionNode setTuningParameters:fullPreloadParams forRangeMode:ASLayoutRangeModeFull rangeType:ASLayoutRangeTypePreload]; - - XCTAssertTrue(ASRangeTuningParametersEqualToRangeTuningParameters(minimumRenderParams, - [collectionNode tuningParametersForRangeMode:ASLayoutRangeModeMinimum rangeType:ASLayoutRangeTypeDisplay])); - XCTAssertTrue(ASRangeTuningParametersEqualToRangeTuningParameters(minimumPreloadParams, - [collectionNode tuningParametersForRangeMode:ASLayoutRangeModeMinimum rangeType:ASLayoutRangeTypePreload])); - XCTAssertTrue(ASRangeTuningParametersEqualToRangeTuningParameters(fullRenderParams, - [collectionNode tuningParametersForRangeMode:ASLayoutRangeModeFull rangeType:ASLayoutRangeTypeDisplay])); - XCTAssertTrue(ASRangeTuningParametersEqualToRangeTuningParameters(fullPreloadParams, - [collectionNode tuningParametersForRangeMode:ASLayoutRangeModeFull rangeType:ASLayoutRangeTypePreload])); -} - -- (void)testTuningParameters -{ - UICollectionViewFlowLayout *layout = [[UICollectionViewFlowLayout alloc] init]; - ASCollectionView *collectionView = [[ASCollectionView alloc] initWithFrame:CGRectZero collectionViewLayout:layout]; - - ASRangeTuningParameters renderParams = { .leadingBufferScreenfuls = 1.2, .trailingBufferScreenfuls = 3.2 }; - ASRangeTuningParameters preloadParams = { .leadingBufferScreenfuls = 4.3, .trailingBufferScreenfuls = 2.3 }; - - [collectionView setTuningParameters:renderParams forRangeType:ASLayoutRangeTypeDisplay]; - [collectionView setTuningParameters:preloadParams forRangeType:ASLayoutRangeTypePreload]; - - XCTAssertTrue(ASRangeTuningParametersEqualToRangeTuningParameters(renderParams, [collectionView tuningParametersForRangeType:ASLayoutRangeTypeDisplay])); - XCTAssertTrue(ASRangeTuningParametersEqualToRangeTuningParameters(preloadParams, [collectionView tuningParametersForRangeType:ASLayoutRangeTypePreload])); -} - -// Informations to test: https://github.com/TextureGroup/Texture/issues/1094 -- (void)testThatCollectionNodeCanHandleNilRangeController -{ - UICollectionViewFlowLayout *layout = [[UICollectionViewFlowLayout alloc] init]; - ASCollectionNode *collectionNode = [[ASCollectionNode alloc] initWithCollectionViewLayout:layout]; - [collectionNode recursivelySetInterfaceState:ASInterfaceStateDisplay]; - [collectionNode setHierarchyState:ASHierarchyStateRangeManaged]; - [collectionNode recursivelySetInterfaceState:ASInterfaceStateNone]; - ASCATransactionQueueWait(nil); -} - -/** - * This may seem silly, but we had issues where the runtime sometimes wouldn't correctly report - * conformances declared on categories. - */ -- (void)testThatCollectionNodeConformsToExpectedProtocols -{ - ASCollectionNode *node = [[ASCollectionNode alloc] initWithFrame:CGRectZero collectionViewLayout:[[UICollectionViewFlowLayout alloc] init]]; - XCTAssert([node conformsToProtocol:@protocol(ASRangeControllerUpdateRangeProtocol)]); -} - -#pragma mark - Update Validations - -#define updateValidationTestPrologue \ - ASCollectionViewTestController *testController = [[ASCollectionViewTestController alloc] initWithNibName:nil bundle:nil];\ - __unused ASCollectionViewTestDelegate *del = testController.asyncDelegate;\ - __unused ASCollectionView *cv = testController.collectionView;\ - ASCollectionNode *cn = testController.collectionNode;\ - UIWindow *window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];\ - [window makeKeyAndVisible]; \ - window.rootViewController = testController;\ - \ - [cn reloadData];\ - [cn waitUntilAllUpdatesAreProcessed]; \ - [testController.collectionView layoutIfNeeded]; - -- (void)testThatSubmittingAValidInsertDoesNotThrowAnException -{ - updateValidationTestPrologue - NSInteger sectionCount = del->_itemCounts.size(); - - del->_itemCounts[sectionCount - 1]++; - XCTAssertNoThrow([cv insertItemsAtIndexPaths:@[ [NSIndexPath indexPathForItem:0 inSection:sectionCount - 1] ]]); -} - -- (void)testThatSubmittingAValidReloadDoesNotThrowAnException -{ - updateValidationTestPrologue - NSInteger sectionCount = del->_itemCounts.size(); - - XCTAssertNoThrow([cv reloadItemsAtIndexPaths:@[ [NSIndexPath indexPathForItem:0 inSection:sectionCount - 1] ]]); -} - -- (void)testThatSubmittingAnInvalidInsertThrowsAnException -{ - updateValidationTestPrologue - NSInteger sectionCount = del->_itemCounts.size(); - - XCTAssertThrows([cv insertItemsAtIndexPaths:@[ [NSIndexPath indexPathForItem:0 inSection:sectionCount + 1] ]]); -} - -- (void)testThatSubmittingAnInvalidDeleteThrowsAnException -{ - updateValidationTestPrologue - NSInteger sectionCount = del->_itemCounts.size(); - - XCTAssertThrows([cv deleteItemsAtIndexPaths:@[ [NSIndexPath indexPathForItem:0 inSection:sectionCount + 1] ]]); -} - -- (void)testThatDeletingAndReloadingTheSameItemThrowsAnException -{ - updateValidationTestPrologue - - XCTAssertThrows([cv performBatchUpdates:^{ - NSArray *indexPaths = @[ [NSIndexPath indexPathForItem:0 inSection:0] ]; - [cv deleteItemsAtIndexPaths:indexPaths]; - [cv reloadItemsAtIndexPaths:indexPaths]; - } completion:nil]); -} - -- (void)testThatHavingAnIncorrectSectionCountThrowsAnException -{ - updateValidationTestPrologue - - XCTAssertThrows([cv deleteSections:[NSIndexSet indexSetWithIndex:0]]); -} - -- (void)testThatHavingAnIncorrectItemCountThrowsAnException -{ - updateValidationTestPrologue - - XCTAssertThrows([cv deleteItemsAtIndexPaths:@[ [NSIndexPath indexPathForItem:0 inSection:0] ]]); -} - -- (void)testThatHavingAnIncorrectItemCountWithNoUpdatesThrowsAnException -{ - updateValidationTestPrologue - - XCTAssertThrows([cv performBatchUpdates:^{ - del->_itemCounts[0]++; - } completion:nil]); -} - -- (void)testThatInsertingAnInvalidSectionThrowsAnException -{ - updateValidationTestPrologue - NSInteger sectionCount = del->_itemCounts.size(); - - del->_itemCounts.push_back(10); - XCTAssertThrows([cv performBatchUpdates:^{ - [cv insertSections:[NSIndexSet indexSetWithIndex:sectionCount + 1]]; - } completion:nil]); -} - -- (void)testThatDeletingAndReloadingASectionThrowsAnException -{ - updateValidationTestPrologue - NSInteger sectionCount = del->_itemCounts.size(); - - del->_itemCounts.pop_back(); - XCTAssertThrows([cv performBatchUpdates:^{ - NSIndexSet *sections = [NSIndexSet indexSetWithIndex:sectionCount - 1]; - [cv reloadSections:sections]; - [cv deleteSections:sections]; - } completion:nil]); -} - -- (void)testCellNodeLayoutAttributes -{ - updateValidationTestPrologue - NSSet *nodeBatch1 = [NSSet setWithArray:[cn visibleNodes]]; - XCTAssertGreaterThan(nodeBatch1.count, 0); - - NSArray *visibleLayoutAttributesBatch1 = [cv.collectionViewLayout layoutAttributesForElementsInRect:cv.bounds]; - XCTAssertGreaterThan(visibleLayoutAttributesBatch1.count, 0); - - // Expect all visible nodes get 1 applyLayoutAttributes and have a non-nil value. - for (ASTextCellNodeWithSetSelectedCounter *node in nodeBatch1) { - XCTAssertEqual(node.applyLayoutAttributesCount, 1, @"Expected applyLayoutAttributes to be called exactly once for visible nodes."); - XCTAssertNotNil(node.layoutAttributes, @"Expected layoutAttributes to be non-nil for visible cell node."); - } - - for (UICollectionViewLayoutAttributes *layoutAttributes in visibleLayoutAttributesBatch1) { - if (layoutAttributes.representedElementCategory != UICollectionElementCategorySupplementaryView) { - continue; - } - ASTextCellNodeWithSetSelectedCounter *node = (ASTextCellNodeWithSetSelectedCounter *)[cv supplementaryNodeForElementKind:layoutAttributes.representedElementKind atIndexPath:layoutAttributes.indexPath]; - XCTAssertEqual(node.applyLayoutAttributesCount, 1, @"Expected applyLayoutAttributes to be called exactly once for visible supplementary nodes."); - XCTAssertNotNil(node.layoutAttributes, @"Expected layoutAttributes to be non-nil for visible supplementary node."); - } - - // Scroll to next batch of items. - NSIndexPath *nextIP = [NSIndexPath indexPathForItem:nodeBatch1.count inSection:0]; - [cv scrollToItemAtIndexPath:nextIP atScrollPosition:UICollectionViewScrollPositionTop animated:NO]; - [cv layoutIfNeeded]; - - // Ensure we scrolled far enough that all the old ones are offscreen. - NSSet *nodeBatch2 = [NSSet setWithArray:[cn visibleNodes]]; - XCTAssertFalse([nodeBatch1 intersectsSet:nodeBatch2], @"Expected to scroll far away enough that all nodes are replaced."); - - // Now the nodes are no longer visible, expect their layout attributes are nil but not another applyLayoutAttributes call. - for (ASTextCellNodeWithSetSelectedCounter *node in nodeBatch1) { - XCTAssertEqual(node.applyLayoutAttributesCount, 1, @"Expected applyLayoutAttributes to be called exactly once for visible nodes, even after node is removed."); - XCTAssertNil(node.layoutAttributes, @"Expected layoutAttributes to be nil for removed cell node."); - } - - for (UICollectionViewLayoutAttributes *layoutAttributes in visibleLayoutAttributesBatch1) { - if (layoutAttributes.representedElementCategory != UICollectionElementCategorySupplementaryView) { - continue; - } - ASTextCellNodeWithSetSelectedCounter *node = (ASTextCellNodeWithSetSelectedCounter *)[cv supplementaryNodeForElementKind:layoutAttributes.representedElementKind atIndexPath:layoutAttributes.indexPath]; - XCTAssertEqual(node.applyLayoutAttributesCount, 1, @"Expected applyLayoutAttributes to be called exactly once for visible supplementary nodes, even after node is removed."); - XCTAssertNil(node.layoutAttributes, @"Expected layoutAttributes to be nil for removed supplementary node."); - } -} - -- (void)testCellNodeIndexPathConsistency -{ - updateValidationTestPrologue - - // Test with a visible cell - NSIndexPath *indexPath = [NSIndexPath indexPathForItem:2 inSection:0]; - ASCellNode *cell = [cn nodeForItemAtIndexPath:indexPath]; - - // Check if cell's indexPath corresponds to the indexPath being tested - XCTAssertTrue(cell.indexPath.section == indexPath.section && cell.indexPath.item == indexPath.item, @"Expected the cell's indexPath to be the same as the indexPath being tested."); - - // Remove an item prior to the cell's indexPath from the same section and check for indexPath consistency - --del->_itemCounts[indexPath.section]; - [cn deleteItemsAtIndexPaths:@[[NSIndexPath indexPathForItem:0 inSection:indexPath.section]]]; - XCTAssertTrue(cell.indexPath.section == indexPath.section && cell.indexPath.item == (indexPath.item - 1), @"Expected the cell's indexPath to be updated once a cell with a lower index is deleted."); - - // Remove the section that includes the indexPath and check if the cell's indexPath is now nil - del->_itemCounts.erase(del->_itemCounts.begin()); - [cn deleteSections:[NSIndexSet indexSetWithIndex:indexPath.section]]; - XCTAssertNil(cell.indexPath, @"Expected the cell's indexPath to be nil once the section that contains the node is deleted."); - - // Run the same tests but with a non-displayed cell - indexPath = [NSIndexPath indexPathForItem:2 inSection:(del->_itemCounts.size() - 1)]; - cell = [cn nodeForItemAtIndexPath:indexPath]; - - // Check if cell's indexPath corresponds to the indexPath being tested - XCTAssertTrue(cell.indexPath.section == indexPath.section && cell.indexPath.item == indexPath.item, @"Expected the cell's indexPath to be the same as the indexPath in question."); - - // Remove an item prior to the cell's indexPath from the same section and check for indexPath consistency - --del->_itemCounts[indexPath.section]; - [cn deleteItemsAtIndexPaths:@[[NSIndexPath indexPathForItem:0 inSection:indexPath.section]]]; - XCTAssertTrue(cell.indexPath.section == indexPath.section && cell.indexPath.item == (indexPath.item - 1), @"Expected the cell's indexPath to be updated once a cell with a lower index is deleted."); - - // Remove the section that includes the indexPath and check if the cell's indexPath is now nil - del->_itemCounts.pop_back(); - [cn deleteSections:[NSIndexSet indexSetWithIndex:indexPath.section]]; - XCTAssertNil(cell.indexPath, @"Expected the cell's indexPath to be nil once the section that contains the node is deleted."); -} - -/** - * https://github.com/facebook/AsyncDisplayKit/issues/2011 - * - * If this ever becomes a pain to maintain, drop it. The underlying issue is tested by testThatLayerBackedSubnodesAreMarkedInvisibleBeforeDeallocWhenSupernodesViewIsRemovedFromHierarchyWhileBeingRetained - */ -- (void)testThatDisappearingSupplementariesWithLayerBackedNodesDontFailAssert -{ - UIWindow *window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds]; - UICollectionViewLayout *layout = [[UICollectionViewFlowLayout alloc] init]; - ASCollectionNode *cn = [[ASCollectionNode alloc] initWithFrame:window.bounds collectionViewLayout:layout]; - ASCollectionView *cv = cn.view; - - - __unused NSMutableSet *keepaliveNodes = [NSMutableSet set]; - id dataSource = [OCMockObject niceMockForProtocol:@protocol(ASCollectionDataSource)]; - static int nodeIdx = 0; - [[[dataSource stub] andDo:^(NSInvocation *invocation) { - __autoreleasing ASCellNode *suppNode = [[ASCellNode alloc] init]; - int thisNodeIdx = nodeIdx++; - suppNode.debugName = [NSString stringWithFormat:@"Cell #%d", thisNodeIdx]; - [keepaliveNodes addObject:suppNode]; - - ASDisplayNode *layerBacked = [[ASDisplayNode alloc] init]; - layerBacked.layerBacked = YES; - layerBacked.debugName = [NSString stringWithFormat:@"Subnode #%d", thisNodeIdx]; - [suppNode addSubnode:layerBacked]; - [invocation setReturnValue:&suppNode]; - }] collectionNode:cn nodeForSupplementaryElementOfKind:UICollectionElementKindSectionHeader atIndexPath:OCMOCK_ANY]; - [[[dataSource stub] andReturnValue:[NSNumber numberWithInteger:1]] numberOfSectionsInCollectionView:cv]; - cv.asyncDataSource = dataSource; - - id delegate = [OCMockObject niceMockForProtocol:@protocol(UICollectionViewDelegateFlowLayout)]; - [[[delegate stub] andReturnValue:[NSValue valueWithCGSize:CGSizeMake(100, 100)]] collectionView:cv layout:OCMOCK_ANY referenceSizeForHeaderInSection:0]; - cv.asyncDelegate = delegate; - - [cv registerSupplementaryNodeOfKind:UICollectionElementKindSectionHeader]; - [window addSubview:cv]; - - [window makeKeyAndVisible]; - - for (NSInteger i = 0; i < 2; i++) { - // NOTE: reloadData and waitUntilAllUpdatesAreProcessed are not sufficient here!! - XCTestExpectation *done = [self expectationWithDescription:[NSString stringWithFormat:@"Reload #%td complete", i]]; - [cn reloadDataWithCompletion:^{ - [done fulfill]; - }]; - [self waitForExpectationsWithTimeout:1 handler:nil]; - } - -} - -- (void)testThatNodeCalculatedSizesAreUpdatedBeforeFirstPrepareLayoutAfterRotation -{ - updateValidationTestPrologue - id layout = cv.collectionViewLayout; - CGSize initialItemSize = [cv nodeForItemAtIndexPath:[NSIndexPath indexPathForItem:0 inSection:0]].calculatedSize; - CGSize initialCVSize = cv.bounds.size; - - // Capture the node size before first call to prepareLayout after frame change. - __block CGSize itemSizeAtFirstLayout = CGSizeZero; - __block CGSize boundsSizeAtFirstLayout = CGSizeZero; - [[[[layout expect] andDo:^(NSInvocation *) { - itemSizeAtFirstLayout = [cv nodeForItemAtIndexPath:[NSIndexPath indexPathForItem:0 inSection:0]].calculatedSize; - boundsSizeAtFirstLayout = [cv bounds].size; - }] andForwardToRealObject] prepareLayout]; - - // Rotate the device - UIDeviceOrientation oldDeviceOrientation = [[UIDevice currentDevice] orientation]; - [[UIDevice currentDevice] setValue:@(UIDeviceOrientationLandscapeLeft) forKey:@"orientation"]; - - CGSize finalItemSize = [cv nodeForItemAtIndexPath:[NSIndexPath indexPathForItem:0 inSection:0]].calculatedSize; - CGSize finalCVSize = cv.bounds.size; - XCTAssertNotEqualObjects(NSStringFromCGSize(initialItemSize), NSStringFromCGSize(itemSizeAtFirstLayout)); - XCTAssertNotEqualObjects(NSStringFromCGSize(initialCVSize), NSStringFromCGSize(boundsSizeAtFirstLayout)); - XCTAssertEqualObjects(NSStringFromCGSize(itemSizeAtFirstLayout), NSStringFromCGSize(finalItemSize)); - XCTAssertEqualObjects(NSStringFromCGSize(boundsSizeAtFirstLayout), NSStringFromCGSize(finalCVSize)); - [layout verify]; - - // Teardown - [[UIDevice currentDevice] setValue:@(oldDeviceOrientation) forKey:@"orientation"]; -} - -/** - * See corresponding test in ASUICollectionViewTests - * - * @discussion Currently, we do not replicate UICollectionView's call order (outer, inner0, inner1, ...) - * and instead call (inner0, inner1, outer, ...). This is because we primarily provide a - * beginUpdates/endUpdatesWithCompletion: interface (like UITableView). With UICollectionView's - * performBatchUpdates:completion:, the completion block is enqueued at -beginUpdates time. - * With our tableView-like scheme, the completion block is provided at -endUpdates time - * and it is naturally enqueued at this time. It is assumed that this is an acceptable deviation, - * and that developers do not expect a particular completion order guarantee. - */ -- (void)testThatNestedBatchCompletionsAreCalledInOrder -{ - ASCollectionViewTestController *testController = [[ASCollectionViewTestController alloc] initWithNibName:nil bundle:nil]; - - ASCollectionView *cv = testController.collectionView; - - XCTestExpectation *inner0 = [self expectationWithDescription:@"Inner completion 0 is called"]; - XCTestExpectation *inner1 = [self expectationWithDescription:@"Inner completion 1 is called"]; - XCTestExpectation *outer = [self expectationWithDescription:@"Outer completion is called"]; - - NSMutableArray *completions = [NSMutableArray array]; - - [cv performBatchUpdates:^{ - [cv performBatchUpdates:^{ - - } completion:^(BOOL finished) { - [completions addObject:inner0]; - [inner0 fulfill]; - }]; - [cv performBatchUpdates:^{ - - } completion:^(BOOL finished) { - [completions addObject:inner1]; - [inner1 fulfill]; - }]; - } completion:^(BOOL finished) { - [completions addObject:outer]; - [outer fulfill]; - }]; - - [self waitForExpectationsWithTimeout:5 handler:nil]; - XCTAssertEqualObjects(completions, (@[ inner0, inner1, outer ]), @"Expected completion order to be correct"); -} - -#pragma mark - ASSectionContext tests - -- (void)testThatSectionContextsAreCorrectAfterTheInitialLayout -{ - updateValidationTestPrologue - NSInteger sectionCount = del->_itemCounts.size(); - for (NSInteger section = 0; section < sectionCount; section++) { - ASTestSectionContext *context = (ASTestSectionContext *)[cn contextForSection:section]; - XCTAssertNotNil(context); - XCTAssertEqual(context.sectionGeneration, 1); - XCTAssertEqual(context.sectionIndex, section); - } -} - -- (void)testThatSectionContextsAreCorrectAfterSectionMove -{ - updateValidationTestPrologue - NSInteger sectionCount = del->_itemCounts.size(); - NSInteger originalSection = sectionCount - 1; - NSInteger toSection = 0; - - del.sectionGeneration++; - [cv moveSection:originalSection toSection:toSection]; - [cv waitUntilAllUpdatesAreCommitted]; - - // Only test left moving - XCTAssertTrue(toSection < originalSection); - ASTestSectionContext *movedSectionContext = (ASTestSectionContext *)[cn contextForSection:toSection]; - XCTAssertNotNil(movedSectionContext); - // ASCollectionView currently splits a move operation to a pair of delete and insert ones. - // So this movedSectionContext is newly loaded and thus is second generation. - XCTAssertEqual(movedSectionContext.sectionGeneration, 2); - XCTAssertEqual(movedSectionContext.sectionIndex, toSection); - - for (NSInteger section = toSection + 1; section <= originalSection && section < sectionCount; section++) { - ASTestSectionContext *context = (ASTestSectionContext *)[cn contextForSection:section]; - XCTAssertNotNil(context); - XCTAssertEqual(context.sectionGeneration, 1); - // This section context was shifted to the right - XCTAssertEqual(context.sectionIndex, (section - 1)); - } -} - -- (void)testThatSectionContextsAreCorrectAfterReloadData -{ - updateValidationTestPrologue - - del.sectionGeneration++; - [cn reloadData]; - [cn waitUntilAllUpdatesAreProcessed]; - - NSInteger sectionCount = del->_itemCounts.size(); - for (NSInteger section = 0; section < sectionCount; section++) { - ASTestSectionContext *context = (ASTestSectionContext *)[cn contextForSection:section]; - XCTAssertNotNil(context); - XCTAssertEqual(context.sectionGeneration, 2); - XCTAssertEqual(context.sectionIndex, section); - } -} - -- (void)testThatSectionContextsAreCorrectAfterReloadASection -{ - updateValidationTestPrologue - NSInteger sectionToReload = 0; - - del.sectionGeneration++; - [cv reloadSections:[NSIndexSet indexSetWithIndex:sectionToReload]]; - [cv waitUntilAllUpdatesAreCommitted]; - - NSInteger sectionCount = del->_itemCounts.size(); - for (NSInteger section = 0; section < sectionCount; section++) { - ASTestSectionContext *context = (ASTestSectionContext *)[cn contextForSection:section]; - XCTAssertNotNil(context); - XCTAssertEqual(context.sectionGeneration, section != sectionToReload ? 1 : 2); - XCTAssertEqual(context.sectionIndex, section); - } -} - -/// See the same test in ASUICollectionViewTests for the reference behavior. -- (void)testThatIssuingAnUpdateBeforeInitialReloadIsAcceptable -{ - ASCollectionViewTestDelegate *del = [[ASCollectionViewTestDelegate alloc] initWithNumberOfSections:0 numberOfItemsInSection:0]; - ASCollectionView *cv = [[ASCollectionView alloc] initWithCollectionViewLayout:[UICollectionViewFlowLayout new]]; - cv.asyncDataSource = del; - cv.asyncDelegate = del; - - // Add a section to the data source - del->_itemCounts.push_back(0); - // Attempt to insert section into collection view. We ignore it to workaround - // the bug demonstrated by - // ASUICollectionViewTests.testThatIssuingAnUpdateBeforeInitialReloadIsUnacceptable - XCTAssertNoThrow([cv insertSections:[NSIndexSet indexSetWithIndex:0]]); -} - -- (void)testThatNodeAtIndexPathIsCorrectImmediatelyAfterSubmittingUpdate -{ - updateValidationTestPrologue - NSIndexPath *indexPath = [NSIndexPath indexPathForItem:0 inSection:0]; - - // Insert an item and assert nodeForItemAtIndexPath: immediately returns new node - ASCellNode *oldNode = [cn nodeForItemAtIndexPath:indexPath]; - XCTAssertNotNil(oldNode); - del->_itemCounts[0] += 1; - [cv insertItemsAtIndexPaths:@[ indexPath ]]; - ASCellNode *newNode = [cn nodeForItemAtIndexPath:indexPath]; - XCTAssertNotNil(newNode); - XCTAssertNotEqualObjects(oldNode, newNode); - - // Delete all sections and assert nodeForItemAtIndexPath: immediately returns nil - NSIndexSet *sections = [NSIndexSet indexSetWithIndexesInRange:NSMakeRange(0, del->_itemCounts.size())]; - del->_itemCounts.clear(); - [cv deleteSections:sections]; - XCTAssertNil([cn nodeForItemAtIndexPath:indexPath]); -} - -- (void)DISABLED_testThatSupplementaryNodeAtIndexPathIsCorrectImmediatelyAfterSubmittingUpdate -{ - updateValidationTestPrologue - NSIndexPath *indexPath = [NSIndexPath indexPathForItem:0 inSection:0]; - ASCellNode *oldHeader = [cv supplementaryNodeForElementKind:UICollectionElementKindSectionHeader atIndexPath:indexPath]; - XCTAssertNotNil(oldHeader); - - // Reload the section and ensure that the new header is loaded - [cv reloadSections:[NSIndexSet indexSetWithIndex:0]]; - ASCellNode *newHeader = [cv supplementaryNodeForElementKind:UICollectionElementKindSectionHeader atIndexPath:indexPath]; - XCTAssertNotNil(newHeader); - XCTAssertNotEqualObjects(oldHeader, newHeader); -} - -- (void)testThatNilBatchUpdatesCanBeSubmitted -{ - __block ASCollectionViewTestController *testController = [[ASCollectionViewTestController alloc] initWithNibName:nil bundle:nil]; - __block ASCollectionNode *cn = testController.collectionNode; - - // Passing nil blocks should not crash - [cn performBatchUpdates:nil completion:nil]; - [cn performBatchAnimated:NO updates:nil completion:nil]; -} - -- (void)testThatDeletedItemsAreMarkedInvisible -{ - UIWindow *window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds]; - ASCollectionViewTestController *testController = [[ASCollectionViewTestController alloc] initWithNibName:nil bundle:nil]; - window.rootViewController = testController; - - __block NSInteger itemCount = 1; - testController.asyncDelegate->_itemCounts = {itemCount}; - [window makeKeyAndVisible]; - [window layoutIfNeeded]; - - ASCollectionNode *cn = testController.collectionNode; - [cn waitUntilAllUpdatesAreProcessed]; - [cn.view layoutIfNeeded]; - ASCellNode *node = [cn nodeForItemAtIndexPath:[NSIndexPath indexPathForItem:0 inSection:0]]; - ASCATransactionQueueWait(nil); - XCTAssertTrue(node.visible); - testController.asyncDelegate->_itemCounts = {0}; - [cn deleteItemsAtIndexPaths: @[[NSIndexPath indexPathForItem:0 inSection:0]]]; - [self expectationForPredicate:[NSPredicate predicateWithFormat:@"visible = NO"] evaluatedWithObject:node handler:nil]; - [self waitForExpectationsWithTimeout:3 handler:nil]; -} - -- (void)disabled_testThatMultipleBatchFetchesDontHappenUnnecessarily -{ - UIWindow *window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds]; - ASCollectionViewTestController *testController = [[ASCollectionViewTestController alloc] initWithNibName:nil bundle:nil]; - window.rootViewController = testController; - - // Start with 1 item so that our content does not fill bounds. - __block NSInteger itemCount = 1; - testController.asyncDelegate->_itemCounts = {itemCount}; - [window makeKeyAndVisible]; - [window layoutIfNeeded]; - - ASCollectionNode *cn = testController.collectionNode; - [cn waitUntilAllUpdatesAreProcessed]; - XCTAssertGreaterThan(cn.bounds.size.height, cn.view.contentSize.height, @"Expected initial data not to fill collection view area."); - - __block NSUInteger batchFetchCount = 0; - XCTestExpectation *expectation = [self expectationWithDescription:@"Batch fetching completed and then some"]; - __weak ASCollectionViewTestController *weakController = testController; - testController.asyncDelegate.willBeginBatchFetch = ^(ASBatchContext *context) { - - // Ensure only 1 batch fetch happens - batchFetchCount += 1; - if (batchFetchCount > 1) { - XCTFail(@"Too many batch fetches!"); - return; - } - - dispatch_async(dispatch_get_main_queue(), ^{ - // Up the item count to 1000 so that we're well beyond the - // edge of the collection view and not ready for another batch fetch. - NSMutableArray *indexPaths = [NSMutableArray array]; - for (; itemCount < 1000; itemCount++) { - [indexPaths addObject:[NSIndexPath indexPathForItem:itemCount inSection:0]]; - } - weakController.asyncDelegate->_itemCounts = {itemCount}; - [cn insertItemsAtIndexPaths:indexPaths]; - [context completeBatchFetching:YES]; - - // Let the run loop turn before we consider the test passed. - dispatch_async(dispatch_get_main_queue(), ^{ - [expectation fulfill]; - }); - }); - }; - [self waitForExpectationsWithTimeout:3 handler:nil]; -} - -- (void)testThatBatchFetchHappensForEmptyCollection -{ - UIWindow *window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds]; - ASCollectionViewTestController *testController = [[ASCollectionViewTestController alloc] initWithNibName:nil bundle:nil]; - window.rootViewController = testController; - - testController.asyncDelegate->_itemCounts = {}; - [window makeKeyAndVisible]; - [window layoutIfNeeded]; - - ASCollectionNode *cn = testController.collectionNode; - [cn waitUntilAllUpdatesAreProcessed]; - - __block NSUInteger batchFetchCount = 0; - XCTestExpectation *e = [self expectationWithDescription:@"Batch fetching completed"]; - testController.asyncDelegate.willBeginBatchFetch = ^(ASBatchContext *context) { - // Ensure only 1 batch fetch happens - batchFetchCount += 1; - if (batchFetchCount > 1) { - XCTFail(@"Too many batch fetches!"); - return; - } - [e fulfill]; - }; - [self waitForExpectationsWithTimeout:3 handler:nil]; -} - -- (void)testThatWeBatchFetchUntilContentRequirementIsMet_Animated -{ - [self _primitiveBatchFetchingFillTestAnimated:YES visible:YES controller:nil]; -} - -- (void)testThatWeBatchFetchUntilContentRequirementIsMet_Nonanimated -{ - [self _primitiveBatchFetchingFillTestAnimated:NO visible:YES controller:nil]; -} - -- (void)testThatWeBatchFetchUntilContentRequirementIsMet_Invisible -{ - [self _primitiveBatchFetchingFillTestAnimated:NO visible:NO controller:nil]; -} - -- (void)testThatWhenWeBecomeVisibleWeWillFetchAdditionalContent -{ - ASCollectionViewTestController *ctrl = [[ASCollectionViewTestController alloc] initWithNibName:nil bundle:nil]; - // Start with 1 empty section - ctrl.asyncDelegate->_itemCounts = {0}; - [self _primitiveBatchFetchingFillTestAnimated:NO visible:NO controller:ctrl]; - XCTAssertGreaterThan([ctrl.collectionNode numberOfItemsInSection:0], 0); - [self _primitiveBatchFetchingFillTestAnimated:NO visible:YES controller:ctrl]; -} - -- (void)_primitiveBatchFetchingFillTestAnimated:(BOOL)animated visible:(BOOL)visible controller:(nullable ASCollectionViewTestController *)testController -{ - if (testController == nil) { - testController = [[ASCollectionViewTestController alloc] initWithNibName:nil bundle:nil]; - // Start with 1 empty section - testController.asyncDelegate->_itemCounts = {0}; - } - ASCollectionNode *cn = testController.collectionNode; - - UIWindow *window = nil; - UIView *view = nil; - if (visible) { - window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds]; - view = window; - } else { - view = cn.view; - view.frame = [UIScreen mainScreen].bounds; - } - - XCTestExpectation *expectation = [self expectationWithDescription:@"Completed all batch fetches"]; - __weak ASCollectionViewTestController *weakController = testController; - __block NSInteger batchFetchCount = 0; - testController.asyncDelegate.willBeginBatchFetch = ^(ASBatchContext *context) { - dispatch_async(dispatch_get_main_queue(), ^{ - NSInteger fetchIndex = batchFetchCount++; - - NSInteger itemCount = weakController.asyncDelegate->_itemCounts[0]; - weakController.asyncDelegate->_itemCounts[0] = (itemCount + 1); - if (animated) { - [cn insertItemsAtIndexPaths:@[ [NSIndexPath indexPathForItem:itemCount inSection:0] ]]; - } else { - [cn performBatchAnimated:NO updates:^{ - [cn insertItemsAtIndexPaths:@[ [NSIndexPath indexPathForItem:itemCount inSection:0] ]]; - } completion:nil]; - } - - [context completeBatchFetching:YES]; - - // If no more batch fetches have happened in 1 second, assume we're done. - dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ - if (fetchIndex == batchFetchCount - 1) { - [expectation fulfill]; - } - }); - }); - }; - window.rootViewController = testController; - - [window makeKeyAndVisible]; - // Trigger the initial reload to start - [view layoutIfNeeded]; - - // Wait for ASDK reload to finish - [cn waitUntilAllUpdatesAreProcessed]; - // Force UIKit to read updated data & range controller to update and account for it - [cn.view layoutIfNeeded]; - [self waitForExpectationsWithTimeout:60 handler:nil]; - - CGFloat contentHeight = cn.view.contentSize.height; - CGFloat requiredContentHeight; - CGFloat itemHeight = [cn.view layoutAttributesForItemAtIndexPath:[NSIndexPath indexPathForItem:0 inSection:0]].size.height; - if (visible) { - requiredContentHeight = CGRectGetMaxY(cn.bounds) + CGRectGetHeight(cn.bounds) * cn.view.leadingScreensForBatching; - } else { - requiredContentHeight = CGRectGetMaxY(cn.bounds); - } - XCTAssertGreaterThan(batchFetchCount, 2); - XCTAssertGreaterThanOrEqual(contentHeight, requiredContentHeight, @"Loaded too little content."); - XCTAssertLessThanOrEqual(contentHeight, requiredContentHeight + 3 * itemHeight, @"Loaded too much content."); -} - -- (void)testInitialRangeBounds -{ - [self testInitialRangeBoundsWithCellLayoutMode:ASCellLayoutModeNone - shouldWaitUntilAllUpdatesAreProcessed:YES]; -} - -- (void)testInitialRangeBoundsCellLayoutModeAlwaysAsync -{ - [self testInitialRangeBoundsWithCellLayoutMode:ASCellLayoutModeAlwaysAsync - shouldWaitUntilAllUpdatesAreProcessed:YES]; -} - -- (void)testInitialRangeBoundsWithCellLayoutMode:(ASCellLayoutMode)cellLayoutMode - shouldWaitUntilAllUpdatesAreProcessed:(BOOL)shouldWait -{ - UIWindow *window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds]; - ASCollectionViewTestController *testController = [[ASCollectionViewTestController alloc] initWithNibName:nil bundle:nil]; - ASCollectionNode *cn = testController.collectionNode; - cn.cellLayoutMode = cellLayoutMode; - [cn setTuningParameters:{ .leadingBufferScreenfuls = 2, .trailingBufferScreenfuls = 0 } forRangeMode:ASLayoutRangeModeMinimum rangeType:ASLayoutRangeTypePreload]; - window.rootViewController = testController; - - [testController.collectionNode.collectionViewLayout invalidateLayout]; - [testController.collectionNode.collectionViewLayout prepareLayout]; - - [window makeKeyAndVisible]; - // Trigger the initial reload to start - [window layoutIfNeeded]; - - if (shouldWait) { - XCTAssertTrue(cn.isProcessingUpdates, @"ASCollectionNode should still be processing updates after initial layoutIfNeeded call (reloadData)"); - - [cn onDidFinishProcessingUpdates:^{ - XCTAssertTrue(!cn.isProcessingUpdates, @"ASCollectionNode should no longer be processing updates inside -onDidFinishProcessingUpdates: block"); - }]; - - // Wait for ASDK reload to finish - [cn waitUntilAllUpdatesAreProcessed]; - } - - XCTAssertTrue(!cn.isProcessingUpdates, @"ASCollectionNode should no longer be processing updates after -wait call"); - - // Force UIKit to read updated data & range controller to update and account for it - [cn.view layoutIfNeeded]; - - CGRect preloadBounds = ({ - CGRect r = CGRectNull; - for (NSInteger s = 0; s < cn.numberOfSections; s++) { - NSInteger c = [cn numberOfItemsInSection:s]; - for (NSInteger i = 0; i < c; i++) { - NSIndexPath *ip = [NSIndexPath indexPathForItem:i inSection:s]; - ASCellNode *node = [cn nodeForItemAtIndexPath:ip]; - ASCATransactionQueueWait(nil); - if (node.inPreloadState) { - CGRect frame = [cn.view layoutAttributesForItemAtIndexPath:ip].frame; - r = CGRectUnion(r, frame); - } - } - } - r; - }); - CGFloat expectedHeight = cn.bounds.size.height * 3; - XCTAssertEqualWithAccuracy(CGRectGetHeight(preloadBounds), expectedHeight, expectedHeight * 0.1); - XCTAssertEqual([[cn valueForKeyPath:@"rangeController.currentRangeMode"] integerValue], ASLayoutRangeModeMinimum, @"Expected range mode to be minimum before scrolling begins."); -} - -- (void)testTraitCollectionChangesMidUpdate -{ - CGRect screenBounds = [UIScreen mainScreen].bounds; - UIWindow *window = [[UIWindow alloc] initWithFrame:screenBounds]; - ASCollectionViewTestController *testController = [[ASCollectionViewTestController alloc] initWithNibName:nil bundle:nil]; - ASCollectionNode *cn = testController.collectionNode; - window.rootViewController = testController; - - [window makeKeyAndVisible]; - // Trigger the initial reload to start - [window layoutIfNeeded]; - - // The initial reload is async, changing the trait collection here should be "mid-update" - ASPrimitiveTraitCollection traitCollection = ASPrimitiveTraitCollectionMakeDefault(); - traitCollection.displayScale = cn.primitiveTraitCollection.displayScale + 1; // Just a dummy change - traitCollection.containerSize = screenBounds.size; - cn.primitiveTraitCollection = traitCollection; - - [cn waitUntilAllUpdatesAreProcessed]; - [cn.view layoutIfNeeded]; - - // Assert that the new trait collection is picked up by all cell nodes, including ones that were not allocated but are forced to allocate now - for (NSInteger s = 0; s < cn.numberOfSections; s++) { - NSInteger c = [cn numberOfItemsInSection:s]; - for (NSInteger i = 0; i < c; i++) { - NSIndexPath *ip = [NSIndexPath indexPathForItem:i inSection:s]; - ASCellNode *node = [cn.view nodeForItemAtIndexPath:ip]; - XCTAssertTrue(ASPrimitiveTraitCollectionIsEqualToASPrimitiveTraitCollection(traitCollection, node.primitiveTraitCollection)); - } - } -} - -/** - * This tests an issue where, since subnode insertions aren't applied until the UIKit layout pass, - * which we trigger during the display phase, subnodes like network image nodes are not preloading - * until this layout pass happens which is too late. - */ -- (void)DISABLED_testThatAutomaticallyManagedSubnodesGetPreloadCallBeforeDisplay -{ - UIWindow *window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds]; - ASCollectionViewTestController *testController = [[ASCollectionViewTestController alloc] initWithNibName:nil bundle:nil]; - window.rootViewController = testController; - ASCollectionNode *cn = testController.collectionNode; - - __block NSInteger itemCount = 100; - testController.asyncDelegate->_itemCounts = {itemCount}; - [window makeKeyAndVisible]; - [window layoutIfNeeded]; - - [cn waitUntilAllUpdatesAreProcessed]; - for (NSInteger i = 0; i < itemCount; i++) { - ASTextCellNodeWithSetSelectedCounter *node = [cn nodeForItemAtIndexPath:[NSIndexPath indexPathForItem:i inSection:0]]; - XCTAssert(node.automaticallyManagesSubnodes, @"Expected test cell node to use automatic subnode management. Can modify the test with a different class if needed."); - ASDisplayNode *subnode = node.textNode; - XCTAssertEqualObjects(NSStringFromASInterfaceState(subnode.interfaceState), NSStringFromASInterfaceState(node.interfaceState), @"Subtree interface state should match cell node interface state for ASM nodes."); - XCTAssert(node.inDisplayState || !node.nodeLoaded, @"Only nodes in the display range should be loaded."); - } - -} - -@end diff --git a/submodules/AsyncDisplayKit/Tests/ASCollectionViewThrashTests.mm b/submodules/AsyncDisplayKit/Tests/ASCollectionViewThrashTests.mm deleted file mode 100644 index 4650639d1f..0000000000 --- a/submodules/AsyncDisplayKit/Tests/ASCollectionViewThrashTests.mm +++ /dev/null @@ -1,217 +0,0 @@ -// -// ASCollectionViewThrashTests.mm -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import -#import -#import -#import - -#import "ASThrashUtility.h" - -@interface ASCollectionViewThrashTests : XCTestCase - -@end - -@implementation ASCollectionViewThrashTests -{ - // The current update, which will be logged in case of a failure. - ASThrashUpdate *_update; - BOOL _failed; -} - -- (void)tearDown -{ - if (_failed && _update != nil) { - NSLog(@"Failed update %@: %@", _update, _update.logFriendlyBase64Representation); - } - _failed = NO; - _update = nil; -} - -// NOTE: Despite the documentation, this is not always called if an exception is caught. -- (void)recordFailureWithDescription:(NSString *)description inFile:(NSString *)filePath atLine:(NSUInteger)lineNumber expected:(BOOL)expected -{ - _failed = YES; - [super recordFailureWithDescription:description inFile:filePath atLine:lineNumber expected:expected]; -} - -- (void)verifyDataSource:(ASThrashDataSource *)ds -{ - CollectionView *collectionView = ds.collectionView; - NSArray *data = [ds data]; - for (NSInteger i = 0; i < collectionView.numberOfSections; i++) { - XCTAssertEqual([collectionView numberOfItemsInSection:i], data[i].items.count); - - for (NSInteger j = 0; j < [collectionView numberOfItemsInSection:i]; j++) { - NSIndexPath *indexPath = [NSIndexPath indexPathForItem:j inSection:i]; - ASThrashTestItem *item = data[i].items[j]; - ASThrashTestNode *node = (ASThrashTestNode *)[collectionView nodeForItemAtIndexPath:indexPath]; - XCTAssertEqualObjects(node.item, item, @"Wrong node at index path %@", indexPath); - } - } -} - -#pragma mark Test Methods - -- (void)testInitialDataRead -{ - ASThrashDataSource *ds = [[ASThrashDataSource alloc] initCollectionViewDataSourceWithData:[ASThrashTestSection sectionsWithCount:kInitialSectionCount]]; - [self verifyDataSource:ds]; -} - -/// Replays the Base64 representation of an ASThrashUpdate from "ASThrashTestRecordedCase" file -- (void)testRecordedThrashCase -{ - NSURL *caseURL = [[NSBundle bundleForClass:[self class]] URLForResource:@"ASThrashTestRecordedCase" withExtension:nil subdirectory:@"TestResources"]; - NSString *base64 = [NSString stringWithContentsOfURL:caseURL encoding:NSUTF8StringEncoding error:NULL]; - - _update = [ASThrashUpdate thrashUpdateWithBase64String:base64]; - if (_update == nil) { - return; - } - - ASThrashDataSource *ds = [[ASThrashDataSource alloc] initCollectionViewDataSourceWithData:_update.oldData]; - [self applyUpdateUsingBatchUpdates:_update - toDataSource:ds - animated:NO - useXCTestWait:YES]; - [self verifyDataSource:ds]; -} - -- (void)testThrashingWildly -{ - for (NSInteger i = 0; i < kThrashingIterationCount; i++) { - [self setUp]; - @autoreleasepool { - NSArray *sections = [ASThrashTestSection sectionsWithCount:kInitialSectionCount]; - _update = [[ASThrashUpdate alloc] initWithData:sections]; - ASThrashDataSource *ds = [[ASThrashDataSource alloc] initCollectionViewDataSourceWithData:sections]; - - [self applyUpdateUsingBatchUpdates:_update - toDataSource:ds - animated:NO - useXCTestWait:NO]; - [self verifyDataSource:ds]; - [self expectationForPredicate:[ds predicateForDeallocatedHierarchy] evaluatedWithObject:(id)kCFNull handler:nil]; - } - [self waitForExpectationsWithTimeout:3 handler:nil]; - - [self tearDown]; - } -} - -- (void)testThrashingWildlyOnSameCollectionView -{ - XCTestExpectation *expectation = [self expectationWithDescription:@"last test ran"]; - ASThrashDataSource *ds = [[ASThrashDataSource alloc] initCollectionViewDataSourceWithData:nil]; - for (NSInteger i = 0; i < 1000; i++) { - [self setUp]; - @autoreleasepool { - NSArray *sections = [ASThrashTestSection sectionsWithCount:kInitialSectionCount]; - _update = [[ASThrashUpdate alloc] initWithData:sections]; - [ds setData:sections]; - [ds.collectionView reloadData]; - - [self applyUpdateUsingBatchUpdates:_update - toDataSource:ds - animated:NO - useXCTestWait:NO]; - [self verifyDataSource:ds]; - if (i == 999) { - [expectation fulfill]; - } - } - - [self tearDown]; - } - [self waitForExpectationsWithTimeout:3 handler:nil]; -} - -- (void)testThrashingWildlyDispatchWildly -{ - XCTestExpectation *expectation = [self expectationWithDescription:@"last test ran"]; - for (NSInteger i = 0; i < kThrashingIterationCount; i++) { - [self setUp]; - @autoreleasepool { - dispatch_async(dispatch_get_main_queue(), ^{ - NSArray *sections = [ASThrashTestSection sectionsWithCount:kInitialSectionCount]; - _update = [[ASThrashUpdate alloc] initWithData:sections]; - ASThrashDataSource *ds = [[ASThrashDataSource alloc] initCollectionViewDataSourceWithData:sections]; - - [self applyUpdateUsingBatchUpdates:_update - toDataSource:ds - animated:NO - useXCTestWait:NO]; - [self verifyDataSource:ds]; - if (i == kThrashingIterationCount-1) { - [expectation fulfill]; - } - }); - } - - [self tearDown]; - } - - [self waitForExpectationsWithTimeout:100 handler:nil]; -} - -#pragma mark Helpers - -- (void)applyUpdateUsingBatchUpdates:(ASThrashUpdate *)update - toDataSource:(ASThrashDataSource *)dataSource animated:(BOOL)animated - useXCTestWait:(BOOL)wait -{ - CollectionView *collectionView = dataSource.collectionView; - - XCTestExpectation *expectation; - if (wait) { - expectation = [self expectationWithDescription:@"Wait for collection view to update"]; - } - - void (^updateBlock)() = ^ void (){ - dataSource.data = update.data; - - [collectionView insertSections:update.insertedSectionIndexes]; - [collectionView deleteSections:update.deletedSectionIndexes]; - [collectionView reloadSections:update.replacedSectionIndexes]; - - [update.insertedItemIndexes enumerateObjectsUsingBlock:^(NSMutableIndexSet * _Nonnull indexes, NSUInteger idx, BOOL * _Nonnull stop) { - NSArray *indexPaths = [indexes indexPathsInSection:idx]; - [collectionView insertItemsAtIndexPaths:indexPaths]; - }]; - - [update.deletedItemIndexes enumerateObjectsUsingBlock:^(NSMutableIndexSet * _Nonnull indexes, NSUInteger idx, BOOL * _Nonnull stop) { - NSArray *indexPaths = [indexes indexPathsInSection:idx]; - [collectionView deleteItemsAtIndexPaths:indexPaths]; - }]; - - [update.replacedItemIndexes enumerateObjectsUsingBlock:^(NSMutableIndexSet * _Nonnull indexes, NSUInteger idx, BOOL * _Nonnull stop) { - NSArray *indexPaths = [indexes indexPathsInSection:idx]; - [collectionView reloadItemsAtIndexPaths:indexPaths]; - }]; - }; - - @try { - [collectionView performBatchAnimated:animated - updates:updateBlock - completion:^(BOOL finished) { - [expectation fulfill]; - }]; - } @catch (NSException *exception) { - _failed = YES; - XCTFail("TEST FAILED"); - @throw exception; - } - - if (wait) { - [self waitForExpectationsWithTimeout:1 handler:nil]; - } -} - -@end diff --git a/submodules/AsyncDisplayKit/Tests/ASCollectionsTests.mm b/submodules/AsyncDisplayKit/Tests/ASCollectionsTests.mm deleted file mode 100644 index ae0313d78c..0000000000 --- a/submodules/AsyncDisplayKit/Tests/ASCollectionsTests.mm +++ /dev/null @@ -1,55 +0,0 @@ -// -// ASCollectionsTests.mm -// Texture -// -// Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import -#import - -@interface ASCollectionsTests : XCTestCase - -@end - -@implementation ASCollectionsTests - -- (void)testTransferArray { - id objs[2]; - objs[0] = [NSObject new]; - id o0 = objs[0]; - objs[1] = [NSObject new]; - __weak id w0 = objs[0]; - __weak id w1 = objs[1]; - CFTypeRef cf0 = (__bridge CFTypeRef)objs[0]; - CFTypeRef cf1 = (__bridge CFTypeRef)objs[1]; - XCTAssertEqual(CFGetRetainCount(cf0), 2); - XCTAssertEqual(CFGetRetainCount(cf1), 1); - NSArray *arr = [NSArray arrayByTransferring:objs count:2]; - XCTAssertNil(objs[0]); - XCTAssertNil(objs[1]); - XCTAssertEqual(CFGetRetainCount(cf0), 2); - XCTAssertEqual(CFGetRetainCount(cf1), 1); - NSArray *immutableCopy = [arr copy]; - XCTAssertEqual(immutableCopy, arr); - XCTAssertEqual(CFGetRetainCount(cf0), 2); - XCTAssertEqual(CFGetRetainCount(cf1), 1); - NSMutableArray *mc = [arr mutableCopy]; - XCTAssertEqual(CFGetRetainCount(cf0), 3); - XCTAssertEqual(CFGetRetainCount(cf1), 2); - arr = nil; - immutableCopy = nil; - XCTAssertEqual(CFGetRetainCount(cf0), 2); - XCTAssertEqual(CFGetRetainCount(cf1), 1); - [mc removeObjectAtIndex:0]; - XCTAssertEqual(CFGetRetainCount(cf0), 1); - XCTAssertEqual(CFGetRetainCount(cf1), 1); - [mc removeObjectAtIndex:0]; - XCTAssertEqual(CFGetRetainCount(cf0), 1); - XCTAssertNil(w1); - o0 = nil; - XCTAssertNil(w0); -} - -@end diff --git a/submodules/AsyncDisplayKit/Tests/ASConfigurationTests.mm b/submodules/AsyncDisplayKit/Tests/ASConfigurationTests.mm deleted file mode 100644 index 6952924851..0000000000 --- a/submodules/AsyncDisplayKit/Tests/ASConfigurationTests.mm +++ /dev/null @@ -1,139 +0,0 @@ -// -// ASConfigurationTests.m -// Texture -// -// Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -#import -#import -#import -#import - -#import "ASTestCase.h" - -static ASExperimentalFeatures features[] = { - ASExperimentalGraphicsContexts, -#if AS_ENABLE_TEXTNODE - ASExperimentalTextNode, -#endif - ASExperimentalInterfaceStateCoalescing, - ASExperimentalUnfairLock, - ASExperimentalLayerDefaults, - ASExperimentalCollectionTeardown, - ASExperimentalFramesetterCache, - ASExperimentalSkipClearData, - ASExperimentalDidEnterPreloadSkipASMLayout, - ASExperimentalDisableAccessibilityCache, - ASExperimentalDispatchApply, - ASExperimentalImageDownloaderPriority, - ASExperimentalTextDrawing -}; - -@interface ASConfigurationTests : ASTestCase - -@end - -@implementation ASConfigurationTests { - void (^onActivate)(ASConfigurationTests *self, ASExperimentalFeatures feature); -} - -+ (NSArray *)names { - return @[ - @"exp_graphics_contexts", - @"exp_text_node", - @"exp_interface_state_coalesce", - @"exp_unfair_lock", - @"exp_infer_layer_defaults", - @"exp_collection_teardown", - @"exp_framesetter_cache", - @"exp_skip_clear_data", - @"exp_did_enter_preload_skip_asm_layout", - @"exp_disable_a11y_cache", - @"exp_dispatch_apply", - @"exp_image_downloader_priority", - @"exp_text_drawing" - ]; -} - -- (ASExperimentalFeatures)allFeatures { - ASExperimentalFeatures allFeatures = 0; - for (int i = 0; i < sizeof(features)/sizeof(ASExperimentalFeatures); i++) { - allFeatures |= features[i]; - } - return allFeatures; -} - -#if AS_ENABLE_TEXTNODE - -- (void)testExperimentalFeatureConfig -{ - // Set the config - ASConfiguration *config = [[ASConfiguration alloc] initWithDictionary:nil]; - config.experimentalFeatures = ASExperimentalGraphicsContexts; - config.delegate = self; - [ASConfigurationManager test_resetWithConfiguration:config]; - - // Set an expectation for a callback, and assert we only get one. - XCTestExpectation *e = [self expectationWithDescription:@"Callbacks done."]; - e.expectedFulfillmentCount = 2; - e.assertForOverFulfill = YES; - onActivate = ^(ASConfigurationTests *self, ASExperimentalFeatures feature) { - [e fulfill]; - }; - - // Now activate the graphics experiment and expect it works. - XCTAssertTrue(ASActivateExperimentalFeature(ASExperimentalGraphicsContexts)); - // We should get a callback here - // Now activate text node and expect it fails. - XCTAssertFalse(ASActivateExperimentalFeature(ASExperimentalTextNode)); - // But we should get another callback. - [self waitForExpectationsWithTimeout:3 handler:nil]; -} - -#endif - -- (void)textureDidActivateExperimentalFeatures:(ASExperimentalFeatures)feature -{ - if (onActivate) { - onActivate(self, feature); - } -} - -- (void)testMappingNamesToFlags -{ - // Throw in a bad bit. - ASExperimentalFeatures allFeatures = [self allFeatures]; - ASExperimentalFeatures featuresWithBadBit = allFeatures | (1 << 22); - NSArray *expectedNames = [ASConfigurationTests names]; - XCTAssertEqualObjects(expectedNames, ASExperimentalFeaturesGetNames(featuresWithBadBit)); -} - -- (void)testMappingFlagsFromNames -{ - // Throw in a bad name. - NSMutableArray *allNames = [[NSMutableArray alloc] initWithArray:[ASConfigurationTests names]]; - [allNames addObject:@"__invalid_name"]; - ASExperimentalFeatures expected = [self allFeatures]; - XCTAssertEqual(expected, ASExperimentalFeaturesFromArray(allNames)); -} - -- (void)testFlagMatchName -{ - NSArray *names = [ASConfigurationTests names]; - for (NSInteger i = 0; i < names.count; i++) { - XCTAssertEqual(features[i], ASExperimentalFeaturesFromArray(@[names[i]])); - } -} - -- (void)testNameMatchFlag { - NSArray *names = [ASConfigurationTests names]; - for (NSInteger i = 0; i < names.count; i++) { - XCTAssertEqualObjects(@[names[i]], ASExperimentalFeaturesGetNames(features[i])); - } -} - -@end diff --git a/submodules/AsyncDisplayKit/Tests/ASControlNodeTests.mm b/submodules/AsyncDisplayKit/Tests/ASControlNodeTests.mm deleted file mode 100644 index e1c0150a0d..0000000000 --- a/submodules/AsyncDisplayKit/Tests/ASControlNodeTests.mm +++ /dev/null @@ -1,225 +0,0 @@ -// -// ASControlNodeTests.mm -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -#import -#import - -#define ACTION @selector(action) -#define ACTION_SENDER @selector(action:) -#define ACTION_SENDER_EVENT @selector(action:event:) -#define EVENT ASControlNodeEventTouchUpInside - -@interface ReceiverController : UIViewController -@property (nonatomic) NSInteger hits; -@end -@implementation ReceiverController -@end - -@interface ASActionController : ReceiverController -@end -@implementation ASActionController -- (void)action { self.hits++; } -- (void)firstAction { } -- (void)secondAction { } -- (void)thirdAction { } -@end - -@interface ASActionSenderController : ReceiverController -@end -@implementation ASActionSenderController -- (void)action:(id)sender { self.hits++; } -@end - -@interface ASActionSenderEventController : ReceiverController -@end -@implementation ASActionSenderEventController -- (void)action:(id)sender event:(UIEvent *)event { self.hits++; } -@end - -@interface ASGestureController : ReceiverController -@end -@implementation ASGestureController -- (void)onGesture:(UIGestureRecognizer *)recognizer { self.hits++; } -- (void)action:(id)sender { self.hits++; } -@end - -@interface ASControlNodeTests : XCTestCase - -@end - -@implementation ASControlNodeTests - -- (void)testActionWithoutParameters { - ASActionController *controller = [[ASActionController alloc] init]; - ASControlNode *node = [[ASControlNode alloc] init]; - [node addTarget:controller action:ACTION forControlEvents:EVENT]; - [controller.view addSubview:node.view]; - [node sendActionsForControlEvents:EVENT withEvent:nil]; - XCTAssert(controller.hits == 1, @"Controller did not receive the action event"); -} - -- (void)testActionAndSender { - ASActionSenderController *controller = [[ASActionSenderController alloc] init]; - ASControlNode *node = [[ASControlNode alloc] init]; - [node addTarget:controller action:ACTION_SENDER forControlEvents:EVENT]; - [controller.view addSubview:node.view]; - [node sendActionsForControlEvents:EVENT withEvent:nil]; - XCTAssert(controller.hits == 1, @"Controller did not receive the action event"); -} - -- (void)testActionAndSenderAndEvent { - ASActionSenderEventController *controller = [[ASActionSenderEventController alloc] init]; - ASControlNode *node = [[ASControlNode alloc] init]; - [node addTarget:controller action:ACTION_SENDER_EVENT forControlEvents:EVENT]; - [controller.view addSubview:node.view]; - [node sendActionsForControlEvents:EVENT withEvent:nil]; - XCTAssert(controller.hits == 1, @"Controller did not receive the action event"); -} - -- (void)testActionWithoutTarget { - ASActionController *controller = [[ASActionController alloc] init]; - ASControlNode *node = [[ASControlNode alloc] init]; - [node addTarget:nil action:ACTION forControlEvents:EVENT]; - [controller.view addSubview:node.view]; - [node sendActionsForControlEvents:EVENT withEvent:nil]; - XCTAssert(controller.hits == 1, @"Controller did not receive the action event"); -} - -- (void)testActionAndSenderWithoutTarget { - ASActionSenderController *controller = [[ASActionSenderController alloc] init]; - ASControlNode *node = [[ASControlNode alloc] init]; - [node addTarget:nil action:ACTION_SENDER forControlEvents:EVENT]; - [controller.view addSubview:node.view]; - [node sendActionsForControlEvents:EVENT withEvent:nil]; - XCTAssert(controller.hits == 1, @"Controller did not receive the action event"); -} - -- (void)testActionAndSenderAndEventWithoutTarget { - ASActionSenderEventController *controller = [[ASActionSenderEventController alloc] init]; - ASControlNode *node = [[ASControlNode alloc] init]; - [node addTarget:nil action:ACTION_SENDER_EVENT forControlEvents:EVENT]; - [controller.view addSubview:node.view]; - [node sendActionsForControlEvents:EVENT withEvent:nil]; - XCTAssert(controller.hits == 1, @"Controller did not receive the action event"); -} - -- (void)testRemoveWithoutTargetRemovesTargetlessAction { - ASActionSenderEventController *controller = [[ASActionSenderEventController alloc] init]; - ASControlNode *node = [[ASControlNode alloc] init]; - [node addTarget:nil action:ACTION_SENDER_EVENT forControlEvents:EVENT]; - [node removeTarget:nil action:ACTION_SENDER_EVENT forControlEvents:EVENT]; - [controller.view addSubview:node.view]; - [node sendActionsForControlEvents:EVENT withEvent:nil]; - XCTAssertEqual(controller.hits, 0, @"Controller did not receive exactly zero action events"); -} - -- (void)testRemoveWithTarget { - ASActionSenderEventController *controller = [[ASActionSenderEventController alloc] init]; - ASControlNode *node = [[ASControlNode alloc] init]; - [node addTarget:controller action:ACTION_SENDER_EVENT forControlEvents:EVENT]; - [node removeTarget:controller action:ACTION_SENDER_EVENT forControlEvents:EVENT]; - [controller.view addSubview:node.view]; - [node sendActionsForControlEvents:EVENT withEvent:nil]; - XCTAssertEqual(controller.hits, 0, @"Controller did not receive exactly zero action events"); -} - -- (void)testRemoveWithTargetRemovesAction { - ASActionSenderEventController *controller = [[ASActionSenderEventController alloc] init]; - ASControlNode *node = [[ASControlNode alloc] init]; - [node addTarget:controller action:ACTION_SENDER_EVENT forControlEvents:EVENT]; - [node removeTarget:controller action:ACTION_SENDER_EVENT forControlEvents:EVENT]; - [controller.view addSubview:node.view]; - [node sendActionsForControlEvents:EVENT withEvent:nil]; - XCTAssertEqual(controller.hits, 0, @"Controller did not receive exactly zero action events"); -} - -- (void)testRemoveWithoutTargetRemovesTargetedAction { - ASActionSenderEventController *controller = [[ASActionSenderEventController alloc] init]; - ASControlNode *node = [[ASControlNode alloc] init]; - [node addTarget:controller action:ACTION_SENDER_EVENT forControlEvents:EVENT]; - [node removeTarget:nil action:ACTION_SENDER_EVENT forControlEvents:EVENT]; - [controller.view addSubview:node.view]; - [node sendActionsForControlEvents:EVENT withEvent:nil]; - XCTAssertEqual(controller.hits, 0, @"Controller did not receive exactly zero action events"); -} - -- (void)testDuplicateEntriesWithoutTarget { - ASActionSenderEventController *controller = [[ASActionSenderEventController alloc] init]; - ASControlNode *node = [[ASControlNode alloc] init]; - [node addTarget:nil action:ACTION_SENDER_EVENT forControlEvents:EVENT]; - [node addTarget:nil action:ACTION_SENDER_EVENT forControlEvents:EVENT]; - [controller.view addSubview:node.view]; - [node sendActionsForControlEvents:EVENT withEvent:nil]; - XCTAssertEqual(controller.hits, 1, @"Controller did not receive exactly one action event"); -} - -- (void)testDuplicateEntriesWithTarget { - ASActionSenderEventController *controller = [[ASActionSenderEventController alloc] init]; - ASControlNode *node = [[ASControlNode alloc] init]; - [node addTarget:controller action:ACTION_SENDER_EVENT forControlEvents:EVENT]; - [node addTarget:controller action:ACTION_SENDER_EVENT forControlEvents:EVENT]; - [controller.view addSubview:node.view]; - [node sendActionsForControlEvents:EVENT withEvent:nil]; - XCTAssertEqual(controller.hits, 1, @"Controller did not receive exactly one action event"); -} - -- (void)testDuplicateEntriesWithAndWithoutTarget { - ASActionSenderEventController *controller = [[ASActionSenderEventController alloc] init]; - ASControlNode *node = [[ASControlNode alloc] init]; - [node addTarget:controller action:ACTION_SENDER_EVENT forControlEvents:EVENT]; - [node addTarget:nil action:ACTION_SENDER_EVENT forControlEvents:EVENT]; - [controller.view addSubview:node.view]; - [node sendActionsForControlEvents:EVENT withEvent:nil]; - XCTAssertEqual(controller.hits, 2, @"Controller did not receive exactly two action events"); -} - -- (void)testDeeperHierarchyWithoutTarget { - ASActionController *controller = [[ASActionController alloc] init]; - UIView *view = [[UIView alloc] init]; - ASControlNode *node = [[ASControlNode alloc] init]; - [node addTarget:nil action:ACTION forControlEvents:EVENT]; - [view addSubview:node.view]; - [controller.view addSubview:view]; - [node sendActionsForControlEvents:EVENT withEvent:nil]; - XCTAssert(controller.hits == 1, @"Controller did not receive the action event"); -} - -- (void)testTouchesWorkWithGestures { - ASGestureController *controller = [[ASGestureController alloc] init]; - ASControlNode *node = [[ASControlNode alloc] init]; - [node addTarget:controller action:@selector(action:) forControlEvents:ASControlNodeEventTouchUpInside]; - [node.view addGestureRecognizer:[[UITapGestureRecognizer alloc] initWithTarget:controller action:@selector(onGesture:)]]; - [controller.view addSubnode:node]; - - [node sendActionsForControlEvents:EVENT withEvent:nil]; - XCTAssert(controller.hits == 1, @"Controller did not receive the tap event"); -} - -- (void)testActionsAreCalledInTheSameOrderAsTheyWereAdded { - ASActionController *controller = [[ASActionController alloc] init]; - ASControlNode *node = [[ASControlNode alloc] init]; - [node addTarget:controller action:@selector(firstAction) forControlEvents:ASControlNodeEventTouchUpInside]; - [node addTarget:controller action:@selector(secondAction) forControlEvents:ASControlNodeEventTouchUpInside]; - [node addTarget:controller action:@selector(thirdAction) forControlEvents:ASControlNodeEventTouchUpInside]; - [controller.view addSubnode:node]; - - id controllerMock = [OCMockObject partialMockForObject:controller]; - [controllerMock setExpectationOrderMatters:YES]; - [[controllerMock expect] firstAction]; - [[controllerMock expect] secondAction]; - [[controllerMock expect] thirdAction]; - - [node sendActionsForControlEvents:ASControlNodeEventTouchUpInside withEvent:nil]; - - [controllerMock verify]; -} - -@end diff --git a/submodules/AsyncDisplayKit/Tests/ASCornerLayoutSpecSnapshotTests.mm b/submodules/AsyncDisplayKit/Tests/ASCornerLayoutSpecSnapshotTests.mm deleted file mode 100644 index 2c496cd595..0000000000 --- a/submodules/AsyncDisplayKit/Tests/ASCornerLayoutSpecSnapshotTests.mm +++ /dev/null @@ -1,215 +0,0 @@ -// -// ASCornerLayoutSpecSnapshotTests.mm -// Texture -// -// Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import "ASLayoutSpecSnapshotTestsHelper.h" -#import -#import - -typedef NS_ENUM(NSInteger, ASCornerLayoutSpecSnapshotTestsOffsetOption) { - ASCornerLayoutSpecSnapshotTestsOffsetOptionCenter, - ASCornerLayoutSpecSnapshotTestsOffsetOptionInner, - ASCornerLayoutSpecSnapshotTestsOffsetOptionOuter, -}; - - -@interface ASCornerLayoutSpecSnapshotTests : ASLayoutSpecSnapshotTestCase - -@property (nonatomic, copy) UIColor *boxColor; -@property (nonatomic, copy) UIColor *baseColor; -@property (nonatomic, copy) UIColor *cornerColor; -@property (nonatomic, copy) UIColor *contextColor; - -@property (nonatomic) CGSize baseSize; -@property (nonatomic) CGSize cornerSize; -@property (nonatomic) CGSize contextSize; - -@property (nonatomic) ASSizeRange contextSizeRange; - -@end - - -@implementation ASCornerLayoutSpecSnapshotTests - -- (void)setUp -{ - [super setUp]; - - self.recordMode = NO; - - _boxColor = [UIColor greenColor]; - _baseColor = [UIColor blueColor]; - _cornerColor = [UIColor orangeColor]; - _contextColor = [UIColor lightGrayColor]; - - _baseSize = CGSizeMake(60, 60); - _cornerSize = CGSizeMake(20, 20); - _contextSize = CGSizeMake(120, 120); - - _contextSizeRange = ASSizeRangeMake(CGSizeZero, _contextSize); -} - -- (void)testCornerSpecForAllLocations -{ - ASCornerLayoutSpecSnapshotTestsOffsetOption center = ASCornerLayoutSpecSnapshotTestsOffsetOptionCenter; - - [self testCornerSpecWithLocation:ASCornerLayoutLocationTopLeft offsetOption:center wrapsCorner:NO]; - [self testCornerSpecWithLocation:ASCornerLayoutLocationTopLeft offsetOption:center wrapsCorner:YES]; - - [self testCornerSpecWithLocation:ASCornerLayoutLocationTopRight offsetOption:center wrapsCorner:NO]; - [self testCornerSpecWithLocation:ASCornerLayoutLocationTopRight offsetOption:center wrapsCorner:YES]; - - [self testCornerSpecWithLocation:ASCornerLayoutLocationBottomLeft offsetOption:center wrapsCorner:NO]; - [self testCornerSpecWithLocation:ASCornerLayoutLocationBottomLeft offsetOption:center wrapsCorner:YES]; - - [self testCornerSpecWithLocation:ASCornerLayoutLocationBottomRight offsetOption:center wrapsCorner:NO]; - [self testCornerSpecWithLocation:ASCornerLayoutLocationBottomRight offsetOption:center wrapsCorner:YES]; -} - -- (void)testCornerSpecForAllLocationsWithInnerOffset -{ - ASCornerLayoutSpecSnapshotTestsOffsetOption inner = ASCornerLayoutSpecSnapshotTestsOffsetOptionInner; - - [self testCornerSpecWithLocation:ASCornerLayoutLocationTopLeft offsetOption:inner wrapsCorner:NO]; - [self testCornerSpecWithLocation:ASCornerLayoutLocationTopLeft offsetOption:inner wrapsCorner:YES]; - - [self testCornerSpecWithLocation:ASCornerLayoutLocationTopRight offsetOption:inner wrapsCorner:NO]; - [self testCornerSpecWithLocation:ASCornerLayoutLocationTopRight offsetOption:inner wrapsCorner:YES]; - - [self testCornerSpecWithLocation:ASCornerLayoutLocationBottomLeft offsetOption:inner wrapsCorner:NO]; - [self testCornerSpecWithLocation:ASCornerLayoutLocationBottomLeft offsetOption:inner wrapsCorner:YES]; - - [self testCornerSpecWithLocation:ASCornerLayoutLocationBottomRight offsetOption:inner wrapsCorner:NO]; - [self testCornerSpecWithLocation:ASCornerLayoutLocationBottomRight offsetOption:inner wrapsCorner:YES]; -} - -- (void)testCornerSpecForAllLocationsWithOuterOffset -{ - ASCornerLayoutSpecSnapshotTestsOffsetOption outer = ASCornerLayoutSpecSnapshotTestsOffsetOptionOuter; - - [self testCornerSpecWithLocation:ASCornerLayoutLocationTopLeft offsetOption:outer wrapsCorner:NO]; - [self testCornerSpecWithLocation:ASCornerLayoutLocationTopLeft offsetOption:outer wrapsCorner:YES]; - - [self testCornerSpecWithLocation:ASCornerLayoutLocationTopRight offsetOption:outer wrapsCorner:NO]; - [self testCornerSpecWithLocation:ASCornerLayoutLocationTopRight offsetOption:outer wrapsCorner:YES]; - - [self testCornerSpecWithLocation:ASCornerLayoutLocationBottomLeft offsetOption:outer wrapsCorner:NO]; - [self testCornerSpecWithLocation:ASCornerLayoutLocationBottomLeft offsetOption:outer wrapsCorner:YES]; - - [self testCornerSpecWithLocation:ASCornerLayoutLocationBottomRight offsetOption:outer wrapsCorner:NO]; - [self testCornerSpecWithLocation:ASCornerLayoutLocationBottomRight offsetOption:outer wrapsCorner:YES]; -} - -- (void)testCornerSpecWithLocation:(ASCornerLayoutLocation)location - offsetOption:(ASCornerLayoutSpecSnapshotTestsOffsetOption)offsetOption - wrapsCorner:(BOOL)wrapsCorner -{ - ASDisplayNode *baseNode = ASDisplayNodeWithBackgroundColor(_baseColor, _baseSize); - ASDisplayNode *cornerNode = ASDisplayNodeWithBackgroundColor(_cornerColor, _cornerSize); - ASDisplayNode *debugBoxNode = ASDisplayNodeWithBackgroundColor(_boxColor); - - baseNode.style.layoutPosition = CGPointMake((_contextSize.width - _baseSize.width) / 2, - (_contextSize.height - _baseSize.height) / 2); - - ASCornerLayoutSpec *cornerSpec = [ASCornerLayoutSpec cornerLayoutSpecWithChild:baseNode - corner:cornerNode - location:location]; - - CGPoint delta = (CGPoint){ _cornerSize.width / 2, _cornerSize.height / 2 }; - cornerSpec.offset = [self offsetForOption:offsetOption location:location delta:delta]; - cornerSpec.wrapsCorner = wrapsCorner; - - ASBackgroundLayoutSpec *backgroundSpec = [ASBackgroundLayoutSpec backgroundLayoutSpecWithChild:cornerSpec - background:debugBoxNode]; - - [self testLayoutSpec:backgroundSpec - sizeRange:_contextSizeRange - subnodes:@[debugBoxNode, baseNode, cornerNode] - identifier:[self suffixWithLocation:location option:offsetOption wrapsCorner:wrapsCorner]]; -} - -- (CGPoint)offsetForOption:(ASCornerLayoutSpecSnapshotTestsOffsetOption)option - location:(ASCornerLayoutLocation)location - delta:(CGPoint)delta -{ - CGFloat x = delta.x; - CGFloat y = delta.y; - - switch (option) { - - case ASCornerLayoutSpecSnapshotTestsOffsetOptionCenter: - return CGPointZero; - - case ASCornerLayoutSpecSnapshotTestsOffsetOptionInner: - - switch (location) { - case ASCornerLayoutLocationTopLeft: return (CGPoint){ x, y }; - case ASCornerLayoutLocationTopRight: return (CGPoint){ -x, y }; - case ASCornerLayoutLocationBottomLeft: return (CGPoint){ x, -y }; - case ASCornerLayoutLocationBottomRight: return (CGPoint){ -x, -y }; - } - - case ASCornerLayoutSpecSnapshotTestsOffsetOptionOuter: - - switch (location) { - case ASCornerLayoutLocationTopLeft: return (CGPoint){ -x, -y }; - case ASCornerLayoutLocationTopRight: return (CGPoint){ x, -y }; - case ASCornerLayoutLocationBottomLeft: return (CGPoint){ -x, y }; - case ASCornerLayoutLocationBottomRight: return (CGPoint){ x, y }; - } - - } - -} - -- (NSString *)suffixWithLocation:(ASCornerLayoutLocation)location - option:(ASCornerLayoutSpecSnapshotTestsOffsetOption)option - wrapsCorner:(BOOL)wrapsCorner -{ - NSMutableString *desc = [NSMutableString string]; - - switch (location) { - case ASCornerLayoutLocationTopLeft: - [desc appendString:@"topLeft"]; - break; - case ASCornerLayoutLocationTopRight: - [desc appendString:@"topRight"]; - break; - case ASCornerLayoutLocationBottomLeft: - [desc appendString:@"bottomLeft"]; - break; - case ASCornerLayoutLocationBottomRight: - [desc appendString:@"bottomRight"]; - break; - } - - [desc appendString:@"_"]; - - switch (option) { - case ASCornerLayoutSpecSnapshotTestsOffsetOptionCenter: - [desc appendString:@"center"]; - break; - case ASCornerLayoutSpecSnapshotTestsOffsetOptionInner: - [desc appendString:@"inner"]; - break; - case ASCornerLayoutSpecSnapshotTestsOffsetOptionOuter: - [desc appendString:@"outer"]; - break; - } - - [desc appendString:@"_"]; - - if (wrapsCorner) { - [desc appendString:@"fullSize"]; - } else { - [desc appendString:@"childSize"]; - } - - return desc.copy; -} - -@end diff --git a/submodules/AsyncDisplayKit/Tests/ASDimensionTests.mm b/submodules/AsyncDisplayKit/Tests/ASDimensionTests.mm deleted file mode 100644 index c3e30ae63c..0000000000 --- a/submodules/AsyncDisplayKit/Tests/ASDimensionTests.mm +++ /dev/null @@ -1,106 +0,0 @@ -// -// ASDimensionTests.mm -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import -#import - -#import "ASXCTExtensions.h" - - -@interface ASDimensionTests : XCTestCase -@end - -@implementation ASDimensionTests - -- (void)testCreatingDimensionUnitAutos -{ - XCTAssertNoThrow(ASDimensionMake(ASDimensionUnitAuto, 0)); - XCTAssertThrows(ASDimensionMake(ASDimensionUnitAuto, 100)); - ASXCTAssertEqualDimensions(ASDimensionAuto, ASDimensionMake(@"")); - ASXCTAssertEqualDimensions(ASDimensionAuto, ASDimensionMake(@"auto")); -} - -- (void)testCreatingDimensionUnitFraction -{ - XCTAssertNoThrow(ASDimensionMake(ASDimensionUnitFraction, 0.5)); - ASXCTAssertEqualDimensions(ASDimensionMake(ASDimensionUnitFraction, 0.5), ASDimensionMake(@"50%")); -} - -- (void)testCreatingDimensionUnitPoints -{ - XCTAssertNoThrow(ASDimensionMake(ASDimensionUnitPoints, 100)); - ASXCTAssertEqualDimensions(ASDimensionMake(ASDimensionUnitPoints, 100), ASDimensionMake(@"100pt")); -} - -- (void)testIntersectingOverlappingSizeRangesReturnsTheirIntersection -{ - // range: |---------| - // other: |----------| - // result: |----| - - ASSizeRange range = {{0,0}, {10,10}}; - ASSizeRange other = {{7,7}, {15,15}}; - ASSizeRange result = ASSizeRangeIntersect(range, other); - ASSizeRange expected = {{7,7}, {10,10}}; - XCTAssertTrue(ASSizeRangeEqualToSizeRange(result, expected), @"Expected %@ but got %@", NSStringFromASSizeRange(expected), NSStringFromASSizeRange(result)); -} - -- (void)testIntersectingSizeRangeWithRangeThatContainsItReturnsSameRange -{ - // range: |-----| - // other: |---------| - // result: |-----| - - ASSizeRange range = {{2,2}, {8,8}}; - ASSizeRange other = {{0,0}, {10,10}}; - ASSizeRange result = ASSizeRangeIntersect(range, other); - ASSizeRange expected = {{2,2}, {8,8}}; - XCTAssertTrue(ASSizeRangeEqualToSizeRange(result, expected), @"Expected %@ but got %@", NSStringFromASSizeRange(expected), NSStringFromASSizeRange(result)); -} - -- (void)testIntersectingSizeRangeWithRangeContainedWithinItReturnsContainedRange -{ - // range: |---------| - // other: |-----| - // result: |-----| - - ASSizeRange range = {{0,0}, {10,10}}; - ASSizeRange other = {{2,2}, {8,8}}; - ASSizeRange result = ASSizeRangeIntersect(range, other); - ASSizeRange expected = {{2,2}, {8,8}}; - XCTAssertTrue(ASSizeRangeEqualToSizeRange(result, expected), @"Expected %@ but got %@", NSStringFromASSizeRange(expected), NSStringFromASSizeRange(result)); -} - -- (void)testIntersectingSizeRangeWithNonOverlappingRangeToRightReturnsSinglePointNearestOtherRange -{ - // range: |-----| - // other: |---| - // result: * - - ASSizeRange range = {{0,0}, {5,5}}; - ASSizeRange other = {{10,10}, {15,15}}; - ASSizeRange result = ASSizeRangeIntersect(range, other); - ASSizeRange expected = {{5,5}, {5,5}}; - XCTAssertTrue(ASSizeRangeEqualToSizeRange(result, expected), @"Expected %@ but got %@", NSStringFromASSizeRange(expected), NSStringFromASSizeRange(result)); -} - -- (void)testIntersectingSizeRangeWithNonOverlappingRangeToLeftReturnsSinglePointNearestOtherRange -{ - // range: |---| - // other: |-----| - // result: * - - ASSizeRange range = {{10,10}, {15,15}}; - ASSizeRange other = {{0,0}, {5,5}}; - ASSizeRange result = ASSizeRangeIntersect(range, other); - ASSizeRange expected = {{10,10}, {10,10}}; - XCTAssertTrue(ASSizeRangeEqualToSizeRange(result, expected), @"Expected %@ but got %@", NSStringFromASSizeRange(expected), NSStringFromASSizeRange(result)); -} - -@end diff --git a/submodules/AsyncDisplayKit/Tests/ASDispatchTests.mm b/submodules/AsyncDisplayKit/Tests/ASDispatchTests.mm deleted file mode 100644 index a90bce7ed8..0000000000 --- a/submodules/AsyncDisplayKit/Tests/ASDispatchTests.mm +++ /dev/null @@ -1,64 +0,0 @@ -// -// ASDispatchTests.mm -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import -#import - -@interface ASDispatchTests : XCTestCase - -@end - -@implementation ASDispatchTests - -- (void)testDispatchApply -{ - dispatch_queue_t q = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0); - NSInteger expectedThreadCount = [NSProcessInfo processInfo].activeProcessorCount * 2; - NSLock *lock = [NSLock new]; - NSMutableSet *threads = [NSMutableSet set]; - NSMutableIndexSet *indices = [NSMutableIndexSet indexSet]; - - size_t const iterations = 1E5; - ASDispatchApply(iterations, q, 0, ^(size_t i) { - [lock lock]; - [threads addObject:[NSThread currentThread]]; - XCTAssertFalse([indices containsIndex:i]); - [indices addIndex:i]; - [lock unlock]; - }); - XCTAssertLessThanOrEqual(threads.count, expectedThreadCount); - XCTAssertEqualObjects(indices, [NSIndexSet indexSetWithIndexesInRange:NSMakeRange(0, iterations)]); -} - -- (void)testDispatchAsync -{ - dispatch_queue_t q = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0); - NSInteger expectedThreadCount = [NSProcessInfo processInfo].activeProcessorCount * 2; - NSLock *lock = [NSLock new]; - NSMutableSet *threads = [NSMutableSet set]; - NSMutableIndexSet *indices = [NSMutableIndexSet indexSet]; - XCTestExpectation *expectation = [self expectationWithDescription:@"Executed all blocks"]; - - size_t const iterations = 1E5; - ASDispatchAsync(iterations, q, 0, ^(size_t i) { - [lock lock]; - [threads addObject:[NSThread currentThread]]; - XCTAssertFalse([indices containsIndex:i]); - [indices addIndex:i]; - if (indices.count == iterations) { - [expectation fulfill]; - } - [lock unlock]; - }); - [self waitForExpectationsWithTimeout:10 handler:nil]; - XCTAssertLessThanOrEqual(threads.count, expectedThreadCount); - XCTAssertEqualObjects(indices, [NSIndexSet indexSetWithIndexesInRange:NSMakeRange(0, iterations)]); -} - -@end diff --git a/submodules/AsyncDisplayKit/Tests/ASDisplayLayerTests.mm b/submodules/AsyncDisplayKit/Tests/ASDisplayLayerTests.mm deleted file mode 100644 index 2e03eb6da2..0000000000 --- a/submodules/AsyncDisplayKit/Tests/ASDisplayLayerTests.mm +++ /dev/null @@ -1,598 +0,0 @@ -// -// ASDisplayLayerTests.mm -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -#import -#import -#import - -#import - -#import "ASDisplayNodeTestsHelper.h" - -static UIImage *bogusImage() { - static UIImage *bogusImage = nil; - static dispatch_once_t onceToken; - dispatch_once(&onceToken, ^{ - - UIGraphicsBeginImageContext(CGSizeMake(10, 10)); - - bogusImage = UIGraphicsGetImageFromCurrentImageContext(); - - UIGraphicsEndImageContext(); - - }); - - return bogusImage; -} - -@interface _ASDisplayLayerTestContainerLayer : CALayer -@property (nonatomic, readonly) NSUInteger didCompleteTransactionCount; -@end - -@implementation _ASDisplayLayerTestContainerLayer - -- (void)asyncdisplaykit_asyncTransactionContainerDidCompleteTransaction:(_ASAsyncTransaction *)transaction -{ - _didCompleteTransactionCount++; -} - -@end - - -@interface ASDisplayNode (HackForTests) -- (id)initWithViewClass:(Class)viewClass; -- (id)initWithLayerClass:(Class)layerClass; -@end - - -@interface _ASDisplayLayerTestLayer : _ASDisplayLayer -{ - BOOL _isInCancelAsyncDisplay; - BOOL _isInDisplay; -} -@property (nonatomic, readonly) NSUInteger displayCount; -@property (nonatomic, readonly) NSUInteger drawInContextCount; -@property (nonatomic, readonly) NSUInteger setContentsAsyncCount; -@property (nonatomic, readonly) NSUInteger setContentsSyncCount; -@property (nonatomic, copy, readonly) NSString *setContentsCounts; -- (BOOL)checkSetContentsCountsWithSyncCount:(NSUInteger)syncCount asyncCount:(NSUInteger)asyncCount; -@end - -@implementation _ASDisplayLayerTestLayer - -- (NSString *)setContentsCounts -{ - return [NSString stringWithFormat:@"syncCount:%tu, asyncCount:%tu", _setContentsSyncCount, _setContentsAsyncCount]; -} - -- (BOOL)checkSetContentsCountsWithSyncCount:(NSUInteger)syncCount asyncCount:(NSUInteger)asyncCount -{ - return ((syncCount == _setContentsSyncCount) && - (asyncCount == _setContentsAsyncCount)); -} - -- (void)setContents:(id)contents -{ - [super setContents:contents]; - - if (self.displaysAsynchronously) { - if (_isInDisplay) { - [NSException raise:NSInvalidArgumentException format:@"There is no placeholder logic in _ASDisplayLayer, unknown caller for setContents:"]; - } else if (!_isInCancelAsyncDisplay) { - _setContentsAsyncCount++; - } - } else { - _setContentsSyncCount++; - } -} - -- (void)display -{ - _isInDisplay = YES; - [super display]; - _isInDisplay = NO; - _displayCount++; -} - -- (void)cancelAsyncDisplay -{ - _isInCancelAsyncDisplay = YES; - [super cancelAsyncDisplay]; - _isInCancelAsyncDisplay = NO; -} - -// This should never get called. This just records if it is. -- (void)drawInContext:(CGContextRef)context -{ - [super drawInContext:context]; - _drawInContextCount++; -} - -@end - -typedef NS_ENUM(NSUInteger, _ASDisplayLayerTestDelegateMode) -{ - _ASDisplayLayerTestDelegateModeNone = 0, - _ASDisplayLayerTestDelegateModeDrawParameters = 1 << 0, - _ASDisplayLayerTestDelegateModeWillDisplay = 1 << 1, - _ASDisplayLayerTestDelegateModeDidDisplay = 1 << 2, -}; - -typedef NS_ENUM(NSUInteger, _ASDisplayLayerTestDelegateClassModes) { - _ASDisplayLayerTestDelegateClassModeNone = 0, - _ASDisplayLayerTestDelegateClassModeDisplay = 1 << 0, - _ASDisplayLayerTestDelegateClassModeDrawInContext = 1 << 1, -}; - -@interface _ASDisplayLayerTestDelegate : ASDisplayNode <_ASDisplayLayerDelegate> - -@property (nonatomic) NSUInteger didDisplayCount; -@property (nonatomic) NSUInteger drawParametersCount; -@property (nonatomic) NSUInteger willDisplayCount; - -// for _ASDisplayLayerTestDelegateModeClassDisplay -@property (nonatomic) NSUInteger displayCount; -@property (nonatomic) UIImage *(^displayLayerBlock)(void); - -// for _ASDisplayLayerTestDelegateModeClassDrawInContext -@property (nonatomic) NSUInteger drawRectCount; - -@end - -@implementation _ASDisplayLayerTestDelegate { - _ASDisplayLayerTestDelegateMode _modes; -} - -static _ASDisplayLayerTestDelegateClassModes _class_modes; - -+ (void)setClassModes:(_ASDisplayLayerTestDelegateClassModes)classModes -{ - _class_modes = classModes; -} - -- (id)initWithModes:(_ASDisplayLayerTestDelegateMode)modes -{ - _modes = modes; - - if (!(self = [super initWithLayerClass:[_ASDisplayLayerTestLayer class]])) - return nil; - - return self; -} - -- (void)didDisplayAsyncLayer:(_ASDisplayLayer *)layer -{ - _didDisplayCount++; -} - -- (NSObject *)drawParametersForAsyncLayer:(_ASDisplayLayer *)layer -{ - _drawParametersCount++; - return self; -} - -- (void)willDisplayAsyncLayer:(_ASDisplayLayer *)layer -{ - _willDisplayCount++; -} - -- (BOOL)respondsToSelector:(SEL)selector -{ - if (sel_isEqual(selector, @selector(didDisplayAsyncLayer:))) { - return (_modes & _ASDisplayLayerTestDelegateModeDidDisplay); - } else if (sel_isEqual(selector, @selector(drawParametersForAsyncLayer:))) { - return (_modes & _ASDisplayLayerTestDelegateModeDrawParameters); - } else if (sel_isEqual(selector, @selector(willDisplayAsyncLayer:))) { - return (_modes & _ASDisplayLayerTestDelegateModeWillDisplay); - } else { - return [super respondsToSelector:selector]; - } -} - -+ (BOOL)respondsToSelector:(SEL)selector -{ - if (sel_isEqual(selector, @selector(displayWithParameters:isCancelled:))) { - return _class_modes & _ASDisplayLayerTestDelegateClassModeDisplay; - } else if (sel_isEqual(selector, @selector(drawRect:withParameters:isCancelled:isRasterizing:))) { - return _class_modes & _ASDisplayLayerTestDelegateClassModeDrawInContext; - } else { - return [super respondsToSelector:selector]; - } -} - -// DANGER: Don't use the delegate as the parameters in real code; this is not thread-safe and just for accounting in unit tests! -+ (UIImage *)displayWithParameters:(_ASDisplayLayerTestDelegate *)delegate isCancelled:(NS_NOESCAPE asdisplaynode_iscancelled_block_t)sentinelBlock -{ - UIImage *contents = bogusImage(); - if (delegate->_displayLayerBlock != NULL) { - contents = delegate->_displayLayerBlock(); - } - delegate->_displayCount++; - return contents; -} - -// DANGER: Don't use the delegate as the parameters in real code; this is not thread-safe and just for accounting in unit tests! -+ (void)drawRect:(CGRect)bounds withParameters:(_ASDisplayLayerTestDelegate *)delegate isCancelled:(NS_NOESCAPE asdisplaynode_iscancelled_block_t)sentinelBlock isRasterizing:(BOOL)isRasterizing -{ - __atomic_add_fetch(&delegate->_drawRectCount, 1, __ATOMIC_SEQ_CST); -} - -- (NSUInteger)drawRectCount -{ - return(__atomic_load_n(&_drawRectCount, __ATOMIC_SEQ_CST)); -} - -@end - -@interface _ASDisplayLayerTests : XCTestCase -@end - -@implementation _ASDisplayLayerTests - -- (void)setUp { - [super setUp]; - // Force bogusImage() to create+cache its image. This impacts any time-sensitive tests which call the method from - // within the timed portion of the test. It seems that, in rare cases, this image creation can take a bit too long, - // causing a test failure. - bogusImage(); -} - -// since we're not running in an application, we need to force this display on layer the hierarchy -- (void)displayLayerRecursively:(CALayer *)layer -{ - if (layer.needsDisplay) { - [layer displayIfNeeded]; - } - for (CALayer *sublayer in layer.sublayers) { - [self displayLayerRecursively:sublayer]; - } -} - -- (void)waitForDisplayQueue -{ - // make sure we don't lock up the tests indefinitely; fail after 1 sec by using an async barrier - __block BOOL didHitBarrier = NO; - dispatch_barrier_async([_ASDisplayLayer displayQueue], ^{ - __atomic_store_n(&didHitBarrier, YES, __ATOMIC_SEQ_CST); - }); - XCTAssertTrue(ASDisplayNodeRunRunLoopUntilBlockIsTrue(^BOOL{ return __atomic_load_n(&didHitBarrier, __ATOMIC_SEQ_CST); })); -} - -- (void)waitForLayer:(_ASDisplayLayerTestLayer *)layer asyncDisplayCount:(NSUInteger)count -{ - // make sure we don't lock up the tests indefinitely; fail after 1 sec of waiting for the setContents async count to increment - // NOTE: the layer sets its contents async back on the main queue, so we need to wait for main - XCTAssertTrue(ASDisplayNodeRunRunLoopUntilBlockIsTrue(^BOOL{ - return (layer.setContentsAsyncCount == count); - })); -} - -- (void)waitForAsyncDelegate:(_ASDisplayLayerTestDelegate *)asyncDelegate -{ - XCTAssertTrue(ASDisplayNodeRunRunLoopUntilBlockIsTrue(^BOOL{ - return (asyncDelegate.didDisplayCount == 1); - })); -} - -- (void)checkDelegateDisplay:(BOOL)displaysAsynchronously -{ - [_ASDisplayLayerTestDelegate setClassModes:_ASDisplayLayerTestDelegateClassModeDisplay]; - _ASDisplayLayerTestDelegate *asyncDelegate = [[_ASDisplayLayerTestDelegate alloc] initWithModes:_ASDisplayLayerTestDelegateMode(_ASDisplayLayerTestDelegateModeDidDisplay | _ASDisplayLayerTestDelegateModeDrawParameters)]; - - _ASDisplayLayerTestLayer *layer = (_ASDisplayLayerTestLayer *)asyncDelegate.layer; - layer.displaysAsynchronously = displaysAsynchronously; - - if (displaysAsynchronously) { - dispatch_suspend([_ASDisplayLayer displayQueue]); - } - layer.frame = CGRectMake(0.0, 0.0, 100.0, 100.0); - [layer setNeedsDisplay]; - [layer displayIfNeeded]; - - if (displaysAsynchronously) { - XCTAssertTrue([layer checkSetContentsCountsWithSyncCount:0 asyncCount:0], @"%@", layer.setContentsCounts); - XCTAssertEqual(layer.displayCount, 1u); - XCTAssertEqual(layer.drawInContextCount, 0u); - dispatch_resume([_ASDisplayLayer displayQueue]); - [self waitForDisplayQueue]; - [self waitForAsyncDelegate:asyncDelegate]; - XCTAssertTrue([layer checkSetContentsCountsWithSyncCount:0 asyncCount:1], @"%@", layer.setContentsCounts); - } else { - XCTAssertTrue([layer checkSetContentsCountsWithSyncCount:1 asyncCount:0], @"%@", layer.setContentsCounts); - } - - XCTAssertFalse(layer.needsDisplay); - XCTAssertEqual(layer.displayCount, 1u); - XCTAssertEqual(layer.drawInContextCount, 0u); - XCTAssertEqual(asyncDelegate.didDisplayCount, 1u); - XCTAssertEqual(asyncDelegate.displayCount, 1u); -} - -- (void)testDelegateDisplaySync -{ - [self checkDelegateDisplay:NO]; -} - -- (void)testDelegateDisplayAsync -{ - [self checkDelegateDisplay:YES]; -} - -- (void)checkDelegateDrawInContext:(BOOL)displaysAsynchronously -{ - [_ASDisplayLayerTestDelegate setClassModes:_ASDisplayLayerTestDelegateClassModeDrawInContext]; - _ASDisplayLayerTestDelegate *asyncDelegate = [[_ASDisplayLayerTestDelegate alloc] initWithModes:_ASDisplayLayerTestDelegateMode(_ASDisplayLayerTestDelegateModeDidDisplay | _ASDisplayLayerTestDelegateModeDrawParameters)]; - - _ASDisplayLayerTestLayer *layer = (_ASDisplayLayerTestLayer *)asyncDelegate.layer; - layer.displaysAsynchronously = displaysAsynchronously; - - if (displaysAsynchronously) { - dispatch_suspend([_ASDisplayLayer displayQueue]); - } - layer.frame = CGRectMake(0.0, 0.0, 100.0, 100.0); - [layer setNeedsDisplay]; - [layer displayIfNeeded]; - - if (displaysAsynchronously) { - XCTAssertTrue([layer checkSetContentsCountsWithSyncCount:0 asyncCount:0], @"%@", layer.setContentsCounts); - XCTAssertEqual(layer.displayCount, 1u); - XCTAssertEqual(layer.drawInContextCount, 0u); - XCTAssertEqual(asyncDelegate.drawRectCount, 0u); - dispatch_resume([_ASDisplayLayer displayQueue]); - [self waitForLayer:layer asyncDisplayCount:1]; - [self waitForAsyncDelegate:asyncDelegate]; - XCTAssertTrue([layer checkSetContentsCountsWithSyncCount:0 asyncCount:1], @"%@", layer.setContentsCounts); - } else { - XCTAssertTrue([layer checkSetContentsCountsWithSyncCount:1 asyncCount:0], @"%@", layer.setContentsCounts); - } - - XCTAssertFalse(layer.needsDisplay); - XCTAssertEqual(layer.displayCount, 1u); - XCTAssertEqual(layer.drawInContextCount, 0u); - XCTAssertEqual(asyncDelegate.didDisplayCount, 1u); - XCTAssertEqual(asyncDelegate.displayCount, 0u); - XCTAssertEqual(asyncDelegate.drawParametersCount, 1u); - XCTAssertEqual(asyncDelegate.drawRectCount, 1u); -} - -- (void)testDelegateDrawInContextSync -{ - [self checkDelegateDrawInContext:NO]; -} - -- (void)testDelegateDrawInContextAsync -{ - [self checkDelegateDrawInContext:YES]; -} - -- (void)checkDelegateDisplayAndDrawInContext:(BOOL)displaysAsynchronously -{ - [_ASDisplayLayerTestDelegate setClassModes:_ASDisplayLayerTestDelegateClassModes(_ASDisplayLayerTestDelegateClassModeDisplay | _ASDisplayLayerTestDelegateClassModeDrawInContext)]; - _ASDisplayLayerTestDelegate *asyncDelegate = [[_ASDisplayLayerTestDelegate alloc] initWithModes:_ASDisplayLayerTestDelegateMode(_ASDisplayLayerTestDelegateModeDidDisplay | _ASDisplayLayerTestDelegateModeDrawParameters)]; - - _ASDisplayLayerTestLayer *layer = (_ASDisplayLayerTestLayer *)asyncDelegate.layer; - layer.displaysAsynchronously = displaysAsynchronously; - - if (displaysAsynchronously) { - dispatch_suspend([_ASDisplayLayer displayQueue]); - } - layer.frame = CGRectMake(0.0, 0.0, 100.0, 100.0); - [layer setNeedsDisplay]; - [layer displayIfNeeded]; - - if (displaysAsynchronously) { - XCTAssertTrue([layer checkSetContentsCountsWithSyncCount:0 asyncCount:0], @"%@", layer.setContentsCounts); - XCTAssertEqual(layer.displayCount, 1u); - XCTAssertEqual(asyncDelegate.drawParametersCount, 1u); - XCTAssertEqual(asyncDelegate.drawRectCount, 0u); - dispatch_resume([_ASDisplayLayer displayQueue]); - [self waitForDisplayQueue]; - [self waitForAsyncDelegate:asyncDelegate]; - XCTAssertTrue([layer checkSetContentsCountsWithSyncCount:0 asyncCount:1], @"%@", layer.setContentsCounts); - } else { - XCTAssertTrue([layer checkSetContentsCountsWithSyncCount:1 asyncCount:0], @"%@", layer.setContentsCounts); - } - - XCTAssertFalse(layer.needsDisplay); - XCTAssertEqual(layer.displayCount, 1u); - XCTAssertEqual(layer.drawInContextCount, 0u); - XCTAssertEqual(asyncDelegate.didDisplayCount, 1u); - XCTAssertEqual(asyncDelegate.displayCount, 1u); - XCTAssertEqual(asyncDelegate.drawParametersCount, 1u); - XCTAssertEqual(asyncDelegate.drawRectCount, 0u); -} - -- (void)testDelegateDisplayAndDrawInContextSync -{ - [self checkDelegateDisplayAndDrawInContext:NO]; -} - -- (void)testDelegateDisplayAndDrawInContextAsync -{ - [self checkDelegateDisplayAndDrawInContext:YES]; -} - -- (void)testCancelAsyncDisplay -{ - [_ASDisplayLayerTestDelegate setClassModes:_ASDisplayLayerTestDelegateClassModeDisplay]; - _ASDisplayLayerTestDelegate *asyncDelegate = [[_ASDisplayLayerTestDelegate alloc] initWithModes:_ASDisplayLayerTestDelegateModeDidDisplay]; - _ASDisplayLayerTestLayer *layer = (_ASDisplayLayerTestLayer *)asyncDelegate.layer; - - dispatch_suspend([_ASDisplayLayer displayQueue]); - layer.frame = CGRectMake(0.0, 0.0, 100.0, 100.0); - [layer setNeedsDisplay]; - XCTAssertTrue(layer.needsDisplay); - [layer displayIfNeeded]; - - XCTAssertTrue([layer checkSetContentsCountsWithSyncCount:0 asyncCount:0], @"%@", layer.setContentsCounts); - XCTAssertFalse(layer.needsDisplay); - XCTAssertEqual(layer.displayCount, 1u); - XCTAssertEqual(layer.drawInContextCount, 0u); - - [layer cancelAsyncDisplay]; - - dispatch_resume([_ASDisplayLayer displayQueue]); - [self waitForDisplayQueue]; - XCTAssertTrue([layer checkSetContentsCountsWithSyncCount:0 asyncCount:0], @"%@", layer.setContentsCounts); - XCTAssertEqual(layer.displayCount, 1u); - XCTAssertEqual(layer.drawInContextCount, 0u); - XCTAssertEqual(asyncDelegate.didDisplayCount, 0u); - XCTAssertEqual(asyncDelegate.displayCount, 0u); - XCTAssertEqual(asyncDelegate.drawParametersCount, 0u); -} - -- (void)DISABLED_testTransaction -{ - auto delegateModes = _ASDisplayLayerTestDelegateMode(_ASDisplayLayerTestDelegateModeDidDisplay | _ASDisplayLayerTestDelegateModeDrawParameters); - [_ASDisplayLayerTestDelegate setClassModes:_ASDisplayLayerTestDelegateClassModeDisplay]; - - // Setup - _ASDisplayLayerTestContainerLayer *containerLayer = [[_ASDisplayLayerTestContainerLayer alloc] init]; - containerLayer.asyncdisplaykit_asyncTransactionContainer = YES; - containerLayer.frame = CGRectMake(0.0, 0.0, 100.0, 100.0); - - _ASDisplayLayerTestDelegate *layer1Delegate = [[_ASDisplayLayerTestDelegate alloc] initWithModes:delegateModes]; - _ASDisplayLayerTestLayer *layer1 = (_ASDisplayLayerTestLayer *)layer1Delegate.layer; - layer1.displaysAsynchronously = YES; - - dispatch_semaphore_t displayAsyncLayer1Sema = dispatch_semaphore_create(0); - layer1Delegate.displayLayerBlock = ^UIImage *{ - dispatch_semaphore_wait(displayAsyncLayer1Sema, DISPATCH_TIME_FOREVER); - return bogusImage(); - }; - layer1.backgroundColor = [UIColor blackColor].CGColor; - layer1.frame = CGRectMake(0.0, 0.0, 333.0, 123.0); - [containerLayer addSublayer:layer1]; - - _ASDisplayLayerTestDelegate *layer2Delegate = [[_ASDisplayLayerTestDelegate alloc] initWithModes:delegateModes]; - _ASDisplayLayerTestLayer *layer2 = (_ASDisplayLayerTestLayer *)layer2Delegate.layer; - layer2.displaysAsynchronously = YES; - layer2.backgroundColor = [UIColor blackColor].CGColor; - layer2.frame = CGRectMake(0.0, 50.0, 97.0, 50.0); - [containerLayer addSublayer:layer2]; - - dispatch_suspend([_ASDisplayLayer displayQueue]); - - // display below if needed - [layer1 setNeedsDisplay]; - [layer2 setNeedsDisplay]; - [containerLayer setNeedsDisplay]; - [self displayLayerRecursively:containerLayer]; - - // check state before running displayQueue - XCTAssertTrue([layer1 checkSetContentsCountsWithSyncCount:0 asyncCount:0], @"%@", layer1.setContentsCounts); - XCTAssertEqual(layer1.displayCount, 1u); - XCTAssertEqual(layer1Delegate.displayCount, 0u); - XCTAssertTrue([layer2 checkSetContentsCountsWithSyncCount:0 asyncCount:0], @"%@", layer2.setContentsCounts); - XCTAssertEqual(layer2.displayCount, 1u); - XCTAssertEqual(layer1Delegate.displayCount, 0u); - XCTAssertEqual(containerLayer.didCompleteTransactionCount, 0u); - - // run displayQueue until async display for layer2 has been run - dispatch_resume([_ASDisplayLayer displayQueue]); - XCTAssertTrue(ASDisplayNodeRunRunLoopUntilBlockIsTrue(^BOOL{ - return (layer2Delegate.displayCount == 1); - })); - - // check layer1 has not had async display run - XCTAssertTrue([layer1 checkSetContentsCountsWithSyncCount:0 asyncCount:0], @"%@", layer1.setContentsCounts); - XCTAssertEqual(layer1.displayCount, 1u); - XCTAssertEqual(layer1Delegate.displayCount, 0u); - // check layer2 has had async display run - XCTAssertTrue([layer2 checkSetContentsCountsWithSyncCount:0 asyncCount:0], @"%@", layer2.setContentsCounts); - XCTAssertEqual(layer2.displayCount, 1u); - XCTAssertEqual(layer2Delegate.displayCount, 1u); - XCTAssertEqual(containerLayer.didCompleteTransactionCount, 0u); - - - // allow layer1 to complete display - dispatch_semaphore_signal(displayAsyncLayer1Sema); - [self waitForLayer:layer1 asyncDisplayCount:1]; - - // check that both layers have completed display - XCTAssertTrue([layer1 checkSetContentsCountsWithSyncCount:0 asyncCount:1], @"%@", layer1.setContentsCounts); - XCTAssertEqual(layer1.displayCount, 1u); - XCTAssertEqual(layer1Delegate.displayCount, 1u); - XCTAssertTrue([layer2 checkSetContentsCountsWithSyncCount:0 asyncCount:1], @"%@", layer2.setContentsCounts); - XCTAssertEqual(layer2.displayCount, 1u); - XCTAssertEqual(layer2Delegate.displayCount, 1u); - - XCTAssertTrue(ASDisplayNodeRunRunLoopUntilBlockIsTrue(^BOOL{ - return (containerLayer.didCompleteTransactionCount == 1); - })); -} - -- (void)checkSuspendResume:(BOOL)displaysAsynchronously -{ - [_ASDisplayLayerTestDelegate setClassModes:_ASDisplayLayerTestDelegateClassModeDrawInContext]; - _ASDisplayLayerTestDelegate *asyncDelegate = [[_ASDisplayLayerTestDelegate alloc] initWithModes:_ASDisplayLayerTestDelegateMode(_ASDisplayLayerTestDelegateModeDidDisplay | _ASDisplayLayerTestDelegateModeDrawParameters)]; - - _ASDisplayLayerTestLayer *layer = (_ASDisplayLayerTestLayer *)asyncDelegate.layer; - layer.displaysAsynchronously = displaysAsynchronously; - layer.frame = CGRectMake(0.0, 0.0, 100.0, 100.0); - - if (displaysAsynchronously) { - dispatch_suspend([_ASDisplayLayer displayQueue]); - } - - // Layer shouldn't display because display is suspended - layer.displaySuspended = YES; - [layer setNeedsDisplay]; - [layer displayIfNeeded]; - XCTAssertEqual(layer.displayCount, 0u, @"Should not have displayed because display is suspended, thus -setNeedsDisplay is a no-op"); - XCTAssertFalse(layer.needsDisplay, @"Should not need display"); - if (displaysAsynchronously) { - XCTAssertTrue([layer checkSetContentsCountsWithSyncCount:0 asyncCount:0], @"%@", layer.setContentsCounts); - dispatch_resume([_ASDisplayLayer displayQueue]); - [self waitForDisplayQueue]; - XCTAssertTrue([layer checkSetContentsCountsWithSyncCount:0 asyncCount:0], @"%@", layer.setContentsCounts); - } else { - XCTAssertTrue([layer checkSetContentsCountsWithSyncCount:0 asyncCount:0], @"%@", layer.setContentsCounts); - } - XCTAssertFalse(layer.needsDisplay); - XCTAssertEqual(layer.drawInContextCount, 0u); - XCTAssertEqual(asyncDelegate.drawRectCount, 0u); - - // Layer should display because display is resumed - if (displaysAsynchronously) { - dispatch_suspend([_ASDisplayLayer displayQueue]); - } - layer.displaySuspended = NO; - XCTAssertTrue(layer.needsDisplay); - [layer displayIfNeeded]; - XCTAssertEqual(layer.displayCount, 1u); - if (displaysAsynchronously) { - XCTAssertTrue([layer checkSetContentsCountsWithSyncCount:0 asyncCount:0], @"%@", layer.setContentsCounts); - XCTAssertEqual(layer.drawInContextCount, 0u); - XCTAssertEqual(asyncDelegate.drawRectCount, 0u); - dispatch_resume([_ASDisplayLayer displayQueue]); - [self waitForLayer:layer asyncDisplayCount:1]; - XCTAssertTrue([layer checkSetContentsCountsWithSyncCount:0 asyncCount:1], @"%@", layer.setContentsCounts); - } else { - XCTAssertTrue([layer checkSetContentsCountsWithSyncCount:1 asyncCount:0], @"%@", layer.setContentsCounts); - } - XCTAssertEqual(layer.drawInContextCount, 0u); - XCTAssertEqual(asyncDelegate.drawParametersCount, 1u); - XCTAssertEqual(asyncDelegate.drawRectCount, 1u); - XCTAssertFalse(layer.needsDisplay); -} - -- (void)testSuspendResumeAsync -{ - [self checkSuspendResume:YES]; -} - -- (void)testSuspendResumeSync -{ - [self checkSuspendResume:NO]; -} - -@end diff --git a/submodules/AsyncDisplayKit/Tests/ASDisplayNodeAppearanceTests.mm b/submodules/AsyncDisplayKit/Tests/ASDisplayNodeAppearanceTests.mm deleted file mode 100644 index 515bcf7cfc..0000000000 --- a/submodules/AsyncDisplayKit/Tests/ASDisplayNodeAppearanceTests.mm +++ /dev/null @@ -1,417 +0,0 @@ -// -// ASDisplayNodeAppearanceTests.mm -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -#import - -#import - -#import -#import -#import -#import - -// helper functions -IMP class_replaceMethodWithBlock(Class theClass, SEL originalSelector, id block); -IMP class_replaceMethodWithBlock(Class theClass, SEL originalSelector, id block) -{ - IMP newImplementation = imp_implementationWithBlock(block); - Method method = class_getInstanceMethod(theClass, originalSelector); - return class_replaceMethod(theClass, originalSelector, newImplementation, method_getTypeEncoding(method)); -} - -static dispatch_block_t modifyMethodByAddingPrologueBlockAndReturnCleanupBlock(Class theClass, SEL originalSelector, void (^block)(id)) -{ - __block IMP originalImp = NULL; - void (^blockActualSwizzle)(id) = ^(id swizzedSelf){ - block(swizzedSelf); - ((void(*)(id, SEL))originalImp)(swizzedSelf, originalSelector); - }; - originalImp = class_replaceMethodWithBlock(theClass, originalSelector, blockActualSwizzle); - void (^cleanupBlock)(void) = ^{ - // restore original method - Method method = class_getInstanceMethod(theClass, originalSelector); - class_replaceMethod(theClass, originalSelector, originalImp, method_getTypeEncoding(method)); - }; - return cleanupBlock; -}; - -@interface ASDisplayNode (PrivateStuffSoWeDontPullInCPPInternalH) -- (BOOL)__visibilityNotificationsDisabled; -- (BOOL)__selfOrParentHasVisibilityNotificationsDisabled; -- (id)initWithViewClass:(Class)viewClass; -- (id)initWithLayerClass:(Class)layerClass; -@end - -@interface ASDisplayNodeAppearanceTests : XCTestCase -@end - -// Conveniences for making nodes named a certain way -#define DeclareNodeNamed(n) ASDisplayNode *n = [[ASDisplayNode alloc] init]; n.debugName = @#n -#define DeclareViewNamed(v) \ - ASDisplayNode *node_##v = [[ASDisplayNode alloc] init]; \ - node_##v.debugName = @#v; \ - UIView *v = node_##v.view; - -@implementation ASDisplayNodeAppearanceTests -{ - _ASDisplayView *_view; - - NSMutableArray *_swizzleCleanupBlocks; - - NSCountedSet *_willEnterHierarchyCounts; - NSCountedSet *_didExitHierarchyCounts; - -} - -- (void)setUp -{ - [super setUp]; - - _swizzleCleanupBlocks = [[NSMutableArray alloc] init]; - - // Using this instead of mocks. Count # of times method called - _willEnterHierarchyCounts = [[NSCountedSet alloc] init]; - _didExitHierarchyCounts = [[NSCountedSet alloc] init]; - - dispatch_block_t cleanupBlock = modifyMethodByAddingPrologueBlockAndReturnCleanupBlock([ASDisplayNode class], @selector(willEnterHierarchy), ^(id blockSelf){ - [_willEnterHierarchyCounts addObject:blockSelf]; - }); - [_swizzleCleanupBlocks addObject:cleanupBlock]; - cleanupBlock = modifyMethodByAddingPrologueBlockAndReturnCleanupBlock([ASDisplayNode class], @selector(didExitHierarchy), ^(id blockSelf){ - [_didExitHierarchyCounts addObject:blockSelf]; - }); - [_swizzleCleanupBlocks addObject:cleanupBlock]; -} - -- (void)tearDown -{ - [super tearDown]; - - for(dispatch_block_t cleanupBlock in _swizzleCleanupBlocks) { - cleanupBlock(); - } - _swizzleCleanupBlocks = nil; - _willEnterHierarchyCounts = nil; - _didExitHierarchyCounts = nil; -} - -- (void)testAppearanceMethodsCalledWithRootNodeInWindowLayer -{ - [self checkAppearanceMethodsCalledWithRootNodeInWindowLayerBacked:YES]; -} - -- (void)testAppearanceMethodsCalledWithRootNodeInWindowView -{ - [self checkAppearanceMethodsCalledWithRootNodeInWindowLayerBacked:NO]; -} - -- (void)checkAppearanceMethodsCalledWithRootNodeInWindowLayerBacked:(BOOL)isLayerBacked -{ - // ASDisplayNode visibility does not change if modifying a hierarchy that is not in a window. So create one and add the superview to it. - UIWindow *window = [[UIWindow alloc] initWithFrame:CGRectZero]; - - DeclareNodeNamed(n); - DeclareViewNamed(superview); - - n.layerBacked = isLayerBacked; - - if (isLayerBacked) { - [superview.layer addSublayer:n.layer]; - } else { - [superview addSubview:n.view]; - } - - XCTAssertEqual([_willEnterHierarchyCounts countForObject:n], 0u, @"willEnterHierarchy erroneously called"); - XCTAssertEqual([_didExitHierarchyCounts countForObject:n], 0u, @"didExitHierarchy erroneously called"); - - [window addSubview:superview]; - XCTAssertEqual([_willEnterHierarchyCounts countForObject:n], 1u, @"willEnterHierarchy not called when node's view added to hierarchy"); - XCTAssertEqual([_didExitHierarchyCounts countForObject:n], 0u, @"didExitHierarchy erroneously called"); - - XCTAssertTrue(n.inHierarchy, @"Node should be visible"); - - if (isLayerBacked) { - [n.layer removeFromSuperlayer]; - } else { - [n.view removeFromSuperview]; - } - - XCTAssertFalse(n.inHierarchy, @"Node should be not visible"); - - XCTAssertEqual([_willEnterHierarchyCounts countForObject:n], 1u, @"willEnterHierarchy not called when node's view added to hierarchy"); - XCTAssertEqual([_didExitHierarchyCounts countForObject:n], 1u, @"didExitHierarchy erroneously called"); -} - -- (void)checkManualAppearanceViewLoaded:(BOOL)isViewLoaded layerBacked:(BOOL)isLayerBacked -{ - // ASDisplayNode visibility does not change if modifying a hierarchy that is not in a window. So create one and add the superview to it. - UIWindow *window = [[UIWindow alloc] initWithFrame:CGRectZero]; - - DeclareNodeNamed(parent); - DeclareNodeNamed(a); - DeclareNodeNamed(b); - DeclareNodeNamed(aa); - DeclareNodeNamed(ab); - - for (ASDisplayNode *n in @[parent, a, b, aa, ab]) { - n.layerBacked = isLayerBacked; - if (isViewLoaded) - [n layer]; - } - - [parent addSubnode:a]; - - XCTAssertFalse(parent.inHierarchy, @"Nothing should be visible"); - XCTAssertFalse(a.inHierarchy, @"Nothing should be visible"); - XCTAssertFalse(b.inHierarchy, @"Nothing should be visible"); - XCTAssertFalse(aa.inHierarchy, @"Nothing should be visible"); - XCTAssertFalse(ab.inHierarchy, @"Nothing should be visible"); - - if (isLayerBacked) { - [window.layer addSublayer:parent.layer]; - } else { - [window addSubview:parent.view]; - } - - XCTAssertEqual([_willEnterHierarchyCounts countForObject:parent], 1u, @"Should have -willEnterHierarchy called once"); - XCTAssertEqual([_willEnterHierarchyCounts countForObject:a], 1u, @"Should have -willEnterHierarchy called once"); - XCTAssertEqual([_willEnterHierarchyCounts countForObject:b], 0u, @"Should not have appeared yet"); - XCTAssertEqual([_willEnterHierarchyCounts countForObject:aa], 0u, @"Should not have appeared yet"); - XCTAssertEqual([_willEnterHierarchyCounts countForObject:ab], 0u, @"Should not have appeared yet"); - - XCTAssertTrue(parent.inHierarchy, @"Should be visible"); - XCTAssertTrue(a.inHierarchy, @"Should be visible"); - XCTAssertFalse(b.inHierarchy, @"Nothing should be visible"); - XCTAssertFalse(aa.inHierarchy, @"Nothing should be visible"); - XCTAssertFalse(ab.inHierarchy, @"Nothing should be visible"); - - // Add to an already-visible node should make the node visible - [parent addSubnode:b]; - [a insertSubnode:aa atIndex:0]; - [a insertSubnode:ab aboveSubnode:aa]; - - XCTAssertTrue(parent.inHierarchy, @"Should be visible"); - XCTAssertTrue(a.inHierarchy, @"Should be visible"); - XCTAssertTrue(b.inHierarchy, @"Should be visible after adding to visible parent"); - XCTAssertTrue(aa.inHierarchy, @"Nothing should be visible"); - XCTAssertTrue(ab.inHierarchy, @"Nothing should be visible"); - - XCTAssertEqual([_willEnterHierarchyCounts countForObject:parent], 1u, @"Should have -willEnterHierarchy called once"); - XCTAssertEqual([_willEnterHierarchyCounts countForObject:a], 1u, @"Should have -willEnterHierarchy called once"); - XCTAssertEqual([_willEnterHierarchyCounts countForObject:b], 1u, @"Should have -willEnterHierarchy called once"); - XCTAssertEqual([_willEnterHierarchyCounts countForObject:aa], 1u, @"Should have -willEnterHierarchy called once"); - XCTAssertEqual([_willEnterHierarchyCounts countForObject:ab], 1u, @"Should have -willEnterHierarchy called once"); - - if (isLayerBacked) { - [parent.layer removeFromSuperlayer]; - } else { - [parent.view removeFromSuperview]; - } - - XCTAssertFalse(parent.inHierarchy, @"Nothing should be visible"); - XCTAssertFalse(a.inHierarchy, @"Nothing should be visible"); - XCTAssertFalse(b.inHierarchy, @"Nothing should be visible"); - XCTAssertFalse(aa.inHierarchy, @"Nothing should be visible"); - XCTAssertFalse(ab.inHierarchy, @"Nothing should be visible"); -} - -- (void)testAppearanceMethodsNoLayer -{ - [self checkManualAppearanceViewLoaded:NO layerBacked:YES]; -} - -- (void)testAppearanceMethodsNoView -{ - [self checkManualAppearanceViewLoaded:NO layerBacked:NO]; -} - -- (void)testAppearanceMethodsLayer -{ - [self checkManualAppearanceViewLoaded:YES layerBacked:YES]; -} - -- (void)testAppearanceMethodsView -{ - [self checkManualAppearanceViewLoaded:YES layerBacked:NO]; -} - -- (void)testSynchronousIntermediaryView -{ - // Parent is a wrapper node for a scrollview - ASDisplayNode *parentSynchronousNode = [[ASDisplayNode alloc] initWithViewClass:[UIScrollView class]]; - DeclareNodeNamed(layerBackedNode); - DeclareNodeNamed(viewBackedNode); - - layerBackedNode.layerBacked = YES; - - UIWindow *window = [[UIWindow alloc] initWithFrame:CGRectZero]; - [parentSynchronousNode addSubnode:layerBackedNode]; - [parentSynchronousNode addSubnode:viewBackedNode]; - - XCTAssertFalse(parentSynchronousNode.inHierarchy, @"Should not yet be visible"); - XCTAssertFalse(layerBackedNode.inHierarchy, @"Should not yet be visible"); - XCTAssertFalse(viewBackedNode.inHierarchy, @"Should not yet be visible"); - - [window addSubview:parentSynchronousNode.view]; - - // This is a known case that isn't supported - XCTAssertFalse(parentSynchronousNode.inHierarchy, @"Synchronous views are not currently marked visible"); - - XCTAssertTrue(layerBackedNode.inHierarchy, @"Synchronous views' subviews should get marked visible"); - XCTAssertTrue(viewBackedNode.inHierarchy, @"Synchronous views' subviews should get marked visible"); - - // Try moving a node to/from a synchronous node in the window with the node API - // Setup - [layerBackedNode removeFromSupernode]; - [viewBackedNode removeFromSupernode]; - XCTAssertFalse(layerBackedNode.inHierarchy, @"aoeu"); - XCTAssertFalse(viewBackedNode.inHierarchy, @"aoeu"); - - // now move to synchronous node - [parentSynchronousNode addSubnode:layerBackedNode]; - [parentSynchronousNode insertSubnode:viewBackedNode aboveSubnode:layerBackedNode]; - XCTAssertTrue(layerBackedNode.inHierarchy, @"Synchronous views' subviews should get marked visible"); - XCTAssertTrue(viewBackedNode.inHierarchy, @"Synchronous views' subviews should get marked visible"); - - [parentSynchronousNode.view removeFromSuperview]; - - XCTAssertFalse(parentSynchronousNode.inHierarchy, @"Should not have changed"); - XCTAssertFalse(layerBackedNode.inHierarchy, @"Should have been marked invisible when synchronous superview was removed from the window"); - XCTAssertFalse(viewBackedNode.inHierarchy, @"Should have been marked invisible when synchronous superview was removed from the window"); -} - -- (void)checkMoveAcrossHierarchyLayerBacked:(BOOL)isLayerBacked useManualCalls:(BOOL)useManualDisable useNodeAPI:(BOOL)useNodeAPI -{ - UIWindow *window = [[UIWindow alloc] initWithFrame:CGRectZero]; - - DeclareNodeNamed(parentA); - DeclareNodeNamed(parentB); - DeclareNodeNamed(child); - DeclareNodeNamed(childSubnode); - - for (ASDisplayNode *n in @[parentA, parentB, child, childSubnode]) { - n.layerBacked = isLayerBacked; - } - - [parentA addSubnode:child]; - [child addSubnode:childSubnode]; - - XCTAssertFalse(parentA.inHierarchy, @"Should not yet be visible"); - XCTAssertFalse(parentB.inHierarchy, @"Should not yet be visible"); - XCTAssertFalse(child.inHierarchy, @"Should not yet be visible"); - XCTAssertFalse(childSubnode.inHierarchy, @"Should not yet be visible"); - XCTAssertFalse(childSubnode.inHierarchy, @"Should not yet be visible"); - - XCTAssertEqual([_willEnterHierarchyCounts countForObject:child], 0u, @"Should not have -willEnterHierarchy called"); - XCTAssertEqual([_willEnterHierarchyCounts countForObject:childSubnode], 0u, @"Should not have -willEnterHierarchy called"); - - if (isLayerBacked) { - [window.layer addSublayer:parentA.layer]; - [window.layer addSublayer:parentB.layer]; - } else { - [window addSubview:parentA.view]; - [window addSubview:parentB.view]; - } - - XCTAssertTrue(parentA.inHierarchy, @"Should be visible after added to window"); - XCTAssertTrue(parentB.inHierarchy, @"Should be visible after added to window"); - XCTAssertTrue(child.inHierarchy, @"Should be visible after parent added to window"); - XCTAssertTrue(childSubnode.inHierarchy, @"Should be visible after parent added to window"); - - XCTAssertEqual([_willEnterHierarchyCounts countForObject:child], 1u, @"Should have -willEnterHierarchy called once"); - XCTAssertEqual([_willEnterHierarchyCounts countForObject:childSubnode], 1u, @"Should have -willEnterHierarchy called once"); - - // Move subnode from A to B - if (useManualDisable) { - ASDisplayNodeDisableHierarchyNotifications(child); - } - if (!useNodeAPI) { - [child removeFromSupernode]; - [parentB addSubnode:child]; - } else { - [parentB addSubnode:child]; - } - if (useManualDisable) { - XCTAssertTrue([child __visibilityNotificationsDisabled], @"Should not have re-enabled yet"); - XCTAssertTrue([child __selfOrParentHasVisibilityNotificationsDisabled], @"Should not have re-enabled yet"); - ASDisplayNodeEnableHierarchyNotifications(child); - } - - XCTAssertEqual([_willEnterHierarchyCounts countForObject:child], 1u, @"Should not have -willEnterHierarchy called when moving child around in hierarchy"); - - // Move subnode back to A - if (useManualDisable) { - ASDisplayNodeDisableHierarchyNotifications(child); - } - if (!useNodeAPI) { - [child removeFromSupernode]; - [parentA insertSubnode:child atIndex:0]; - } else { - [parentA insertSubnode:child atIndex:0]; - } - if (useManualDisable) { - XCTAssertTrue([child __visibilityNotificationsDisabled], @"Should not have re-enabled yet"); - XCTAssertTrue([child __selfOrParentHasVisibilityNotificationsDisabled], @"Should not have re-enabled yet"); - ASDisplayNodeEnableHierarchyNotifications(child); - } - - - XCTAssertEqual([_willEnterHierarchyCounts countForObject:child], 1u, @"Should not have -willEnterHierarchy called when moving child around in hierarchy"); - - // Finally, remove subnode - [child removeFromSupernode]; - - XCTAssertEqual([_willEnterHierarchyCounts countForObject:child], 1u, @"Should appear and disappear just once"); - - // Make sure that we don't leave these unbalanced - XCTAssertFalse([child __visibilityNotificationsDisabled], @"Unbalanced visibility notifications calls"); - XCTAssertFalse([child __selfOrParentHasVisibilityNotificationsDisabled], @"Should not have re-enabled yet"); -} - -- (void)testMoveAcrossHierarchyLayer -{ - [self checkMoveAcrossHierarchyLayerBacked:YES useManualCalls:NO useNodeAPI:YES]; -} - -- (void)testMoveAcrossHierarchyView -{ - [self checkMoveAcrossHierarchyLayerBacked:NO useManualCalls:NO useNodeAPI:YES]; -} - -- (void)testMoveAcrossHierarchyManualLayer -{ - [self checkMoveAcrossHierarchyLayerBacked:YES useManualCalls:YES useNodeAPI:NO]; -} - -- (void)testMoveAcrossHierarchyManualView -{ - [self checkMoveAcrossHierarchyLayerBacked:NO useManualCalls:YES useNodeAPI:NO]; -} - -- (void)testDisableWithNodeAPILayer -{ - [self checkMoveAcrossHierarchyLayerBacked:YES useManualCalls:YES useNodeAPI:YES]; -} - -- (void)testDisableWithNodeAPIView -{ - [self checkMoveAcrossHierarchyLayerBacked:NO useManualCalls:YES useNodeAPI:YES]; -} - -- (void)testPreventManualAppearanceMethods -{ - DeclareNodeNamed(n); - - XCTAssertThrows([n willEnterHierarchy], @"Should not allow manually calling appearance methods."); - XCTAssertThrows([n didExitHierarchy], @"Should not allow manually calling appearance methods."); -} - -@end diff --git a/submodules/AsyncDisplayKit/Tests/ASDisplayNodeExtrasTests.mm b/submodules/AsyncDisplayKit/Tests/ASDisplayNodeExtrasTests.mm deleted file mode 100644 index 77d904c2e6..0000000000 --- a/submodules/AsyncDisplayKit/Tests/ASDisplayNodeExtrasTests.mm +++ /dev/null @@ -1,76 +0,0 @@ -// -// ASDisplayNodeExtrasTests.mm -// Texture -// -// Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import -#import -#import - -@interface ASDisplayNodeExtrasTests : XCTestCase - -@end - -@interface TestDisplayNode : ASDisplayNode -@end - -@implementation TestDisplayNode -@end - -@implementation ASDisplayNodeExtrasTests - -- (void)testShallowFindSubnodesOfSubclass { - ASDisplayNode *supernode = [[ASDisplayNode alloc] initWithLayerBlock:^CALayer * _Nonnull{ - return [CALayer layer]; - }]; - NSUInteger count = 10; - NSMutableArray *expected = [[NSMutableArray alloc] initWithCapacity:count]; - for (NSUInteger nodeIndex = 0; nodeIndex < count; nodeIndex++) { - TestDisplayNode *node = [[TestDisplayNode alloc] initWithLayerBlock:^CALayer * _Nonnull{ - return [CALayer layer]; - }]; - [supernode addSubnode:node]; - [expected addObject:node]; - } - NSArray *found = ASDisplayNodeFindAllSubnodesOfClass(supernode, [TestDisplayNode class]); - XCTAssertEqualObjects(found, expected, @"Expecting %lu %@ nodes, found %lu", (unsigned long)count, [TestDisplayNode class], (unsigned long)found.count); -} - -- (void)testDeepFindSubnodesOfSubclass { - ASDisplayNode *supernode = [[ASDisplayNode alloc] initWithLayerBlock:^CALayer * _Nonnull{ - return [CALayer layer]; - }]; - - const NSUInteger count = 2; - const NSUInteger levels = 2; - const NSUInteger capacity = [[self class] capacityForCount:count levels:levels]; - NSMutableArray *expected = [[NSMutableArray alloc] initWithCapacity:capacity]; - - [[self class] addSubnodesToNode:supernode number:count remainingLevels:levels accumulated:expected]; - - NSArray *found = ASDisplayNodeFindAllSubnodesOfClass(supernode, [TestDisplayNode class]); - XCTAssertEqualObjects(found, expected, @"Expecting %lu %@ nodes, found %lu", (unsigned long)count, [TestDisplayNode class], (unsigned long)found.count); -} - -+ (void)addSubnodesToNode:(ASDisplayNode *)supernode number:(NSUInteger)number remainingLevels:(NSUInteger)level accumulated:(inout NSMutableArray *)expected { - if (level == 0) return; - for (NSUInteger nodeIndex = 0; nodeIndex < number; nodeIndex++) { - TestDisplayNode *node = [[TestDisplayNode alloc] initWithLayerBlock:^CALayer * _Nonnull{ - return [CALayer layer]; - }]; - [supernode addSubnode:node]; - [expected addObject:node]; - [self addSubnodesToNode:node number:number remainingLevels:(level - 1) accumulated:expected]; - } -} - -// Graph theory is failing me atm. -+ (NSUInteger)capacityForCount:(NSUInteger)count levels:(NSUInteger)level { - if (level == 0) return 0; - return pow(count, level) + [self capacityForCount:count levels:(level - 1)]; -} - -@end diff --git a/submodules/AsyncDisplayKit/Tests/ASDisplayNodeImplicitHierarchyTests.mm b/submodules/AsyncDisplayKit/Tests/ASDisplayNodeImplicitHierarchyTests.mm deleted file mode 100644 index ea41a322b3..0000000000 --- a/submodules/AsyncDisplayKit/Tests/ASDisplayNodeImplicitHierarchyTests.mm +++ /dev/null @@ -1,329 +0,0 @@ -// -// ASDisplayNodeImplicitHierarchyTests.mm -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -#import -#import - -#import "ASDisplayNodeTestsHelper.h" - -@interface ASSpecTestDisplayNode : ASDisplayNode - -/** - Simple state identifier to allow control of current spec inside of the layoutSpecBlock - */ -@property (nonatomic) NSNumber *layoutState; - -@end - -@implementation ASSpecTestDisplayNode - -- (instancetype)init -{ - self = [super init]; - if (self) { - _layoutState = @1; - } - return self; -} - -@end - -@interface ASDisplayNodeImplicitHierarchyTests : XCTestCase - -@end - -@implementation ASDisplayNodeImplicitHierarchyTests - -- (void)testFeatureFlag -{ - ASDisplayNode *node = [[ASDisplayNode alloc] init]; - XCTAssertFalse(node.automaticallyManagesSubnodes); - - node.automaticallyManagesSubnodes = YES; - XCTAssertTrue(node.automaticallyManagesSubnodes); -} - -- (void)testInitialNodeInsertionWithOrdering -{ - static CGSize kSize = {100, 100}; - - ASDisplayNode *node1 = [[ASDisplayNode alloc] init]; - ASDisplayNode *node2 = [[ASDisplayNode alloc] init]; - ASDisplayNode *node3 = [[ASDisplayNode alloc] init]; - ASDisplayNode *node4 = [[ASDisplayNode alloc] init]; - ASDisplayNode *node5 = [[ASDisplayNode alloc] init]; - - - // As we will involve a stack spec we have to give the nodes an intrinsic content size - node1.style.preferredSize = kSize; - node2.style.preferredSize = kSize; - node3.style.preferredSize = kSize; - node4.style.preferredSize = kSize; - node5.style.preferredSize = kSize; - - ASSpecTestDisplayNode *node = [[ASSpecTestDisplayNode alloc] init]; - node.automaticallyManagesSubnodes = YES; - node.layoutSpecBlock = ^(ASDisplayNode *weakNode, ASSizeRange constrainedSize) { - ASAbsoluteLayoutSpec *absoluteLayout = [ASAbsoluteLayoutSpec absoluteLayoutSpecWithChildren:@[node4]]; - - ASStackLayoutSpec *stack1 = [[ASStackLayoutSpec alloc] init]; - [stack1 setChildren:@[node1, node2]]; - - ASStackLayoutSpec *stack2 = [[ASStackLayoutSpec alloc] init]; - [stack2 setChildren:@[node3, absoluteLayout]]; - - return [ASAbsoluteLayoutSpec absoluteLayoutSpecWithChildren:@[stack1, stack2, node5]]; - }; - - ASDisplayNodeSizeToFitSizeRange(node, ASSizeRangeMake(CGSizeZero, CGSizeMake(CGFLOAT_MAX, CGFLOAT_MAX))); - [node.view layoutIfNeeded]; - - XCTAssertEqual(node.subnodes[0], node1); - XCTAssertEqual(node.subnodes[1], node2); - XCTAssertEqual(node.subnodes[2], node3); - XCTAssertEqual(node.subnodes[3], node4); - XCTAssertEqual(node.subnodes[4], node5); -} - -- (void)testInitialNodeInsertionWhenEnterPreloadState -{ - static CGSize kSize = {100, 100}; - - static NSInteger subnodeCount = 5; - NSMutableArray *subnodes = [NSMutableArray arrayWithCapacity:subnodeCount]; - for (NSInteger i = 0; i < subnodeCount; i++) { - ASDisplayNode *subnode = [[ASDisplayNode alloc] init]; - // As we will involve a stack spec we have to give the nodes an intrinsic content size - subnode.style.preferredSize = kSize; - [subnodes addObject:subnode]; - } - - ASSpecTestDisplayNode *node = [[ASSpecTestDisplayNode alloc] init]; - [node setHierarchyState:ASHierarchyStateRangeManaged]; - node.automaticallyManagesSubnodes = YES; - node.layoutSpecBlock = ^(ASDisplayNode *weakNode, ASSizeRange constrainedSize) { - ASAbsoluteLayoutSpec *absoluteLayout = [ASAbsoluteLayoutSpec absoluteLayoutSpecWithChildren:@[subnodes[3]]]; - - ASStackLayoutSpec *stack1 = [[ASStackLayoutSpec alloc] init]; - [stack1 setChildren:@[subnodes[0], subnodes[1]]]; - - ASStackLayoutSpec *stack2 = [[ASStackLayoutSpec alloc] init]; - [stack2 setChildren:@[subnodes[2], absoluteLayout]]; - - return [ASAbsoluteLayoutSpec absoluteLayoutSpecWithChildren:@[stack1, stack2, subnodes[4]]]; - }; - - ASDisplayNodeSizeToFitSizeRange(node, ASSizeRangeMake(CGSizeZero, CGSizeMake(CGFLOAT_MAX, CGFLOAT_MAX))); - [node recursivelySetInterfaceState:ASInterfaceStatePreload]; - - ASCATransactionQueueWait(nil); - // No premature view allocation - XCTAssertFalse(node.isNodeLoaded); - // Subnodes should be inserted, laid out and entered preload state - XCTAssertTrue([subnodes isEqualToArray:node.subnodes]); - for (NSInteger i = 0; i < subnodeCount; i++) { - ASDisplayNode *subnode = subnodes[i]; - XCTAssertTrue(CGSizeEqualToSize(kSize, subnode.bounds.size)); - XCTAssertTrue(ASInterfaceStateIncludesPreload(subnode.interfaceState)); - } -} - -- (void)testCalculatedLayoutHierarchyTransitions -{ - static CGSize kSize = {100, 100}; - - ASDisplayNode *node1 = [[ASDisplayNode alloc] init]; - ASDisplayNode *node2 = [[ASDisplayNode alloc] init]; - ASDisplayNode *node3 = [[ASDisplayNode alloc] init]; - - node1.debugName = @"a"; - node2.debugName = @"b"; - node3.debugName = @"c"; - - // As we will involve a stack spec we have to give the nodes an intrinsic content size - node1.style.preferredSize = kSize; - node2.style.preferredSize = kSize; - node3.style.preferredSize = kSize; - - ASSpecTestDisplayNode *node = [[ASSpecTestDisplayNode alloc] init]; - node.automaticallyManagesSubnodes = YES; - node.layoutSpecBlock = ^(ASDisplayNode *weakNode, ASSizeRange constrainedSize){ - ASSpecTestDisplayNode *strongNode = (ASSpecTestDisplayNode *)weakNode; - if ([strongNode.layoutState isEqualToNumber:@1]) { - return [ASAbsoluteLayoutSpec absoluteLayoutSpecWithChildren:@[node1, node2]]; - } else { - ASStackLayoutSpec *stackLayout = [[ASStackLayoutSpec alloc] init]; - [stackLayout setChildren:@[node3, node2]]; - return [ASAbsoluteLayoutSpec absoluteLayoutSpecWithChildren:@[node1, stackLayout]]; - } - }; - - ASDisplayNodeSizeToFitSizeRange(node, ASSizeRangeMake(CGSizeZero, CGSizeMake(CGFLOAT_MAX, CGFLOAT_MAX))); - [node.view layoutIfNeeded]; - XCTAssertEqual(node.subnodes[0], node1); - XCTAssertEqual(node.subnodes[1], node2); - - node.layoutState = @2; - [node setNeedsLayout]; // After a state change the layout needs to be invalidated - [node.view layoutIfNeeded]; // A new layout pass will trigger the hiearchy transition - - XCTAssertEqual(node.subnodes[0], node1); - XCTAssertEqual(node.subnodes[1], node3); - XCTAssertEqual(node.subnodes[2], node2); -} - -// Disable test for now as we disabled the assertion -//- (void)testLayoutTransitionWillThrowForManualSubnodeManagement -//{ -// ASDisplayNode *node1 = [[ASDisplayNode alloc] init]; -// node1.name = @"node1"; -// -// ASSpecTestDisplayNode *node = [[ASSpecTestDisplayNode alloc] init]; -// node.automaticallyManagesSubnodes = YES; -// node.layoutSpecBlock = ^ASLayoutSpec *(ASDisplayNode *weakNode, ASSizeRange constrainedSize){ -// return [ASAbsoluteLayoutSpec absoluteLayoutSpecWithChildren:@[node1]]; -// }; -// -// XCTAssertNoThrow([node layoutThatFits:ASSizeRangeMake(CGSizeZero)]); -// XCTAssertThrows([node1 removeFromSupernode]); -//} - -- (void)testLayoutTransitionMeasurementCompletionBlockIsCalledOnMainThread -{ - const CGSize kSize = CGSizeMake(100, 100); - - ASDisplayNode *displayNode = [[ASDisplayNode alloc] init]; - displayNode.style.preferredSize = kSize; - - // Trigger explicit view creation to be able to use the Transition API - [displayNode view]; - - XCTestExpectation *expectation = [self expectationWithDescription:@"Call measurement completion block on main"]; - - [displayNode transitionLayoutWithSizeRange:ASSizeRangeMake(CGSizeZero, CGSizeMake(INFINITY, INFINITY)) animated:YES shouldMeasureAsync:YES measurementCompletion:^{ - XCTAssertTrue(ASDisplayNodeThreadIsMain(), @"Measurement completion block should be called on main thread"); - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:2.0 handler:nil]; -} - -- (void)testMeasurementInBackgroundThreadWithLoadedNode -{ - const CGSize kNodeSize = CGSizeMake(100, 100); - ASDisplayNode *node1 = [[ASDisplayNode alloc] init]; - ASDisplayNode *node2 = [[ASDisplayNode alloc] init]; - - ASSpecTestDisplayNode *node = [[ASSpecTestDisplayNode alloc] init]; - node.style.preferredSize = kNodeSize; - node.automaticallyManagesSubnodes = YES; - node.layoutSpecBlock = ^(ASDisplayNode *weakNode, ASSizeRange constrainedSize) { - ASSpecTestDisplayNode *strongNode = (ASSpecTestDisplayNode *)weakNode; - if ([strongNode.layoutState isEqualToNumber:@1]) { - return [ASAbsoluteLayoutSpec absoluteLayoutSpecWithChildren:@[node1]]; - } else { - return [ASAbsoluteLayoutSpec absoluteLayoutSpecWithChildren:@[node2]]; - } - }; - - // Intentionally trigger view creation - [node view]; - [node2 view]; - - XCTestExpectation *expectation = [self expectationWithDescription:@"Fix IHM layout also if one node is already loaded"]; - - dispatch_async(dispatch_get_global_queue( DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{ - - // Measurement happens in the background - ASDisplayNodeSizeToFitSizeRange(node, ASSizeRangeMake(CGSizeZero, CGSizeMake(INFINITY, INFINITY))); - - // Dispatch back to the main thread to let the insertion / deletion of subnodes happening - dispatch_async(dispatch_get_main_queue(), ^{ - - // Layout on main - [node setNeedsLayout]; - [node.view layoutIfNeeded]; - XCTAssertEqual(node.subnodes[0], node1); - - dispatch_async(dispatch_get_global_queue( DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{ - - // Change state and measure in the background - node.layoutState = @2; - [node setNeedsLayout]; - - ASDisplayNodeSizeToFitSizeRange(node, ASSizeRangeMake(CGSizeZero, CGSizeMake(INFINITY, INFINITY))); - - // Dispatch back to the main thread to let the insertion / deletion of subnodes happening - dispatch_async(dispatch_get_main_queue(), ^{ - - // Layout on main again - [node.view layoutIfNeeded]; - XCTAssertEqual(node.subnodes[0], node2); - - [expectation fulfill]; - }); - }); - }); - }); - - [self waitForExpectationsWithTimeout:5.0 handler:^(NSError *error) { - if (error) { - NSLog(@"Timeout Error: %@", error); - } - }]; -} - -- (void)testTransitionLayoutWithAnimationWithLoadedNodes -{ - const CGSize kNodeSize = CGSizeMake(100, 100); - ASDisplayNode *node1 = [[ASDisplayNode alloc] init]; - ASDisplayNode *node2 = [[ASDisplayNode alloc] init]; - - ASSpecTestDisplayNode *node = [[ASSpecTestDisplayNode alloc] init]; - node.automaticallyManagesSubnodes = YES; - node.style.preferredSize = kNodeSize; - node.layoutSpecBlock = ^(ASDisplayNode *weakNode, ASSizeRange constrainedSize) { - ASSpecTestDisplayNode *strongNode = (ASSpecTestDisplayNode *)weakNode; - if ([strongNode.layoutState isEqualToNumber:@1]) { - return [ASAbsoluteLayoutSpec absoluteLayoutSpecWithChildren:@[node1]]; - } else { - return [ASAbsoluteLayoutSpec absoluteLayoutSpecWithChildren:@[node2]]; - } - }; - - // Intentionally trigger view creation - [node1 view]; - [node2 view]; - - XCTestExpectation *expectation = [self expectationWithDescription:@"Fix IHM layout transition also if one node is already loaded"]; - - ASDisplayNodeSizeToFitSizeRange(node, ASSizeRangeMake(CGSizeZero, CGSizeMake(INFINITY, INFINITY))); - [node.view layoutIfNeeded]; - XCTAssertEqual(node.subnodes[0], node1); - - node.layoutState = @2; - [node invalidateCalculatedLayout]; - [node transitionLayoutWithAnimation:YES shouldMeasureAsync:YES measurementCompletion:^{ - // Push this to the next runloop to let async insertion / removing of nodes finished before checking - dispatch_async(dispatch_get_main_queue(), ^{ - XCTAssertEqual(node.subnodes[0], node2); - [expectation fulfill]; - }); - }]; - - [self waitForExpectationsWithTimeout:5.0 handler:^(NSError *error) { - if (error) { - NSLog(@"Timeout Error: %@", error); - } - }]; -} - -@end diff --git a/submodules/AsyncDisplayKit/Tests/ASDisplayNodeLayoutTests.mm b/submodules/AsyncDisplayKit/Tests/ASDisplayNodeLayoutTests.mm deleted file mode 100644 index 582e141634..0000000000 --- a/submodules/AsyncDisplayKit/Tests/ASDisplayNodeLayoutTests.mm +++ /dev/null @@ -1,175 +0,0 @@ -// -// ASDisplayNodeLayoutTests.mm -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import "ASXCTExtensions.h" -#import -#import -#import - -#import "ASLayoutSpecSnapshotTestsHelper.h" - -@interface ASDisplayNodeLayoutTests : XCTestCase -@end - -@implementation ASDisplayNodeLayoutTests - -- (void)testMeasureOnLayoutIfNotHappenedBefore -{ - CGSize nodeSize = CGSizeMake(100, 100); - - ASDisplayNode *displayNode = [[ASDisplayNode alloc] init]; - displayNode.style.width = ASDimensionMake(100); - displayNode.style.height = ASDimensionMake(100); - - // Use a button node in here as ASButtonNode uses layoutSpecThatFits: - ASButtonNode *buttonNode = [ASButtonNode new]; - [displayNode addSubnode:buttonNode]; - - displayNode.frame = {.size = nodeSize}; - buttonNode.frame = {.size = nodeSize}; - - ASXCTAssertEqualSizes(displayNode.calculatedSize, CGSizeZero, @"Calculated size before measurement and layout should be 0"); - ASXCTAssertEqualSizes(buttonNode.calculatedSize, CGSizeZero, @"Calculated size before measurement and layout should be 0"); - - // Trigger view creation and layout pass without a manual -layoutThatFits: call before so the automatic measurement - // pass will trigger in the layout pass - [displayNode.view layoutIfNeeded]; - - ASXCTAssertEqualSizes(displayNode.calculatedSize, nodeSize, @"Automatic measurement pass should have happened in layout pass"); - ASXCTAssertEqualSizes(buttonNode.calculatedSize, nodeSize, @"Automatic measurement pass should have happened in layout pass"); -} - -#if DEBUG -- (void)testNotAllowAddingSubnodesInLayoutSpecThatFits -{ - ASDisplayNode *displayNode = [ASDisplayNode new]; - ASDisplayNode *someOtherNode = [ASDisplayNode new]; - - displayNode.layoutSpecBlock = ^(ASDisplayNode * _Nonnull node, ASSizeRange constrainedSize) { - [node addSubnode:someOtherNode]; - return [ASInsetLayoutSpec insetLayoutSpecWithInsets:UIEdgeInsetsZero child:someOtherNode]; - }; - - XCTAssertThrows([displayNode layoutThatFits:ASSizeRangeMake(CGSizeZero, CGSizeMake(100, 100))], @"Should throw if subnode was added in layoutSpecThatFits:"); -} - -- (void)testNotAllowModifyingSubnodesInLayoutSpecThatFits -{ - ASDisplayNode *displayNode = [ASDisplayNode new]; - ASDisplayNode *someOtherNode = [ASDisplayNode new]; - - [displayNode addSubnode:someOtherNode]; - - displayNode.layoutSpecBlock = ^(ASDisplayNode * _Nonnull node, ASSizeRange constrainedSize) { - [someOtherNode removeFromSupernode]; - [node addSubnode:[ASDisplayNode new]]; - return [ASInsetLayoutSpec insetLayoutSpecWithInsets:UIEdgeInsetsZero child:someOtherNode]; - }; - - XCTAssertThrows([displayNode layoutThatFits:ASSizeRangeMake(CGSizeZero, CGSizeMake(100, 100))], @"Should throw if subnodes where modified in layoutSpecThatFits:"); -} -#endif - -- (void)testMeasureOnLayoutIfNotHappenedBeforeNoRemeasureForSameBounds -{ - CGSize nodeSize = CGSizeMake(100, 100); - - ASDisplayNode *displayNode = [ASDisplayNode new]; - displayNode.style.width = ASDimensionMake(nodeSize.width); - displayNode.style.height = ASDimensionMake(nodeSize.height); - - ASButtonNode *buttonNode = [ASButtonNode new]; - [displayNode addSubnode:buttonNode]; - - __block atomic_int numberOfLayoutSpecThatFitsCalls = ATOMIC_VAR_INIT(0); - displayNode.layoutSpecBlock = ^(ASDisplayNode * _Nonnull node, ASSizeRange constrainedSize) { - atomic_fetch_add(&numberOfLayoutSpecThatFitsCalls, 1); - return [ASInsetLayoutSpec insetLayoutSpecWithInsets:UIEdgeInsetsZero child:buttonNode]; - }; - - displayNode.frame = {.size = nodeSize}; - - // Trigger initial layout pass without a measurement pass before - [displayNode.view layoutIfNeeded]; - XCTAssertEqual(numberOfLayoutSpecThatFitsCalls, 1, @"Should measure during layout if not measured"); - - [displayNode layoutThatFits:ASSizeRangeMake(nodeSize, nodeSize)]; - XCTAssertEqual(numberOfLayoutSpecThatFitsCalls, 1, @"Should not remeasure with same bounds"); -} - -- (void)testThatLayoutWithInvalidSizeCausesException -{ - ASDisplayNode *displayNode = [[ASDisplayNode alloc] init]; - ASDisplayNode *node = [[ASDisplayNode alloc] init]; - node.layoutSpecBlock = ^ASLayoutSpec *(ASDisplayNode *node, ASSizeRange constrainedSize) { - return [ASWrapperLayoutSpec wrapperWithLayoutElement:displayNode]; - }; - - XCTAssertThrows([node layoutThatFits:ASSizeRangeMake(CGSizeMake(0, FLT_MAX))]); -} - -- (void)testThatLayoutCreatedWithInvalidSizeCausesException -{ - ASDisplayNode *displayNode = [[ASDisplayNode alloc] init]; - XCTAssertThrows([ASLayout layoutWithLayoutElement:displayNode size:CGSizeMake(FLT_MAX, FLT_MAX)]); - XCTAssertThrows([ASLayout layoutWithLayoutElement:displayNode size:CGSizeMake(CGFLOAT_MAX, CGFLOAT_MAX)]); - XCTAssertThrows([ASLayout layoutWithLayoutElement:displayNode size:CGSizeMake(INFINITY, INFINITY)]); -} - -- (void)testThatLayoutElementCreatedInLayoutSpecThatFitsDoNotGetDeallocated -{ - const CGSize kSize = CGSizeMake(300, 300); - - ASDisplayNode *subNode = [[ASDisplayNode alloc] init]; - subNode.automaticallyManagesSubnodes = YES; - subNode.layoutSpecBlock = ^(ASDisplayNode * _Nonnull node, ASSizeRange constrainedSize) { - ASTextNode *textNode = [ASTextNode new]; - textNode.attributedText = [[NSAttributedString alloc] initWithString:@"Test Test Test Test Test Test Test Test"]; - ASInsetLayoutSpec *insetSpec = [ASInsetLayoutSpec insetLayoutSpecWithInsets:UIEdgeInsetsZero child:textNode]; - return [ASInsetLayoutSpec insetLayoutSpecWithInsets:UIEdgeInsetsZero child:insetSpec]; - }; - - ASDisplayNode *rootNode = [[ASDisplayNode alloc] init]; - rootNode.automaticallyManagesSubnodes = YES; - rootNode.layoutSpecBlock = ^(ASDisplayNode * _Nonnull node, ASSizeRange constrainedSize) { - ASTextNode *textNode = [ASTextNode new]; - textNode.attributedText = [[NSAttributedString alloc] initWithString:@"Test Test Test Test Test"]; - ASInsetLayoutSpec *insetSpec = [ASInsetLayoutSpec insetLayoutSpecWithInsets:UIEdgeInsetsZero child:textNode]; - - return [ASStackLayoutSpec - stackLayoutSpecWithDirection:ASStackLayoutDirectionVertical - spacing:0.0 - justifyContent:ASStackLayoutJustifyContentStart - alignItems:ASStackLayoutAlignItemsStretch - children:@[insetSpec, subNode]]; - }; - - rootNode.frame = CGRectMake(0, 0, kSize.width, kSize.height); - [rootNode view]; - - XCTestExpectation *expectation = [self expectationWithDescription:@"Execute measure and layout pass"]; - - dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{ - - [rootNode layoutThatFits:ASSizeRangeMake(kSize)]; - - dispatch_async(dispatch_get_main_queue(), ^{ - XCTAssertNoThrow([rootNode.view layoutIfNeeded]); - [expectation fulfill]; - }); - }); - - [self waitForExpectationsWithTimeout:5.0 handler:^(NSError *error) { - if (error) { - XCTFail(@"Expectation failed: %@", error); - } - }]; -} - -@end diff --git a/submodules/AsyncDisplayKit/Tests/ASDisplayNodeSnapshotTests.mm b/submodules/AsyncDisplayKit/Tests/ASDisplayNodeSnapshotTests.mm deleted file mode 100644 index 489727e3ba..0000000000 --- a/submodules/AsyncDisplayKit/Tests/ASDisplayNodeSnapshotTests.mm +++ /dev/null @@ -1,36 +0,0 @@ -// -// ASDisplayNodeSnapshotTests.mm -// Texture -// -// Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import "ASSnapshotTestCase.h" -#import - -@interface ASDisplayNodeSnapshotTests : ASSnapshotTestCase - -@end - -@implementation ASDisplayNodeSnapshotTests - -- (void)testBasicHierarchySnapshotTesting -{ - ASDisplayNode *node = [[ASDisplayNode alloc] init]; - node.backgroundColor = [UIColor blueColor]; - - ASTextNode *subnode = [[ASTextNode alloc] init]; - subnode.backgroundColor = [UIColor whiteColor]; - - subnode.attributedText = [[NSAttributedString alloc] initWithString:@"Hello"]; - node.automaticallyManagesSubnodes = YES; - node.layoutSpecBlock = ^(ASDisplayNode * _Nonnull node, ASSizeRange constrainedSize) { - return [ASInsetLayoutSpec insetLayoutSpecWithInsets:UIEdgeInsetsMake(5, 5, 5, 5) child:subnode]; - }; - - ASDisplayNodeSizeToFitSizeRange(node, ASSizeRangeMake(CGSizeZero, CGSizeMake(INFINITY, INFINITY))); - ASSnapshotVerifyNode(node, nil); -} - -@end diff --git a/submodules/AsyncDisplayKit/Tests/ASDisplayNodeTests.mm b/submodules/AsyncDisplayKit/Tests/ASDisplayNodeTests.mm deleted file mode 100644 index d1e1698413..0000000000 --- a/submodules/AsyncDisplayKit/Tests/ASDisplayNodeTests.mm +++ /dev/null @@ -1,2705 +0,0 @@ -// -// ASDisplayNodeTests.mm -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import -#import - -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import - -#import "ASXCTExtensions.h" -#import "ASDisplayNodeTestsHelper.h" - -// Conveniences for making nodes named a certain way -#define DeclareNodeNamed(n) ASDisplayNode *n = [[ASDisplayNode alloc] init]; n.debugName = @#n -#define DeclareViewNamed(v) \ - ASDisplayNode *node_##v = [[ASDisplayNode alloc] init]; \ - node_##v.debugName = @#v; \ - UIView *v = node_##v.view; -#define DeclareLayerNamed(l) \ - ASDisplayNode *node_##l = [[ASDisplayNode alloc] init]; \ - node_##l.debugName = @#l; \ - node_##l.layerBacked = YES; \ - CALayer *l = node_##l.layer; - -static NSString *orderStringFromSublayers(CALayer *l) { - return [[[l.sublayers valueForKey:@"asyncdisplaykit_node"] valueForKey:@"debugName"] componentsJoinedByString:@","]; -} - -static NSString *orderStringFromSubviews(UIView *v) { - return [[[v.subviews valueForKey:@"asyncdisplaykit_node"] valueForKey:@"debugName"] componentsJoinedByString:@","]; -} - -static NSString *orderStringFromSubnodes(ASDisplayNode *n) { - return [[n.subnodes valueForKey:@"debugName"] componentsJoinedByString:@","]; -} - -// Asserts subnode, subview, sublayer order match what you provide here -#define XCTAssertNodeSubnodeSubviewSublayerOrder(n, loaded, isLayerBacked, order, description) \ -XCTAssertEqualObjects(orderStringFromSubnodes(n), order, @"Incorrect node order for " description );\ -if (loaded) {\ - if (!isLayerBacked) {\ - XCTAssertEqualObjects(orderStringFromSubviews(n.view), order, @"Incorrect subviews for " description);\ - }\ - XCTAssertEqualObjects(orderStringFromSublayers(n.layer), order, @"Incorrect sublayers for " description);\ -} - -#define XCTAssertNodesHaveParent(parent, nodes ...) \ -for (ASDisplayNode *n in @[ nodes ]) {\ - XCTAssertEqualObjects(parent, n.supernode, @"%@ has the wrong parent", n.debugName);\ -} - -#define XCTAssertNodesLoaded(nodes ...) \ -for (ASDisplayNode *n in @[ nodes ]) {\ - XCTAssertTrue(n.nodeLoaded, @"%@ should be loaded", n.debugName);\ -} - -#define XCTAssertNodesNotLoaded(nodes ...) \ -for (ASDisplayNode *n in @[ nodes ]) {\ - XCTAssertFalse(n.nodeLoaded, @"%@ should not be loaded", n.debugName);\ -} - -@interface UIWindow (Testing) -// UIWindow has this handy method that is not public but great for testing -- (UIResponder *)firstResponder; -@end - -@interface ASDisplayNode (HackForTests) -- (id)initWithViewClass:(Class)viewClass; -- (id)initWithLayerClass:(Class)layerClass; -- (void)setInterfaceState:(ASInterfaceState)state; -// FIXME: Importing ASDisplayNodeInternal.h causes a heap of problems. -- (void)enterInterfaceState:(ASInterfaceState)interfaceState; -@end - -@interface ASTestDisplayNode : ASDisplayNode -@property (nonatomic) void (^willDeallocBlock)(__unsafe_unretained ASTestDisplayNode *node); -@property (nonatomic) CGSize(^calculateSizeBlock)(ASTestDisplayNode *node, CGSize size); - -@property (nonatomic, nullable) UIGestureRecognizer *gestureRecognizer; -@property (nonatomic, nullable) id idGestureRecognizer; -@property (nonatomic, nullable) UIImage *bigImage; -@property (nonatomic, nullable) NSArray *randomProperty; - -@property (nonatomic, nullable) UIGestureRecognizer *gestureRecognizer; -@property (nonatomic, nullable) id idGestureRecognizer; -@property (nonatomic, nullable) UIImage *bigImage; -@property (nonatomic, nullable) NSArray *randomProperty; - -@property (nonatomic) BOOL displayRangeStateChangedToYES; -@property (nonatomic) BOOL displayRangeStateChangedToNO; - -@property (nonatomic) BOOL hasPreloaded; -@property (nonatomic) BOOL preloadStateChangedToYES; -@property (nonatomic) BOOL preloadStateChangedToNO; - -@property (nonatomic) NSUInteger displayWillStartCount; -@property (nonatomic) NSUInteger didDisplayCount; - -@end - -@interface ASTestResponderNode : ASTestDisplayNode -@end - -@implementation ASTestDisplayNode - -- (void)setInterfaceState:(ASInterfaceState)state -{ - [super setInterfaceState:state]; - ASCATransactionQueueWait(nil); -} - -- (CGSize)calculateSizeThatFits:(CGSize)constrainedSize -{ - return _calculateSizeBlock ? _calculateSizeBlock(self, constrainedSize) : CGSizeZero; -} - -- (void)didEnterDisplayState -{ - [super didEnterDisplayState]; - self.displayRangeStateChangedToYES = YES; -} - -- (void)didExitDisplayState -{ - [super didExitDisplayState]; - self.displayRangeStateChangedToNO = YES; -} - -- (void)didEnterPreloadState -{ - [super didEnterPreloadState]; - self.preloadStateChangedToYES = YES; - self.hasPreloaded = YES; -} - -- (void)didExitPreloadState -{ - [super didExitPreloadState]; - self.preloadStateChangedToNO = YES; -} - -- (void)dealloc -{ - if (_willDeallocBlock) { - _willDeallocBlock(self); - } -} - -- (void)displayDidFinish -{ - [super displayDidFinish]; - _didDisplayCount++; -} - -- (void)displayWillStartAsynchronously:(BOOL)asynchronously -{ - [super displayWillStartAsynchronously:asynchronously]; - _displayWillStartCount++; -} - -- (CALayer *__strong (*)[NUM_CLIP_CORNER_LAYERS])clipCornerLayers -{ - return &self->_clipCornerLayers; -} - -@end - -@interface ASSynchronousTestDisplayNodeViaViewClass : ASDisplayNode -@end - -@implementation ASSynchronousTestDisplayNodeViaViewClass - -+ (Class)viewClass { - return [UIView class]; -} - -@end - -@interface ASSynchronousTestDisplayNodeViaLayerClass : ASDisplayNode -@end - -@implementation ASSynchronousTestDisplayNodeViaLayerClass - -+ (Class)layerClass { - return [CALayer class]; -} - -@end - -@interface UIDisplayNodeTestView : UIView -@end - -@interface UIResponderNodeTestView : _ASDisplayView -@property(nonatomic) BOOL testIsFirstResponder; -@end - -@implementation UIDisplayNodeTestView -@end - -@interface ASTestWindow : UIWindow -@end - -@implementation ASTestWindow - -- (id)firstResponder { - return self.subviews.firstObject; -} - -@end - -@implementation ASTestResponderNode - -+ (Class)viewClass { - return [UIResponderNodeTestView class]; -} - -- (BOOL)canBecomeFirstResponder { - return YES; -} - -@end - -@implementation UIResponderNodeTestView - -- (BOOL)becomeFirstResponder { - self.testIsFirstResponder = YES; - return YES; -} - -- (BOOL)canResignFirstResponder { - return YES; -} - -- (BOOL)resignFirstResponder { - [super resignFirstResponder]; - if (self.testIsFirstResponder) { - self.testIsFirstResponder = NO; - return YES; - } - return NO; -} - -@end - -@interface ASTestResponderNodeWithOverride : ASDisplayNode -@end -@implementation ASTestResponderNodeWithOverride -- (BOOL)canBecomeFirstResponder { - return YES; -} -@end - -@interface ASTestViewController: ASViewController -@end -@implementation ASTestViewController -- (BOOL)prefersStatusBarHidden { return YES; } -@end - -@interface UIResponderNodeTestDisplayViewCallingSuper : _ASDisplayView -@end -@implementation UIResponderNodeTestDisplayViewCallingSuper -- (BOOL)canBecomeFirstResponder { return YES; } -- (BOOL)becomeFirstResponder { return [super becomeFirstResponder]; } -@end - -@interface UIResponderNodeTestViewCallingSuper : UIView -@end -@implementation UIResponderNodeTestViewCallingSuper -- (BOOL)canBecomeFirstResponder { return YES; } -- (BOOL)becomeFirstResponder { return [super becomeFirstResponder]; } -@end - -@interface ASDisplayNodeTests : XCTestCase -@end - -@implementation ASDisplayNodeTests -{ - dispatch_queue_t queue; -} - -- (void)testOverriddenNodeFirstResponderBehavior -{ - ASTestDisplayNode *node = [[ASTestResponderNode alloc] init]; - XCTAssertTrue([node canBecomeFirstResponder]); - XCTAssertTrue([node becomeFirstResponder]); -} - -- (void)testOverriddenDisplayViewFirstResponderBehavior -{ - UIWindow *window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds]; - ASDisplayNode *node = [[ASDisplayNode alloc] initWithViewClass:[UIResponderNodeTestDisplayViewCallingSuper class]]; - - // We have to add the node to a window otherwise the super responder methods call responses are undefined - // This will also create the backing view of the node - [window addSubnode:node]; - [window makeKeyAndVisible]; - - XCTAssertTrue([node canBecomeFirstResponder]); - XCTAssertTrue([node becomeFirstResponder]); -} - -- (void)testOverriddenViewFirstResponderBehavior -{ - UIWindow *window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds]; - ASDisplayNode *node = [[ASDisplayNode alloc] initWithViewClass:[UIResponderNodeTestViewCallingSuper class]]; - - // We have to add the node to a window otherwise the super responder methods call responses are undefined - // This will also create the backing view of the node - [window addSubnode:node]; - [window makeKeyAndVisible]; - - XCTAssertTrue([node canBecomeFirstResponder]); - XCTAssertTrue([node becomeFirstResponder]); -} - -- (void)testDefaultFirstResponderBehavior -{ - ASTestDisplayNode *node = [[ASTestDisplayNode alloc] init]; - XCTAssertFalse([node canBecomeFirstResponder]); - XCTAssertFalse([node becomeFirstResponder]); -} - -- (void)testResponderMethodsBehavior -{ - UIWindow *window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds]; - ASEditableTextNode *textNode = [[ASEditableTextNode alloc] init]; - - // We have to add the text node to a window otherwise the responder methods responses are undefined - // This will also create the backing view of the node - [window addSubnode:textNode]; - [window makeKeyAndVisible]; - - XCTAssertTrue([textNode canBecomeFirstResponder]); - XCTAssertTrue([textNode becomeFirstResponder]); - XCTAssertTrue([window firstResponder] == textNode.textView); - XCTAssertTrue([textNode resignFirstResponder]); - - // If the textNode resigns it's first responder the view should not be the first responder - XCTAssertTrue([window firstResponder] == nil); - XCTAssertFalse([textNode.view isFirstResponder]); -} - -- (void)testResponderOverrrideCanBecomeFirstResponder -{ - UIWindow *window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds]; - ASTestResponderNodeWithOverride *node = [[ASTestResponderNodeWithOverride alloc] init]; - - // We have to add the text node to a window otherwise the responder methods responses are undefined - // This will also create the backing view of the node - [window addSubnode:node]; - [window makeKeyAndVisible]; - - XCTAssertTrue([node canBecomeFirstResponder]); - XCTAssertTrue([node becomeFirstResponder]); - XCTAssertTrue([window firstResponder] == node.view); -} - -- (void)testUnsupportedResponderSetupWillThrow -{ - ASTestResponderNode *node = [[ASTestResponderNode alloc] init]; - [node setViewBlock:^UIView * _Nonnull{ - return [[UIView alloc] init]; - }]; - XCTAssertThrows([node view], @"Externally provided views should be synchronous"); -} - -- (void)setUp -{ - [super setUp]; - queue = dispatch_queue_create("com.facebook.AsyncDisplayKit.ASDisplayNodeTestsQueue", NULL); -} - -- (void)testViewCreatedOffThreadCanBeRealizedOnThread -{ - __block ASDisplayNode *node = nil; - [self executeOffThread:^{ - node = [[ASDisplayNode alloc] init]; - }]; - - UIView *view = node.view; - XCTAssertNotNil(view, @"Getting node's view on-thread should succeed."); -} - -- (void)testNodeCreatedOffThreadWithExistingView -{ - UIView *view = [[UIDisplayNodeTestView alloc] init]; - - __block ASDisplayNode *node = nil; - [self executeOffThread:^{ - node = [[ASDisplayNode alloc] initWithViewBlock:^UIView *{ - return view; - }]; - }]; - - XCTAssertFalse(node.layerBacked, @"Can't be layer backed"); - XCTAssertTrue(node.synchronous, @"Node with plain view should be synchronous"); - XCTAssertFalse(node.nodeLoaded, @"Shouldn't have a view yet"); - XCTAssertEqual(view, node.view, @"Getting node's view on-thread should succeed."); -} - -- (void)testNodeCreatedOffThreadWithLazyView -{ - __block UIView *view = nil; - __block ASDisplayNode *node = nil; - [self executeOffThread:^{ - node = [[ASDisplayNode alloc] initWithViewBlock:^UIView *{ - XCTAssertTrue([NSThread isMainThread], @"View block must run on the main queue"); - view = [[UIDisplayNodeTestView alloc] init]; - return view; - }]; - }]; - - XCTAssertNil(view, @"View block should not be invoked yet"); - [node view]; - XCTAssertNotNil(view, @"View block should have been invoked"); - XCTAssertEqual(view, node.view, @"Getting node's view on-thread should succeed."); - XCTAssertTrue(node.synchronous, @"Node with plain view should be synchronous"); -} - -- (void)testNodeCreatedWithLazyAsyncView -{ - ASDisplayNode *node = [[ASDisplayNode alloc] initWithViewBlock:^UIView *{ - XCTAssertTrue([NSThread isMainThread], @"View block must run on the main queue"); - return [[_ASDisplayView alloc] init]; - }]; - - XCTAssertThrows([node view], @"Externally provided views should be synchronous"); - XCTAssertTrue(node.synchronous, @"Node with externally provided view should be synchronous"); -} - -- (void)checkValuesMatchDefaults:(ASDisplayNode *)node isLayerBacked:(BOOL)isLayerBacked -{ - NSString *targetName = isLayerBacked ? @"layer" : @"view"; - NSString *hasLoadedView = node.nodeLoaded ? @"with view" : [NSString stringWithFormat:@"after loading %@", targetName]; - -// id rgbBlackCGColorIdPtr = (id)[UIColor blackColor].CGColor; - - XCTAssertEqual((id)nil, node.contents, @"default contents broken %@", hasLoadedView); - XCTAssertEqual(NO, node.clipsToBounds, @"default clipsToBounds broken %@", hasLoadedView); - XCTAssertEqual(YES, node.opaque, @"default opaque broken %@", hasLoadedView); - XCTAssertEqual(NO, node.needsDisplayOnBoundsChange, @"default needsDisplayOnBoundsChange broken %@", hasLoadedView); - XCTAssertEqual(YES, node.allowsGroupOpacity, @"default allowsGroupOpacity broken %@", hasLoadedView); - XCTAssertEqual(NO, node.allowsEdgeAntialiasing, @"default allowsEdgeAntialiasing broken %@", hasLoadedView); - XCTAssertEqual((unsigned int)(kCALayerLeftEdge | kCALayerRightEdge | kCALayerBottomEdge | kCALayerTopEdge), node.edgeAntialiasingMask, @"default edgeAntialisingMask broken %@", hasLoadedView); - XCTAssertEqual(NO, node.hidden, @"default hidden broken %@", hasLoadedView); - XCTAssertEqual(1.0f, node.alpha, @"default alpha broken %@", hasLoadedView); - XCTAssertTrue(CGRectEqualToRect(CGRectZero, node.bounds), @"default bounds broken %@", hasLoadedView); - XCTAssertTrue(CGRectEqualToRect(CGRectZero, node.frame), @"default frame broken %@", hasLoadedView); - XCTAssertTrue(CGPointEqualToPoint(CGPointZero, node.position), @"default position broken %@", hasLoadedView); - XCTAssertEqual((CGFloat)0.0, node.zPosition, @"default zPosition broken %@", hasLoadedView); - XCTAssertEqual(1.0f, node.contentsScale, @"default contentsScale broken %@", hasLoadedView); - XCTAssertEqual([UIScreen mainScreen].scale, node.contentsScaleForDisplay, @"default contentsScaleForDisplay broken %@", hasLoadedView); - XCTAssertTrue(CATransform3DEqualToTransform(CATransform3DIdentity, node.transform), @"default transform broken %@", hasLoadedView); - XCTAssertTrue(CATransform3DEqualToTransform(CATransform3DIdentity, node.subnodeTransform), @"default subnodeTransform broken %@", hasLoadedView); - XCTAssertEqual((id)nil, node.backgroundColor, @"default backgroundColor broken %@", hasLoadedView); - XCTAssertEqual(UIViewContentModeScaleToFill, node.contentMode, @"default contentMode broken %@", hasLoadedView); -// XCTAssertEqualObjects(rgbBlackCGColorIdPtr, (id)node.shadowColor, @"default shadowColor broken %@", hasLoadedView); - XCTAssertEqual(0.0f, node.shadowOpacity, @"default shadowOpacity broken %@", hasLoadedView); - XCTAssertTrue(CGSizeEqualToSize(CGSizeMake(0, -3), node.shadowOffset), @"default shadowOffset broken %@", hasLoadedView); - XCTAssertEqual(3.f, node.shadowRadius, @"default shadowRadius broken %@", hasLoadedView); - XCTAssertEqual(0.0f, node.borderWidth, @"default borderWidth broken %@", hasLoadedView); -// XCTAssertEqualObjects(rgbBlackCGColorIdPtr, (id)node.borderColor, @"default borderColor broken %@", hasLoadedView); - XCTAssertEqual(NO, node.displaySuspended, @"default displaySuspended broken %@", hasLoadedView); - XCTAssertEqual(YES, node.displaysAsynchronously, @"default displaysAsynchronously broken %@", hasLoadedView); - XCTAssertEqual(NO, node.asyncdisplaykit_asyncTransactionContainer, @"default asyncdisplaykit_asyncTransactionContainer broken %@", hasLoadedView); - XCTAssertEqualObjects(nil, node.debugName, @"default name broken %@", hasLoadedView); - - XCTAssertEqual(NO, node.isAccessibilityElement, @"default isAccessibilityElement is broken %@", hasLoadedView); - XCTAssertEqual((id)nil, node.accessibilityLabel, @"default accessibilityLabel is broken %@", hasLoadedView); - XCTAssertEqual((id)nil, node.accessibilityHint, @"default accessibilityHint is broken %@", hasLoadedView); - XCTAssertEqual((id)nil, node.accessibilityValue, @"default accessibilityValue is broken %@", hasLoadedView); -// if (AS_AT_LEAST_IOS11) { -// XCTAssertEqual((id)nil, node.accessibilityAttributedLabel, @"default accessibilityAttributedLabel is broken %@", hasLoadedView); -// XCTAssertEqual((id)nil, node.accessibilityAttributedHint, @"default accessibilityAttributedHint is broken %@", hasLoadedView); -// XCTAssertEqual((id)nil, node.accessibilityAttributedValue, @"default accessibilityAttributedValue is broken %@", hasLoadedView); -// } - XCTAssertEqual(UIAccessibilityTraitNone, node.accessibilityTraits, @"default accessibilityTraits is broken %@", hasLoadedView); - XCTAssertTrue(CGRectEqualToRect(CGRectZero, node.accessibilityFrame), @"default accessibilityFrame is broken %@", hasLoadedView); - XCTAssertEqual((id)nil, node.accessibilityLanguage, @"default accessibilityLanguage is broken %@", hasLoadedView); - XCTAssertEqual(NO, node.accessibilityElementsHidden, @"default accessibilityElementsHidden is broken %@", hasLoadedView); - XCTAssertEqual(NO, node.accessibilityViewIsModal, @"default accessibilityViewIsModal is broken %@", hasLoadedView); - XCTAssertEqual(NO, node.shouldGroupAccessibilityChildren, @"default shouldGroupAccessibilityChildren is broken %@", hasLoadedView); - - if (!isLayerBacked) { - XCTAssertEqual(YES, node.userInteractionEnabled, @"default userInteractionEnabled broken %@", hasLoadedView); - XCTAssertEqual(NO, node.exclusiveTouch, @"default exclusiveTouch broken %@", hasLoadedView); - XCTAssertEqual(YES, node.autoresizesSubviews, @"default autoresizesSubviews broken %@", hasLoadedView); - XCTAssertEqual(UIViewAutoresizingNone, node.autoresizingMask, @"default autoresizingMask broken %@", hasLoadedView); - XCTAssertTrue(UIEdgeInsetsEqualToEdgeInsets(UIEdgeInsetsMake(8, 8, 8, 8), node.layoutMargins), @"default layoutMargins broken %@", hasLoadedView); - XCTAssertEqual(NO, node.preservesSuperviewLayoutMargins, @"default preservesSuperviewLayoutMargins broken %@", hasLoadedView); - XCTAssertTrue(UIEdgeInsetsEqualToEdgeInsets(UIEdgeInsetsZero, node.safeAreaInsets), @"default safeAreaInsets broken %@", hasLoadedView); - XCTAssertEqual(YES, node.insetsLayoutMarginsFromSafeArea, @"default insetsLayoutMarginsFromSafeArea broken %@", hasLoadedView); - } else { - XCTAssertEqual(NO, node.userInteractionEnabled, @"layer-backed nodes do not support userInteractionEnabled %@", hasLoadedView); - XCTAssertEqual(NO, node.exclusiveTouch, @"layer-backed nodes do not support exclusiveTouch %@", hasLoadedView); - } -} - -- (void)checkDefaultPropertyValuesWithLayerBacking:(BOOL)isLayerBacked -{ - ASDisplayNode *node = [[ASDisplayNode alloc] init]; - - XCTAssertEqual(NO, node.isLayerBacked, @"default isLayerBacked broken without view"); - node.layerBacked = isLayerBacked; - XCTAssertEqual(isLayerBacked, node.isLayerBacked, @"setIsLayerBacked: broken"); - - // Assert that the values can be fetched from the node before the view is realized. - [self checkValuesMatchDefaults:node isLayerBacked:isLayerBacked]; - - [node layer]; // Force either view or layer loading - XCTAssertTrue(node.nodeLoaded, @"Didn't load view"); - - // Assert that the values can be fetched from the node after the view is realized. - [self checkValuesMatchDefaults:node isLayerBacked:isLayerBacked]; -} - -- (void)testDefaultPropertyValuesLayer -{ - [self checkDefaultPropertyValuesWithLayerBacking:YES]; -} - -- (void)testDefaultPropertyValuesView -{ - [self checkDefaultPropertyValuesWithLayerBacking:NO]; -} - -- (UIImage *)bogusImage -{ - static UIImage *bogusImage; - static dispatch_once_t onceToken; - dispatch_once(&onceToken, ^{ - UIGraphicsBeginImageContext(CGSizeMake(1, 1)); - bogusImage = UIGraphicsGetImageFromCurrentImageContext(); - UIGraphicsEndImageContext(); - }); - return bogusImage; -} - -- (void)checkValuesMatchSetValues:(ASDisplayNode *)node isLayerBacked:(BOOL)isLayerBacked -{ - NSString *targetName = isLayerBacked ? @"layer" : @"view"; - NSString *hasLoadedView = node.nodeLoaded ? @"with view" : [NSString stringWithFormat:@"after loading %@", targetName]; - - XCTAssertEqual(isLayerBacked, node.isLayerBacked, @"isLayerBacked broken %@", hasLoadedView); - XCTAssertEqualObjects((id)[self bogusImage].CGImage, (id)node.contents, @"contents broken %@", hasLoadedView); - XCTAssertEqual(YES, node.clipsToBounds, @"clipsToBounds broken %@", hasLoadedView); - XCTAssertEqual(NO, node.opaque, @"opaque broken %@", hasLoadedView); - XCTAssertEqual(YES, node.needsDisplayOnBoundsChange, @"needsDisplayOnBoundsChange broken %@", hasLoadedView); - XCTAssertEqual(NO, node.allowsGroupOpacity, @"allowsGroupOpacity broken %@", hasLoadedView); - XCTAssertEqual(YES, node.allowsEdgeAntialiasing, @"allowsEdgeAntialiasing broken %@", hasLoadedView); - XCTAssertTrue((unsigned int)(kCALayerLeftEdge | kCALayerTopEdge) == node.edgeAntialiasingMask, @"edgeAntialiasingMask broken: %@", hasLoadedView); - XCTAssertEqual(YES, node.hidden, @"hidden broken %@", hasLoadedView); - XCTAssertEqual(.5f, node.alpha, @"alpha broken %@", hasLoadedView); - XCTAssertTrue(CGRectEqualToRect(CGRectMake(10, 15, 42, 115.2), node.bounds), @"bounds broken %@", hasLoadedView); - XCTAssertTrue(CGPointEqualToPoint(CGPointMake(10, 65), node.position), @"position broken %@", hasLoadedView); - XCTAssertEqual((CGFloat)5.6, node.zPosition, @"zPosition broken %@", hasLoadedView); - XCTAssertEqual(.5f, node.contentsScale, @"contentsScale broken %@", hasLoadedView); - XCTAssertTrue(CATransform3DEqualToTransform(CATransform3DMakeScale(0.5, 0.5, 1.0), node.transform), @"transform broken %@", hasLoadedView); - XCTAssertTrue(CATransform3DEqualToTransform(CATransform3DMakeTranslation(1337, 7357, 7007), node.subnodeTransform), @"subnodeTransform broken %@", hasLoadedView); - XCTAssertEqualObjects([UIColor clearColor], node.backgroundColor, @"backgroundColor broken %@", hasLoadedView); - XCTAssertEqual(UIViewContentModeBottom, node.contentMode, @"contentMode broken %@", hasLoadedView); - XCTAssertEqual([[UIColor cyanColor] CGColor], node.shadowColor, @"shadowColor broken %@", hasLoadedView); - XCTAssertEqual(.5f, node.shadowOpacity, @"shadowOpacity broken %@", hasLoadedView); - XCTAssertTrue(CGSizeEqualToSize(CGSizeMake(1.0f, 1.0f), node.shadowOffset), @"shadowOffset broken %@", hasLoadedView); - XCTAssertEqual(.5f, node.shadowRadius, @"shadowRadius broken %@", hasLoadedView); - XCTAssertEqual(.5f, node.borderWidth, @"borderWidth broken %@", hasLoadedView); - XCTAssertEqual([[UIColor orangeColor] CGColor], node.borderColor, @"borderColor broken %@", hasLoadedView); - XCTAssertEqual(YES, node.displaySuspended, @"displaySuspended broken %@", hasLoadedView); - XCTAssertEqual(NO, node.displaysAsynchronously, @"displaySuspended broken %@", hasLoadedView); - XCTAssertEqual(YES, node.asyncdisplaykit_asyncTransactionContainer, @"asyncTransactionContainer broken %@", hasLoadedView); - XCTAssertEqual(NO, node.userInteractionEnabled, @"userInteractionEnabled broken %@", hasLoadedView); - XCTAssertEqual((BOOL)!isLayerBacked, node.exclusiveTouch, @"exclusiveTouch broken %@", hasLoadedView); - XCTAssertEqualObjects(@"quack like a duck", node.debugName, @"debugName broken %@", hasLoadedView); - - XCTAssertEqual(YES, node.isAccessibilityElement, @"accessibilityElement broken %@", hasLoadedView); - XCTAssertEqualObjects(@"Ship love", node.accessibilityLabel, @"accessibilityLabel broken %@", hasLoadedView); - XCTAssertEqualObjects(@"Awesome things will happen", node.accessibilityHint, @"accessibilityHint broken %@", hasLoadedView); - XCTAssertEqualObjects(@"1 of 2", node.accessibilityValue, @"accessibilityValue broken %@", hasLoadedView); - - // setting the accessibilityLabel, accessibilityHint and accessibilityValue is supposed to be bridged to the attributed versions -// if (AS_AT_LEAST_IOS11) { -// XCTAssertEqualObjects(@"Ship love", node.accessibilityAttributedLabel.string, @"accessibilityAttributedLabel is broken %@", hasLoadedView); -// XCTAssertEqualObjects(@"Awesome things will happen", node.accessibilityAttributedHint.string, @"accessibilityAttributedHint is broken %@", hasLoadedView); -// XCTAssertEqualObjects(@"1 of 2", node.accessibilityAttributedValue.string, @"accessibilityAttributedValue is broken %@", hasLoadedView); -// } - XCTAssertEqual(UIAccessibilityTraitSelected | UIAccessibilityTraitButton, node.accessibilityTraits, @"accessibilityTraits broken %@", hasLoadedView); - XCTAssertTrue(CGRectEqualToRect(CGRectMake(1, 2, 3, 4), node.accessibilityFrame), @"accessibilityFrame broken %@", hasLoadedView); - XCTAssertEqualObjects(@"mas", node.accessibilityLanguage, @"accessibilityLanguage broken %@", hasLoadedView); - XCTAssertEqual(YES, node.accessibilityElementsHidden, @"accessibilityElementsHidden broken %@", hasLoadedView); - XCTAssertEqual(YES, node.accessibilityViewIsModal, @"accessibilityViewIsModal broken %@", hasLoadedView); - XCTAssertEqual(YES, node.shouldGroupAccessibilityChildren, @"shouldGroupAccessibilityChildren broken %@", hasLoadedView); - XCTAssertEqual(UIAccessibilityNavigationStyleSeparate, node.accessibilityNavigationStyle, @"accessibilityNavigationStyle broken %@", hasLoadedView); - XCTAssertTrue(CGPointEqualToPoint(CGPointMake(1.0, 1.0), node.accessibilityActivationPoint), @"accessibilityActivationPoint broken %@", hasLoadedView); - XCTAssertNotNil(node.accessibilityPath, @"accessibilityPath broken %@", hasLoadedView); - - - if (!isLayerBacked) { - XCTAssertEqual(UIViewAutoresizingFlexibleLeftMargin, node.autoresizingMask, @"autoresizingMask %@", hasLoadedView); - XCTAssertEqual(NO, node.autoresizesSubviews, @"autoresizesSubviews broken %@", hasLoadedView); - XCTAssertTrue(UIEdgeInsetsEqualToEdgeInsets(UIEdgeInsetsMake(3, 5, 8, 11), node.layoutMargins), @"layoutMargins broken %@", hasLoadedView); - XCTAssertEqual(YES, node.preservesSuperviewLayoutMargins, @"preservesSuperviewLayoutMargins broken %@", hasLoadedView); - XCTAssertEqual(NO, node.insetsLayoutMarginsFromSafeArea, @"insetsLayoutMarginsFromSafeArea broken %@", hasLoadedView); - } -} - -- (void)checkSimpleBridgePropertiesSetPropagate:(BOOL)isLayerBacked -{ - __block ASDisplayNode *node = nil; - - [self executeOffThread:^{ - node = [[ASDisplayNode alloc] init]; - node.layerBacked = isLayerBacked; - - node.contents = (id)[self bogusImage].CGImage; - node.clipsToBounds = YES; - node.opaque = NO; - node.needsDisplayOnBoundsChange = YES; - node.allowsGroupOpacity = NO; - node.allowsEdgeAntialiasing = YES; - node.edgeAntialiasingMask = (kCALayerLeftEdge | kCALayerTopEdge); - node.hidden = YES; - node.alpha = .5f; - node.position = CGPointMake(10, 65); - node.zPosition = 5.6; - node.bounds = CGRectMake(10, 15, 42, 115.2); - node.contentsScale = .5f; - node.transform = CATransform3DMakeScale(0.5, 0.5, 1.0); - node.subnodeTransform = CATransform3DMakeTranslation(1337, 7357, 7007); - node.backgroundColor = [UIColor clearColor]; - node.contentMode = UIViewContentModeBottom; - node.shadowColor = [[UIColor cyanColor] CGColor]; - node.shadowOpacity = .5f; - node.shadowOffset = CGSizeMake(1.0f, 1.0f); - node.shadowRadius = .5f; - node.borderWidth = .5f; - node.borderColor = [[UIColor orangeColor] CGColor]; - node.displaySuspended = YES; - node.displaysAsynchronously = NO; - node.asyncdisplaykit_asyncTransactionContainer = YES; - node.userInteractionEnabled = NO; - node.debugName = @"quack like a duck"; - - node.isAccessibilityElement = YES; - - for (int i = 0; i < 4; i++) { - if (i % 2 == 0) { - XCTAssertNoThrow(node.accessibilityLabel = nil); - XCTAssertNoThrow(node.accessibilityHint = nil); - XCTAssertNoThrow(node.accessibilityValue = nil); - } else { - node.accessibilityLabel = @"Ship love"; - node.accessibilityHint = @"Awesome things will happen"; - node.accessibilityValue = @"1 of 2"; - } - } - - node.accessibilityTraits = UIAccessibilityTraitSelected | UIAccessibilityTraitButton; - node.accessibilityFrame = CGRectMake(1, 2, 3, 4); - node.accessibilityLanguage = @"mas"; - node.accessibilityElementsHidden = YES; - node.accessibilityViewIsModal = YES; - node.shouldGroupAccessibilityChildren = YES; - node.accessibilityNavigationStyle = UIAccessibilityNavigationStyleSeparate; - node.accessibilityActivationPoint = CGPointMake(1.0, 1.0); - node.accessibilityPath = [UIBezierPath bezierPath]; - - if (!isLayerBacked) { - node.exclusiveTouch = YES; - node.autoresizesSubviews = NO; - node.autoresizingMask = UIViewAutoresizingFlexibleLeftMargin; - node.insetsLayoutMarginsFromSafeArea = NO; - node.layoutMargins = UIEdgeInsetsMake(3, 5, 8, 11); - node.preservesSuperviewLayoutMargins = YES; - } - }]; - - // Assert that the values can be fetched from the node before the view is realized. - [self checkValuesMatchSetValues:node isLayerBacked:isLayerBacked]; - - // Assert that the realized view/layer have the correct values. - [node layer]; - - [self checkValuesMatchSetValues:node isLayerBacked:isLayerBacked]; - - // As a final sanity check, change a value on the realized view and ensure it is fetched through the node. - if (isLayerBacked) { - node.layer.hidden = NO; - } else { - node.view.hidden = NO; - } - XCTAssertEqual(NO, node.hidden, @"After the view is realized, the node should delegate properties to the view."); -} - -// Set each of the simple bridged UIView properties to a non-default value off-thread, then -// assert that they are correct on the node and propagated to the UIView realized on-thread. -- (void)testSimpleUIViewBridgePropertiesSetOffThreadPropagate -{ - [self checkSimpleBridgePropertiesSetPropagate:NO]; -} - -- (void)testSimpleCALayerBridgePropertiesSetOffThreadPropagate -{ - [self checkSimpleBridgePropertiesSetPropagate:YES]; -} - -- (void)testPropertiesSetOffThreadBeforeLoadingExternalView -{ - UIView *view = [[UIDisplayNodeTestView alloc] init]; - - __block ASDisplayNode *node = nil; - [self executeOffThread:^{ - node = [[ASDisplayNode alloc] initWithViewBlock:^{ - return view; - }]; - node.backgroundColor = [UIColor blueColor]; - node.frame = CGRectMake(10, 20, 30, 40); - node.autoresizingMask = UIViewAutoresizingFlexibleWidth; - node.userInteractionEnabled = YES; - }]; - - [self checkExternalViewAppliedPropertiesMatch:node]; -} - -- (void)testPropertiesSetOnThreadAfterLoadingExternalView -{ - UIView *view = [[UIDisplayNodeTestView alloc] init]; - ASDisplayNode *node = [[ASDisplayNode alloc] initWithViewBlock:^{ - return view; - }]; - - // Load the backing view first - [node view]; - - node.backgroundColor = [UIColor blueColor]; - node.frame = CGRectMake(10, 20, 30, 40); - node.autoresizingMask = UIViewAutoresizingFlexibleWidth; - node.userInteractionEnabled = YES; - - [self checkExternalViewAppliedPropertiesMatch:node]; -} - -- (void)checkExternalViewAppliedPropertiesMatch:(ASDisplayNode *)node -{ - UIView *view = node.view; - - XCTAssertEqualObjects([UIColor blueColor], view.backgroundColor, @"backgroundColor not propagated to view"); - XCTAssertTrue(CGRectEqualToRect(CGRectMake(10, 20, 30, 40), view.frame), @"frame not propagated to view"); - XCTAssertEqual(UIViewAutoresizingFlexibleWidth, view.autoresizingMask, @"autoresizingMask not propagated to view"); - XCTAssertEqual(YES, view.userInteractionEnabled, @"userInteractionEnabled not propagated to view"); -} - -- (void)testPropertiesSetOffThreadBeforeLoadingExternalLayer -{ - CALayer *layer = [[CAShapeLayer alloc] init]; - - __block ASDisplayNode *node = nil; - [self executeOffThread:^{ - node = [[ASDisplayNode alloc] initWithLayerBlock:^{ - return layer; - }]; - node.backgroundColor = [UIColor blueColor]; - node.frame = CGRectMake(10, 20, 30, 40); - }]; - - [self checkExternalLayerAppliedPropertiesMatch:node]; -} - -- (void)testPropertiesSetOnThreadAfterLoadingExternalLayer -{ - CALayer *layer = [[CAShapeLayer alloc] init]; - ASDisplayNode *node = [[ASDisplayNode alloc] initWithLayerBlock:^{ - return layer; - }]; - - // Load the backing layer first - [node layer]; - - node.backgroundColor = [UIColor blueColor]; - node.frame = CGRectMake(10, 20, 30, 40); - - [self checkExternalLayerAppliedPropertiesMatch:node]; -} - -- (void)checkExternalLayerAppliedPropertiesMatch:(ASDisplayNode *)node -{ - CALayer *layer = node.layer; - - XCTAssertTrue(CGColorEqualToColor([UIColor blueColor].CGColor, layer.backgroundColor), @"backgroundColor not propagated to layer"); - XCTAssertTrue(CGRectEqualToRect(CGRectMake(10, 20, 30, 40), layer.frame), @"frame not propagated to layer"); -} - - -// Perform parallel updates of a standard UIView/CALayer and an ASDisplayNode and ensure they are equivalent. -- (void)testDeriveFrameFromBoundsPositionAnchorPoint -{ - UIView *plainView = [[UIView alloc] initWithFrame:CGRectZero]; - plainView.layer.anchorPoint = CGPointMake(0.25f, 0.75f); - plainView.layer.position = CGPointMake(10, 20); - plainView.layer.bounds = CGRectMake(0, 0, 60, 80); - - __block ASDisplayNode *node = nil; - [self executeOffThread:^{ - node = [[ASDisplayNode alloc] init]; - node.anchorPoint = CGPointMake(0.25f, 0.75f); - node.bounds = CGRectMake(0, 0, 60, 80); - node.position = CGPointMake(10, 20); - }]; - - XCTAssertTrue(CGRectEqualToRect(plainView.frame, node.frame), @"Node frame should match UIView frame before realization."); - XCTAssertTrue(CGRectEqualToRect(plainView.frame, node.view.frame), @"Realized view frame should match UIView frame."); -} - -// Perform parallel updates of a standard UIView/CALayer and an ASDisplayNode and ensure they are equivalent. -- (void)testSetFrameSetsBoundsPosition -{ - UIView *plainView = [[UIView alloc] initWithFrame:CGRectZero]; - plainView.layer.anchorPoint = CGPointMake(0.25f, 0.75f); - plainView.layer.frame = CGRectMake(10, 20, 60, 80); - - __block ASDisplayNode *node = nil; - [self executeOffThread:^{ - node = [[ASDisplayNode alloc] init]; - node.anchorPoint = CGPointMake(0.25f, 0.75f); - node.frame = CGRectMake(10, 20, 60, 80); - }]; - - XCTAssertTrue(CGPointEqualToPoint(plainView.layer.position, node.position), @"Node position should match UIView position before realization."); - XCTAssertTrue(CGRectEqualToRect(plainView.layer.bounds, node.bounds), @"Node bounds should match UIView bounds before realization."); - XCTAssertTrue(CGPointEqualToPoint(plainView.layer.position, node.view.layer.position), @"Realized view position should match UIView position before realization."); - XCTAssertTrue(CGRectEqualToRect(plainView.layer.bounds, node.view.layer.bounds), @"Realized view bounds should match UIView bounds before realization."); -} - -- (void)testDisplayNodePointConversionWithFrames -{ - ASDisplayNode *node = nil; - ASDisplayNode *innerNode = nil; - - // Setup - CGPoint originalPoint = CGPointZero, convertedPoint = CGPointZero, correctPoint = CGPointZero; - node = [[ASDisplayNode alloc] init]; - innerNode = [[ASDisplayNode alloc] init]; - [node addSubnode:innerNode]; - - // Convert point *FROM* outer node's coordinate space to inner node's coordinate space - node.frame = CGRectMake(100, 100, 100, 100); - innerNode.frame = CGRectMake(10, 10, 20, 20); - originalPoint = CGPointMake(105, 105); - correctPoint = CGPointMake(95, 95); - convertedPoint = [self checkConvertPoint:originalPoint fromNode:node selfNode:innerNode]; - XCTAssertTrue(CGPointEqualToPoint(convertedPoint, correctPoint), @"Unexpected point conversion result. Point: %@ Expected conversion: %@ Actual conversion: %@", NSStringFromCGPoint(originalPoint), NSStringFromCGPoint(correctPoint), NSStringFromCGPoint(convertedPoint)); - - // Setup - node = [[ASDisplayNode alloc] init]; - innerNode = [[ASDisplayNode alloc] init]; - [node addSubnode:innerNode]; - - // Convert point *FROM* inner node's coordinate space to outer node's coordinate space - node.frame = CGRectMake(100, 100, 100, 100); - innerNode.frame = CGRectMake(10, 10, 20, 20); - originalPoint = CGPointMake(5, 5); - correctPoint = CGPointMake(15, 15); - convertedPoint = [self checkConvertPoint:originalPoint fromNode:innerNode selfNode:node]; - XCTAssertTrue(CGPointEqualToPoint(convertedPoint, correctPoint), @"Unexpected point conversion result. Point: %@ Expected conversion: %@ Actual conversion: %@", NSStringFromCGPoint(originalPoint), NSStringFromCGPoint(correctPoint), NSStringFromCGPoint(convertedPoint)); - - // Setup - node = [[ASDisplayNode alloc] init]; - innerNode = [[ASDisplayNode alloc] init]; - [node addSubnode:innerNode]; - - // Convert point in inner node's coordinate space *TO* outer node's coordinate space - node.frame = CGRectMake(100, 100, 100, 100); - innerNode.frame = CGRectMake(10, 10, 20, 20); - originalPoint = CGPointMake(95, 95); - correctPoint = CGPointMake(105, 105); - convertedPoint = [self checkConvertPoint:originalPoint toNode:node selfNode:innerNode]; - XCTAssertTrue(CGPointEqualToPoint(convertedPoint, correctPoint), @"Unexpected point conversion result. Point: %@ Expected conversion: %@ Actual conversion: %@", NSStringFromCGPoint(originalPoint), NSStringFromCGPoint(correctPoint), NSStringFromCGPoint(convertedPoint)); - - // Setup - node = [[ASDisplayNode alloc] init]; - innerNode = [[ASDisplayNode alloc] init]; - [node addSubnode:innerNode]; - - // Convert point in outer node's coordinate space *TO* inner node's coordinate space - node.frame = CGRectMake(0, 0, 100, 100); - innerNode.frame = CGRectMake(10, 10, 20, 20); - originalPoint = CGPointMake(5, 5); - correctPoint = CGPointMake(-5, -5); - convertedPoint = [self checkConvertPoint:originalPoint toNode:innerNode selfNode:node]; - XCTAssertTrue(CGPointEqualToPoint(convertedPoint, correctPoint), @"Unexpected point conversion result. Point: %@ Expected conversion: %@ Actual conversion: %@", NSStringFromCGPoint(originalPoint), NSStringFromCGPoint(correctPoint), NSStringFromCGPoint(convertedPoint)); -} - -// Test conversions when bounds is not null. -// NOTE: Esoteric values were picked to facilitate visual inspection by demonstrating the relevance of certain numbers and lack of relevance of others -- (void)testDisplayNodePointConversionWithNonZeroBounds -{ - ASDisplayNode *node = nil; - ASDisplayNode *innerNode = nil; - - // Setup - CGPoint originalPoint = CGPointZero, convertedPoint = CGPointZero, correctPoint = CGPointZero; - node = [[ASDisplayNode alloc] init]; - innerNode = [[ASDisplayNode alloc] init]; - [node addSubnode:innerNode]; - - // Convert point *FROM* outer node's coordinate space to inner node's coordinate space - node.anchorPoint = CGPointZero; - innerNode.anchorPoint = CGPointZero; - node.bounds = CGRectMake(20, 20, 100, 100); - innerNode.position = CGPointMake(23, 23); - innerNode.bounds = CGRectMake(17, 17, 20, 20); - originalPoint = CGPointMake(42, 42); - correctPoint = CGPointMake(36, 36); - convertedPoint = [self checkConvertPoint:originalPoint fromNode:node selfNode:innerNode]; - XCTAssertTrue(CGPointEqualToPoint(convertedPoint, correctPoint), @"Unexpected point conversion result. Point: %@ Expected conversion: %@ Actual conversion: %@", NSStringFromCGPoint(originalPoint), NSStringFromCGPoint(correctPoint), NSStringFromCGPoint(convertedPoint)); - - // Setup - node = [[ASDisplayNode alloc] init]; - innerNode = [[ASDisplayNode alloc] init]; - [node addSubnode:innerNode]; - - // Convert point *FROM* inner node's coordinate space to outer node's coordinate space - node.anchorPoint = CGPointZero; - innerNode.anchorPoint = CGPointZero; - node.bounds = CGRectMake(-1000, -1000, 1337, 1337); - innerNode.position = CGPointMake(23, 23); - innerNode.bounds = CGRectMake(17, 17, 200, 200); - originalPoint = CGPointMake(5, 5); - correctPoint = CGPointMake(11, 11); - convertedPoint = [self checkConvertPoint:originalPoint fromNode:innerNode selfNode:node]; - XCTAssertTrue(CGPointEqualToPoint(convertedPoint, correctPoint), @"Unexpected point conversion result. Point: %@ Expected conversion: %@ Actual conversion: %@", NSStringFromCGPoint(originalPoint), NSStringFromCGPoint(correctPoint), NSStringFromCGPoint(convertedPoint)); - - // Setup - node = [[ASDisplayNode alloc] init]; - innerNode = [[ASDisplayNode alloc] init]; - [node addSubnode:innerNode]; - - // Convert point in inner node's coordinate space *TO* outer node's coordinate space - node.anchorPoint = CGPointZero; - innerNode.anchorPoint = CGPointZero; - node.bounds = CGRectMake(20, 20, 100, 100); - innerNode.position = CGPointMake(23, 23); - innerNode.bounds = CGRectMake(17, 17, 20, 20); - originalPoint = CGPointMake(36, 36); - correctPoint = CGPointMake(42, 42); - convertedPoint = [self checkConvertPoint:originalPoint toNode:node selfNode:innerNode]; - XCTAssertTrue(CGPointEqualToPoint(convertedPoint, correctPoint), @"Unexpected point conversion result. Point: %@ Expected conversion: %@ Actual conversion: %@", NSStringFromCGPoint(originalPoint), NSStringFromCGPoint(correctPoint), NSStringFromCGPoint(convertedPoint)); - - // Setup - node = [[ASDisplayNode alloc] init]; - innerNode = [[ASDisplayNode alloc] init]; - [node addSubnode:innerNode]; - - // Convert point in outer node's coordinate space *TO* inner node's coordinate space - node.anchorPoint = CGPointZero; - innerNode.anchorPoint = CGPointZero; - node.bounds = CGRectMake(-1000, -1000, 1337, 1337); - innerNode.position = CGPointMake(23, 23); - innerNode.bounds = CGRectMake(17, 17, 200, 200); - originalPoint = CGPointMake(11, 11); - correctPoint = CGPointMake(5, 5); - convertedPoint = [self checkConvertPoint:originalPoint toNode:innerNode selfNode:node]; - XCTAssertTrue(CGPointEqualToPoint(convertedPoint, correctPoint), @"Unexpected point conversion result. Point: %@ Expected conversion: %@ Actual conversion: %@", NSStringFromCGPoint(originalPoint), NSStringFromCGPoint(correctPoint), NSStringFromCGPoint(convertedPoint)); -} - -// Test conversions when the anchorPoint is not {0.0, 0.0}. -- (void)testDisplayNodePointConversionWithNonZeroAnchorPoint -{ - ASDisplayNode *node = nil; - ASDisplayNode *innerNode = nil; - - // Setup - CGPoint originalPoint = CGPointZero, convertedPoint = CGPointZero, correctPoint = CGPointZero; - node = [[ASDisplayNode alloc] init]; - innerNode = [[ASDisplayNode alloc] init]; - [node addSubnode:innerNode]; - - // Convert point *FROM* outer node's coordinate space to inner node's coordinate space - node.bounds = CGRectMake(20, 20, 100, 100); - innerNode.anchorPoint = CGPointMake(0.75, 1); - innerNode.position = CGPointMake(23, 23); - innerNode.bounds = CGRectMake(17, 17, 20, 20); - originalPoint = CGPointMake(42, 42); - correctPoint = CGPointMake(51, 56); - convertedPoint = [self checkConvertPoint:originalPoint fromNode:node selfNode:innerNode]; - XCTAssertTrue(_CGPointEqualToPointWithEpsilon(convertedPoint, correctPoint, 0.001), @"Unexpected point conversion result. Point: %@ Expected conversion: %@ Actual conversion: %@", NSStringFromCGPoint(originalPoint), NSStringFromCGPoint(correctPoint), NSStringFromCGPoint(convertedPoint)); - - // Setup - node = [[ASDisplayNode alloc] init]; - innerNode = [[ASDisplayNode alloc] init]; - [node addSubnode:innerNode]; - - // Convert point *FROM* inner node's coordinate space to outer node's coordinate space - node.bounds = CGRectMake(-1000, -1000, 1337, 1337); - innerNode.anchorPoint = CGPointMake(0.3, 0.3); - innerNode.position = CGPointMake(23, 23); - innerNode.bounds = CGRectMake(17, 17, 200, 200); - originalPoint = CGPointMake(55, 55); - correctPoint = CGPointMake(1, 1); - convertedPoint = [self checkConvertPoint:originalPoint fromNode:innerNode selfNode:node]; - XCTAssertTrue(_CGPointEqualToPointWithEpsilon(convertedPoint, correctPoint, 0.001), @"Unexpected point conversion result. Point: %@ Expected conversion: %@ Actual conversion: %@", NSStringFromCGPoint(originalPoint), NSStringFromCGPoint(correctPoint), NSStringFromCGPoint(convertedPoint)); - - // Setup - node = [[ASDisplayNode alloc] init]; - innerNode = [[ASDisplayNode alloc] init]; - [node addSubnode:innerNode]; - - // Convert point in inner node's coordinate space *TO* outer node's coordinate space - node.bounds = CGRectMake(20, 20, 100, 100); - innerNode.anchorPoint = CGPointMake(0.75, 1); - innerNode.position = CGPointMake(23, 23); - innerNode.bounds = CGRectMake(17, 17, 20, 20); - originalPoint = CGPointMake(51, 56); - correctPoint = CGPointMake(42, 42); - convertedPoint = [self checkConvertPoint:originalPoint toNode:node selfNode:innerNode]; - XCTAssertTrue(_CGPointEqualToPointWithEpsilon(convertedPoint, correctPoint, 0.001), @"Unexpected point conversion result. Point: %@ Expected conversion: %@ Actual conversion: %@", NSStringFromCGPoint(originalPoint), NSStringFromCGPoint(correctPoint), NSStringFromCGPoint(convertedPoint)); - - // Setup - node = [[ASDisplayNode alloc] init]; - innerNode = [[ASDisplayNode alloc] init]; - [node addSubnode:innerNode]; - - // Convert point in outer node's coordinate space *TO* inner node's coordinate space - node.bounds = CGRectMake(-1000, -1000, 1337, 1337); - innerNode.anchorPoint = CGPointMake(0.3, 0.3); - innerNode.position = CGPointMake(23, 23); - innerNode.bounds = CGRectMake(17, 17, 200, 200); - originalPoint = CGPointMake(1, 1); - correctPoint = CGPointMake(55, 55); - convertedPoint = [self checkConvertPoint:originalPoint toNode:innerNode selfNode:node]; - XCTAssertTrue(_CGPointEqualToPointWithEpsilon(convertedPoint, correctPoint, 0.001), @"Unexpected point conversion result. Point: %@ Expected conversion: %@ Actual conversion: %@", NSStringFromCGPoint(originalPoint), NSStringFromCGPoint(correctPoint), NSStringFromCGPoint(convertedPoint)); -} - -- (void)testDisplayNodePointConversionAgainstSelf { - ASDisplayNode *innerNode = nil; - CGPoint originalPoint = CGPointZero, convertedPoint = CGPointZero; - - innerNode = [[ASDisplayNode alloc] init]; - innerNode.frame = CGRectMake(10, 10, 20, 20); - originalPoint = CGPointMake(105, 105); - convertedPoint = [self checkConvertPoint:originalPoint fromNode:innerNode selfNode:innerNode]; - XCTAssertTrue(_CGPointEqualToPointWithEpsilon(convertedPoint, originalPoint, 0.001), @"Unexpected point conversion result. Point: %@ Expected conversion: %@ Actual conversion: %@", NSStringFromCGPoint(originalPoint), NSStringFromCGPoint(originalPoint), NSStringFromCGPoint(convertedPoint)); - - innerNode = [[ASDisplayNode alloc] init]; - innerNode.position = CGPointMake(23, 23); - innerNode.bounds = CGRectMake(17, 17, 20, 20); - originalPoint = CGPointMake(42, 42); - convertedPoint = [self checkConvertPoint:originalPoint fromNode:innerNode selfNode:innerNode]; - XCTAssertTrue(CGPointEqualToPoint(convertedPoint, originalPoint), @"Unexpected point conversion result. Point: %@ Expected conversion: %@ Actual conversion: %@", NSStringFromCGPoint(originalPoint), NSStringFromCGPoint(originalPoint), NSStringFromCGPoint(convertedPoint)); - - innerNode = [[ASDisplayNode alloc] init]; - innerNode.anchorPoint = CGPointMake(0.3, 0.3); - innerNode.position = CGPointMake(23, 23); - innerNode.bounds = CGRectMake(17, 17, 200, 200); - originalPoint = CGPointMake(55, 55); - convertedPoint = [self checkConvertPoint:originalPoint fromNode:innerNode selfNode:innerNode]; - XCTAssertTrue(CGPointEqualToPoint(convertedPoint, originalPoint), @"Unexpected point conversion result. Point: %@ Expected conversion: %@ Actual conversion: %@", NSStringFromCGPoint(originalPoint), NSStringFromCGPoint(originalPoint), NSStringFromCGPoint(convertedPoint)); - - innerNode = [[ASDisplayNode alloc] init]; - innerNode.frame = CGRectMake(10, 10, 20, 20); - originalPoint = CGPointMake(95, 95); - convertedPoint = [self checkConvertPoint:originalPoint toNode:innerNode selfNode:innerNode]; - XCTAssertTrue(CGPointEqualToPoint(convertedPoint, originalPoint), @"Unexpected point conversion result. Point: %@ Expected conversion: %@ Actual conversion: %@", NSStringFromCGPoint(originalPoint), NSStringFromCGPoint(originalPoint), NSStringFromCGPoint(convertedPoint)); - - innerNode = [[ASDisplayNode alloc] init]; - innerNode.position = CGPointMake(23, 23); - innerNode.bounds = CGRectMake(17, 17, 20, 20); - originalPoint = CGPointMake(36, 36); - convertedPoint = [self checkConvertPoint:originalPoint toNode:innerNode selfNode:innerNode]; - XCTAssertTrue(CGPointEqualToPoint(convertedPoint, originalPoint), @"Unexpected point conversion result. Point: %@ Expected conversion: %@ Actual conversion: %@", NSStringFromCGPoint(originalPoint), NSStringFromCGPoint(originalPoint), NSStringFromCGPoint(convertedPoint)); - - innerNode = [[ASDisplayNode alloc] init]; - innerNode.anchorPoint = CGPointMake(0.75, 1); - innerNode.position = CGPointMake(23, 23); - innerNode.bounds = CGRectMake(17, 17, 20, 20); - originalPoint = CGPointMake(51, 56); - convertedPoint = [self checkConvertPoint:originalPoint toNode:innerNode selfNode:innerNode]; - XCTAssertTrue(CGPointEqualToPoint(convertedPoint, originalPoint), @"Unexpected point conversion result. Point: %@ Expected conversion: %@ Actual conversion: %@", NSStringFromCGPoint(originalPoint), NSStringFromCGPoint(originalPoint), NSStringFromCGPoint(convertedPoint)); -} - -- (void)testDisplayNodePointConversionFailureFromDisjointHierarchies -{ - ASDisplayNode *node = [[ASDisplayNode alloc] init]; - ASDisplayNode *childNode = [[ASDisplayNode alloc] init]; - ASDisplayNode *otherNode = [[ASDisplayNode alloc] init]; - [node addSubnode:childNode]; - - XCTAssertNoThrow([self checkConvertPoint:CGPointZero fromNode:node selfNode:childNode], @"Assertion should have succeeded; nodes are in the same hierarchy"); - XCTAssertThrows([self checkConvertPoint:CGPointZero fromNode:node selfNode:otherNode], @"Assertion should have failed for nodes that are not in the same node hierarchy"); - XCTAssertThrows([self checkConvertPoint:CGPointZero fromNode:childNode selfNode:otherNode], @"Assertion should have failed for nodes that are not in the same node hierarchy"); - - XCTAssertNoThrow([self checkConvertPoint:CGPointZero fromNode:childNode selfNode:node], @"Assertion should have succeeded; nodes are in the same hierarchy"); - XCTAssertThrows([self checkConvertPoint:CGPointZero fromNode:otherNode selfNode:node], @"Assertion should have failed for nodes that are not in the same node hierarchy"); - XCTAssertThrows([self checkConvertPoint:CGPointZero fromNode:otherNode selfNode:childNode], @"Assertion should have failed for nodes that are not in the same node hierarchy"); - - XCTAssertNoThrow([self checkConvertPoint:CGPointZero toNode:node selfNode:childNode], @"Assertion should have succeeded; nodes are in the same hierarchy"); - XCTAssertThrows([self checkConvertPoint:CGPointZero toNode:node selfNode:otherNode], @"Assertion should have failed for nodes that are not in the same node hierarchy"); - XCTAssertThrows([self checkConvertPoint:CGPointZero toNode:childNode selfNode:otherNode], @"Assertion should have failed for nodes that are not in the same node hierarchy"); - - XCTAssertNoThrow([self checkConvertPoint:CGPointZero toNode:childNode selfNode:node], @"Assertion should have succeeded; nodes are in the same hierarchy"); - XCTAssertThrows([self checkConvertPoint:CGPointZero toNode:otherNode selfNode:node], @"Assertion should have failed for nodes that are not in the same node hierarchy"); - XCTAssertThrows([self checkConvertPoint:CGPointZero toNode:otherNode selfNode:childNode], @"Assertion should have failed for nodes that are not in the same node hierarchy"); -} - -- (void)testDisplayNodePointConversionOnDeepHierarchies -{ - ASDisplayNode *node = [[ASDisplayNode alloc] init]; - - // 7 deep (six below root); each one positioned at position = (1, 1) - _addTonsOfSubnodes(node, 2, 6, ^(ASDisplayNode *createdNode) { - createdNode.position = CGPointMake(1, 1); - }); - - ASDisplayNode *deepSubNode = [self _getDeepSubnodeForRoot:node withIndices:@[@1, @1, @1, @1, @1, @1]]; - - CGPoint originalPoint = CGPointMake(55, 55); - CGPoint correctPoint = CGPointMake(61, 61); - CGPoint convertedPoint = [deepSubNode convertPoint:originalPoint toNode:node]; - XCTAssertTrue(CGPointEqualToPoint(convertedPoint, correctPoint), @"Unexpected point conversion result. Point: %@ Expected conversion: %@ Actual conversion: %@", NSStringFromCGPoint(originalPoint), NSStringFromCGPoint(correctPoint), NSStringFromCGPoint(convertedPoint)); -} - -// Adds nodes (breadth-first rather than depth-first addition) -static void _addTonsOfSubnodes(ASDisplayNode *parent, NSUInteger fanout, NSUInteger depth, void (^onCreate)(ASDisplayNode *createdNode)) { - if (depth == 0) { - return; - } - - for (NSUInteger i = 0; i < fanout; i++) { - ASDisplayNode *subnode = [[ASDisplayNode alloc] init]; - [parent addSubnode:subnode]; - onCreate(subnode); - } - for (NSUInteger i = 0; i < fanout; i++) { - _addTonsOfSubnodes(parent.subnodes[i], fanout, depth - 1, onCreate); - } -} - -// Convenience function for getting a node deep within a node hierarchy -- (ASDisplayNode *)_getDeepSubnodeForRoot:(ASDisplayNode *)root withIndices:(NSArray *)indexArray { - if ([indexArray count] == 0) { - return root; - } - - NSArray *subnodes = root.subnodes; - if ([subnodes count] == 0) { - XCTFail(@"Node hierarchy isn't deep enough for given index array"); - } - - NSUInteger index = [indexArray[0] unsignedIntegerValue]; - NSArray *otherIndices = [indexArray subarrayWithRange:NSMakeRange(1, [indexArray count] -1)]; - - return [self _getDeepSubnodeForRoot:subnodes[index] withIndices:otherIndices]; -} - -static inline BOOL _CGPointEqualToPointWithEpsilon(CGPoint point1, CGPoint point2, CGFloat epsilon) { - CGFloat absEpsilon = fabs(epsilon); - BOOL xOK = fabs(point1.x - point2.x) < absEpsilon; - BOOL yOK = fabs(point1.y - point2.y) < absEpsilon; - return xOK && yOK; -} - -- (CGPoint)checkConvertPoint:(CGPoint)point fromNode:(ASDisplayNode *)fromNode selfNode:(ASDisplayNode *)toNode -{ - CGPoint nodeConversion = [toNode convertPoint:point fromNode:fromNode]; - - UIView *fromView = fromNode.view; - UIView *toView = toNode.view; - CGPoint viewConversion = [toView convertPoint:point fromView:fromView]; - XCTAssertTrue(_CGPointEqualToPointWithEpsilon(nodeConversion, viewConversion, 0.001), @"Conversion mismatch: node: %@ view: %@", NSStringFromCGPoint(nodeConversion), NSStringFromCGPoint(viewConversion)); - return nodeConversion; -} - -- (CGPoint)checkConvertPoint:(CGPoint)point toNode:(ASDisplayNode *)toNode selfNode:(ASDisplayNode *)fromNode -{ - CGPoint nodeConversion = [fromNode convertPoint:point toNode:toNode]; - - UIView *fromView = fromNode.view; - UIView *toView = toNode.view; - CGPoint viewConversion = [fromView convertPoint:point toView:toView]; - XCTAssertTrue(_CGPointEqualToPointWithEpsilon(nodeConversion, viewConversion, 0.001), @"Conversion mismatch: node: %@ view: %@", NSStringFromCGPoint(nodeConversion), NSStringFromCGPoint(viewConversion)); - return nodeConversion; -} - -- (void)executeOffThread:(void (^)(void))block -{ - __block BOOL blockExecuted = NO; - dispatch_group_t g = dispatch_group_create(); - dispatch_group_async(g, queue, ^{ - block(); - blockExecuted = YES; - }); - dispatch_group_wait(g, DISPATCH_TIME_FOREVER); - XCTAssertTrue(blockExecuted, @"Block did not finish executing. Timeout or exception?"); -} - -- (void)testReferenceCounting -{ - __weak ASTestDisplayNode *weakNode = nil; - { - NS_VALID_UNTIL_END_OF_SCOPE ASTestDisplayNode *node = [[ASTestDisplayNode alloc] init]; - weakNode = node; - } - XCTAssertNil(weakNode); -} - -- (void)testAddingNodeToHierarchyRetainsNode -{ - UIView *v = [[UIView alloc] initWithFrame:CGRectZero]; - __weak ASTestDisplayNode *weakNode = nil; - { - NS_VALID_UNTIL_END_OF_SCOPE ASTestDisplayNode *node = [[ASTestDisplayNode alloc] init]; - [v addSubview:node.view]; - weakNode = node; - } - XCTAssertNotNil(weakNode); -} - -- (void)testAddingSubnodeDoesNotCreateRetainCycle -{ - __weak ASTestDisplayNode *weakNode = nil; - __weak ASTestDisplayNode *weakSubnode = nil; - { - NS_VALID_UNTIL_END_OF_SCOPE ASTestDisplayNode *node = [[ASTestDisplayNode alloc] init]; - NS_VALID_UNTIL_END_OF_SCOPE ASTestDisplayNode *subnode = [[ASTestDisplayNode alloc] init]; - [node addSubnode:subnode]; - weakNode = node; - weakSubnode = subnode; - - XCTAssertNotNil(weakNode); - XCTAssertNotNil(weakSubnode); - } - XCTAssertNil(weakNode); - XCTAssertNil(weakSubnode); -} - -- (void)testThatUIKitDeallocationTrampoliningWorks -{ - NS_VALID_UNTIL_END_OF_SCOPE __weak UIGestureRecognizer *weakRecognizer = nil; - NS_VALID_UNTIL_END_OF_SCOPE __weak UIGestureRecognizer *weakIdRecognizer = nil; - NS_VALID_UNTIL_END_OF_SCOPE __weak UIView *weakView = nil; - NS_VALID_UNTIL_END_OF_SCOPE __weak CALayer *weakLayer = nil; - NS_VALID_UNTIL_END_OF_SCOPE __weak UIImage *weakImage = nil; - NS_VALID_UNTIL_END_OF_SCOPE __weak NSArray *weakArray = nil; - __block NS_VALID_UNTIL_END_OF_SCOPE ASTestDisplayNode *node = nil; - @autoreleasepool { - node = [[ASTestDisplayNode alloc] init]; - node.gestureRecognizer = [[UIGestureRecognizer alloc] init]; - node.idGestureRecognizer = [[UIGestureRecognizer alloc] init]; - UIGraphicsBeginImageContextWithOptions(CGSizeMake(1000, 1000), YES, 1); - node.bigImage = UIGraphicsGetImageFromCurrentImageContext(); - node.randomProperty = @[ @"Hello, world!" ]; - UIGraphicsEndImageContext(); - weakImage = node.bigImage; - weakView = node.view; - weakLayer = node.layer; - weakArray = node.randomProperty; - weakIdRecognizer = node.idGestureRecognizer; - weakRecognizer = node.gestureRecognizer; - } - - [self executeOffThread:^{ - node = nil; - }]; - - XCTAssertNotNil(weakRecognizer, @"UIGestureRecognizer ivars should be deallocated on main."); - XCTAssertNotNil(weakIdRecognizer, @"UIGestureRecognizer-backed 'id' ivars should be deallocated on main."); - XCTAssertNotNil(weakView, @"UIView ivars should be deallocated on main."); - XCTAssertNotNil(weakLayer, @"CALayer ivars should be deallocated on main."); - XCTAssertNil(weakImage, @"UIImage ivars should be deallocated normally."); - XCTAssertNil(weakArray, @"NSArray ivars should be deallocated normally."); - XCTAssertNil(node); - - [self expectationForPredicate:[NSPredicate predicateWithBlock:^BOOL(id _Nonnull evaluatedObject, NSDictionary * _Nullable bindings) { - return (weakRecognizer == nil && weakIdRecognizer == nil && weakView == nil); - }] evaluatedWithObject:(id)kCFNull handler:nil]; - [self waitForExpectationsWithTimeout:10 handler:nil]; -} - -- (void)testSubnodes -{ - ASDisplayNode *parent = [[ASDisplayNode alloc] init]; - ASDisplayNode *nilNode = nil; - XCTAssertThrows([parent addSubnode:nilNode], @"Don't try to add nil, but we'll deal with it in production, but throw in development."); - XCTAssertNoThrow([parent addSubnode:parent], @"Not good, test that we recover"); - XCTAssertEqual(0u, parent.subnodes.count, @"We shouldn't have any subnodes"); -} - -- (void)testReplaceSubnodeNoView -{ - [self checkReplaceSubnodeLoaded:NO layerBacked:NO]; -} - -- (void)testReplaceSubnodeNoLayer -{ - [self checkReplaceSubnodeLoaded:NO layerBacked:YES]; -} - -- (void)testReplaceSubnodeView -{ - [self checkReplaceSubnodeLoaded:YES layerBacked:NO]; -} - -- (void)testReplaceSubnodeLayer -{ - [self checkReplaceSubnodeLoaded:YES layerBacked:YES]; -} - - -- (void)checkReplaceSubnodeLoaded:(BOOL)loaded layerBacked:(BOOL)isLayerBacked -{ - DeclareNodeNamed(parent); - DeclareNodeNamed(a); - DeclareNodeNamed(b); - DeclareNodeNamed(c); - DeclareNodeNamed(d); - - for (ASDisplayNode *n in @[parent, a, b, c, d]) { - n.layerBacked = isLayerBacked; - } - - [parent addSubnode:a]; - [parent addSubnode:b]; - [parent addSubnode:c]; - - if (loaded) { - [parent layer]; - } - - if (loaded) { - XCTAssertFalse(d.nodeLoaded, @"Should not yet be loaded"); - } - - // Shut the type mismatch up - ASDisplayNode *nilParent = nil; - - // Check initial state - XCTAssertNodeSubnodeSubviewSublayerOrder(parent, loaded, isLayerBacked, @"a,b,c", @"initial state"); - XCTAssertNodesHaveParent(parent, a, b, c); - XCTAssertNodesHaveParent(nilParent, d); - - // Check replace 0th - [parent replaceSubnode:a withSubnode:d]; - - XCTAssertNodeSubnodeSubviewSublayerOrder(parent, loaded, isLayerBacked, @"d,b,c", @"after replace 0th"); - XCTAssertNodesHaveParent(parent, d, b, c); - XCTAssertNodesHaveParent(nilParent, a); - if (loaded) { - XCTAssertNodesLoaded(d); - } - - [parent replaceSubnode:d withSubnode:a]; - - // Check replace 1st - [parent replaceSubnode:b withSubnode:d]; - - XCTAssertNodeSubnodeSubviewSublayerOrder(parent, loaded, isLayerBacked, @"a,d,c", @"Replace"); - XCTAssertNodesHaveParent(parent, a, c, d); - XCTAssertNodesHaveParent(nilParent, b); - - [parent replaceSubnode:d withSubnode:b]; - - // Check replace 2nd - [parent replaceSubnode:c withSubnode:d]; - - XCTAssertNodeSubnodeSubviewSublayerOrder(parent, loaded, isLayerBacked, @"a,b,d", @"Replace"); - XCTAssertNodesHaveParent(parent, a, b, d); - XCTAssertNodesHaveParent(nilParent, c); - - [parent replaceSubnode:d withSubnode:c]; - - //Check initial again - XCTAssertNodeSubnodeSubviewSublayerOrder(parent, loaded, isLayerBacked, @"a,b,c", @"check should back to initial"); - XCTAssertNodesHaveParent(parent, a, b, c); - XCTAssertNodesHaveParent(nilParent, d); - - // Check replace 0th with 2nd - [parent replaceSubnode:a withSubnode:c]; - - XCTAssertNodeSubnodeSubviewSublayerOrder(parent, loaded, isLayerBacked, @"c,b", @"After replace 0th"); - XCTAssertNodesHaveParent(parent, c, b); - XCTAssertNodesHaveParent(nilParent, a,d); - - //TODO: assert that things deallocate immediately and don't have latent autoreleases in here -} - -- (void)testInsertSubnodeAtIndexView -{ - [self checkInsertSubnodeAtIndexWithViewLoaded:YES layerBacked:NO]; -} - -- (void)testInsertSubnodeAtIndexLayer -{ - [self checkInsertSubnodeAtIndexWithViewLoaded:YES layerBacked:YES]; -} - -- (void)testInsertSubnodeAtIndexNoView -{ - [self checkInsertSubnodeAtIndexWithViewLoaded:NO layerBacked:NO]; -} - -- (void)testInsertSubnodeAtIndexNoLayer -{ - [self checkInsertSubnodeAtIndexWithViewLoaded:NO layerBacked:YES]; -} - -- (void)checkInsertSubnodeAtIndexWithViewLoaded:(BOOL)loaded layerBacked:(BOOL)isLayerBacked -{ - DeclareNodeNamed(parent); - DeclareNodeNamed(a); - DeclareNodeNamed(b); - DeclareNodeNamed(c); - - for (ASDisplayNode *v in @[parent, a, b, c]) { - v.layerBacked = isLayerBacked; - } - - // Load parent - if (loaded) { - (void)[parent layer]; - } - - // Add another subnode to test creation after parent is loaded - DeclareNodeNamed(d); - d.layerBacked = isLayerBacked; - if (loaded) { - XCTAssertFalse(d.nodeLoaded, @"Should not yet be loaded"); - } - - // Shut the type mismatch up - ASDisplayNode *nilParent = nil; - - // Check initial state - XCTAssertEqual(0u, parent.subnodes.count, @"Should have the right subnode count"); - - // Check insert at 0th () => (a,b,c) - [parent insertSubnode:c atIndex:0]; - [parent insertSubnode:b atIndex:0]; - [parent insertSubnode:a atIndex:0]; - - XCTAssertNodeSubnodeSubviewSublayerOrder(parent, loaded, isLayerBacked, @"a,b,c", @"initial state"); - XCTAssertNodesHaveParent(parent, a, b, c); - XCTAssertNodesHaveParent(nilParent, d); - - if (loaded) { - XCTAssertNodesLoaded(a, b, c); - } else { - XCTAssertNodesNotLoaded(a, b, c); - } - - // Check insert at 1st (a,b,c) => (a,d,b,c) - [parent insertSubnode:d atIndex:1]; - XCTAssertNodeSubnodeSubviewSublayerOrder(parent, loaded, isLayerBacked, @"a,d,b,c", @"initial state"); - XCTAssertNodesHaveParent(parent, a, b, c, d); - if (loaded) { - XCTAssertNodesLoaded(d); - } - - // Reset - [d removeFromSupernode]; - XCTAssertEqual(3u, parent.subnodes.count, @"Should have the right subnode count"); - XCTAssertNodeSubnodeSubviewSublayerOrder(parent, loaded, isLayerBacked, @"a,b,c", @"Bad removal of d"); - XCTAssertNodesHaveParent(nilParent, d); - - // Check insert at last position - [parent insertSubnode:d atIndex:3]; - - XCTAssertEqual(4u, parent.subnodes.count, @"Should have the right subnode count"); - XCTAssertNodeSubnodeSubviewSublayerOrder(parent, loaded, isLayerBacked, @"a,b,c,d", @"insert at last position."); - XCTAssertNodesHaveParent(parent, a, b, c, d); - - // Reset - [d removeFromSupernode]; - XCTAssertEqual(3u, parent.subnodes.count, @"Should have the right subnode count"); - XCTAssertEqualObjects(nilParent, d.supernode, @"d's parent is messed up"); - - // Check insert a nil node - ASDisplayNode *nilNode = nil; - XCTAssertThrows([parent insertSubnode:nilNode atIndex:0], @"Should not allow insertion of nil node. We will throw in development and deal with it in production"); - - // Check insert at invalid index - XCTAssertThrows([parent insertSubnode:d atIndex:NSNotFound], @"Should not allow insertion at invalid index"); - XCTAssertThrows([parent insertSubnode:d atIndex:-1], @"Should not allow insertion at invalid index"); - - // Should have same state as before - XCTAssertNodeSubnodeSubviewSublayerOrder(parent, loaded, isLayerBacked, @"a,b,c", @"Funny business should not corrupt state"); - XCTAssertNodesHaveParent(parent, a, b, c); - XCTAssertNodesHaveParent(nilParent, d); - - // Check reordering existing subnodes with the insert API - // Move c to front - [parent insertSubnode:c atIndex:0]; - XCTAssertNodeSubnodeSubviewSublayerOrder(parent, loaded, isLayerBacked, @"c,a,b", @"Move to front when already a subnode"); - XCTAssertNodesHaveParent(parent, a, b, c); - XCTAssertNodesHaveParent(nilParent, d); - - // Move c to middle - [parent insertSubnode:c atIndex:1]; - XCTAssertNodeSubnodeSubviewSublayerOrder(parent, loaded, isLayerBacked, @"a,c,b", @"Move c to middle"); - XCTAssertNodesHaveParent(parent, a, b, c); - XCTAssertNodesHaveParent(nilParent, d); - - // Insert c at the index it's already at - [parent insertSubnode:c atIndex:1]; - XCTAssertNodeSubnodeSubviewSublayerOrder(parent, loaded, isLayerBacked, @"a,c,b", @"Funny business should not corrupt state"); - XCTAssertNodesHaveParent(parent, a, b, c); - XCTAssertNodesHaveParent(nilParent, d); - - // Insert c at 0th when it's already in the array - [parent insertSubnode:c atIndex:2]; - XCTAssertNodeSubnodeSubviewSublayerOrder(parent, loaded, isLayerBacked, @"a,b,c", @"Funny business should not corrupt state"); - XCTAssertNodesHaveParent(parent, a, b, c); - XCTAssertNodesHaveParent(nilParent, d); - - //TODO: assert that things deallocate immediately and don't have latent autoreleases in here -} - -// This tests our resiliancy to having other views and layers inserted into our view or layer -- (void)testInsertSubviewAtIndexWithMeddlingViewsAndLayersViewBacked -{ - ASDisplayNode *parent = [[ASDisplayNode alloc] init]; - - DeclareNodeNamed(a); - DeclareNodeNamed(b); - DeclareNodeNamed(c); - DeclareViewNamed(d); - DeclareLayerNamed(e); - - [parent layer]; - - // (a,b) - [parent addSubnode:a]; - [parent addSubnode:b]; - XCTAssertEqualObjects(orderStringFromSublayers(parent.layer), @"a,b", @"Didn't match"); - - // (a,b) => (a,d,b) - [parent.view insertSubview:d aboveSubview:a.view]; - XCTAssertEqualObjects(orderStringFromSublayers(parent.layer), @"a,d,b", @"Didn't match"); - - // (a,d,b) => (a,e,d,b) - [parent.layer insertSublayer:e above:a.layer]; - XCTAssertEqualObjects(orderStringFromSublayers(parent.layer), @"a,e,d,b", @"Didn't match"); - - // (a,e,d,b) => (a,e,d,c,b) - [parent insertSubnode:c belowSubnode:b]; - XCTAssertEqualObjects(orderStringFromSublayers(parent.layer), @"a,e,d,c,b", @"Didn't match"); - - XCTAssertEqual(4u, parent.subnodes.count, @"Should have the right subnode count"); - XCTAssertEqual(4u, parent.view.subviews.count, @"Should have the right subview count"); - XCTAssertEqual(5u, parent.layer.sublayers.count, @"Should have the right sublayer count"); - - [e removeFromSuperlayer]; - XCTAssertEqual(4u, parent.layer.sublayers.count, @"Should have the right sublayer count"); - - //TODO: assert that things deallocate immediately and don't have latent autoreleases in here -} - -- (void)testAppleBugInsertSubview -{ - DeclareViewNamed(parent); - - DeclareLayerNamed(aa); - DeclareLayerNamed(ab); - DeclareViewNamed(a); - DeclareLayerNamed(ba); - DeclareLayerNamed(bb); - DeclareLayerNamed(bc); - DeclareLayerNamed(bd); - DeclareViewNamed(c); - DeclareViewNamed(d); - DeclareLayerNamed(ea); - DeclareLayerNamed(eb); - DeclareLayerNamed(ec); - - [parent.layer addSublayer:aa]; - [parent.layer addSublayer:ab]; - [parent addSubview:a]; - [parent.layer addSublayer:ba]; - [parent.layer addSublayer:bb]; - [parent.layer addSublayer:bc]; - [parent.layer addSublayer:bd]; - [parent addSubview:d]; - [parent.layer addSublayer:ea]; - [parent.layer addSublayer:eb]; - [parent.layer addSublayer:ec]; - - XCTAssertEqualObjects(orderStringFromSublayers(parent.layer), @"aa,ab,a,ba,bb,bc,bd,d,ea,eb,ec", @"Should be in order"); - - // Should insert at SUBVIEW index 1, right?? - [parent insertSubview:c atIndex:1]; - - // You would think that this would be true, but instead it inserts it at the SUBLAYER index 1 -// XCTAssertEquals([parent.subviews indexOfObjectIdenticalTo:c], 1u, @"Should have index 1 after insert"); -// XCTAssertEqualObjects(orderStringFromSublayers(parent.layer), @"aa,ab,a,ba,bb,bc,bd,c,d,ea,eb,ec", @"Should be in order"); - - XCTAssertEqualObjects(orderStringFromSublayers(parent.layer), @"aa,c,ab,a,ba,bb,bc,bd,d,ea,eb,ec", @"Apple has fixed insertSubview:atIndex:. You must update insertSubnode: etc. APIS to accomidate this."); -} - -// This tests our resiliancy to having other views and layers inserted into our view or layer -- (void)testInsertSubviewAtIndexWithMeddlingView -{ - DeclareNodeNamed(parent); - DeclareNodeNamed(a); - DeclareNodeNamed(b); - DeclareNodeNamed(c); - DeclareViewNamed(d); - - [parent layer]; - - // (a,b) - [parent addSubnode:a]; - [parent addSubnode:b]; - XCTAssertEqualObjects(orderStringFromSublayers(parent.layer), @"a,b", @"Didn't match"); - - // (a,b) => (a,d,b) - [parent.view insertSubview:d aboveSubview:a.view]; - XCTAssertEqualObjects(orderStringFromSublayers(parent.layer), @"a,d,b", @"Didn't match"); - - // (a,d,b) => (a,d,>c<,b) - [parent insertSubnode:c belowSubnode:b]; - XCTAssertEqualObjects(orderStringFromSublayers(parent.layer), @"a,d,c,b", @"Didn't match"); - - XCTAssertEqual(4u, parent.subnodes.count, @"Should have the right subnode count"); - XCTAssertEqual(4u, parent.view.subviews.count, @"Should have the right subview count"); - XCTAssertEqual(4u, parent.layer.sublayers.count, @"Should have the right sublayer count"); - - //TODO: assert that things deallocate immediately and don't have latent autoreleases in here -} - - -- (void)testInsertSubnodeBelowWithView -{ - [self checkInsertSubnodeBelowWithView:YES layerBacked:NO]; -} - -- (void)testInsertSubnodeBelowWithNoView -{ - [self checkInsertSubnodeBelowWithView:NO layerBacked:NO]; -} - -- (void)testInsertSubnodeBelowWithNoLayer -{ - [self checkInsertSubnodeBelowWithView:NO layerBacked:YES]; -} - -- (void)testInsertSubnodeBelowWithLayer -{ - [self checkInsertSubnodeBelowWithView:YES layerBacked:YES]; -} - - -- (void)checkInsertSubnodeBelowWithView:(BOOL)loaded layerBacked:(BOOL)isLayerBacked -{ - DeclareNodeNamed(parent); - DeclareNodeNamed(a); - DeclareNodeNamed(b); - DeclareNodeNamed(c); - - for (ASDisplayNode *v in @[parent, a, b, c]) { - v.layerBacked = isLayerBacked; - } - - [parent addSubnode:b]; - - if (loaded) { - [parent layer]; - } - - // Shut the type mismatch up - ASDisplayNode *nilParent = nil; - - // (b) => (a, b) - [parent insertSubnode:a belowSubnode:b]; - XCTAssertNodeSubnodeSubviewSublayerOrder(parent, loaded, isLayerBacked, @"a,b", @"Incorrect insertion below"); - XCTAssertNodesHaveParent(parent, a, b); - XCTAssertNodesHaveParent(nilParent, c); - - // (a,b) => (c,a,b) - [parent insertSubnode:c belowSubnode:a]; - XCTAssertNodeSubnodeSubviewSublayerOrder(parent, loaded, isLayerBacked, @"c,a,b", @"Incorrect insertion below"); - XCTAssertNodesHaveParent(parent, a, b, c); - - // Check insertSubnode with no below - ASDisplayNode *nilNode = nil; - XCTAssertThrows([parent insertSubnode:b belowSubnode:nilNode], @"Can't insert below a nil"); - // Check nothing was inserted - XCTAssertNodeSubnodeSubviewSublayerOrder(parent, loaded, isLayerBacked, @"c,a,b", @"Incorrect insertion below"); - - - XCTAssertThrows([parent insertSubnode:nilNode belowSubnode:nilNode], @"Can't insert a nil subnode"); - XCTAssertThrows([parent insertSubnode:nilNode belowSubnode:a], @"Can't insert a nil subnode"); - - // Check inserting below when you're already in the array - // (c,a,b) => (a,c,b) - [parent insertSubnode:c belowSubnode:b]; - XCTAssertNodeSubnodeSubviewSublayerOrder(parent, loaded, isLayerBacked, @"a,c,b", @"Incorrect insertion below"); - XCTAssertNodesHaveParent(parent, a, c, b); - - // Check what happens when you try to insert a node below itself (should do nothing) - // (a,c,b) => (a,c,b) - [parent insertSubnode:c belowSubnode:c]; - XCTAssertNodeSubnodeSubviewSublayerOrder(parent, loaded, isLayerBacked, @"a,c,b", @"Incorrect insertion below"); - XCTAssertNodesHaveParent(parent, a, c, b); - - //TODO: assert that things deallocate immediately and don't have latent autoreleases in here -} - -- (void)testInsertSubnodeAboveWithView -{ - [self checkInsertSubnodeAboveLoaded:YES layerBacked:NO]; -} - -- (void)testInsertSubnodeAboveWithNoView -{ - [self checkInsertSubnodeAboveLoaded:NO layerBacked:NO]; -} - -- (void)testInsertSubnodeAboveWithLayer -{ - [self checkInsertSubnodeAboveLoaded:YES layerBacked:YES]; -} - -- (void)testInsertSubnodeAboveWithNoLayer -{ - [self checkInsertSubnodeAboveLoaded:NO layerBacked:YES]; -} - - -- (void)checkInsertSubnodeAboveLoaded:(BOOL)loaded layerBacked:(BOOL)isLayerBacked -{ - DeclareNodeNamed(parent); - DeclareNodeNamed(a); - DeclareNodeNamed(b); - DeclareNodeNamed(c); - - for (ASDisplayNode *n in @[parent, a, b, c]) { - n.layerBacked = isLayerBacked; - } - - [parent addSubnode:a]; - - if (loaded) { - [parent layer]; - } - - // Shut the type mismatch up - ASDisplayNode *nilParent = nil; - - // (a) => (a,b) - [parent insertSubnode:b aboveSubnode:a]; - XCTAssertNodeSubnodeSubviewSublayerOrder(parent, loaded, isLayerBacked, @"a,b", @"Insert subnode above"); - XCTAssertNodesHaveParent(parent, a,b); - XCTAssertNodesHaveParent(nilParent, c); - - // (a,b) => (a,c,b) - [parent insertSubnode:c aboveSubnode:a]; - XCTAssertNodeSubnodeSubviewSublayerOrder(parent, loaded, isLayerBacked, @"a,c,b", @"After insert c above a"); - - // Check insertSubnode with invalid parameters throws and doesn't change anything - // (a,c,b) => (a,c,b) - ASDisplayNode *nilNode = nil; - XCTAssertThrows([parent insertSubnode:b aboveSubnode:nilNode], @"Can't insert below a nil"); - XCTAssertNodeSubnodeSubviewSublayerOrder(parent, loaded, isLayerBacked, @"a,c,b", @"Check no monkey business"); - - XCTAssertThrows([parent insertSubnode:nilNode aboveSubnode:nilNode], @"Can't insert a nil subnode"); - XCTAssertNodeSubnodeSubviewSublayerOrder(parent, loaded, isLayerBacked, @"a,c,b", @"Check no monkey business"); - - XCTAssertThrows([parent insertSubnode:nilNode aboveSubnode:a], @"Can't insert a nil subnode"); - XCTAssertNodeSubnodeSubviewSublayerOrder(parent, loaded, isLayerBacked, @"a,c,b", @"Check no monkey business"); - - // Check inserting above when you're already in the array - // (a,c,b) => (c,b,a) - [parent insertSubnode:a aboveSubnode:b]; - XCTAssertNodeSubnodeSubviewSublayerOrder(parent, loaded, isLayerBacked, @"c,b,a", @"Check inserting above when you're already in the array"); - XCTAssertNodesHaveParent(parent, a, c, b); - - // Check what happens when you try to insert a node above itself (should do nothing) - // (c,b,a) => (c,b,a) - [parent insertSubnode:a aboveSubnode:a]; - XCTAssertNodeSubnodeSubviewSublayerOrder(parent, loaded, isLayerBacked, @"c,b,a", @"Insert above self should not change anything"); - XCTAssertNodesHaveParent(parent, a, c, b); - - //TODO: assert that things deallocate immediately and don't have latent autoreleases in here -} - -- (void)testRemoveFromViewBackedLoadedSupernode -{ - DeclareNodeNamed(a); - DeclareNodeNamed(b); - [b addSubnode:a]; - [a view]; - [b view]; - XCTAssertNodesLoaded(a, b); - XCTAssertEqual(a.supernode, b); - XCTAssertEqual(a.view.superview, b.view); - - [a removeFromSupernode]; - XCTAssertNil(a.supernode); - XCTAssertNil(a.view.superview); -} - -- (void)testRemoveFromLayerBackedLoadedSupernode -{ - DeclareNodeNamed(a); - a.layerBacked = YES; - DeclareNodeNamed(b); - b.layerBacked = YES; - [b addSubnode:a]; - [a layer]; - [b layer]; - XCTAssertNodesLoaded(a, b); - XCTAssertEqual(a.supernode, b); - XCTAssertEqual(a.layer.superlayer, b.layer); - - [a removeFromSupernode]; - XCTAssertNil(a.supernode); - XCTAssertNil(a.layer.superlayer); -} - -- (void)testRemoveLayerBackedFromViewBackedLoadedSupernode -{ - DeclareNodeNamed(a); - a.layerBacked = YES; - DeclareNodeNamed(b); - [b addSubnode:a]; - [a layer]; - [b view]; - XCTAssertNodesLoaded(a, b); - XCTAssertEqual(a.supernode, b); - XCTAssertEqual(a.layer.superlayer, b.layer); - - [a removeFromSupernode]; - XCTAssertNil(a.supernode); - XCTAssertNil(a.layer.superlayer); -} - -- (void)testSubnodeAddedBeforeLoadingExternalView -{ - UIView *view = [[UIDisplayNodeTestView alloc] init]; - - __block ASDisplayNode *parent = nil; - __block ASDisplayNode *child = nil; - [self executeOffThread:^{ - parent = [[ASDisplayNode alloc] initWithViewBlock:^{ - return view; - }]; - child = [[ASDisplayNode alloc] init]; - [parent addSubnode:child]; - }]; - - XCTAssertEqual(1, parent.subnodes.count, @"Parent should have 1 subnode"); - XCTAssertEqualObjects(parent, child.supernode, @"Child has the wrong parent"); - XCTAssertEqual(0, view.subviews.count, @"View shouldn't have any subviews"); - - [parent view]; - - XCTAssertEqual(1, view.subviews.count, @"View should have 1 subview"); -} - -- (void)testSubnodeAddedAfterLoadingExternalView -{ - UIView *view = [[UIDisplayNodeTestView alloc] init]; - ASDisplayNode *parent = [[ASDisplayNode alloc] initWithViewBlock:^{ - return view; - }]; - - [parent view]; - - ASDisplayNode *child = [[ASDisplayNode alloc] init]; - [parent addSubnode:child]; - - XCTAssertEqual(1, parent.subnodes.count, @"Parent should have 1 subnode"); - XCTAssertEqualObjects(parent, child.supernode, @"Child has the wrong parent"); - XCTAssertEqual(1, view.subviews.count, @"View should have 1 subview"); -} - -- (void)checkBackgroundColorOpaqueRelationshipWithViewLoaded:(BOOL)loaded layerBacked:(BOOL)isLayerBacked -{ - ASDisplayNode *node = [[ASDisplayNode alloc] init]; - node.layerBacked = isLayerBacked; - - if (loaded) { - // Force load - [node layer]; - } - - XCTAssertTrue(node.opaque, @"Node should start opaque"); - XCTAssertTrue(node.layer.opaque, @"Node should start opaque"); - - node.backgroundColor = [UIColor clearColor]; - - // This could be debated, but at the moment we differ from UIView's behavior to change the other property in response - XCTAssertTrue(node.opaque, @"Set background color should not have made this not opaque"); - XCTAssertTrue(node.layer.opaque, @"Set background color should not have made this not opaque"); - - [node layer]; - - XCTAssertTrue(node.opaque, @"Set background color should not have made this not opaque"); - XCTAssertTrue(node.layer.opaque, @"Set background color should not have made this not opaque"); -} - -- (void)testBackgroundColorOpaqueRelationshipView -{ - [self checkBackgroundColorOpaqueRelationshipWithViewLoaded:YES layerBacked:NO]; -} - -- (void)testBackgroundColorOpaqueRelationshipLayer -{ - [self checkBackgroundColorOpaqueRelationshipWithViewLoaded:YES layerBacked:YES]; -} - -- (void)testBackgroundColorOpaqueRelationshipNoView -{ - [self checkBackgroundColorOpaqueRelationshipWithViewLoaded:NO layerBacked:NO]; -} - -- (void)testBackgroundColorOpaqueRelationshipNoLayer -{ - [self checkBackgroundColorOpaqueRelationshipWithViewLoaded:NO layerBacked:YES]; -} - -// Check that nodes who have no cell node (no range controller) -// do get their `preload` called, and they do report -// the preload interface state. -- (void)testInterfaceStateForNonCellNode -{ - ASTestWindow *window = [ASTestWindow new]; - ASTestDisplayNode *node = [ASTestDisplayNode new]; - XCTAssert(node.interfaceState == ASInterfaceStateNone); - XCTAssert(!node.hasPreloaded); - - [window addSubview:node.view]; - XCTAssert(node.hasPreloaded); - XCTAssert(node.interfaceState == ASInterfaceStateInHierarchy); - - [node.view removeFromSuperview]; - // We don't want to call -didExitPreloadState on nodes that aren't being managed by a range controller. - // Otherwise we get flashing behavior from normal UIKit manipulations like navigation controller push / pop. - // Still, the interfaceState should be None to reflect the current state of the node. - // We just don't proactively clear contents or fetched data for this state transition. - XCTAssert(node.hasPreloaded); - XCTAssert(node.interfaceState == ASInterfaceStateNone); -} - -// Check that nodes who have no cell node (no range controller) -// do get their `preload` called, and they do report -// the preload interface state. -- (void)testInterfaceStateForCellNode -{ - ASCellNode *cellNode = [ASCellNode new]; - ASTestDisplayNode *node = [ASTestDisplayNode new]; - XCTAssert(node.interfaceState == ASInterfaceStateNone); - XCTAssert(!node.hasPreloaded); - - // Simulate range handler updating cell node. - [cellNode addSubnode:node]; - [cellNode enterInterfaceState:ASInterfaceStatePreload]; - XCTAssert(node.hasPreloaded); - XCTAssert(node.interfaceState == ASInterfaceStatePreload); - - // If the node goes into a view it should not adopt the `InHierarchy` state. - ASTestWindow *window = [ASTestWindow new]; - [window addSubview:cellNode.view]; - XCTAssert(node.hasPreloaded); - XCTAssert(node.interfaceState == ASInterfaceStateInHierarchy); -} - -- (void)testSetNeedsPreloadImmediateState -{ - ASCellNode *cellNode = [ASCellNode new]; - ASTestDisplayNode *node = [ASTestDisplayNode new]; - [cellNode addSubnode:node]; - [cellNode enterInterfaceState:ASInterfaceStatePreload]; - node.hasPreloaded = NO; - [cellNode setNeedsPreload]; - XCTAssert(node.hasPreloaded); -} - -- (void)testPreloadExitingAndEnteringRange -{ - ASCellNode *cellNode = [ASCellNode new]; - ASTestDisplayNode *node = [ASTestDisplayNode new]; - [cellNode addSubnode:node]; - [cellNode setHierarchyState:ASHierarchyStateRangeManaged]; - - // Simulate enter range, preload, exit range - [cellNode enterInterfaceState:ASInterfaceStatePreload]; - [cellNode exitInterfaceState:ASInterfaceStatePreload]; - node.hasPreloaded = NO; - [cellNode enterInterfaceState:ASInterfaceStatePreload]; - - XCTAssert(node.hasPreloaded); -} - -- (void)testInitWithViewClass -{ - ASDisplayNode *scrollNode = [[ASDisplayNode alloc] initWithViewClass:[UIScrollView class]]; - - XCTAssertFalse(scrollNode.isLayerBacked, @"Can't be layer backed"); - XCTAssertFalse(scrollNode.nodeLoaded, @"Shouldn't have a view yet"); - - scrollNode.frame = CGRectMake(12, 52, 100, 53); - scrollNode.alpha = 0.5; - - XCTAssertTrue([scrollNode.view isKindOfClass:[UIScrollView class]], @"scrollview should load as expected"); - XCTAssertTrue(CGRectEqualToRect(CGRectMake(12, 52, 100, 53), scrollNode.frame), @"Should have set the frame on the scroll node"); - XCTAssertEqual(0.5f, scrollNode.alpha, @"Alpha not working"); -} - -- (void)testInitWithLayerClass -{ - ASDisplayNode *transformNode = [[ASDisplayNode alloc] initWithLayerClass:[CATransformLayer class]]; - - XCTAssertTrue(transformNode.isLayerBacked, @"Created with layer class => should be layer-backed by default"); - XCTAssertFalse(transformNode.nodeLoaded, @"Shouldn't have a view yet"); - - transformNode.frame = CGRectMake(12, 52, 100, 53); - transformNode.alpha = 0.5; - - XCTAssertTrue([transformNode.layer isKindOfClass:[CATransformLayer class]], @"scrollview should load as expected"); - XCTAssertTrue(CGRectEqualToRect(CGRectMake(12, 52, 100, 53), transformNode.frame), @"Should have set the frame on the scroll node"); - XCTAssertEqual(0.5f, transformNode.alpha, @"Alpha not working"); -} - -static bool stringContainsPointer(NSString *description, id p) { - return [description rangeOfString:[NSString stringWithFormat:@"%p", p]].location != NSNotFound; -} - -- (void)testDebugDescription -{ - // View node has subnodes. Make sure all of the nodes are included in the description - ASDisplayNode *parent = [[ASDisplayNode alloc] init]; - - ASDisplayNode *a = [[ASDisplayNode alloc] init]; - a.layerBacked = YES; - ASDisplayNode *b = [[ASDisplayNode alloc] init]; - b.layerBacked = YES; - b.frame = CGRectMake(0, 0, 100, 123); - ASDisplayNode *c = [[ASDisplayNode alloc] init]; - - for (ASDisplayNode *child in @[a, b, c]) { - [parent addSubnode:child]; - } - - NSString *nodeDescription = [parent displayNodeRecursiveDescription]; - - // Make sure [parent recursiveDescription] contains a, b, and c's pointer string - XCTAssertTrue(stringContainsPointer(nodeDescription, a), @"Layer backed node not present in [parent displayNodeRecursiveDescription]"); - XCTAssertTrue(stringContainsPointer(nodeDescription, b), @"Layer-backed node not present in [parent displayNodeRecursiveDescription]"); - XCTAssertTrue(stringContainsPointer(nodeDescription, c), @"View-backed node not present in [parent displayNodeRecursiveDescription]"); - - NSString *viewDescription = [parent.view valueForKey:@"recursiveDescription"]; - - // Make sure string contains a, b, and c's pointer string - XCTAssertTrue(stringContainsPointer(viewDescription, a), @"Layer backed node not present"); - XCTAssertTrue(stringContainsPointer(viewDescription, b), @"Layer-backed node not present"); - XCTAssertTrue(stringContainsPointer(viewDescription, c), @"View-backed node not present"); - - // Make sure layer names have display node in description - XCTAssertTrue(stringContainsPointer([a.layer debugDescription], a), @"Layer backed node not present"); - XCTAssertTrue(stringContainsPointer([b.layer debugDescription], b), @"Layer-backed node not present"); -} - -- (void)checkNameInDescriptionIsLayerBacked:(BOOL)isLayerBacked -{ - ASDisplayNode *node = [[ASDisplayNode alloc] init]; - node.layerBacked = isLayerBacked; - - XCTAssertFalse([node.description containsString:@"debugName"], @"Shouldn't reference 'debugName' in description"); - node.debugName = @"big troll eater name"; - - XCTAssertTrue([node.description containsString:node.debugName], @"debugName didn't end up in description"); - [node layer]; - XCTAssertTrue([node.description containsString:node.debugName], @"debugName didn't end up in description"); -} - -- (void)testNameInDescriptionLayer -{ - [self checkNameInDescriptionIsLayerBacked:YES]; -} - -- (void)testNameInDescriptionView -{ - [self checkNameInDescriptionIsLayerBacked:NO]; -} - -- (void)testBounds -{ - ASDisplayNode *node = [[ASDisplayNode alloc] init]; - node.bounds = CGRectMake(1, 2, 3, 4); - node.frame = CGRectMake(5, 6, 7, 8); - - XCTAssert(node.bounds.origin.x == 1, @"Wrong ASDisplayNode.bounds.origin.x"); - XCTAssert(node.bounds.origin.y == 2, @"Wrong ASDisplayNode.bounds.origin.y"); - XCTAssert(node.bounds.size.width == 7, @"Wrong ASDisplayNode.bounds.size.width"); - XCTAssert(node.bounds.size.height == 8, @"Wrong ASDisplayNode.bounds.size.height"); -} - -- (void)testDidEnterDisplayIsCalledWhenNodesEnterDisplayRange -{ - ASTestDisplayNode *node = [[ASTestDisplayNode alloc] init]; - - [node recursivelySetInterfaceState:ASInterfaceStateDisplay]; - - XCTAssert([node displayRangeStateChangedToYES]); -} - -- (void)testDidExitDisplayIsCalledWhenNodesExitDisplayRange -{ - ASTestDisplayNode *node = [[ASTestDisplayNode alloc] init]; - - [node recursivelySetInterfaceState:ASInterfaceStateDisplay]; - [node recursivelySetInterfaceState:ASInterfaceStatePreload]; - - XCTAssert([node displayRangeStateChangedToNO]); -} - -- (void)testDidEnterPreloadIsCalledWhenNodesEnterPreloadRange -{ - ASTestDisplayNode *node = [[ASTestDisplayNode alloc] init]; - - [node recursivelySetInterfaceState:ASInterfaceStatePreload]; - - XCTAssert([node preloadStateChangedToYES]); -} - -- (void)testDidExitPreloadIsCalledWhenNodesExitPreloadRange -{ - ASTestDisplayNode *node = [[ASTestDisplayNode alloc] init]; - [node setHierarchyState:ASHierarchyStateRangeManaged]; - - [node recursivelySetInterfaceState:ASInterfaceStatePreload]; - [node recursivelySetInterfaceState:ASInterfaceStateDisplay]; - - XCTAssert([node preloadStateChangedToNO]); -} - - -- (void)testThatNodeGetsRenderedIfItGoesFromZeroSizeToRealSizeButOnlyOnce -{ - NSString *path = [[NSBundle bundleForClass:[self class]] pathForResource:@"logo-square" - ofType:@"png" inDirectory:@"TestResources"]; - UIImage *image = [UIImage imageWithContentsOfFile:path]; - ASImageNode *node = [[ASImageNode alloc] init]; - node.image = image; - - // When rendered at zero-size, we get no contents - XCTAssert(CGSizeEqualToSize(node.bounds.size, CGSizeZero)); - [node recursivelyEnsureDisplaySynchronously:YES]; - XCTAssertNil(node.contents); - - // When size becomes positive, we got some new contents - node.bounds = CGRectMake(0, 0, 100, 100); - [node recursivelyEnsureDisplaySynchronously:YES]; - id contentsAfterRedisplay = node.contents; - XCTAssertNotNil(contentsAfterRedisplay); - - // When size changes again, we do not get new contents - node.bounds = CGRectMake(0, 0, 1000, 1000); - [node recursivelyEnsureDisplaySynchronously:YES]; - XCTAssertEqual(contentsAfterRedisplay, node.contents); -} - -// Underlying issue for: https://github.com/facebook/AsyncDisplayKit/issues/2205 -- (void)testThatRasterizedNodesGetInterfaceStateUpdatesWhenContainerEntersHierarchy -{ - ASDisplayNode *supernode = [[ASTestDisplayNode alloc] init]; - [supernode enableSubtreeRasterization]; - ASDisplayNode *subnode = [[ASTestDisplayNode alloc] init]; - ASSetDebugNames(supernode, subnode); - UIWindow *window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds]; - [supernode addSubnode:subnode]; - [window addSubnode:supernode]; - [window makeKeyAndVisible]; - XCTAssertTrue(ASHierarchyStateIncludesRasterized(subnode.hierarchyState)); - XCTAssertTrue(subnode.isVisible); - [supernode.view removeFromSuperview]; - XCTAssertTrue(ASHierarchyStateIncludesRasterized(subnode.hierarchyState)); - XCTAssertFalse(subnode.isVisible); -} - -// Underlying issue for: https://github.com/facebook/AsyncDisplayKit/issues/2205 -- (void)testThatRasterizedNodesGetInterfaceStateUpdatesWhenAddedToContainerThatIsInHierarchy -{ - ASDisplayNode *supernode = [[ASTestDisplayNode alloc] init]; - [supernode enableSubtreeRasterization]; - ASDisplayNode *subnode = [[ASTestDisplayNode alloc] init]; - ASSetDebugNames(supernode, subnode); - - UIWindow *window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds]; - [window addSubnode:supernode]; - [window makeKeyAndVisible]; - [supernode addSubnode:subnode]; - XCTAssertTrue(ASHierarchyStateIncludesRasterized(subnode.hierarchyState)); - XCTAssertTrue(subnode.isVisible); - [subnode removeFromSupernode]; - XCTAssertFalse(ASHierarchyStateIncludesRasterized(subnode.hierarchyState)); - XCTAssertFalse(subnode.isVisible); -} - -- (void)testThatRasterizingWrapperNodesIsNotAllowed -{ - ASDisplayNode *rasterizedSupernode = [[ASDisplayNode alloc] init]; - [rasterizedSupernode enableSubtreeRasterization]; - ASDisplayNode *subnode = [[ASDisplayNode alloc] initWithViewBlock:^UIView * _Nonnull{ - return [[UIView alloc] init]; - }]; - ASSetDebugNames(rasterizedSupernode, subnode); - XCTAssertThrows([rasterizedSupernode addSubnode:subnode]); -} - -- (void)testThatSubnodesGetDisplayUpdatesIfRasterized -{ - ASTestDisplayNode *supernode = [[ASTestDisplayNode alloc] init]; - supernode.frame = CGRectMake(0.0, 0.0, 100.0, 100.0); - [supernode enableSubtreeRasterization]; - - ASTestDisplayNode *subnode = [[ASTestDisplayNode alloc] init]; - ASTestDisplayNode *subSubnode = [[ASTestDisplayNode alloc] init]; - - ASSetDebugNames(supernode, subnode); - UIWindow *window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds]; - [subnode addSubnode:subSubnode]; - [supernode addSubnode:subnode]; - [window addSubnode:supernode]; - [window makeKeyAndVisible]; - - XCTAssertTrue(ASDisplayNodeRunRunLoopUntilBlockIsTrue(^BOOL{ - return (subnode.didDisplayCount == 1); - })); - - XCTAssertTrue(ASDisplayNodeRunRunLoopUntilBlockIsTrue(^BOOL{ - return (subSubnode.didDisplayCount == 1); - })); - - XCTAssertTrue(ASDisplayNodeRunRunLoopUntilBlockIsTrue(^BOOL{ - return (subnode.displayWillStartCount == 1); - })); - - XCTAssertTrue(ASDisplayNodeRunRunLoopUntilBlockIsTrue(^BOOL{ - return (subSubnode.displayWillStartCount == 1); - })); -} - -// Underlying issue for: https://github.com/facebook/AsyncDisplayKit/issues/2011 -- (void)testThatLayerBackedSubnodesAreMarkedInvisibleBeforeDeallocWhenSupernodesViewIsRemovedFromHierarchyWhileBeingRetained -{ - UIWindow *window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds]; - - NS_VALID_UNTIL_END_OF_SCOPE UIView *nodeView = nil; - { - NS_VALID_UNTIL_END_OF_SCOPE ASDisplayNode *node = [[ASDisplayNode alloc] init]; - nodeView = node.view; - node.debugName = @"Node"; - - NS_VALID_UNTIL_END_OF_SCOPE ASDisplayNode *subnode = [[ASDisplayNode alloc] init]; - subnode.layerBacked = YES; - [node addSubnode:subnode]; - subnode.debugName = @"Subnode"; - - [window addSubview:nodeView]; - } - - // nodeView must continue to be retained across this call, but the nodes must not. - XCTAssertNoThrow([nodeView removeFromSuperview]); -} - -// Running on main thread -// Cause retain count of node to fall to zero synchronously on a background thread (pausing main thread) -// ASDealloc2MainObject queues actual call to -dealloc to occur on the main thread -// Continue execution on main, before the dealloc can run, to dealloc the host view -// Node is in an invalid state (about to dealloc, not valid to retain) but accesses to sublayer delegates -// causes attempted retain — unless weak variable works correctly -- (void)testThatLayerDelegateDoesntDangleAndCauseCrash -{ - NS_VALID_UNTIL_END_OF_SCOPE UIView *host = [[UIView alloc] init]; - - __block NS_VALID_UNTIL_END_OF_SCOPE ASDisplayNode *node = [[ASDisplayNode alloc] init]; - node.layerBacked = YES; - - [host addSubnode:node]; - [self executeOffThread:^{ - node = nil; - }]; - host = nil; // <- Would crash here, when UIView accesses its sublayers' delegates in -dealloc. -} - -- (void)testThatSubnodeGetsInterfaceStateSetIfRasterized -{ - ASTestDisplayNode *node = [[ASTestDisplayNode alloc] init]; - node.debugName = @"Node"; - [node enableSubtreeRasterization]; - - ASTestDisplayNode *subnode = [[ASTestDisplayNode alloc] init]; - subnode.debugName = @"Subnode"; - [node addSubnode:subnode]; - - [node view]; // Node needs to be loaded - - [node enterInterfaceState:ASInterfaceStatePreload]; - - XCTAssertTrue((node.interfaceState & ASInterfaceStatePreload) == ASInterfaceStatePreload); - XCTAssertTrue((subnode.interfaceState & ASInterfaceStatePreload) == ASInterfaceStatePreload); - XCTAssertTrue(node.hasPreloaded); - XCTAssertTrue(subnode.hasPreloaded); -} - -// FIXME -// Supernode is measured, subnode isnt, transition starts, UIKit does a layout pass before measurement finishes -- (void)testThatItsSafeToAutomeasureANodeMidTransition -{ - ASDisplayNode *supernode = [[ASDisplayNode alloc] init]; - [supernode layoutThatFits:ASSizeRangeMake(CGSizeZero, CGSizeMake(100, 100))]; - ASDisplayNode *node = [[ASDisplayNode alloc] init]; - node.bounds = CGRectMake(0, 0, 50, 50); - [supernode addSubnode:node]; - - XCTAssertNil(node.calculatedLayout); - XCTAssertTrue(node.layer.needsLayout); - - [supernode transitionLayoutWithAnimation:NO shouldMeasureAsync:YES measurementCompletion:nil]; - - XCTAssertNoThrow([node.view layoutIfNeeded]); -} - -- (void)testThatOnDidLoadThrowsIfCalledOnLoadedOffMain -{ - ASTestDisplayNode *node = [[ASTestDisplayNode alloc] init]; - [node view]; - [self executeOffThread:^{ - XCTAssertThrows([node onDidLoad:^(ASDisplayNode * _Nonnull node) { }]); - }]; -} - -- (void)testThatOnDidLoadWorks -{ - ASTestDisplayNode *node = [[ASTestDisplayNode alloc] init]; - NSMutableArray *calls = [NSMutableArray array]; - [node onDidLoad:^(ASTestDisplayNode * _Nonnull node) { - [calls addObject:@0]; - }]; - [node onDidLoad:^(ASTestDisplayNode * _Nonnull node) { - [calls addObject:@1]; - }]; - [node onDidLoad:^(ASTestDisplayNode * _Nonnull node) { - [calls addObject:@2]; - }]; - [node view]; - NSArray *expected = @[ @0, @1, @2 ]; - XCTAssertEqualObjects(calls, expected); -} - -- (void)testSettingPropertiesViaStyllableProtocol -{ - ASDisplayNode *node = [[ASDisplayNode alloc] init]; - id returnedNode = - [node styledWithBlock:^(ASLayoutElementStyle * _Nonnull style) { - style.width = ASDimensionMake(100); - style.flexGrow = 1.0; - style.flexShrink = 1.0; - }]; - - XCTAssertEqualObjects(node, returnedNode); - ASXCTAssertEqualDimensions(node.style.width, ASDimensionMake(100)); - XCTAssertEqual(node.style.flexGrow, 1.0, @"flexGrow should have have the value 1.0"); - XCTAssertEqual(node.style.flexShrink, 1.0, @"flexShrink should have have the value 1.0"); -} - -- (void)testSubnodesFastEnumeration -{ - DeclareNodeNamed(parentNode); - DeclareNodeNamed(a); - DeclareNodeNamed(b); - DeclareNodeNamed(c); - DeclareViewNamed(d); - - NSArray *subnodes = @[a, b, c, d]; - for (ASDisplayNode *node in subnodes) { - [parentNode addSubnode:node]; - } - - NSInteger i = 0; - for (ASDisplayNode *subnode in parentNode.subnodes) { - XCTAssertEqualObjects(subnode, subnodes[i]); - i++; - } -} - -- (void)testThatHavingTheSameNodeTwiceInALayoutSpecCausesExceptionOnLayoutCalculation -{ - ASDisplayNode *node = [[ASDisplayNode alloc] init]; - ASDisplayNode *subnode = [[ASDisplayNode alloc] init]; - node.layoutSpecBlock = ^ASLayoutSpec *(ASDisplayNode *node, ASSizeRange constrainedSize) { - return [ASOverlayLayoutSpec overlayLayoutSpecWithChild:[ASInsetLayoutSpec insetLayoutSpecWithInsets:UIEdgeInsetsZero child:subnode] overlay:subnode]; - }; - XCTAssertThrowsSpecificNamed([node calculateLayoutThatFits:ASSizeRangeMake(CGSizeMake(100, 100))], NSException, NSInternalInconsistencyException); -} - -- (void)testThatStackSpecOrdersSubnodesCorrectlyRandomness -{ - // This test ensures that the z-order of nodes matches the stack spec, including after several random relayouts / transitions. - ASDisplayNode *node = [[ASDisplayNode alloc] init]; - node.automaticallyManagesSubnodes = YES; - - DeclareNodeNamed(a); - DeclareNodeNamed(b); - DeclareNodeNamed(c); - DeclareNodeNamed(d); - DeclareNodeNamed(e); - DeclareNodeNamed(f); - DeclareNodeNamed(g); - DeclareNodeNamed(h); - DeclareNodeNamed(i); - DeclareNodeNamed(j); - - NSMutableArray *allNodes = [@[a, b, c, d, e, f, g, h, i, j] mutableCopy]; - NSArray *testPrevious = @[]; - NSArray __block *testPending = @[]; - - int len1 = 1 + arc4random_uniform(9); - for (NSUInteger n = 0; n < len1; n++) { // shuffle and add - [allNodes exchangeObjectAtIndex:n withObjectAtIndex:n + arc4random_uniform(10 - (uint32_t) n)]; - testPrevious = [testPrevious arrayByAddingObject:allNodes[n]]; - } - - __block NSUInteger testCount = 0; - node.layoutSpecBlock = ^(ASDisplayNode *node, ASSizeRange size) { - ASStackLayoutSpec *stack = [ASStackLayoutSpec verticalStackLayoutSpec]; - - if (testCount++ == 0) { - stack.children = testPrevious; - } - else { - testPending = @[]; - int len2 = 1 + arc4random_uniform(9); - for (NSUInteger n = 0; n < len2; n++) { // shuffle and add - [allNodes exchangeObjectAtIndex:n withObjectAtIndex:n + arc4random_uniform(10 - (uint32_t) n)]; - testPending = [testPending arrayByAddingObject:allNodes[n]]; - } - stack.children = testPending; - } - - return stack; - }; - - ASDisplayNodeSizeToFitSize(node, CGSizeMake(100, 100)); - [node.view layoutIfNeeded]; - - // Because automaticallyManagesSubnodes is used, the subnodes array is constructed from the layout spec's children. - NSString *expected = [[testPrevious valueForKey:@"debugName"] componentsJoinedByString:@","]; - XCTAssert([node.subnodes isEqualToArray:testPrevious], @"subnodes: %@, array: %@", node.subnodes, testPrevious); - XCTAssertNodeSubnodeSubviewSublayerOrder(node, YES /* isLoaded */, NO /* isLayerBacked */, - expected, @"Initial order"); - - for (NSUInteger n = 0; n < 25; n++) { - [node invalidateCalculatedLayout]; - [node.view setNeedsLayout]; - [node.view layoutIfNeeded]; - - - XCTAssert([node.subnodes isEqualToArray:testPending], @"subnodes: %@, array: %@", node.subnodes, testPending); - expected = [[testPending valueForKey:@"debugName"] componentsJoinedByString:@","]; - - XCTAssertEqualObjects(orderStringFromSubnodes(node), expected, @"Incorrect node order for Random order #%ld", (unsigned long) n); - XCTAssertEqualObjects(orderStringFromSubviews(node.view), expected, @"Incorrect subviews for Random order #%ld", (unsigned long) n); - XCTAssertEqualObjects(orderStringFromSublayers(node.layer), expected, @"Incorrect sublayers for Random order #%ld", (unsigned long) n); - } -} - -- (void)testThatStackSpecOrdersSubnodesCorrectly -{ - // This test ensures that the z-order of nodes matches the stack spec, including after relayout / transition. - ASDisplayNode *node = [[ASDisplayNode alloc] init]; - node.automaticallyManagesSubnodes = YES; - - DeclareNodeNamed(a); - DeclareNodeNamed(b); - DeclareNodeNamed(c); - DeclareNodeNamed(d); - DeclareNodeNamed(e); - - NSArray *nodesForwardOrder = @[a, b, c, d]; - NSArray *nodesReverseOrder = @[d, c, b, a]; - NSArray *addAndMoveOrder = @[a, b, e, d, c]; - __block BOOL flipItemOrder = NO; - - __block NSUInteger testCount = 0; - node.layoutSpecBlock = ^(ASDisplayNode *node, ASSizeRange size) { - ASStackLayoutSpec *stack = [ASStackLayoutSpec verticalStackLayoutSpec]; - switch(testCount) { - case 0: - stack.children = nodesForwardOrder; break; - case 1: - stack.children = nodesReverseOrder; break; - case 2: - default: - stack.children = addAndMoveOrder; break; - } - testCount++; - return stack; - }; - - ASDisplayNodeSizeToFitSize(node, CGSizeMake(100, 100)); - [node.view layoutIfNeeded]; - - // Because automaticallyManagesSubnodes is used, the subnodes array is constructed from the layout spec's children. - XCTAssert([node.subnodes isEqualToArray:nodesForwardOrder], @"subnodes: %@, array: %@", node.subnodes, nodesForwardOrder); - XCTAssertNodeSubnodeSubviewSublayerOrder(node, YES /* isLoaded */, NO /* isLayerBacked */, - @"a,b,c,d", @"Forward order"); - - flipItemOrder = YES; - [node invalidateCalculatedLayout]; - [node.view setNeedsLayout]; - [node.view layoutIfNeeded]; - - // In this case, it's critical that the items are in the new order so that event handling and apparent z-position are correct. - // FIXME: The reversal case is not currently passing. - XCTAssert([node.subnodes isEqualToArray:nodesReverseOrder], @"subnodes: %@, array: %@", node.subnodes, nodesReverseOrder); - XCTAssertNodeSubnodeSubviewSublayerOrder(node, YES /* isLoaded */, NO /* isLayerBacked */, - @"d,c,b,a", @"Reverse order"); - - [node invalidateCalculatedLayout]; - [node.view setNeedsLayout]; - [node.view layoutIfNeeded]; - XCTAssert([node.subnodes isEqualToArray:addAndMoveOrder], @"subnodes: %@, array: %@", node.subnodes, addAndMoveOrder); - XCTAssertNodeSubnodeSubviewSublayerOrder(node, YES /* isLoaded */, NO /* isLayerBacked */, - @"a,b,e,d,c", @"AddAndMove order"); - -} - -- (void)testThatOverlaySpecOrdersSubnodesCorrectly -{ - ASDisplayNode *node = [[ASDisplayNode alloc] init]; - node.automaticallyManagesSubnodes = YES; - ASDisplayNode *underlay = [[ASDisplayNode alloc] init]; - underlay.debugName = @"underlay"; - ASDisplayNode *overlay = [[ASDisplayNode alloc] init]; - overlay.debugName = @"overlay"; - node.layoutSpecBlock = ^(ASDisplayNode *node, ASSizeRange size) { - // The inset spec here is crucial. If the nodes themselves are children, it passed before the fix. - return [ASOverlayLayoutSpec overlayLayoutSpecWithChild:[ASInsetLayoutSpec insetLayoutSpecWithInsets:UIEdgeInsetsZero child:underlay] overlay:overlay]; - }; - - ASDisplayNodeSizeToFitSize(node, CGSizeMake(100, 100)); - [node.view layoutIfNeeded]; - - NSInteger underlayIndex = [node.subnodes indexOfObjectIdenticalTo:underlay]; - NSInteger overlayIndex = [node.subnodes indexOfObjectIdenticalTo:overlay]; - XCTAssertLessThan(underlayIndex, overlayIndex); -} - -- (void)testThatBackgroundLayoutSpecOrdersSubnodesCorrectly -{ - ASDisplayNode *node = [[ASDisplayNode alloc] init]; - node.automaticallyManagesSubnodes = YES; - ASDisplayNode *underlay = [[ASDisplayNode alloc] init]; - underlay.debugName = @"underlay"; - ASDisplayNode *overlay = [[ASDisplayNode alloc] init]; - overlay.debugName = @"overlay"; - node.layoutSpecBlock = ^(ASDisplayNode *node, ASSizeRange size) { - // The inset spec here is crucial. If the nodes themselves are children, it passed before the fix. - return [ASBackgroundLayoutSpec backgroundLayoutSpecWithChild:overlay background:[ASInsetLayoutSpec insetLayoutSpecWithInsets:UIEdgeInsetsZero child:underlay]]; - }; - - ASDisplayNodeSizeToFitSize(node, CGSizeMake(100, 100)); - [node.view layoutIfNeeded]; - - NSInteger underlayIndex = [node.subnodes indexOfObjectIdenticalTo:underlay]; - NSInteger overlayIndex = [node.subnodes indexOfObjectIdenticalTo:overlay]; - XCTAssertLessThan(underlayIndex, overlayIndex); -} - -- (void)testThatConvertPointGoesToWindowWhenPassedNil -{ - UIWindow *window = [[UIWindow alloc] initWithFrame:CGRectMake(0, 0, 20, 20)]; - ASDisplayNode *node = [[ASDisplayNode alloc] init]; - node.frame = CGRectMake(10, 10, 10, 10); - [window addSubnode:node]; - CGPoint expectedOrigin = CGPointMake(10, 10); - ASXCTAssertEqualPoints([node convertPoint:node.bounds.origin toNode:nil], expectedOrigin); -} - -- (void)testThatConvertPointGoesToWindowWhenPassedNil_layerBacked -{ - UIWindow *window = [[UIWindow alloc] initWithFrame:CGRectMake(0, 0, 20, 20)]; - ASDisplayNode *node = [[ASDisplayNode alloc] init]; - node.layerBacked = YES; - node.frame = CGRectMake(10, 10, 10, 10); - [window addSubnode:node]; - CGPoint expectedOrigin = CGPointMake(10, 10); - ASXCTAssertEqualPoints([node convertPoint:node.bounds.origin toNode:nil], expectedOrigin); -} - -- (void)testThatItIsAllowedToRetrieveDebugDescriptionIncludingVCOffMainThread -{ - ASDisplayNode *node = [[ASDisplayNode alloc] init]; - UIViewController *vc = [[UIViewController alloc] init]; - [vc.view addSubnode:node]; - dispatch_group_t g = dispatch_group_create(); - __block NSString *debugDescription; - dispatch_group_async(g, dispatch_get_global_queue(QOS_CLASS_DEFAULT, 0), ^{ - debugDescription = [node debugDescription]; - }); - dispatch_group_wait(g, DISPATCH_TIME_FOREVER); - // Ensure the debug description contains the VC string. - // Have to split into two lines because XCTAssert macro can't handle the stringWithFormat:. - BOOL hasVC = [debugDescription containsString:[NSString stringWithFormat:@"%p", vc]]; - XCTAssert(hasVC); -} - -- (void)testThatSubnodeSafeAreaInsetsAreCalculatedCorrectly -{ - ASDisplayNode *rootNode = [[ASDisplayNode alloc] init]; - ASDisplayNode *subnode = [[ASDisplayNode alloc] init]; - - rootNode.automaticallyManagesSubnodes = YES; - rootNode.layoutSpecBlock = ^ASLayoutSpec * _Nonnull(__kindof ASDisplayNode * _Nonnull node, ASSizeRange constrainedSize) { - return [ASInsetLayoutSpec insetLayoutSpecWithInsets:UIEdgeInsetsMake(1, 2, 3, 4) child:subnode]; - }; - - ASTestViewController *viewController = [[ASTestViewController alloc] initWithNode:rootNode]; - viewController.additionalSafeAreaInsets = UIEdgeInsetsMake(10, 10, 10, 10); - - // It looks like iOS 11 suppresses safeAreaInsets calculation for the views that are not on screen. - UIWindow *window = [[UIWindow alloc] init]; - window.rootViewController = viewController; - [window setHidden:NO]; - [window layoutIfNeeded]; - - UIEdgeInsets expectedRootNodeSafeArea = UIEdgeInsetsMake(10, 10, 10, 10); - UIEdgeInsets expectedSubnodeSafeArea = UIEdgeInsetsMake(9, 8, 7, 6); - - UIEdgeInsets windowSafeArea = UIEdgeInsetsZero; - if (AS_AVAILABLE_IOS(11.0)) { - windowSafeArea = window.safeAreaInsets; - } - - expectedRootNodeSafeArea = ASConcatInsets(expectedRootNodeSafeArea, windowSafeArea); - expectedSubnodeSafeArea = ASConcatInsets(expectedSubnodeSafeArea, windowSafeArea); - - XCTAssertTrue(UIEdgeInsetsEqualToEdgeInsets(expectedRootNodeSafeArea, rootNode.safeAreaInsets), - @"expected rootNode.safeAreaInsets to be %@ but got %@ (window.safeAreaInsets %@)", - NSStringFromUIEdgeInsets(expectedRootNodeSafeArea), - NSStringFromUIEdgeInsets(rootNode.safeAreaInsets), - NSStringFromUIEdgeInsets(windowSafeArea)); - XCTAssertTrue(UIEdgeInsetsEqualToEdgeInsets(expectedSubnodeSafeArea, subnode.safeAreaInsets), - @"expected subnode.safeAreaInsets to be %@ but got %@ (window.safeAreaInsets %@)", - NSStringFromUIEdgeInsets(expectedSubnodeSafeArea), - NSStringFromUIEdgeInsets(subnode.safeAreaInsets), - NSStringFromUIEdgeInsets(windowSafeArea)); - - [window setHidden:YES]; -} - -- (void)testScreenScale -{ - XCTAssertEqual(ASScreenScale(), UIScreen.mainScreen.scale); -} - -- (void)testThatIfViewClassIsOverwrittenItsSynchronous -{ - ASSynchronousTestDisplayNodeViaViewClass *node = [[ASSynchronousTestDisplayNodeViaViewClass alloc] init]; - XCTAssertTrue([node isSynchronous], @"Node should be synchronous if viewClass is ovewritten and not a subclass of _ASDisplayView"); -} - -- (void)testThatIfLayerClassIsOverwrittenItsSynchronous -{ - ASSynchronousTestDisplayNodeViaLayerClass *node = [[ASSynchronousTestDisplayNodeViaLayerClass alloc] init]; - XCTAssertTrue([node isSynchronous], @"Node should be synchronous if viewClass is ovewritten and not a subclass of _ASDisplayView"); -} - -- (void)testCornerRoundingTypeClippingRoundedCornersIsUsingASDisplayNodeCornerLayerDelegate -{ - ASTestDisplayNode *node = [[ASTestDisplayNode alloc] init]; - node.cornerRoundingType = ASCornerRoundingTypeClipping; - node.cornerRadius = 10.0; - auto l = node.clipCornerLayers; - for (int i = 0; i < NUM_CLIP_CORNER_LAYERS; i++) { - CALayer *cornerLayer = (*l)[i]; - XCTAssertTrue([cornerLayer.delegate isKindOfClass:[ASDisplayNodeCornerLayerDelegate class]], @""); - } -} - -@end diff --git a/submodules/AsyncDisplayKit/Tests/ASDisplayNodeTestsHelper.h b/submodules/AsyncDisplayKit/Tests/ASDisplayNodeTestsHelper.h deleted file mode 100644 index 4e884f4428..0000000000 --- a/submodules/AsyncDisplayKit/Tests/ASDisplayNodeTestsHelper.h +++ /dev/null @@ -1,21 +0,0 @@ -// -// ASDisplayNodeTestsHelper.h -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import -#import - -@class ASCATransactionQueue, ASDisplayNode; - -typedef BOOL (^as_condition_block_t)(void); - -AS_EXTERN BOOL ASDisplayNodeRunRunLoopUntilBlockIsTrue(as_condition_block_t block); - -AS_EXTERN void ASDisplayNodeSizeToFitSize(ASDisplayNode *node, CGSize size); -AS_EXTERN void ASDisplayNodeSizeToFitSizeRange(ASDisplayNode *node, ASSizeRange sizeRange); -AS_EXTERN void ASCATransactionQueueWait(ASCATransactionQueue *q); // nil means shared queue diff --git a/submodules/AsyncDisplayKit/Tests/ASDisplayNodeTestsHelper.mm b/submodules/AsyncDisplayKit/Tests/ASDisplayNodeTestsHelper.mm deleted file mode 100644 index ae20549117..0000000000 --- a/submodules/AsyncDisplayKit/Tests/ASDisplayNodeTestsHelper.mm +++ /dev/null @@ -1,69 +0,0 @@ -// -// ASDisplayNodeTestsHelper.mm -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import "ASDisplayNodeTestsHelper.h" -#import -#import -#import - -#import - -#import - -// Poll the condition 1000 times a second. -static CFTimeInterval kSingleRunLoopTimeout = 0.001; - -// Time out after 30 seconds. -static CFTimeInterval kTimeoutInterval = 30.0f; - -BOOL ASDisplayNodeRunRunLoopUntilBlockIsTrue(as_condition_block_t block) -{ - CFTimeInterval timeoutDate = CACurrentMediaTime() + kTimeoutInterval; - BOOL passed = NO; - while (true) { - OSMemoryBarrier(); - passed = block(); - OSMemoryBarrier(); - if (passed) { - break; - } - CFTimeInterval now = CACurrentMediaTime(); - if (now > timeoutDate) { - break; - } - // Run until the poll timeout or until timeoutDate, whichever is first. - CFTimeInterval runLoopTimeout = MIN(kSingleRunLoopTimeout, timeoutDate - now); - CFRunLoopRunInMode(kCFRunLoopDefaultMode, runLoopTimeout, true); - } - return passed; -} - -void ASDisplayNodeSizeToFitSize(ASDisplayNode *node, CGSize size) -{ - CGSize sizeThatFits = [node layoutThatFits:ASSizeRangeMake(size)].size; - node.bounds = (CGRect){.origin = CGPointZero, .size = sizeThatFits}; -} - -void ASDisplayNodeSizeToFitSizeRange(ASDisplayNode *node, ASSizeRange sizeRange) -{ - CGSize sizeThatFits = [node layoutThatFits:sizeRange].size; - node.bounds = (CGRect){.origin = CGPointZero, .size = sizeThatFits}; -} - -void ASCATransactionQueueWait(ASCATransactionQueue *q) -{ - if (!q) { q = ASCATransactionQueueGet(); } - NSDate *date = [NSDate dateWithTimeIntervalSinceNow:1]; - BOOL whileResult = YES; - while ([date timeIntervalSinceNow] > 0 && - (whileResult = ![q isEmpty])) { - [[NSRunLoop currentRunLoop] runUntilDate: - [NSDate dateWithTimeIntervalSinceNow:0.01]]; - } -} diff --git a/submodules/AsyncDisplayKit/Tests/ASDisplayViewAccessibilityTests.mm b/submodules/AsyncDisplayKit/Tests/ASDisplayViewAccessibilityTests.mm deleted file mode 100644 index bbc28cf0b3..0000000000 --- a/submodules/AsyncDisplayKit/Tests/ASDisplayViewAccessibilityTests.mm +++ /dev/null @@ -1,303 +0,0 @@ -// -// ASDisplayViewAccessibilityTests.mm -// Texture -// -// Copyright (c) 2018-present, Pinterest, Inc. All rights reserved. -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -#import -#import -#import -#import -#import -#import - -@interface ASDisplayViewAccessibilityTests : XCTestCase -@end - -@implementation ASDisplayViewAccessibilityTests - -- (void)setUp -{ - ASConfiguration *config = [[ASConfiguration alloc] initWithDictionary:nil]; - config.experimentalFeatures = ASExperimentalDisableAccessibilityCache; - [ASConfigurationManager test_resetWithConfiguration:config]; -} - -- (void)testAccessibilityElementsAccessors -{ - // Setup nodes with accessibility info - ASDisplayNode *node = nil; - ASDisplayNode *subnode = nil; - node = [[ASDisplayNode alloc] init]; - subnode = [[ASDisplayNode alloc] init]; - NSString *label = @"foo"; - subnode.isAccessibilityElement = YES; - subnode.accessibilityLabel = label; - [node addSubnode:subnode]; - XCTAssertEqualObjects([node.view.accessibilityElements.firstObject accessibilityLabel], label); - // NOTE: The following tests will fail unless accessibility is enabled, e.g. by turning the - // accessibility inspector on. See https://github.com/TextureGroup/Texture/pull/1069 for details. - /*XCTAssertEqualObjects([[node.view accessibilityElementAtIndex:0] accessibilityLabel], label); - XCTAssertEqual(node.view.accessibilityElementCount, 1); - XCTAssertEqual([node.view indexOfAccessibilityElement:node.view.accessibilityElements.firstObject], 0);*/ -} - -- (void)testThatSubnodeAccessibilityLabelAggregationWorks -{ - // Setup nodes - ASDisplayNode *node = nil; - ASDisplayNode *innerNode1 = nil; - ASDisplayNode *innerNode2 = nil; - node = [[ASDisplayNode alloc] init]; - innerNode1 = [[ASDisplayNode alloc] init]; - innerNode2 = [[ASDisplayNode alloc] init]; - - // Initialize nodes with relevant accessibility data - node.isAccessibilityContainer = YES; - innerNode1.accessibilityLabel = @"hello"; - innerNode2.accessibilityLabel = @"world"; - - // Attach the subnodes to the parent node, then ensure their accessibility labels have been' - // aggregated to the parent's accessibility label - [node addSubnode:innerNode1]; - [node addSubnode:innerNode2]; - XCTAssertEqualObjects([node.view.accessibilityElements.firstObject accessibilityLabel], - @"hello, world", @"Subnode accessibility label aggregation broken %@", - [node.view.accessibilityElements.firstObject accessibilityLabel]); -} - -- (void)testThatContainerAccessibilityLabelOverrideStopsAggregation -{ - // Setup nodes - ASDisplayNode *node = nil; - ASDisplayNode *innerNode = nil; - node = [[ASDisplayNode alloc] init]; - innerNode = [[ASDisplayNode alloc] init]; - - // Initialize nodes with relevant accessibility data - node.isAccessibilityContainer = YES; - node.accessibilityLabel = @"hello"; - innerNode.accessibilityLabel = @"world"; - - // Attach the subnode to the parent node, then ensure the parent's accessibility label does not - // get aggregated with the subnode's label - [node addSubnode:innerNode]; - XCTAssertEqualObjects([node.view.accessibilityElements.firstObject accessibilityLabel], @"hello", - @"Container accessibility label override broken %@", - [node.view.accessibilityElements.firstObject accessibilityLabel]); -} - -- (void)testAccessibilityLayerbackedNodesOperationInContainer { - ASDisplayNode *contianer = [[ASDisplayNode alloc] init]; - contianer.frame = CGRectMake(50, 50, 200, 400); - contianer.backgroundColor = [UIColor grayColor]; - contianer.isAccessibilityContainer = YES; - // Do any additional setup after loading the view, typically from a nib. - ASTextNode *text1 = [[ASTextNode alloc] init]; - text1.layerBacked = YES; - text1.attributedText = [[NSAttributedString alloc] initWithString:@"hello"]; - text1.frame = CGRectMake(50, 100, 200, 200); - [contianer addSubnode:text1]; - [contianer layoutIfNeeded]; - [contianer.layer displayIfNeeded]; - NSArray *elements = contianer.view.accessibilityElements; - XCTAssertTrue(elements.count == 1); - XCTAssertTrue([[elements.firstObject accessibilityLabel] isEqualToString:@"hello"]); - ASTextNode *text2 = [[ASTextNode alloc] init]; - text2.layerBacked = YES; - text2.attributedText = [[NSAttributedString alloc] initWithString:@"world"]; - text2.frame = CGRectMake(50, 300, 200, 200); - [contianer addSubnode:text2]; - [contianer layoutIfNeeded]; - [contianer.layer displayIfNeeded]; - NSArray *updatedElements = contianer.view.accessibilityElements; - XCTAssertTrue(updatedElements.count == 1); - XCTAssertTrue([[updatedElements.firstObject accessibilityLabel] isEqualToString:@"hello, world"]); - ASTextNode *text3 = [[ASTextNode alloc] init]; - text3.attributedText = [[NSAttributedString alloc] initWithString:@"!!!!"]; - text3.frame = CGRectMake(50, 400, 200, 100); - text3.layerBacked = YES; - [text2 addSubnode:text3]; - [contianer layoutIfNeeded]; - [contianer.layer displayIfNeeded]; - NSArray *updatedElements2 = contianer.view.accessibilityElements; - XCTAssertTrue([[updatedElements2.firstObject accessibilityLabel] isEqualToString:@"hello, world, !!!!"]); -} - -- (void)testAccessibilityNonLayerbackedNodesOperationInContainer -{ - ASDisplayNode *contianer = [[ASDisplayNode alloc] init]; - contianer.frame = CGRectMake(50, 50, 200, 600); - contianer.backgroundColor = [UIColor grayColor]; - contianer.isAccessibilityContainer = YES; - // Do any additional setup after loading the view, typically from a nib. - ASTextNode *text1 = [[ASTextNode alloc] init]; - text1.attributedText = [[NSAttributedString alloc] initWithString:@"hello"]; - text1.frame = CGRectMake(50, 100, 200, 200); - [contianer addSubnode:text1]; - [contianer layoutIfNeeded]; - [contianer.layer displayIfNeeded]; - NSArray *elements = contianer.view.accessibilityElements; - XCTAssertTrue(elements.count == 1); - XCTAssertTrue([[elements.firstObject accessibilityLabel] isEqualToString:@"hello"]); - ASTextNode *text2 = [[ASTextNode alloc] init]; - text2.attributedText = [[NSAttributedString alloc] initWithString:@"world"]; - text2.frame = CGRectMake(50, 300, 200, 200); - [contianer addSubnode:text2]; - [contianer layoutIfNeeded]; - [contianer.layer displayIfNeeded]; - NSArray *updatedElements = contianer.view.accessibilityElements; - XCTAssertTrue(updatedElements.count == 1); - XCTAssertTrue([[updatedElements.firstObject accessibilityLabel] isEqualToString:@"hello, world"]); - ASTextNode *text3 = [[ASTextNode alloc] init]; - text3.attributedText = [[NSAttributedString alloc] initWithString:@"!!!!"]; - text3.frame = CGRectMake(50, 400, 200, 100); - [text2 addSubnode:text3]; - [contianer layoutIfNeeded]; - [contianer.layer displayIfNeeded]; - NSArray *updatedElements2 = contianer.view.accessibilityElements; - XCTAssertTrue([[updatedElements2.firstObject accessibilityLabel] isEqualToString:@"hello, world, !!!!"]); -} - -- (void)testAccessibilityNonLayerbackedNodesOperationInNonContainer -{ - ASDisplayNode *contianer = [[ASDisplayNode alloc] init]; - contianer.frame = CGRectMake(50, 50, 200, 600); - contianer.backgroundColor = [UIColor grayColor]; - // Do any additional setup after loading the view, typically from a nib. - ASTextNode *text1 = [[ASTextNode alloc] init]; - text1.attributedText = [[NSAttributedString alloc] initWithString:@"hello"]; - text1.frame = CGRectMake(50, 100, 200, 200); - [contianer addSubnode:text1]; - [contianer layoutIfNeeded]; - [contianer.layer displayIfNeeded]; - NSArray *elements = contianer.view.accessibilityElements; - XCTAssertTrue(elements.count == 1); - XCTAssertTrue([[elements.firstObject accessibilityLabel] isEqualToString:@"hello"]); - ASTextNode *text2 = [[ASTextNode alloc] init]; - text2.attributedText = [[NSAttributedString alloc] initWithString:@"world"]; - text2.frame = CGRectMake(50, 300, 200, 200); - [contianer addSubnode:text2]; - [contianer layoutIfNeeded]; - [contianer.layer displayIfNeeded]; - NSArray *updatedElements = contianer.view.accessibilityElements; - XCTAssertTrue(updatedElements.count == 2); - XCTAssertTrue([[updatedElements.firstObject accessibilityLabel] isEqualToString:@"hello"]); - XCTAssertTrue([[updatedElements.lastObject accessibilityLabel] isEqualToString:@"world"]); - ASTextNode *text3 = [[ASTextNode alloc] init]; - text3.attributedText = [[NSAttributedString alloc] initWithString:@"!!!!"]; - text3.frame = CGRectMake(50, 400, 200, 100); - [text2 addSubnode:text3]; - [contianer layoutIfNeeded]; - [contianer.layer displayIfNeeded]; - NSArray *updatedElements2 = contianer.view.accessibilityElements; - //text3 won't be read out cause it's overshadowed by text2 - XCTAssertTrue(updatedElements2.count == 2); - XCTAssertTrue([[updatedElements2.firstObject accessibilityLabel] isEqualToString:@"hello"]); - XCTAssertTrue([[updatedElements2.lastObject accessibilityLabel] isEqualToString:@"world"]); -} -- (void)testAccessibilityLayerbackedNodesOperationInNonContainer -{ - ASDisplayNode *contianer = [[ASDisplayNode alloc] init]; - contianer.frame = CGRectMake(50, 50, 200, 600); - contianer.backgroundColor = [UIColor grayColor]; - // Do any additional setup after loading the view, typically from a nib. - ASTextNode *text1 = [[ASTextNode alloc] init]; - text1.layerBacked = YES; - text1.attributedText = [[NSAttributedString alloc] initWithString:@"hello"]; - text1.frame = CGRectMake(50, 0, 100, 100); - [contianer addSubnode:text1]; - [contianer layoutIfNeeded]; - [contianer.layer displayIfNeeded]; - NSArray *elements = contianer.view.accessibilityElements; - XCTAssertTrue(elements.count == 1); - XCTAssertTrue([[elements.firstObject accessibilityLabel] isEqualToString:@"hello"]); - ASTextNode *text2 = [[ASTextNode alloc] init]; - text2.layerBacked = YES; - text2.attributedText = [[NSAttributedString alloc] initWithString:@"world"]; - text2.frame = CGRectMake(50, 100, 100, 100); - [contianer addSubnode:text2]; - [contianer layoutIfNeeded]; - [contianer.layer displayIfNeeded]; - NSArray *updatedElements = contianer.view.accessibilityElements; - XCTAssertTrue(updatedElements.count == 2); - XCTAssertTrue([[updatedElements.firstObject accessibilityLabel] isEqualToString:@"hello"]); - XCTAssertTrue([[updatedElements.lastObject accessibilityLabel] isEqualToString:@"world"]); - ASTextNode *text3 = [[ASTextNode alloc] init]; - text3.layerBacked = YES; - text3.attributedText = [[NSAttributedString alloc] initWithString:@"!!!!"]; - text3.frame = CGRectMake(50, 200, 100, 100); - [text2 addSubnode:text3]; - [contianer layoutIfNeeded]; - [contianer.layer displayIfNeeded]; - NSArray *updatedElements2 = contianer.view.accessibilityElements; - //text3 won't be read out cause it's overshadowed by text2 - XCTAssertTrue(updatedElements2.count == 2); - XCTAssertTrue([[updatedElements2.firstObject accessibilityLabel] isEqualToString:@"hello"]); - XCTAssertTrue([[updatedElements2.lastObject accessibilityLabel] isEqualToString:@"world"]); -} - -- (void)testAccessibilityUpdatesWithElementsChanges -{ - ASDisplayNode *contianer = [[ASDisplayNode alloc] init]; - contianer.frame = CGRectMake(50, 50, 200, 600); - contianer.backgroundColor = [UIColor grayColor]; - contianer.isAccessibilityContainer = YES; - // Do any additional setup after loading the view, typically from a nib. - ASTextNode *text1 = [[ASTextNode alloc] init]; - text1.layerBacked = YES; - text1.attributedText = [[NSAttributedString alloc] initWithString:@"hello"]; - text1.frame = CGRectMake(50, 0, 100, 100); - [contianer addSubnode:text1]; - [contianer layoutIfNeeded]; - [contianer.layer displayIfNeeded]; - NSArray *elements = contianer.view.accessibilityElements; - XCTAssertTrue(elements.count == 1); - XCTAssertTrue([[elements.firstObject accessibilityLabel] isEqualToString:@"hello"]); - text1.attributedText = [[NSAttributedString alloc] initWithString:@"greeting"]; - [contianer layoutIfNeeded]; - [contianer.layer displayIfNeeded]; - NSArray *elements2 = contianer.view.accessibilityElements; - XCTAssertTrue(elements2.count == 1); - XCTAssertTrue([[elements2.firstObject accessibilityLabel] isEqualToString:@"greeting"]); -} - -#pragma mark - -#pragma mark UIAccessibilityAction Forwarding - -- (void)testActionForwarding { - ASDisplayNode *node = [ASDisplayNode new]; - UIView *view = node.view; - - id mockNode = OCMPartialMock(node); - - OCMExpect([mockNode accessibilityActivate]); - [view accessibilityActivate]; - - OCMExpect([mockNode accessibilityIncrement]); - [view accessibilityIncrement]; - - OCMExpect([mockNode accessibilityDecrement]); - [view accessibilityDecrement]; - - OCMExpect([mockNode accessibilityScroll:UIAccessibilityScrollDirectionDown]); - [view accessibilityScroll:UIAccessibilityScrollDirectionDown]; - - OCMExpect([mockNode accessibilityPerformEscape]); - [view accessibilityPerformEscape]; - - OCMExpect([mockNode accessibilityPerformMagicTap]); - [view accessibilityPerformMagicTap]; - - OCMVerifyAll(mockNode); -} - -@end diff --git a/submodules/AsyncDisplayKit/Tests/ASEditableTextNodeTests.mm b/submodules/AsyncDisplayKit/Tests/ASEditableTextNodeTests.mm deleted file mode 100644 index a359629014..0000000000 --- a/submodules/AsyncDisplayKit/Tests/ASEditableTextNodeTests.mm +++ /dev/null @@ -1,171 +0,0 @@ -// -// ASEditableTextNodeTests.mm -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import -#import -#import - -static BOOL CGSizeEqualToSizeWithIn(CGSize size1, CGSize size2, CGFloat delta) -{ - return fabs(size1.width - size2.width) < delta && fabs(size1.height - size2.height) < delta; -} - -@interface ASEditableTextNodeTests : XCTestCase -@property (nonatomic) ASEditableTextNode *editableTextNode; -@property (nonatomic, copy) NSAttributedString *attributedText; -@end - -@implementation ASEditableTextNodeTests - -- (void)setUp -{ - [super setUp]; - - _editableTextNode = [[ASEditableTextNode alloc] init]; - - NSMutableAttributedString *mas = [[NSMutableAttributedString alloc] initWithString:@"Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum."]; - NSMutableParagraphStyle *para = [NSMutableParagraphStyle new]; - para.alignment = NSTextAlignmentCenter; - para.lineSpacing = 1.0; - [mas addAttribute:NSParagraphStyleAttributeName value:para - range:NSMakeRange(0, mas.length - 1)]; - - // Vary the linespacing on the last line - NSMutableParagraphStyle *lastLinePara = [NSMutableParagraphStyle new]; - lastLinePara.alignment = para.alignment; - lastLinePara.lineSpacing = 5.0; - [mas addAttribute:NSParagraphStyleAttributeName value:lastLinePara - range:NSMakeRange(mas.length - 1, 1)]; - - _attributedText = mas; - _editableTextNode.attributedText = _attributedText; -} - -#pragma mark - ASEditableTextNode - -- (void)testAllocASEditableTextNode -{ - ASEditableTextNode *node = [[ASEditableTextNode alloc] init]; - XCTAssertTrue([[node class] isSubclassOfClass:[ASEditableTextNode class]], @"ASEditableTextNode alloc should return an instance of ASEditableTextNode, instead returned %@", [node class]); -} - -#pragma mark - ASEditableTextNode Tests - -- (void)testUITextInputTraitDefaults -{ - ASEditableTextNode *editableTextNode = [[ASEditableTextNode alloc] init]; - - XCTAssertTrue(editableTextNode.autocapitalizationType == UITextAutocapitalizationTypeSentences, @"_ASTextInputTraitsPendingState's autocapitalizationType default should be UITextAutocapitalizationTypeSentences."); - XCTAssertTrue(editableTextNode.autocorrectionType == UITextAutocorrectionTypeDefault, @"_ASTextInputTraitsPendingState's autocorrectionType default should be UITextAutocorrectionTypeDefault."); - XCTAssertTrue(editableTextNode.spellCheckingType == UITextSpellCheckingTypeDefault, @"_ASTextInputTraitsPendingState's spellCheckingType default should be UITextSpellCheckingTypeDefault."); - XCTAssertTrue(editableTextNode.keyboardType == UIKeyboardTypeDefault, @"_ASTextInputTraitsPendingState's keyboardType default should be UIKeyboardTypeDefault."); - XCTAssertTrue(editableTextNode.keyboardAppearance == UIKeyboardAppearanceDefault, @"_ASTextInputTraitsPendingState's keyboardAppearance default should be UIKeyboardAppearanceDefault."); - XCTAssertTrue(editableTextNode.returnKeyType == UIReturnKeyDefault, @"_ASTextInputTraitsPendingState's returnKeyType default should be UIReturnKeyDefault."); - XCTAssertTrue(editableTextNode.enablesReturnKeyAutomatically == NO, @"_ASTextInputTraitsPendingState's enablesReturnKeyAutomatically default should be NO."); - XCTAssertTrue(editableTextNode.isSecureTextEntry == NO, @"_ASTextInputTraitsPendingState's isSecureTextEntry default should be NO."); - - XCTAssertTrue(editableTextNode.textView.autocapitalizationType == UITextAutocapitalizationTypeSentences, @"textView's autocapitalizationType default should be UITextAutocapitalizationTypeSentences."); - XCTAssertTrue(editableTextNode.textView.autocorrectionType == UITextAutocorrectionTypeDefault, @"textView's autocorrectionType default should be UITextAutocorrectionTypeDefault."); - XCTAssertTrue(editableTextNode.textView.spellCheckingType == UITextSpellCheckingTypeDefault, @"textView's spellCheckingType default should be UITextSpellCheckingTypeDefault."); - XCTAssertTrue(editableTextNode.textView.keyboardType == UIKeyboardTypeDefault, @"textView's keyboardType default should be UIKeyboardTypeDefault."); - XCTAssertTrue(editableTextNode.textView.keyboardAppearance == UIKeyboardAppearanceDefault, @"textView's keyboardAppearance default should be UIKeyboardAppearanceDefault."); - XCTAssertTrue(editableTextNode.textView.returnKeyType == UIReturnKeyDefault, @"textView's returnKeyType default should be UIReturnKeyDefault."); - XCTAssertTrue(editableTextNode.textView.enablesReturnKeyAutomatically == NO, @"textView's enablesReturnKeyAutomatically default should be NO."); - XCTAssertTrue(editableTextNode.textView.isSecureTextEntry == NO, @"textView's isSecureTextEntry default should be NO."); -} - -- (void)testUITextInputTraitsSetTraitsBeforeViewLoaded -{ - // UITextView ignores any values set on the first 3 properties below if secureTextEntry is enabled. - // Because of this UIKit behavior, we'll test secure entry seperately - ASEditableTextNode *editableTextNode = [[ASEditableTextNode alloc] init]; - - editableTextNode.autocapitalizationType = UITextAutocapitalizationTypeWords; - editableTextNode.autocorrectionType = UITextAutocorrectionTypeYes; - editableTextNode.spellCheckingType = UITextSpellCheckingTypeYes; - editableTextNode.keyboardType = UIKeyboardTypeTwitter; - editableTextNode.keyboardAppearance = UIKeyboardAppearanceDark; - editableTextNode.returnKeyType = UIReturnKeyGo; - editableTextNode.enablesReturnKeyAutomatically = YES; - - XCTAssertTrue(editableTextNode.textView.autocapitalizationType == UITextAutocapitalizationTypeWords, @"textView's autocapitalizationType should be UITextAutocapitalizationTypeAllCharacters."); - XCTAssertTrue(editableTextNode.textView.autocorrectionType == UITextAutocorrectionTypeYes, @"textView's autocorrectionType should be UITextAutocorrectionTypeYes."); - XCTAssertTrue(editableTextNode.textView.spellCheckingType == UITextSpellCheckingTypeYes, @"textView's spellCheckingType should be UITextSpellCheckingTypeYes."); - XCTAssertTrue(editableTextNode.textView.keyboardType == UIKeyboardTypeTwitter, @"textView's keyboardType should be UIKeyboardTypeTwitter."); - XCTAssertTrue(editableTextNode.textView.keyboardAppearance == UIKeyboardAppearanceDark, @"textView's keyboardAppearance should be UIKeyboardAppearanceDark."); - XCTAssertTrue(editableTextNode.textView.returnKeyType == UIReturnKeyGo, @"textView's returnKeyType should be UIReturnKeyGo."); - XCTAssertTrue(editableTextNode.textView.enablesReturnKeyAutomatically == YES, @"textView's enablesReturnKeyAutomatically should be YES."); - - ASEditableTextNode *secureEditableTextNode = [[ASEditableTextNode alloc] init]; - secureEditableTextNode.secureTextEntry = YES; - - XCTAssertTrue(secureEditableTextNode.textView.secureTextEntry == YES, @"textView's isSecureTextEntry should be YES."); -} - -- (void)testUITextInputTraitsChangeTraitAfterViewLoaded -{ - // UITextView ignores any values set on the first 3 properties below if secureTextEntry is enabled. - // Because of this UIKit behavior, we'll test secure entry seperately - ASEditableTextNode *editableTextNode = [[ASEditableTextNode alloc] init]; - - editableTextNode.textView.autocapitalizationType = UITextAutocapitalizationTypeWords; - editableTextNode.textView.autocorrectionType = UITextAutocorrectionTypeYes; - editableTextNode.textView.spellCheckingType = UITextSpellCheckingTypeYes; - editableTextNode.textView.keyboardType = UIKeyboardTypeTwitter; - editableTextNode.textView.keyboardAppearance = UIKeyboardAppearanceDark; - editableTextNode.textView.returnKeyType = UIReturnKeyGo; - editableTextNode.textView.enablesReturnKeyAutomatically = YES; - - XCTAssertTrue(editableTextNode.textView.autocapitalizationType == UITextAutocapitalizationTypeWords, @"textView's autocapitalizationType should be UITextAutocapitalizationTypeAllCharacters."); - XCTAssertTrue(editableTextNode.textView.autocorrectionType == UITextAutocorrectionTypeYes, @"textView's autocorrectionType should be UITextAutocorrectionTypeYes."); - XCTAssertTrue(editableTextNode.textView.spellCheckingType == UITextSpellCheckingTypeYes, @"textView's spellCheckingType should be UITextSpellCheckingTypeYes."); - XCTAssertTrue(editableTextNode.textView.keyboardType == UIKeyboardTypeTwitter, @"textView's keyboardType should be UIKeyboardTypeTwitter."); - XCTAssertTrue(editableTextNode.textView.keyboardAppearance == UIKeyboardAppearanceDark, @"textView's keyboardAppearance should be UIKeyboardAppearanceDark."); - XCTAssertTrue(editableTextNode.textView.returnKeyType == UIReturnKeyGo, @"textView's returnKeyType should be UIReturnKeyGo."); - XCTAssertTrue(editableTextNode.textView.enablesReturnKeyAutomatically == YES, @"textView's enablesReturnKeyAutomatically should be YES."); - - ASEditableTextNode *secureEditableTextNode = [[ASEditableTextNode alloc] init]; - secureEditableTextNode.textView.secureTextEntry = YES; - - XCTAssertTrue(secureEditableTextNode.textView.secureTextEntry == YES, @"textView's isSecureTextEntry should be YES."); -} - -- (void)testCalculatedSizeIsGreaterThanOrEqualToConstrainedSize -{ - for (NSInteger i = 10; i < 500; i += 50) { - CGSize constrainedSize = CGSizeMake(i, i); - CGSize calculatedSize = [_editableTextNode layoutThatFits:ASSizeRangeMake(CGSizeZero, constrainedSize)].size; - XCTAssertTrue(calculatedSize.width <= constrainedSize.width, @"Calculated width (%f) should be less than or equal to constrained width (%f)", calculatedSize.width, constrainedSize.width); - XCTAssertTrue(calculatedSize.height <= constrainedSize.height, @"Calculated height (%f) should be less than or equal to constrained height (%f)", calculatedSize.height, constrainedSize.height); - } -} - -- (void)testRecalculationOfSizeIsSameAsOriginallyCalculatedSize -{ - for (NSInteger i = 10; i < 500; i += 50) { - CGSize constrainedSize = CGSizeMake(i, i); - CGSize calculatedSize = [_editableTextNode layoutThatFits:ASSizeRangeMake(CGSizeZero, constrainedSize)].size; - CGSize recalculatedSize = [_editableTextNode layoutThatFits:ASSizeRangeMake(CGSizeZero, constrainedSize)].size; - - XCTAssertTrue(CGSizeEqualToSizeWithIn(calculatedSize, recalculatedSize, 4.0), @"Recalculated size %@ should be same as original size %@", NSStringFromCGSize(recalculatedSize), NSStringFromCGSize(calculatedSize)); - } -} - -- (void)testRecalculationOfSizeIsSameAsOriginallyCalculatedFloatingPointSize -{ - for (CGFloat i = 10; i < 500; i *= 1.3) { - CGSize constrainedSize = CGSizeMake(i, i); - CGSize calculatedSize = [_editableTextNode layoutThatFits:ASSizeRangeMake(CGSizeZero, constrainedSize)].size; - CGSize recalculatedSize = [_editableTextNode layoutThatFits:ASSizeRangeMake(CGSizeZero, constrainedSize)].size; - - XCTAssertTrue(CGSizeEqualToSizeWithIn(calculatedSize, recalculatedSize, 11.0), @"Recalculated size %@ should be same as original size %@", NSStringFromCGSize(recalculatedSize), NSStringFromCGSize(calculatedSize)); - } -} - -@end diff --git a/submodules/AsyncDisplayKit/Tests/ASImageNodeSnapshotTests.mm b/submodules/AsyncDisplayKit/Tests/ASImageNodeSnapshotTests.mm deleted file mode 100644 index 55cb5f866e..0000000000 --- a/submodules/AsyncDisplayKit/Tests/ASImageNodeSnapshotTests.mm +++ /dev/null @@ -1,94 +0,0 @@ -// -// ASImageNodeSnapshotTests.mm -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import "ASSnapshotTestCase.h" - -#import - -@interface ASImageNodeSnapshotTests : ASSnapshotTestCase -@end - -@implementation ASImageNodeSnapshotTests - -- (void)setUp -{ - [super setUp]; - - self.recordMode = NO; -} - -- (UIImage *)testImage -{ - NSString *path = [[NSBundle bundleForClass:[self class]] pathForResource:@"logo-square" - ofType:@"png" - inDirectory:@"TestResources"]; - return [UIImage imageWithContentsOfFile:path]; -} - -- (void)testRenderLogoSquare -{ - // trivial test case to ensure ASSnapshotTestCase works - ASImageNode *imageNode = [[ASImageNode alloc] init]; - imageNode.image = [self testImage]; - ASDisplayNodeSizeToFitSize(imageNode, CGSizeMake(100, 100)); - - ASSnapshotVerifyNode(imageNode, nil); -} - -- (void)testForcedScaling -{ - CGSize forcedImageSize = CGSizeMake(100, 100); - - ASImageNode *imageNode = [[ASImageNode alloc] init]; - imageNode.forcedSize = forcedImageSize; - imageNode.image = [self testImage]; - - // Snapshot testing requires that node is formally laid out. - imageNode.style.width = ASDimensionMake(forcedImageSize.width); - imageNode.style.height = ASDimensionMake(forcedImageSize.height); - ASDisplayNodeSizeToFitSize(imageNode, forcedImageSize); - ASSnapshotVerifyNode(imageNode, @"first"); - - imageNode.style.width = ASDimensionMake(200); - imageNode.style.height = ASDimensionMake(200); - ASDisplayNodeSizeToFitSize(imageNode, CGSizeMake(200, 200)); - ASSnapshotVerifyNode(imageNode, @"second"); - - XCTAssert(CGImageGetWidth((CGImageRef)imageNode.contents) == forcedImageSize.width * imageNode.contentsScale && - CGImageGetHeight((CGImageRef)imageNode.contents) == forcedImageSize.height * imageNode.contentsScale, - @"Contents should be 100 x 100 by contents scale."); -} - -- (void)testTintColorBlock -{ - UIImage *test = [self testImage]; - UIImage *tinted = ASImageNodeTintColorModificationBlock([UIColor redColor])(test); - ASImageNode *node = [[ASImageNode alloc] init]; - node.image = tinted; - ASDisplayNodeSizeToFitSize(node, test.size); - - ASSnapshotVerifyNode(node, nil); -} - -- (void)testRoundedCornerBlock -{ - UIGraphicsBeginImageContext(CGSizeMake(100, 100)); - [[UIColor blueColor] setFill]; - UIRectFill(CGRectMake(0, 0, 100, 100)); - UIImage *result = UIGraphicsGetImageFromCurrentImageContext(); - UIGraphicsEndImageContext(); - UIImage *rounded = ASImageNodeRoundBorderModificationBlock(2, [UIColor redColor])(result); - ASImageNode *node = [[ASImageNode alloc] init]; - node.image = rounded; - ASDisplayNodeSizeToFitSize(node, rounded.size); - - ASSnapshotVerifyNode(node, nil); -} - -@end diff --git a/submodules/AsyncDisplayKit/Tests/ASInsetLayoutSpecSnapshotTests.mm b/submodules/AsyncDisplayKit/Tests/ASInsetLayoutSpecSnapshotTests.mm deleted file mode 100644 index d6047d35f3..0000000000 --- a/submodules/AsyncDisplayKit/Tests/ASInsetLayoutSpecSnapshotTests.mm +++ /dev/null @@ -1,117 +0,0 @@ -// -// ASInsetLayoutSpecSnapshotTests.mm -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import "ASLayoutSpecSnapshotTestsHelper.h" - -#import -#import - -typedef NS_OPTIONS(NSUInteger, ASInsetLayoutSpecTestEdge) { - ASInsetLayoutSpecTestEdgeTop = 1 << 0, - ASInsetLayoutSpecTestEdgeLeft = 1 << 1, - ASInsetLayoutSpecTestEdgeBottom = 1 << 2, - ASInsetLayoutSpecTestEdgeRight = 1 << 3, -}; - -static CGFloat insetForEdge(NSUInteger combination, ASInsetLayoutSpecTestEdge edge, CGFloat insetValue) -{ - return combination & edge ? INFINITY : insetValue; -} - -static UIEdgeInsets insetsForCombination(NSUInteger combination, CGFloat insetValue) -{ - return { - .top = insetForEdge(combination, ASInsetLayoutSpecTestEdgeTop, insetValue), - .left = insetForEdge(combination, ASInsetLayoutSpecTestEdgeLeft, insetValue), - .bottom = insetForEdge(combination, ASInsetLayoutSpecTestEdgeBottom, insetValue), - .right = insetForEdge(combination, ASInsetLayoutSpecTestEdgeRight, insetValue), - }; -} - -static NSString *nameForInsets(UIEdgeInsets insets) -{ - return [NSString stringWithFormat:@"%.f-%.f-%.f-%.f", insets.top, insets.left, insets.bottom, insets.right]; -} - -@interface ASInsetLayoutSpecSnapshotTests : ASLayoutSpecSnapshotTestCase -@end - -@implementation ASInsetLayoutSpecSnapshotTests - -- (void)testInsetsWithVariableSize -{ - for (NSUInteger combination = 0; combination < 16; combination++) { - UIEdgeInsets insets = insetsForCombination(combination, 10); - ASDisplayNode *backgroundNode = ASDisplayNodeWithBackgroundColor([UIColor grayColor]); - ASDisplayNode *foregroundNode = ASDisplayNodeWithBackgroundColor([UIColor greenColor], {10, 10}); - - ASLayoutSpec *layoutSpec = - [ASBackgroundLayoutSpec - backgroundLayoutSpecWithChild: - [ASInsetLayoutSpec - insetLayoutSpecWithInsets:insets - child:foregroundNode] - background:backgroundNode]; - - static ASSizeRange kVariableSize = {{0, 0}, {300, 300}}; - [self testLayoutSpec:layoutSpec - sizeRange:kVariableSize - subnodes:@[backgroundNode, foregroundNode] - identifier:nameForInsets(insets)]; - } -} - -- (void)testInsetsWithFixedSize -{ - for (NSUInteger combination = 0; combination < 16; combination++) { - UIEdgeInsets insets = insetsForCombination(combination, 10); - ASDisplayNode *backgroundNode = ASDisplayNodeWithBackgroundColor([UIColor grayColor]); - ASDisplayNode *foregroundNode = ASDisplayNodeWithBackgroundColor([UIColor greenColor], {10, 10}); - - ASLayoutSpec *layoutSpec = - [ASBackgroundLayoutSpec - backgroundLayoutSpecWithChild: - [ASInsetLayoutSpec - insetLayoutSpecWithInsets:insets - child:foregroundNode] - background:backgroundNode]; - - static ASSizeRange kFixedSize = {{300, 300}, {300, 300}}; - [self testLayoutSpec:layoutSpec - sizeRange:kFixedSize - subnodes:@[backgroundNode, foregroundNode] - identifier:nameForInsets(insets)]; - } -} - -/** Regression test, there was a bug mixing insets with infinite and zero sizes */ -- (void)testInsetsWithInfinityAndZeroInsetValue -{ - for (NSUInteger combination = 0; combination < 16; combination++) { - UIEdgeInsets insets = insetsForCombination(combination, 0); - ASDisplayNode *backgroundNode = ASDisplayNodeWithBackgroundColor([UIColor grayColor]); - ASDisplayNode *foregroundNode = ASDisplayNodeWithBackgroundColor([UIColor greenColor], {10, 10}); - - ASLayoutSpec *layoutSpec = - [ASBackgroundLayoutSpec - backgroundLayoutSpecWithChild: - [ASInsetLayoutSpec - insetLayoutSpecWithInsets:insets - child:foregroundNode] - background:backgroundNode]; - - static ASSizeRange kFixedSize = {{300, 300}, {300, 300}}; - [self testLayoutSpec:layoutSpec - sizeRange:kFixedSize - subnodes:@[backgroundNode, foregroundNode] - identifier:nameForInsets(insets)]; - } -} - -@end diff --git a/submodules/AsyncDisplayKit/Tests/ASIntegerMapTests.mm b/submodules/AsyncDisplayKit/Tests/ASIntegerMapTests.mm deleted file mode 100644 index d23e5bf49f..0000000000 --- a/submodules/AsyncDisplayKit/Tests/ASIntegerMapTests.mm +++ /dev/null @@ -1,113 +0,0 @@ -// -// ASIntegerMapTests.mm -// Texture -// -// Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import "ASTestCase.h" -#import "ASIntegerMap.h" - -@interface ASIntegerMapTests : ASTestCase - -@end - -@implementation ASIntegerMapTests - -- (void)testIsEqual -{ - ASIntegerMap *map = [[ASIntegerMap alloc] init]; - [map setInteger:1 forKey:0]; - ASIntegerMap *alsoMap = [[ASIntegerMap alloc] init]; - [alsoMap setInteger:1 forKey:0]; - ASIntegerMap *notMap = [[ASIntegerMap alloc] init]; - [notMap setInteger:2 forKey:0]; - XCTAssertEqualObjects(map, alsoMap); - XCTAssertNotEqualObjects(map, notMap); -} - -#pragma mark - Changeset mapping - -/// 1 item, no changes -> identity map -- (void)testEmptyChange -{ - ASIntegerMap *map = [ASIntegerMap mapForUpdateWithOldCount:1 deleted:nil inserted:nil]; - XCTAssertEqual(map, ASIntegerMap.identityMap); -} - -/// 0 items -> empty map -- (void)testChangeOnNoData -{ - ASIntegerMap *map = [ASIntegerMap mapForUpdateWithOldCount:0 deleted:nil inserted:nil]; - XCTAssertEqual(map, ASIntegerMap.emptyMap); -} - -/// 2 items, delete 0 -- (void)testBasicChange1 -{ - ASIntegerMap *map = [ASIntegerMap mapForUpdateWithOldCount:2 deleted:[NSIndexSet indexSetWithIndex:0] inserted:nil]; - XCTAssertEqual([map integerForKey:0], NSNotFound); - XCTAssertEqual([map integerForKey:1], 0); - XCTAssertEqual([map integerForKey:2], NSNotFound); -} - -/// 2 items, insert 0 -- (void)testBasicChange2 -{ - ASIntegerMap *map = [ASIntegerMap mapForUpdateWithOldCount:2 deleted:nil inserted:[NSIndexSet indexSetWithIndex:0]]; - XCTAssertEqual([map integerForKey:0], 1); - XCTAssertEqual([map integerForKey:1], 2); - XCTAssertEqual([map integerForKey:2], NSNotFound); -} - -/// 2 items, insert 0, delete 0 -- (void)testChange1 -{ - ASIntegerMap *map = [ASIntegerMap mapForUpdateWithOldCount:2 deleted:[NSIndexSet indexSetWithIndex:0] inserted:[NSIndexSet indexSetWithIndex:0]]; - XCTAssertEqual([map integerForKey:0], NSNotFound); - XCTAssertEqual([map integerForKey:1], 1); - XCTAssertEqual([map integerForKey:2], NSNotFound); -} - -/// 4 items, insert {0-1, 3} -- (void)testChange2 -{ - NSMutableIndexSet *inserts = [NSMutableIndexSet indexSetWithIndexesInRange:NSMakeRange(0, 2)]; - [inserts addIndex:3]; - ASIntegerMap *map = [ASIntegerMap mapForUpdateWithOldCount:4 deleted:nil inserted:inserts]; - XCTAssertEqual([map integerForKey:0], 2); - XCTAssertEqual([map integerForKey:1], 4); - XCTAssertEqual([map integerForKey:2], 5); - XCTAssertEqual([map integerForKey:3], 6); -} - -/// 4 items, delete {0-1, 3} -- (void)testChange3 -{ - NSMutableIndexSet *deletes = [NSMutableIndexSet indexSetWithIndexesInRange:NSMakeRange(0, 2)]; - [deletes addIndex:3]; - ASIntegerMap *map = [ASIntegerMap mapForUpdateWithOldCount:4 deleted:deletes inserted:nil]; - XCTAssertEqual([map integerForKey:0], NSNotFound); - XCTAssertEqual([map integerForKey:1], NSNotFound); - XCTAssertEqual([map integerForKey:2], 0); - XCTAssertEqual([map integerForKey:3], NSNotFound); -} - -/// 5 items, delete {0-1, 3} insert {1-2, 4} -- (void)testChange4 -{ - NSMutableIndexSet *deletes = [NSMutableIndexSet indexSetWithIndexesInRange:NSMakeRange(0, 2)]; - [deletes addIndex:3]; - NSMutableIndexSet *inserts = [NSMutableIndexSet indexSetWithIndexesInRange:NSMakeRange(1, 2)]; - [inserts addIndex:4]; - ASIntegerMap *map = [ASIntegerMap mapForUpdateWithOldCount:5 deleted:deletes inserted:inserts]; - XCTAssertEqual([map integerForKey:0], NSNotFound); - XCTAssertEqual([map integerForKey:1], NSNotFound); - XCTAssertEqual([map integerForKey:2], 0); - XCTAssertEqual([map integerForKey:3], NSNotFound); - XCTAssertEqual([map integerForKey:4], 3); - XCTAssertEqual([map integerForKey:5], NSNotFound); -} - -@end diff --git a/submodules/AsyncDisplayKit/Tests/ASLayoutElementStyleTests.mm b/submodules/AsyncDisplayKit/Tests/ASLayoutElementStyleTests.mm deleted file mode 100644 index f6f95066e8..0000000000 --- a/submodules/AsyncDisplayKit/Tests/ASLayoutElementStyleTests.mm +++ /dev/null @@ -1,127 +0,0 @@ -// -// ASLayoutElementStyleTests.mm -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import -#import "ASXCTExtensions.h" -#import - -#pragma mark - ASLayoutElementStyleTestsDelegate - -@interface ASLayoutElementStyleTestsDelegate : NSObject -@property (copy, nonatomic) NSString *propertyNameChanged; -@end - -@implementation ASLayoutElementStyleTestsDelegate - -- (void)style:(id)style propertyDidChange:(NSString *)propertyName -{ - self.propertyNameChanged = propertyName; -} - -@end - -#pragma mark - ASLayoutElementStyleTests - -@interface ASLayoutElementStyleTests : XCTestCase - -@end - -@implementation ASLayoutElementStyleTests - -- (void)testSettingSize -{ - ASLayoutElementStyle *style = [ASLayoutElementStyle new]; - - style.width = ASDimensionMake(100); - style.height = ASDimensionMake(100); - XCTAssertTrue(ASDimensionEqualToDimension(style.width, ASDimensionMake(100))); - XCTAssertTrue(ASDimensionEqualToDimension(style.height, ASDimensionMake(100))); - - style.minWidth = ASDimensionMake(100); - style.minHeight = ASDimensionMake(100); - XCTAssertTrue(ASDimensionEqualToDimension(style.width, ASDimensionMake(100))); - XCTAssertTrue(ASDimensionEqualToDimension(style.height, ASDimensionMake(100))); - - style.maxWidth = ASDimensionMake(100); - style.maxHeight = ASDimensionMake(100); - XCTAssertTrue(ASDimensionEqualToDimension(style.width, ASDimensionMake(100))); - XCTAssertTrue(ASDimensionEqualToDimension(style.height, ASDimensionMake(100))); -} - -- (void)testSettingSizeViaCGSize -{ - ASLayoutElementStyle *style = [ASLayoutElementStyle new]; - - ASXCTAssertEqualSizes(style.preferredSize, CGSizeZero); - - CGSize size = CGSizeMake(100, 100); - - style.preferredSize = size; - ASXCTAssertEqualSizes(style.preferredSize, size); - XCTAssertTrue(ASDimensionEqualToDimension(style.width, ASDimensionMakeWithPoints(size.width))); - XCTAssertTrue(ASDimensionEqualToDimension(style.height, ASDimensionMakeWithPoints(size.height))); - - style.minSize = size; - XCTAssertTrue(ASDimensionEqualToDimension(style.minWidth, ASDimensionMakeWithPoints(size.width))); - XCTAssertTrue(ASDimensionEqualToDimension(style.minHeight, ASDimensionMakeWithPoints(size.height))); - - style.maxSize = size; - XCTAssertTrue(ASDimensionEqualToDimension(style.maxWidth, ASDimensionMakeWithPoints(size.width))); - XCTAssertTrue(ASDimensionEqualToDimension(style.maxHeight, ASDimensionMakeWithPoints(size.height))); -} - -- (void)testReadingInvalidSizeForPreferredSize -{ - ASLayoutElementStyle *style = [ASLayoutElementStyle new]; - - XCTAssertNoThrow(style.preferredSize); - - style.width = ASDimensionMake(ASDimensionUnitFraction, 0.5); - XCTAssertThrows(style.preferredSize); - - style.preferredSize = CGSizeMake(100, 100); - XCTAssertNoThrow(style.preferredSize); -} - -- (void)testSettingSizeViaLayoutSize -{ - ASLayoutElementStyle *style = [ASLayoutElementStyle new]; - - ASLayoutSize layoutSize = ASLayoutSizeMake(ASDimensionMake(100), ASDimensionMake(100)); - - style.preferredLayoutSize = layoutSize; - XCTAssertTrue(ASDimensionEqualToDimension(style.width, layoutSize.width)); - XCTAssertTrue(ASDimensionEqualToDimension(style.height, layoutSize.height)); - XCTAssertTrue(ASDimensionEqualToDimension(style.preferredLayoutSize.width, layoutSize.width)); - XCTAssertTrue(ASDimensionEqualToDimension(style.preferredLayoutSize.height, layoutSize.height)); - - style.minLayoutSize = layoutSize; - XCTAssertTrue(ASDimensionEqualToDimension(style.minWidth, layoutSize.width)); - XCTAssertTrue(ASDimensionEqualToDimension(style.minHeight, layoutSize.height)); - XCTAssertTrue(ASDimensionEqualToDimension(style.minLayoutSize.width, layoutSize.width)); - XCTAssertTrue(ASDimensionEqualToDimension(style.minLayoutSize.height, layoutSize.height)); - - style.maxLayoutSize = layoutSize; - XCTAssertTrue(ASDimensionEqualToDimension(style.maxWidth, layoutSize.width)); - XCTAssertTrue(ASDimensionEqualToDimension(style.maxHeight, layoutSize.height)); - XCTAssertTrue(ASDimensionEqualToDimension(style.maxLayoutSize.width, layoutSize.width)); - XCTAssertTrue(ASDimensionEqualToDimension(style.maxLayoutSize.height, layoutSize.height)); -} - -- (void)testSettingPropertiesWillCallDelegate -{ - ASLayoutElementStyleTestsDelegate *delegate = [ASLayoutElementStyleTestsDelegate new]; - ASLayoutElementStyle *style = [[ASLayoutElementStyle alloc] initWithDelegate:delegate]; - XCTAssertTrue(ASDimensionEqualToDimension(style.width, ASDimensionAuto)); - style.width = ASDimensionMake(100); - XCTAssertTrue(ASDimensionEqualToDimension(style.width, ASDimensionMake(100))); - XCTAssertTrue([delegate.propertyNameChanged isEqualToString:ASLayoutElementStyleWidthProperty]); -} - -@end diff --git a/submodules/AsyncDisplayKit/Tests/ASLayoutEngineTests.mm b/submodules/AsyncDisplayKit/Tests/ASLayoutEngineTests.mm deleted file mode 100644 index 3222f78b5f..0000000000 --- a/submodules/AsyncDisplayKit/Tests/ASLayoutEngineTests.mm +++ /dev/null @@ -1,591 +0,0 @@ -// -// ASLayoutEngineTests.mm -// Texture -// -// Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import "ASTestCase.h" -#import "ASLayoutTestNode.h" -#import "ASXCTExtensions.h" -#import "ASTLayoutFixture.h" - -@interface ASLayoutEngineTests : ASTestCase - -@end - -@implementation ASLayoutEngineTests { - ASLayoutTestNode *nodeA; - ASLayoutTestNode *nodeB; - ASLayoutTestNode *nodeC; - ASLayoutTestNode *nodeD; - ASLayoutTestNode *nodeE; - ASTLayoutFixture *fixture1; - ASTLayoutFixture *fixture2; - ASTLayoutFixture *fixture3; - ASTLayoutFixture *fixture4; - ASTLayoutFixture *fixture5; - - // fixtures 1, 3 and 5 share the same exact node A layout spec block. - // we don't want the infra to call -setNeedsLayout when we switch fixtures - // so we need to use the same exact block. - ASLayoutSpecBlock fixture1and3and5NodeALayoutSpecBlock; - - UIWindow *window; - UIViewController *vc; - NSArray *allNodes; - NSTimeInterval verifyDelay; - // See -stubCalculatedLayoutDidChange. - BOOL stubbedCalculatedLayoutDidChange; -} - -- (void)setUp -{ - [super setUp]; - verifyDelay = 3; - window = [[UIWindow alloc] initWithFrame:CGRectMake(0, 0, 10, 1)]; - vc = [[UIViewController alloc] init]; - nodeA = [ASLayoutTestNode new]; - nodeA.backgroundColor = [UIColor redColor]; - - // NOTE: nodeB has flexShrink, the others don't - nodeB = [ASLayoutTestNode new]; - nodeB.style.flexShrink = 1; - nodeB.backgroundColor = [UIColor orangeColor]; - - nodeC = [ASLayoutTestNode new]; - nodeC.backgroundColor = [UIColor yellowColor]; - nodeD = [ASLayoutTestNode new]; - nodeD.backgroundColor = [UIColor greenColor]; - nodeE = [ASLayoutTestNode new]; - nodeE.backgroundColor = [UIColor blueColor]; - allNodes = @[ nodeA, nodeB, nodeC, nodeD, nodeE ]; - ASSetDebugNames(nodeA, nodeB, nodeC, nodeD, nodeE); - ASLayoutSpecBlock b = ^ASLayoutSpec * _Nonnull(__kindof ASDisplayNode * _Nonnull node, ASSizeRange constrainedSize) { - return [ASStackLayoutSpec stackLayoutSpecWithDirection:ASStackLayoutDirectionHorizontal spacing:0 justifyContent:ASStackLayoutJustifyContentSpaceBetween alignItems:ASStackLayoutAlignItemsStart children:@[ nodeB, nodeC, nodeD ]]; - }; - fixture1and3and5NodeALayoutSpecBlock = b; - fixture1 = [self createFixture1]; - fixture2 = [self createFixture2]; - fixture3 = [self createFixture3]; - fixture4 = [self createFixture4]; - fixture5 = [self createFixture5]; - - nodeA.frame = vc.view.bounds; - nodeA.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight; - [vc.view addSubnode:nodeA]; - - window.rootViewController = vc; - [window makeKeyAndVisible]; -} - -- (void)tearDown -{ - nodeA.layoutSpecBlock = nil; - for (ASLayoutTestNode *node in allNodes) { - OCMVerifyAllWithDelay(node.mock, verifyDelay); - } - [super tearDown]; -} - -- (void)testFirstLayoutPassWhenInWindow -{ - [self runFirstLayoutPassWithFixture:fixture1]; -} - -- (void)testSetNeedsLayoutAndNormalLayoutPass -{ - [self runFirstLayoutPassWithFixture:fixture1]; - - [fixture2 apply]; - - // skip nodeB because its layout doesn't change. - for (ASLayoutTestNode *node in @[ nodeA, nodeC, nodeE ]) { - [fixture2 withSizeRangesForNode:node block:^(ASSizeRange sizeRange) { - OCMExpect([node.mock calculateLayoutThatFits:sizeRange]).onMainThread(); - }]; - OCMExpect([node.mock calculatedLayoutDidChange]).onMainThread(); - } - - [window layoutIfNeeded]; - [self verifyFixture:fixture2]; -} - -/** - * Transition from fixture1 to Fixture2 on node A. - * - * Expect A and D to calculate once off main, and - * to receive calculatedLayoutDidChange on main, - * then to get the measurement completion call on main, - * then to get animateLayoutTransition: and didCompleteLayoutTransition: on main. - */ -- (void)testLayoutTransitionWithAsyncMeasurement -{ - [self stubCalculatedLayoutDidChange]; - [self runFirstLayoutPassWithFixture:fixture1]; - - [fixture2 apply]; - - // Expect A, C, E to calculate new layouts off-main - // dispatch_once onto main to run our injectedMainThread work while the transition calculates. - __block dispatch_block_t injectedMainThreadWork = nil; - for (ASLayoutTestNode *node in @[ nodeA, nodeC, nodeE ]) { - [fixture2 withSizeRangesForNode:node block:^(ASSizeRange sizeRange) { - OCMExpect([node.mock calculateLayoutThatFits:sizeRange]) - .offMainThread() - .andDo(^(NSInvocation *inv) { - // On first calculateLayoutThatFits, schedule our injected main thread work. - static dispatch_once_t onceToken; - dispatch_once(&onceToken, ^{ - dispatch_async(dispatch_get_main_queue(), ^{ - injectedMainThreadWork(); - }); - }); - }); - }]; - } - - // The code in this section is designed to move in time order, all on the main thread: - - OCMExpect([nodeA.mock animateLayoutTransition:OCMOCK_ANY]).onMainThread(); - OCMExpect([nodeA.mock didCompleteLayoutTransition:OCMOCK_ANY]).onMainThread(); - - // Trigger the layout transition. - __block dispatch_block_t measurementCompletionBlock = nil; - [nodeA transitionLayoutWithAnimation:NO shouldMeasureAsync:YES measurementCompletion:^{ - measurementCompletionBlock(); - }]; - - // This block will get run after bg layout calculate starts, but before measurementCompletion - __block BOOL injectedMainThreadWorkDone = NO; - injectedMainThreadWork = ^{ - injectedMainThreadWorkDone = YES; - - [window layoutIfNeeded]; - - // Ensure we're still on the old layout. We should stay on this until the transition completes. - [self verifyFixture:fixture1]; - }; - - measurementCompletionBlock = ^{ - XCTAssert(injectedMainThreadWorkDone, @"We hoped to get onto the main thread before the measurementCompletion callback ran."); - }; - - for (ASLayoutTestNode *node in allNodes) { - OCMVerifyAllWithDelay(node.mock, verifyDelay); - } - - [self verifyFixture:fixture2]; -} - -/** - * Transition from fixture1 to Fixture2 on node A. - * - * Expect A and D to calculate once on main, and - * to receive calculatedLayoutDidChange on main, - * then to get animateLayoutTransition: and didCompleteLayoutTransition: on main. - */ -- (void)testLayoutTransitionWithSyncMeasurement -{ - [self stubCalculatedLayoutDidChange]; - - // Precondition - XCTAssertFalse(CGSizeEqualToSize(fixture5.layout.size, fixture1.layout.size)); - - // First, apply fixture 5 and run a measurement pass, but don't run a layout pass - // After this step, nodes will have pending layouts that are not yet applied - [fixture5 apply]; - [fixture5 withSizeRangesForAllNodesUsingBlock:^(ASLayoutTestNode * _Nonnull node, ASSizeRange sizeRange) { - OCMExpect([node.mock calculateLayoutThatFits:sizeRange]) - .onMainThread(); - }]; - - [nodeA layoutThatFits:ASSizeRangeMake(fixture5.layout.size)]; - - // Assert that node A has layout size and size range from fixture 5 - XCTAssertTrue(CGSizeEqualToSize(fixture5.layout.size, nodeA.calculatedSize)); - XCTAssertTrue(ASSizeRangeEqualToSizeRange([fixture5 firstSizeRangeForNode:nodeA], nodeA.constrainedSizeForCalculatedLayout)); - - // Then switch to fixture 1 and kick off a synchronous layout transition - // Unapplied pending layouts from the previous measurement pass will be outdated - [fixture1 apply]; - [fixture1 withSizeRangesForAllNodesUsingBlock:^(ASLayoutTestNode * _Nonnull node, ASSizeRange sizeRange) { - OCMExpect([node.mock calculateLayoutThatFits:sizeRange]) - .onMainThread(); - }]; - - OCMExpect([nodeA.mock animateLayoutTransition:OCMOCK_ANY]).onMainThread(); - OCMExpect([nodeA.mock didCompleteLayoutTransition:OCMOCK_ANY]).onMainThread(); - - [nodeA transitionLayoutWithAnimation:NO shouldMeasureAsync:NO measurementCompletion:nil]; - - // Assert that node A picks up new layout size and size range from fixture 1 - XCTAssertTrue(CGSizeEqualToSize(fixture1.layout.size, nodeA.calculatedSize)); - XCTAssertTrue(ASSizeRangeEqualToSizeRange([fixture1 firstSizeRangeForNode:nodeA], nodeA.constrainedSizeForCalculatedLayout)); - - [window layoutIfNeeded]; - [self verifyFixture:fixture1]; -} - -/** - * Start at fixture 1. - * Trigger an async transition to fixture 2. - * While it's measuring, on main switch to fixture 4 (setNeedsLayout A, D) and run a CA layout pass. - * - * Correct behavior, we end up at fixture 4 since it's newer. - * Current incorrect behavior, we end up at fixture 2 and we remeasure surviving node C. - * Note: incorrect behavior likely introduced by the early check in __layout added in - * https://github.com/facebookarchive/AsyncDisplayKit/pull/2657 - */ -- (void)DISABLE_testASetNeedsLayoutInterferingWithTheCurrentTransition -{ - static BOOL enforceCorrectBehavior = NO; - - [self stubCalculatedLayoutDidChange]; - [self runFirstLayoutPassWithFixture:fixture1]; - - [fixture2 apply]; - - // Expect A, C, E to calculate new layouts off-main - // dispatch_once onto main to run our injectedMainThread work while the transition calculates. - __block dispatch_block_t injectedMainThreadWork = nil; - for (ASLayoutTestNode *node in @[ nodeA, nodeC, nodeE ]) { - [fixture2 withSizeRangesForNode:node block:^(ASSizeRange sizeRange) { - OCMExpect([node.mock calculateLayoutThatFits:sizeRange]) - .offMainThread() - .andDo(^(NSInvocation *inv) { - // On first calculateLayoutThatFits, schedule our injected main thread work. - static dispatch_once_t onceToken; - dispatch_once(&onceToken, ^{ - dispatch_async(dispatch_get_main_queue(), ^{ - injectedMainThreadWork(); - }); - }); - }); - }]; - } - - // The code in this section is designed to move in time order, all on the main thread: - - // With the current behavior, the transition will continue and complete. - if (!enforceCorrectBehavior) { - OCMExpect([nodeA.mock animateLayoutTransition:OCMOCK_ANY]).onMainThread(); - OCMExpect([nodeA.mock didCompleteLayoutTransition:OCMOCK_ANY]).onMainThread(); - } - - // Trigger the layout transition. - __block dispatch_block_t measurementCompletionBlock = nil; - [nodeA transitionLayoutWithAnimation:NO shouldMeasureAsync:YES measurementCompletion:^{ - measurementCompletionBlock(); - }]; - - // Injected block will get run on main after bg layout calculate starts, but before measurementCompletion - __block BOOL injectedMainThreadWorkDone = NO; - injectedMainThreadWork = ^{ - as_log_verbose(OS_LOG_DEFAULT, "Begin injectedMainThreadWork"); - injectedMainThreadWorkDone = YES; - - [fixture4 apply]; - as_log_verbose(OS_LOG_DEFAULT, "Did apply new fixture"); - - if (enforceCorrectBehavior) { - // Correct measurement behavior here is unclear, may depend on whether the layouts which - // are common to both fixture2 and fixture4 are available from the cache. - } else { - // Incorrect behavior: nodeC will get measured against its new bounds on main. - const auto cPendingSize = [fixture2 layoutForNode:nodeC].size; - OCMExpect([nodeC.mock calculateLayoutThatFits:ASSizeRangeMake(cPendingSize)]).onMainThread(); - } - [window layoutIfNeeded]; - as_log_verbose(OS_LOG_DEFAULT, "End injectedMainThreadWork"); - }; - - measurementCompletionBlock = ^{ - XCTAssert(injectedMainThreadWorkDone, @"We hoped to get onto the main thread before the measurementCompletion callback ran."); - }; - - for (ASLayoutTestNode *node in allNodes) { - OCMVerifyAllWithDelay(node.mock, verifyDelay); - } - - // Incorrect behavior: The transition will "win" even though its transitioning to stale data. - if (enforceCorrectBehavior) { - [self verifyFixture:fixture4]; - } else { - [self verifyFixture:fixture2]; - } -} - -/** - * Start on fixture 3 where nodeB is force-shrunk via multipass layout. - * Apply fixture 1, which just changes nodeB's size and calls -setNeedsLayout on it. - * - * This behavior is currently broken. See implementation for correct behavior and incorrect behavior. - */ -- (void)testCallingSetNeedsLayoutOnANodeThatWasSubjectToMultipassLayout -{ - static BOOL const enforceCorrectBehavior = NO; - [self stubCalculatedLayoutDidChange]; - [self runFirstLayoutPassWithFixture:fixture3]; - - // Switch to fixture 1, updating nodeB's desired size and calling -setNeedsLayout - // Now nodeB will fit happily into the stack. - [fixture1 apply]; - - if (enforceCorrectBehavior) { - /* - * Correct behavior: nodeB is remeasured against the first (unconstrained) size - * and when it's discovered that now nodeB fits, nodeA will re-layout and we'll - * end up correctly at fixture1. - */ - OCMExpect([nodeB.mock calculateLayoutThatFits:[fixture3 firstSizeRangeForNode:nodeB]]); - - [fixture1 withSizeRangesForNode:nodeA block:^(ASSizeRange sizeRange) { - OCMExpect([nodeA.mock calculateLayoutThatFits:sizeRange]); - }]; - - [window layoutIfNeeded]; - [self verifyFixture:fixture1]; - } else { - /* - * Incorrect behavior: nodeB is remeasured against the second (fixed-width) constraint. - * The returned value (8) is clamped to the fixed with (7), and then compared to the previous - * width (7) and we decide not to propagate up the invalidation, and we stay stuck on the old - * layout (fixture3). - */ - OCMExpect([nodeB.mock calculateLayoutThatFits:nodeB.constrainedSizeForCalculatedLayout]); - [window layoutIfNeeded]; - [self verifyFixture:fixture3]; - } -} - -#pragma mark - Helpers - -- (void)verifyFixture:(ASTLayoutFixture *)fixture -{ - const auto expected = fixture.layout; - - // Ensure expected == frames - const auto frames = [fixture.rootNode currentLayoutBasedOnFrames]; - if (![expected isEqual:frames]) { - XCTFail(@"\n*** Layout verification failed – frames don't match expected. ***\nGot:\n%@\nExpected:\n%@", [frames recursiveDescription], [expected recursiveDescription]); - } - - // Ensure expected == calculatedLayout - const auto calculated = fixture.rootNode.calculatedLayout; - if (![expected isEqual:calculated]) { - XCTFail(@"\n*** Layout verification failed – calculated layout doesn't match expected. ***\nGot:\n%@\nExpected:\n%@", [calculated recursiveDescription], [expected recursiveDescription]); - } -} - -/** - * Stubs calculatedLayoutDidChange for all nodes. - * - * It's not really a core layout engine method, and it's also - * currently bugged and gets called a lot so for most - * tests its better not to have expectations about it littered around. - * https://github.com/TextureGroup/Texture/issues/422 - */ -- (void)stubCalculatedLayoutDidChange -{ - stubbedCalculatedLayoutDidChange = YES; - for (ASLayoutTestNode *node in allNodes) { - OCMStub([node.mock calculatedLayoutDidChange]); - } -} - -/** - * Fixture 1: A basic horizontal stack, all single-pass. - * - * [A: HorizStack([B, C, D])]. A is (10x1), B is (1x1), C is (2x1), D is (1x1) - */ -- (ASTLayoutFixture *)createFixture1 -{ - const auto fixture = [[ASTLayoutFixture alloc] init]; - - // nodeB - [fixture addSizeRange:{{0, 0}, {INFINITY, 1}} forNode:nodeB]; - const auto layoutB = [ASLayout layoutWithLayoutElement:nodeB size:{1,1} position:{0,0} sublayouts:nil]; - - // nodeC - [fixture addSizeRange:{{0, 0}, {INFINITY, 1}} forNode:nodeC]; - const auto layoutC = [ASLayout layoutWithLayoutElement:nodeC size:{2,1} position:{4,0} sublayouts:nil]; - - // nodeD - [fixture addSizeRange:{{0, 0}, {INFINITY, 1}} forNode:nodeD]; - const auto layoutD = [ASLayout layoutWithLayoutElement:nodeD size:{1,1} position:{9,0} sublayouts:nil]; - - [fixture addSizeRange:{{10, 1}, {10, 1}} forNode:nodeA]; - const auto layoutA = [ASLayout layoutWithLayoutElement:nodeA size:{10,1} position:ASPointNull sublayouts:@[ layoutB, layoutC, layoutD ]]; - fixture.layout = layoutA; - - [fixture.layoutSpecBlocks setObject:fixture1and3and5NodeALayoutSpecBlock forKey:nodeA]; - return fixture; -} - -/** - * Fixture 2: A simple transition away from fixture 1. - * - * [A: HorizStack([B, C, E])]. A is (10x1), B is (1x1), C is (4x1), E is (1x1) - * - * From fixture 1: - * B survives with same layout - * C survives with new layout - * D is removed - * E joins with first layout - */ -- (ASTLayoutFixture *)createFixture2 -{ - const auto fixture = [[ASTLayoutFixture alloc] init]; - - // nodeB - [fixture addSizeRange:{{0, 0}, {INFINITY, 1}} forNode:nodeB]; - const auto layoutB = [ASLayout layoutWithLayoutElement:nodeB size:{1,1} position:{0,0} sublayouts:nil]; - - // nodeC - [fixture addSizeRange:{{0, 0}, {INFINITY, 1}} forNode:nodeC]; - const auto layoutC = [ASLayout layoutWithLayoutElement:nodeC size:{4,1} position:{3,0} sublayouts:nil]; - - // nodeE - [fixture addSizeRange:{{0, 0}, {INFINITY, 1}} forNode:nodeE]; - const auto layoutE = [ASLayout layoutWithLayoutElement:nodeE size:{1,1} position:{9,0} sublayouts:nil]; - - [fixture addSizeRange:{{10, 1}, {10, 1}} forNode:nodeA]; - const auto layoutA = [ASLayout layoutWithLayoutElement:nodeA size:{10,1} position:ASPointNull sublayouts:@[ layoutB, layoutC, layoutE ]]; - fixture.layout = layoutA; - - ASLayoutSpecBlock specBlockA = ^ASLayoutSpec * _Nonnull(__kindof ASDisplayNode * _Nonnull node, ASSizeRange constrainedSize) { - return [ASStackLayoutSpec stackLayoutSpecWithDirection:ASStackLayoutDirectionHorizontal spacing:0 justifyContent:ASStackLayoutJustifyContentSpaceBetween alignItems:ASStackLayoutAlignItemsStart children:@[ nodeB, nodeC, nodeE ]]; - }; - [fixture.layoutSpecBlocks setObject:specBlockA forKey:nodeA]; - return fixture; -} - -/** - * Fixture 3: Multipass stack layout - * - * [A: HorizStack([B, C, D])]. A is (10x1), B is (7x1), C is (2x1), D is (1x1) - * - * nodeB (which has flexShrink=1) will return 8x1 for its size during the first - * stack pass, and it'll be subject to a second pass where it returns 7x1. - * - */ -- (ASTLayoutFixture *)createFixture3 -{ - const auto fixture = [[ASTLayoutFixture alloc] init]; - - // nodeB wants 8,1 but it will settle for 7,1 - [fixture setReturnedSize:{8,1} forNode:nodeB]; - [fixture addSizeRange:{{0, 0}, {INFINITY, 1}} forNode:nodeB]; - [fixture addSizeRange:{{7, 0}, {7, 1}} forNode:nodeB]; - const auto layoutB = [ASLayout layoutWithLayoutElement:nodeB size:{7,1} position:{0,0} sublayouts:nil]; - - // nodeC - [fixture addSizeRange:{{0, 0}, {INFINITY, 1}} forNode:nodeC]; - const auto layoutC = [ASLayout layoutWithLayoutElement:nodeC size:{2,1} position:{7,0} sublayouts:nil]; - - // nodeD - [fixture addSizeRange:{{0, 0}, {INFINITY, 1}} forNode:nodeD]; - const auto layoutD = [ASLayout layoutWithLayoutElement:nodeD size:{1,1} position:{9,0} sublayouts:nil]; - - [fixture addSizeRange:{{10, 1}, {10, 1}} forNode:nodeA]; - const auto layoutA = [ASLayout layoutWithLayoutElement:nodeA size:{10,1} position:ASPointNull sublayouts:@[ layoutB, layoutC, layoutD ]]; - fixture.layout = layoutA; - - [fixture.layoutSpecBlocks setObject:fixture1and3and5NodeALayoutSpecBlock forKey:nodeA]; - return fixture; -} - -/** - * Fixture 4: A different simple transition away from fixture 1. - * - * [A: HorizStack([B, D, E])]. A is (10x1), B is (1x1), D is (2x1), E is (1x1) - * - * From fixture 1: - * B survives with same layout - * C is removed - * D survives with new layout - * E joins with first layout - * - * From fixture 2: - * B survives with same layout - * C is removed - * D joins with first layout - * E survives with same layout - */ -- (ASTLayoutFixture *)createFixture4 -{ - const auto fixture = [[ASTLayoutFixture alloc] init]; - - // nodeB - [fixture addSizeRange:{{0, 0}, {INFINITY, 1}} forNode:nodeB]; - const auto layoutB = [ASLayout layoutWithLayoutElement:nodeB size:{1,1} position:{0,0} sublayouts:nil]; - - // nodeD - [fixture addSizeRange:{{0, 0}, {INFINITY, 1}} forNode:nodeD]; - const auto layoutD = [ASLayout layoutWithLayoutElement:nodeD size:{2,1} position:{4,0} sublayouts:nil]; - - // nodeE - [fixture addSizeRange:{{0, 0}, {INFINITY, 1}} forNode:nodeE]; - const auto layoutE = [ASLayout layoutWithLayoutElement:nodeE size:{1,1} position:{9,0} sublayouts:nil]; - - [fixture addSizeRange:{{10, 1}, {10, 1}} forNode:nodeA]; - const auto layoutA = [ASLayout layoutWithLayoutElement:nodeA size:{10,1} position:ASPointNull sublayouts:@[ layoutB, layoutD, layoutE ]]; - fixture.layout = layoutA; - - ASLayoutSpecBlock specBlockA = ^ASLayoutSpec * _Nonnull(__kindof ASDisplayNode * _Nonnull node, ASSizeRange constrainedSize) { - return [ASStackLayoutSpec stackLayoutSpecWithDirection:ASStackLayoutDirectionHorizontal spacing:0 justifyContent:ASStackLayoutJustifyContentSpaceBetween alignItems:ASStackLayoutAlignItemsStart children:@[ nodeB, nodeD, nodeE ]]; - }; - [fixture.layoutSpecBlocks setObject:specBlockA forKey:nodeA]; - return fixture; -} - -/** - * Fixture 5: Same as fixture 1, but with a bigger root node (node A). - * - * [A: HorizStack([B, C, D])]. A is (15x1), B is (1x1), C is (2x1), D is (1x1) - */ -- (ASTLayoutFixture *)createFixture5 -{ - const auto fixture = [[ASTLayoutFixture alloc] init]; - - // nodeB - [fixture addSizeRange:{{0, 0}, {INFINITY, 1}} forNode:nodeB]; - const auto layoutB = [ASLayout layoutWithLayoutElement:nodeB size:{1,1} position:{0,0} sublayouts:nil]; - - // nodeC - [fixture addSizeRange:{{0, 0}, {INFINITY, 1}} forNode:nodeC]; - const auto layoutC = [ASLayout layoutWithLayoutElement:nodeC size:{2,1} position:{4,0} sublayouts:nil]; - - // nodeD - [fixture addSizeRange:{{0, 0}, {INFINITY, 1}} forNode:nodeD]; - const auto layoutD = [ASLayout layoutWithLayoutElement:nodeD size:{1,1} position:{9,0} sublayouts:nil]; - - [fixture addSizeRange:{{15, 1}, {15, 1}} forNode:nodeA]; - const auto layoutA = [ASLayout layoutWithLayoutElement:nodeA size:{15,1} position:ASPointNull sublayouts:@[ layoutB, layoutC, layoutD ]]; - fixture.layout = layoutA; - - [fixture.layoutSpecBlocks setObject:fixture1and3and5NodeALayoutSpecBlock forKey:nodeA]; - return fixture; -} - -- (void)runFirstLayoutPassWithFixture:(ASTLayoutFixture *)fixture -{ - [fixture apply]; - [fixture withSizeRangesForAllNodesUsingBlock:^(ASLayoutTestNode * _Nonnull node, ASSizeRange sizeRange) { - OCMExpect([node.mock calculateLayoutThatFits:sizeRange]).onMainThread(); - - if (!stubbedCalculatedLayoutDidChange) { - OCMExpect([node.mock calculatedLayoutDidChange]).onMainThread(); - } - }]; - - // Trigger CA layout pass. - [window layoutIfNeeded]; - - // Make sure it went through. - [self verifyFixture:fixture]; -} - -@end diff --git a/submodules/AsyncDisplayKit/Tests/ASLayoutFlatteningTests.mm b/submodules/AsyncDisplayKit/Tests/ASLayoutFlatteningTests.mm deleted file mode 100644 index 0a1fa02261..0000000000 --- a/submodules/AsyncDisplayKit/Tests/ASLayoutFlatteningTests.mm +++ /dev/null @@ -1,206 +0,0 @@ -// -// ASLayoutFlatteningTests.mm -// Texture -// -// Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import -#import -#import -#import - -@interface ASLayoutFlatteningTests : XCTestCase -@end - -@implementation ASLayoutFlatteningTests - -static ASLayout *layoutWithCustomPosition(CGPoint position, id element, NSArray *sublayouts) -{ - return [ASLayout layoutWithLayoutElement:element - size:CGSizeMake(100, 100) - position:position - sublayouts:sublayouts]; -} - -static ASLayout *layout(id element, NSArray *sublayouts) -{ - return layoutWithCustomPosition(CGPointZero, element, sublayouts); -} - -- (void)testThatFlattenedLayoutContainsOnlyDirectSubnodesInValidOrder -{ - ASLayout *flattenedLayout; - - @autoreleasepool { - NSMutableArray *subnodes = [NSMutableArray array]; - NSMutableArray *layoutSpecs = [NSMutableArray array]; - NSMutableArray *indirectSubnodes = [NSMutableArray array]; - - ASDisplayNode *(^subnode)(void) = ^ASDisplayNode *() { [subnodes addObject:[[ASDisplayNode alloc] init]]; return [subnodes lastObject]; }; - ASLayoutSpec *(^layoutSpec)(void) = ^ASLayoutSpec *() { [layoutSpecs addObject:[[ASLayoutSpec alloc] init]]; return [layoutSpecs lastObject]; }; - ASDisplayNode *(^indirectSubnode)(void) = ^ASDisplayNode *() { [indirectSubnodes addObject:[[ASDisplayNode alloc] init]]; return [indirectSubnodes lastObject]; }; - - NSArray *sublayouts = @[ - layout(subnode(), @[ - layout(indirectSubnode(), @[]), - ]), - layout(layoutSpec(), @[ - layout(subnode(), @[]), - layout(layoutSpec(), @[ - layout(layoutSpec(), @[]), - layout(subnode(), @[]), - ]), - layout(layoutSpec(), @[]), - ]), - layout(layoutSpec(), @[ - layout(subnode(), @[ - layout(indirectSubnode(), @[]), - layout(indirectSubnode(), @[ - layout(indirectSubnode(), @[]) - ]), - ]) - ]), - layout(subnode(), @[]), - ]; - - ASDisplayNode *rootNode = [[ASDisplayNode alloc] init]; - ASLayout *originalLayout = [ASLayout layoutWithLayoutElement:rootNode - size:CGSizeMake(1000, 1000) - sublayouts:sublayouts]; - flattenedLayout = [originalLayout filteredNodeLayoutTree]; - NSArray *flattenedSublayouts = flattenedLayout.sublayouts; - NSUInteger sublayoutsCount = flattenedSublayouts.count; - - XCTAssertEqualObjects(originalLayout.layoutElement, flattenedLayout.layoutElement, @"The root node should be reserved"); - XCTAssertTrue(ASPointIsNull(flattenedLayout.position), @"Position of the root layout should be null"); - XCTAssertEqual(subnodes.count, sublayoutsCount, @"Flattened layout should only contain direct subnodes"); - for (int i = 0; i < sublayoutsCount; i++) { - XCTAssertEqualObjects(subnodes[i], flattenedSublayouts[i].layoutElement, @"Sublayouts should be in correct order (flattened in DFS fashion)"); - } - } - - for (ASLayout *sublayout in flattenedLayout.sublayouts) { - XCTAssertNotNil(sublayout.layoutElement, @"Sublayout elements should be retained"); - XCTAssertEqual(0, sublayout.sublayouts.count, @"Sublayouts should not have their own sublayouts"); - } -} - -#pragma mark - Test reusing ASLayouts while flattening - -- (void)testThatLayoutWithNonNullPositionIsNotReused -{ - ASDisplayNode *rootNode = [[ASDisplayNode alloc] init]; - ASLayout *originalLayout = layoutWithCustomPosition(CGPointMake(10, 10), rootNode, @[]); - ASLayout *flattenedLayout = [originalLayout filteredNodeLayoutTree]; - XCTAssertNotEqualObjects(originalLayout, flattenedLayout, "@Layout should be reused"); - XCTAssertTrue(ASPointIsNull(flattenedLayout.position), @"Position of a root layout should be null"); -} - -- (void)testThatLayoutWithNullPositionAndNoSublayoutIsReused -{ - ASDisplayNode *rootNode = [[ASDisplayNode alloc] init]; - ASLayout *originalLayout = layoutWithCustomPosition(ASPointNull, rootNode, @[]); - ASLayout *flattenedLayout = [originalLayout filteredNodeLayoutTree]; - XCTAssertEqualObjects(originalLayout, flattenedLayout, "@Layout should be reused"); - XCTAssertTrue(ASPointIsNull(flattenedLayout.position), @"Position of a root layout should be null"); -} - -- (void)testThatLayoutWithNullPositionAndFlattenedNodeSublayoutsIsReused -{ - ASLayout *flattenedLayout; - - @autoreleasepool { - ASDisplayNode *rootNode = [[ASDisplayNode alloc] init]; - NSMutableArray *subnodes = [NSMutableArray array]; - ASDisplayNode *(^subnode)(void) = ^ASDisplayNode *() { [subnodes addObject:[[ASDisplayNode alloc] init]]; return [subnodes lastObject]; }; - ASLayout *originalLayout = layoutWithCustomPosition(ASPointNull, - rootNode, - @[ - layoutWithCustomPosition(CGPointMake(10, 10), subnode(), @[]), - layoutWithCustomPosition(CGPointMake(20, 20), subnode(), @[]), - layoutWithCustomPosition(CGPointMake(30, 30), subnode(), @[]), - ]); - flattenedLayout = [originalLayout filteredNodeLayoutTree]; - XCTAssertEqualObjects(originalLayout, flattenedLayout, "@Layout should be reused"); - XCTAssertTrue(ASPointIsNull(flattenedLayout.position), @"Position of the root layout should be null"); - } - - for (ASLayout *sublayout in flattenedLayout.sublayouts) { - XCTAssertNotNil(sublayout.layoutElement, @"Sublayout elements should be retained"); - XCTAssertEqual(0, sublayout.sublayouts.count, @"Sublayouts should not have their own sublayouts"); - } -} - -- (void)testThatLayoutWithNullPositionAndUnflattenedSublayoutsIsNotReused -{ - ASLayout *flattenedLayout; - - @autoreleasepool { - ASDisplayNode *rootNode = [[ASDisplayNode alloc] init]; - NSMutableArray *subnodes = [NSMutableArray array]; - NSMutableArray *layoutSpecs = [NSMutableArray array]; - NSMutableArray *indirectSubnodes = [NSMutableArray array]; - NSMutableArray *reusedLayouts = [NSMutableArray array]; - - ASDisplayNode *(^subnode)(void) = ^ASDisplayNode *() { [subnodes addObject:[[ASDisplayNode alloc] init]]; return [subnodes lastObject]; }; - ASLayoutSpec *(^layoutSpec)(void) = ^ASLayoutSpec *() { [layoutSpecs addObject:[[ASLayoutSpec alloc] init]]; return [layoutSpecs lastObject]; }; - ASDisplayNode *(^indirectSubnode)(void) = ^ASDisplayNode *() { [indirectSubnodes addObject:[[ASDisplayNode alloc] init]]; return [indirectSubnodes lastObject]; }; - ASLayout *(^reusedLayout)(ASDisplayNode *) = ^ASLayout *(ASDisplayNode *subnode) { [reusedLayouts addObject:layout(subnode, @[])]; return [reusedLayouts lastObject]; }; - - /* - * Layouts with sublayouts of both nodes and layout specs should not be reused. - * However, all flattened node sublayouts with valid position should be reused. - */ - ASLayout *originalLayout = layoutWithCustomPosition(ASPointNull, - rootNode, - @[ - reusedLayout(subnode()), - // The 2 node sublayouts below should be reused although they are in a layout spec sublayout. - // That is because each of them have an absolute position of zero. - // This case can happen, for example, as the result of a background/overlay layout spec. - layout(layoutSpec(), @[ - reusedLayout(subnode()), - reusedLayout(subnode()) - ]), - layout(subnode(), @[ - layout(layoutSpec(), @[]) - ]), - layout(subnode(), @[ - layout(indirectSubnode(), @[]) - ]), - layoutWithCustomPosition(CGPointMake(10, 10), subnode(), @[]), - // The 2 node sublayouts below shouldn't be reused because they have non-zero absolute positions. - layoutWithCustomPosition(CGPointMake(20, 20), layoutSpec(), @[ - layout(subnode(), @[]), - layout(subnode(), @[]) - ]), - ]); - flattenedLayout = [originalLayout filteredNodeLayoutTree]; - NSArray *flattenedSublayouts = flattenedLayout.sublayouts; - NSUInteger sublayoutsCount = flattenedSublayouts.count; - - XCTAssertNotEqualObjects(originalLayout, flattenedLayout, @"Original layout should not be reused"); - XCTAssertEqualObjects(originalLayout.layoutElement, flattenedLayout.layoutElement, @"The root node should be reserved"); - XCTAssertTrue(ASPointIsNull(flattenedLayout.position), @"Position of the root layout should be null"); - XCTAssertTrue(reusedLayouts.count <= sublayoutsCount, @"Some sublayouts can't be reused"); - XCTAssertEqual(subnodes.count, sublayoutsCount, @"Flattened layout should only contain direct subnodes"); - int numOfActualReusedLayouts = 0; - for (int i = 0; i < sublayoutsCount; i++) { - ASLayout *sublayout = flattenedSublayouts[i]; - XCTAssertEqualObjects(subnodes[i], sublayout.layoutElement, @"Sublayouts should be in correct order (flattened in DFS fashion)"); - if ([reusedLayouts containsObject:sublayout]) { - numOfActualReusedLayouts++; - } - } - XCTAssertEqual(numOfActualReusedLayouts, reusedLayouts.count, @"Should reuse all layouts that can be reused"); - } - - for (ASLayout *sublayout in flattenedLayout.sublayouts) { - XCTAssertNotNil(sublayout.layoutElement, @"Sublayout elements should be retained"); - XCTAssertEqual(0, sublayout.sublayouts.count, @"Sublayouts should not have their own sublayouts"); - } -} - -@end diff --git a/submodules/AsyncDisplayKit/Tests/ASLayoutSpecSnapshotTestsHelper.h b/submodules/AsyncDisplayKit/Tests/ASLayoutSpecSnapshotTestsHelper.h deleted file mode 100644 index 740017ee9e..0000000000 --- a/submodules/AsyncDisplayKit/Tests/ASLayoutSpecSnapshotTestsHelper.h +++ /dev/null @@ -1,45 +0,0 @@ -// -// ASLayoutSpecSnapshotTestsHelper.h -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import "ASSnapshotTestCase.h" -#import - -@class ASLayoutSpec; - -@interface ASLayoutSpecSnapshotTestCase: ASSnapshotTestCase -/** - Test the layout spec or records a snapshot if recordMode is YES. - @param layoutSpec The layout spec under test or to snapshot - @param sizeRange The size range used to calculate layout of the given layout spec. - @param subnodes An array of ASDisplayNodes used within the layout spec. - @param identifier An optional identifier, used to identify this snapshot test. - - @discussion In order to make the layout spec visible, it is embeded to a ASDisplayNode host. - Any subnodes used within the layout spec must be provided. - They will be added to the host in the same order as the array. - */ -- (void)testLayoutSpec:(ASLayoutSpec *)layoutSpec - sizeRange:(ASSizeRange)sizeRange - subnodes:(NSArray *)subnodes - identifier:(NSString *)identifier; -@end - -__attribute__((overloadable)) static inline ASDisplayNode *ASDisplayNodeWithBackgroundColor(UIColor *backgroundColor, CGSize size) { - ASDisplayNode *node = [[ASDisplayNode alloc] init]; - node.layerBacked = YES; - node.backgroundColor = backgroundColor; - node.style.width = ASDimensionMakeWithPoints(size.width); - node.style.height = ASDimensionMakeWithPoints(size.height); - return node; -} - -__attribute__((overloadable)) static inline ASDisplayNode *ASDisplayNodeWithBackgroundColor(UIColor *backgroundColor) -{ - return ASDisplayNodeWithBackgroundColor(backgroundColor, CGSizeZero); -} diff --git a/submodules/AsyncDisplayKit/Tests/ASLayoutSpecSnapshotTestsHelper.mm b/submodules/AsyncDisplayKit/Tests/ASLayoutSpecSnapshotTestsHelper.mm deleted file mode 100644 index dec82d4c39..0000000000 --- a/submodules/AsyncDisplayKit/Tests/ASLayoutSpecSnapshotTestsHelper.mm +++ /dev/null @@ -1,62 +0,0 @@ -// -// ASLayoutSpecSnapshotTestsHelper.mm -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import "ASLayoutSpecSnapshotTestsHelper.h" - -#import -#import -#import -#import - -@interface ASTestNode : ASDisplayNode -@property (nonatomic, nullable) ASLayoutSpec *layoutSpecUnderTest; -@end - -@implementation ASLayoutSpecSnapshotTestCase - -- (void)setUp -{ - [super setUp]; - self.recordMode = NO; -} - -- (void)testLayoutSpec:(ASLayoutSpec *)layoutSpec - sizeRange:(ASSizeRange)sizeRange - subnodes:(NSArray *)subnodes - identifier:(NSString *)identifier -{ - ASTestNode *node = [[ASTestNode alloc] init]; - - for (ASDisplayNode *subnode in subnodes) { - [node addSubnode:subnode]; - } - - node.layoutSpecUnderTest = layoutSpec; - - ASDisplayNodeSizeToFitSizeRange(node, sizeRange); - ASSnapshotVerifyNode(node, identifier); -} - -@end - -@implementation ASTestNode -- (instancetype)init -{ - if (self = [super init]) { - self.layerBacked = YES; - } - return self; -} - -- (ASLayoutSpec *)layoutSpecThatFits:(ASSizeRange)constrainedSize -{ - return _layoutSpecUnderTest; -} - -@end diff --git a/submodules/AsyncDisplayKit/Tests/ASLayoutSpecTests.mm b/submodules/AsyncDisplayKit/Tests/ASLayoutSpecTests.mm deleted file mode 100644 index ff13b66553..0000000000 --- a/submodules/AsyncDisplayKit/Tests/ASLayoutSpecTests.mm +++ /dev/null @@ -1,112 +0,0 @@ -// -// ASLayoutSpecTests.mm -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -#import -#import - -#pragma mark - ASDKExtendedLayoutSpec - -/* - * Extend the ASDKExtendedLayoutElement - * It adds a - * - primitive / CGFloat (extendedWidth) - * - struct / ASDimension (extendedDimension) - * - primitive / ASStackLayoutDirection (extendedDirection) - */ -@protocol ASDKExtendedLayoutElement -@property (nonatomic) CGFloat extendedWidth; -@property (nonatomic) ASDimension extendedDimension; -@property (copy, nonatomic) NSString *extendedName; -@end - -/* - * Let the ASLayoutElementStyle conform to the ASDKExtendedLayoutElement protocol and add properties implementation - */ -@interface ASLayoutElementStyle (ASDKExtendedLayoutElement) -@end - -@implementation ASLayoutElementStyle (ASDKExtendedLayoutElement) -ASDK_STYLE_PROP_PRIM(CGFloat, extendedWidth, setExtendedWidth, 0); -ASDK_STYLE_PROP_STR(ASDimension, extendedDimension, setExtendedDimension, ASDimensionMake(ASDimensionUnitAuto, 0)); -ASDK_STYLE_PROP_OBJ(NSString *, extendedName, setExtendedName); -@end - -/* - * As the ASLayoutElementStyle conforms to the ASDKExtendedLayoutElement protocol now, ASDKExtendedLayoutElement properties - * can be accessed in ASDKExtendedLayoutSpec - */ -@interface ASDKExtendedLayoutSpec : ASLayoutSpec -@end - -@implementation ASDKExtendedLayoutSpec - -- (void)doSetSomeStyleValuesToChildren -{ - for (id child in self.children) { - child.style.extendedWidth = 100; - child.style.extendedDimension = ASDimensionMake(100); - child.style.extendedName = @"ASDK"; - } -} - -- (void)doUseSomeStyleValuesFromChildren -{ - for (id child in self.children) { - __unused CGFloat extendedWidth = child.style.extendedWidth; - __unused ASDimension extendedDimension = child.style.extendedDimension; - __unused NSString *extendedName = child.style.extendedName; - } -} - -@end - - -#pragma mark - ASLayoutSpecTests - -@interface ASLayoutSpecTests : XCTestCase - -@end - -@implementation ASLayoutSpecTests - -- (void)testSetPrimitiveToExtendedStyle -{ - ASDisplayNode *node = [[ASDisplayNode alloc] init]; - node.style.extendedWidth = 100; - XCTAssert(node.style.extendedWidth == 100, @"Primitive value should be set on extended style"); -} - -- (void)testSetStructToExtendedStyle -{ - ASDisplayNode *node = [[ASDisplayNode alloc] init]; - node.style.extendedDimension = ASDimensionMake(100); - XCTAssertTrue(ASDimensionEqualToDimension(node.style.extendedDimension, ASDimensionMake(100)), @"Struct should be set on extended style"); -} - -- (void)testSetObjectToExtendedStyle -{ - NSString *extendedName = @"ASDK"; - - ASDisplayNode *node = [[ASDisplayNode alloc] init]; - node.style.extendedName = extendedName; - XCTAssertEqualObjects(node.style.extendedName, extendedName, @"Object should be set on extended style"); -} - - -- (void)testUseOfExtendedStyleProperties -{ - ASDKExtendedLayoutSpec *extendedLayoutSpec = [ASDKExtendedLayoutSpec new]; - extendedLayoutSpec.children = @[[[ASDisplayNode alloc] init], [[ASDisplayNode alloc] init]]; - XCTAssertNoThrow([extendedLayoutSpec doSetSomeStyleValuesToChildren]); - XCTAssertNoThrow([extendedLayoutSpec doUseSomeStyleValuesFromChildren]); -} - -@end diff --git a/submodules/AsyncDisplayKit/Tests/ASLayoutTestNode.h b/submodules/AsyncDisplayKit/Tests/ASLayoutTestNode.h deleted file mode 100644 index 231447abe1..0000000000 --- a/submodules/AsyncDisplayKit/Tests/ASLayoutTestNode.h +++ /dev/null @@ -1,38 +0,0 @@ -// -// ASLayoutTestNode.h -// Texture -// -// Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import -#import - -@interface ASLayoutTestNode : ASDisplayNode - -/** - * Mocking ASDisplayNodes directly isn't very safe because when you pump mock objects - * into the guts of the framework, bad things happen e.g. direct-ivar-access on mock - * objects will return garbage data. - * - * Instead we create a strict mock for each node, and forward a selected set of calls to it. - */ -@property (nonatomic, readonly) id mock; - -/** - * The size that this node will return in calculateLayoutThatFits (if it doesn't have a layoutSpecBlock). - * - * Changing this value will call -setNeedsLayout on the node. - */ -@property (nonatomic) CGSize testSize; - -/** - * Generate a layout based on the frame of this node and its subtree. - * - * The root layout will be unpositioned. This is so that the returned layout can be directly - * compared to `calculatedLayout` - */ -- (ASLayout *)currentLayoutBasedOnFrames; - -@end diff --git a/submodules/AsyncDisplayKit/Tests/ASLayoutTestNode.mm b/submodules/AsyncDisplayKit/Tests/ASLayoutTestNode.mm deleted file mode 100644 index 2805aa36c9..0000000000 --- a/submodules/AsyncDisplayKit/Tests/ASLayoutTestNode.mm +++ /dev/null @@ -1,88 +0,0 @@ -// -// ASLayoutTestNode.mm -// Texture -// -// Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import "ASLayoutTestNode.h" -#import -#import "OCMockObject+ASAdditions.h" - -@implementation ASLayoutTestNode - -- (instancetype)init -{ - if (self = [super init]) { - _mock = OCMStrictClassMock([ASDisplayNode class]); - - // If errors occur (e.g. unexpected method) we need to quickly figure out - // which node is at fault, so we inject the node name into the mock instance - // description. - __weak __typeof(self) weakSelf = self; - [_mock setModifyDescriptionBlock:^(id mock, NSString *baseDescription){ - return [NSString stringWithFormat:@"Mock(%@)", weakSelf.description]; - }]; - } - return self; -} - -- (ASLayout *)currentLayoutBasedOnFrames -{ - return [self _currentLayoutBasedOnFramesForRootNode:YES]; -} - -- (ASLayout *)_currentLayoutBasedOnFramesForRootNode:(BOOL)isRootNode -{ - const auto sublayouts = [[NSMutableArray alloc] init]; - for (ASLayoutTestNode *subnode in self.subnodes) { - [sublayouts addObject:[subnode _currentLayoutBasedOnFramesForRootNode:NO]]; - } - CGPoint rootPosition = isRootNode ? ASPointNull : self.frame.origin; - return [ASLayout layoutWithLayoutElement:self size:self.frame.size position:rootPosition sublayouts:sublayouts]; -} - -- (void)setTestSize:(CGSize)testSize -{ - if (!CGSizeEqualToSize(testSize, _testSize)) { - _testSize = testSize; - [self setNeedsLayout]; - } -} - -- (ASLayout *)calculateLayoutThatFits:(ASSizeRange)constrainedSize -{ - [_mock calculateLayoutThatFits:constrainedSize]; - - // If we have a layout spec block, or no test size, return super. - if (self.layoutSpecBlock || CGSizeEqualToSize(self.testSize, CGSizeZero)) { - return [super calculateLayoutThatFits:constrainedSize]; - } else { - // Interestingly, the infra will auto-clamp sizes from calculateSizeThatFits, but not from calculateLayoutThatFits. - const auto size = ASSizeRangeClamp(constrainedSize, self.testSize); - return [ASLayout layoutWithLayoutElement:self size:size]; - } -} - -#pragma mark - Forwarding to mock - -- (void)calculatedLayoutDidChange -{ - [_mock calculatedLayoutDidChange]; - [super calculatedLayoutDidChange]; -} - -- (void)didCompleteLayoutTransition:(id)context -{ - [_mock didCompleteLayoutTransition:context]; - [super didCompleteLayoutTransition:context]; -} - -- (void)animateLayoutTransition:(id)context -{ - [_mock animateLayoutTransition:context]; - [super animateLayoutTransition:context]; -} - -@end diff --git a/submodules/AsyncDisplayKit/Tests/ASMultiplexImageNodeTests.mm b/submodules/AsyncDisplayKit/Tests/ASMultiplexImageNodeTests.mm deleted file mode 100644 index caf86bb48e..0000000000 --- a/submodules/AsyncDisplayKit/Tests/ASMultiplexImageNodeTests.mm +++ /dev/null @@ -1,265 +0,0 @@ -// -// ASMultiplexImageNodeTests.mm -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import -#import "NSInvocation+ASTestHelpers.h" - -#import -#import -#import - -#import - -@interface ASMultiplexImageNodeTests : XCTestCase -{ -@private - id mockCache; - id mockDownloader; - id mockDataSource; - id mockDelegate; - ASMultiplexImageNode *imageNode; -} - -@end - -@implementation ASMultiplexImageNodeTests - -#pragma mark - Helpers. - -- (NSURL *)_testImageURL -{ - return [[NSBundle bundleForClass:[self class]] URLForResource:@"logo-square" - withExtension:@"png" - subdirectory:@"TestResources"]; -} - -- (UIImage *)_testImage -{ - return [UIImage imageWithContentsOfFile:[self _testImageURL].path]; -} - -#pragma mark - Unit tests. - -// TODO: add tests for delegate display notifications - -- (void)setUp -{ - [super setUp]; - - mockCache = OCMStrictProtocolMock(@protocol(ASImageCacheProtocol)); - [mockCache setExpectationOrderMatters:YES]; - mockDownloader = OCMStrictProtocolMock(@protocol(ASImageDownloaderProtocol)); - [mockDownloader setExpectationOrderMatters:YES]; - imageNode = [[ASMultiplexImageNode alloc] initWithCache:mockCache downloader:mockDownloader]; - - mockDataSource = OCMStrictProtocolMock(@protocol(ASMultiplexImageNodeDataSource)); - [mockDataSource setExpectationOrderMatters:YES]; - imageNode.dataSource = mockDataSource; - - mockDelegate = OCMProtocolMock(@protocol(ASMultiplexImageNodeDelegate)); - [mockDelegate setExpectationOrderMatters:YES]; - imageNode.delegate = mockDelegate; -} - -- (void)tearDown -{ - OCMVerifyAll(mockDelegate); - OCMVerifyAll(mockDataSource); - OCMVerifyAll(mockDownloader); - OCMVerifyAll(mockCache); - [super tearDown]; -} - -- (void)testDataSourceImageMethod -{ - NSNumber *imageIdentifier = @1; - - OCMExpect([mockDataSource multiplexImageNode:imageNode imageForImageIdentifier:imageIdentifier]) - .andReturn([self _testImage]); - - imageNode.imageIdentifiers = @[imageIdentifier]; - [imageNode reloadImageIdentifierSources]; - - // Also expect it to be loaded immediately. - XCTAssertEqualObjects(imageNode.loadedImageIdentifier, imageIdentifier, @"imageIdentifier was not loaded"); - // And for the image to be equivalent to the image we provided. - XCTAssertEqualObjects(UIImagePNGRepresentation(imageNode.image), - UIImagePNGRepresentation([self _testImage]), - @"Loaded image isn't the one we provided"); -} - -- (void)testDataSourceURLMethod -{ - NSNumber *imageIdentifier = @1; - - // First expect to be hit for the image directly, and fail to return it. - OCMExpect([mockDataSource multiplexImageNode:imageNode imageForImageIdentifier:imageIdentifier]) - .andReturn((id)nil); - // BUG: -imageForImageIdentifier is called twice in this case (where we return nil). - OCMExpect([mockDataSource multiplexImageNode:imageNode imageForImageIdentifier:imageIdentifier]) - .andReturn((id)nil); - // Then expect to be hit for the URL, which we'll return. - OCMExpect([mockDataSource multiplexImageNode:imageNode URLForImageIdentifier:imageIdentifier]) - .andReturn([self _testImageURL]); - - // Mock the cache to do a cache-hit for the test image URL. - OCMExpect([mockCache cachedImageWithURL:[self _testImageURL] callbackQueue:OCMOCK_ANY completion:[OCMArg isNotNil]]) - .andDo(^(NSInvocation *inv) { - ASImageCacherCompletion completionBlock = [inv as_argumentAtIndexAsObject:4]; - completionBlock([self _testImage]); - }); - - imageNode.imageIdentifiers = @[imageIdentifier]; - // Kick off loading. - [imageNode reloadImageIdentifierSources]; - - // Also expect it to be loaded immediately. - XCTAssertEqualObjects(imageNode.loadedImageIdentifier, imageIdentifier, @"imageIdentifier was not loaded"); - // And for the image to be equivalent to the image we provided. - XCTAssertEqualObjects(UIImagePNGRepresentation(imageNode.image), - UIImagePNGRepresentation([self _testImage]), - @"Loaded image isn't the one we provided"); -} - -- (void)testAddLowerQualityImageIdentifier -{ - // Adding a lower quality image identifier should not cause any loading. - NSNumber *highResIdentifier = @2, *lowResIdentifier = @1; - - OCMExpect([mockDataSource multiplexImageNode:imageNode imageForImageIdentifier:highResIdentifier]) - .andReturn([self _testImage]); - imageNode.imageIdentifiers = @[highResIdentifier]; - [imageNode reloadImageIdentifierSources]; - - // At this point, we should have the high-res identifier loaded and the DS should have been hit once. - XCTAssertEqualObjects(imageNode.loadedImageIdentifier, highResIdentifier, @"High res identifier should be loaded."); - - // BUG: We should not get another -imageForImageIdentifier:highResIdentifier. - OCMExpect([mockDataSource multiplexImageNode:imageNode imageForImageIdentifier:highResIdentifier]) - .andReturn([self _testImage]); - - imageNode.imageIdentifiers = @[highResIdentifier, lowResIdentifier]; - [imageNode reloadImageIdentifierSources]; - - // At this point the high-res should still be loaded, and the data source should not have been hit again (see BUG above). - XCTAssertEqualObjects(imageNode.loadedImageIdentifier, highResIdentifier, @"High res identifier should be loaded."); -} - -- (void)testAddHigherQualityImageIdentifier -{ - NSNumber *lowResIdentifier = @1, *highResIdentifier = @2; - - OCMExpect([mockDataSource multiplexImageNode:imageNode imageForImageIdentifier:lowResIdentifier]) - .andReturn([self _testImage]); - - imageNode.imageIdentifiers = @[lowResIdentifier]; - [imageNode reloadImageIdentifierSources]; - - // At this point, we should have the low-res identifier loaded and the DS should have been hit once. - XCTAssertEqualObjects(imageNode.loadedImageIdentifier, lowResIdentifier, @"Low res identifier should be loaded."); - - OCMExpect([mockDataSource multiplexImageNode:imageNode imageForImageIdentifier:highResIdentifier]) - .andReturn([self _testImage]); - - imageNode.imageIdentifiers = @[highResIdentifier, lowResIdentifier]; - [imageNode reloadImageIdentifierSources]; - - // At this point the high-res should be loaded, and the data source should been hit twice. - XCTAssertEqualObjects(imageNode.loadedImageIdentifier, highResIdentifier, @"High res identifier should be loaded."); -} - -- (void)testIntermediateImageDownloading -{ - imageNode.downloadsIntermediateImages = YES; - - // Let them call URLForImageIdentifier all they want. - OCMStub([mockDataSource multiplexImageNode:imageNode URLForImageIdentifier:[OCMArg isNotNil]]); - - // Set up a few identifiers to load. - NSInteger identifierCount = 5; - NSMutableArray *imageIdentifiers = [NSMutableArray array]; - for (NSInteger identifier = identifierCount; identifier > 0; identifier--) { - [imageIdentifiers addObject:@(identifier)]; - } - - // Create the array of IDs in the order we expect them to get -imageForImageIdentifier: - // BUG: The second to last ID (the last one that returns nil) will get -imageForImageIdentifier: called - // again after the last ID (the one that returns non-nil). - id secondToLastID = imageIdentifiers[identifierCount - 2]; - NSArray *imageIdentifiersThatWillBeCalled = [imageIdentifiers arrayByAddingObject:secondToLastID]; - - for (id imageID in imageIdentifiersThatWillBeCalled) { - // Return nil for everything except the worst ID. - OCMExpect([mockDataSource multiplexImageNode:imageNode imageForImageIdentifier:imageID]) - .andDo(^(NSInvocation *inv){ - id imageID = [inv as_argumentAtIndexAsObject:3]; - if ([imageID isEqual:imageIdentifiers.lastObject]) { - [inv as_setReturnValueWithObject:[self _testImage]]; - } else { - [inv as_setReturnValueWithObject:nil]; - } - }); - } - - imageNode.imageIdentifiers = imageIdentifiers; - [imageNode reloadImageIdentifierSources]; -} - -- (void)testUncachedDownload -{ - // Mock a cache miss. - OCMExpect([mockCache cachedImageWithURL:[self _testImageURL] callbackQueue:OCMOCK_ANY completion:[OCMArg isNotNil]]) - .andDo(^(NSInvocation *inv){ - ASImageCacherCompletion completion = [inv as_argumentAtIndexAsObject:4]; - completion(nil); - }); - - // Mock a 50%-progress URL download. - const CGFloat mockedProgress = 0.5; - OCMExpect([mockDownloader downloadImageWithURL:[self _testImageURL] callbackQueue:OCMOCK_ANY downloadProgress:[OCMArg isNotNil] completion:[OCMArg isNotNil]]) - .andDo(^(NSInvocation *inv){ - // Simulate progress. - ASImageDownloaderProgress progressBlock = [inv as_argumentAtIndexAsObject:4]; - progressBlock(mockedProgress); - - // Simulate completion. - ASImageDownloaderCompletion completionBlock = [inv as_argumentAtIndexAsObject:5]; - completionBlock([self _testImage], nil, nil, nil); - }); - - NSNumber *imageIdentifier = @1; - - // Mock the data source to return nil image, and our test URL. - OCMExpect([mockDataSource multiplexImageNode:imageNode imageForImageIdentifier:imageIdentifier]); - // BUG: Multiplex image node will call imageForImageIdentifier twice if we return nil. - OCMExpect([mockDataSource multiplexImageNode:imageNode imageForImageIdentifier:imageIdentifier]); - OCMExpect([mockDataSource multiplexImageNode:imageNode URLForImageIdentifier:imageIdentifier]) - .andReturn([self _testImageURL]); - - // Mock the delegate to expect start, 50% progress, and completion invocations. - OCMExpect([mockDelegate multiplexImageNode:imageNode didStartDownloadOfImageWithIdentifier:imageIdentifier]); - OCMExpect([mockDelegate multiplexImageNode:imageNode didUpdateDownloadProgress:mockedProgress forImageWithIdentifier:imageIdentifier]); - OCMExpect([mockDelegate multiplexImageNode:imageNode didUpdateImage:[OCMArg isNotNil] withIdentifier:imageIdentifier fromImage:[OCMArg isNil] withIdentifier:[OCMArg isNil]]); - OCMExpect([mockDelegate multiplexImageNode:imageNode didFinishDownloadingImageWithIdentifier:imageIdentifier error:[OCMArg isNil]]); - - imageNode.imageIdentifiers = @[imageIdentifier]; - // Kick off loading. - [imageNode reloadImageIdentifierSources]; - - // Wait until the image is loaded. - [self expectationForPredicate:[NSPredicate predicateWithFormat:@"loadedImageIdentifier = %@", imageIdentifier] evaluatedWithObject:imageNode handler:nil]; - [self waitForExpectationsWithTimeout:30 handler:nil]; -} - -- (void)testThatSettingAnImageExternallyWillThrow -{ - XCTAssertThrows(imageNode.image = [UIImage imageNamed:@""]); -} - -@end diff --git a/submodules/AsyncDisplayKit/Tests/ASMutableAttributedStringBuilderTests.mm b/submodules/AsyncDisplayKit/Tests/ASMutableAttributedStringBuilderTests.mm deleted file mode 100644 index 2415dfc626..0000000000 --- a/submodules/AsyncDisplayKit/Tests/ASMutableAttributedStringBuilderTests.mm +++ /dev/null @@ -1,78 +0,0 @@ -// -// ASMutableAttributedStringBuilderTests.mm -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -#import - -@interface ASMutableAttributedStringBuilderTests : XCTestCase - -@end - -@implementation ASMutableAttributedStringBuilderTests - -- (NSString *)_string -{ - return @"Normcore PBR hella, viral slow-carb mustache chillwave church-key cornhole messenger bag swag vinyl biodiesel ethnic. Fashion axe messenger bag raw denim street art. Flannel Wes Anderson normcore church-key 8-bit. Master cleanse four loko try-hard Carles stumptown ennui, twee literally wayfarers kitsch tofu PBR. Cliche organic post-ironic Wes Anderson kale chips fashion axe. Narwhal Blue Bottle sustainable, Odd Future Godard sriracha banjo disrupt Marfa irony pug Wes Anderson YOLO yr church-key. Mlkshk Intelligentsia semiotics quinoa, butcher meggings wolf Bushwick keffiyeh ethnic pour-over Pinterest letterpress."; -} - -- (ASMutableAttributedStringBuilder *)_builder -{ - return [[ASMutableAttributedStringBuilder alloc] initWithString:[self _string]]; -} - -- (NSRange)_randomizedRangeForStringBuilder:(ASMutableAttributedStringBuilder *)builder -{ - NSUInteger loc = arc4random() % (builder.length - 1); - NSUInteger len = arc4random() % (builder.length - loc); - len = ((len > 0) ? len : 1); - return NSMakeRange(loc, len); -} - -- (void)testSimpleAttributions -{ - // Add a attributes, and verify that they get set on the correct locations. - for (int i = 0; i < 100; i++) { - ASMutableAttributedStringBuilder *builder = [self _builder]; - NSRange range = [self _randomizedRangeForStringBuilder:builder]; - NSString *keyValue = [NSString stringWithFormat:@"%d", i]; - [builder addAttribute:keyValue value:keyValue range:range]; - NSAttributedString *attrStr = [builder composedAttributedString]; - XCTAssertEqual(builder.length, attrStr.length, @"out string should have same length as builder"); - __block BOOL found = NO; - [attrStr enumerateAttributesInRange:NSMakeRange(0, attrStr.length) options:0 usingBlock:^(NSDictionary *attrs, NSRange r, BOOL *stop) { - if ([attrs[keyValue] isEqualToString:keyValue]) { - XCTAssertTrue(NSEqualRanges(range, r), @"enumerated range %@ should be equal to the set range %@", NSStringFromRange(r), NSStringFromRange(range)); - found = YES; - } - }]; - XCTAssertTrue(found, @"enumeration should have found the attribute we set"); - } -} - -- (void)testSetOverAdd -{ - ASMutableAttributedStringBuilder *builder = [self _builder]; - NSRange addRange = NSMakeRange(0, builder.length); - NSRange setRange = NSMakeRange(0, 1); - [builder addAttribute:@"attr" value:@"val1" range:addRange]; - [builder setAttributes:@{@"attr" : @"val2"} range:setRange]; - NSAttributedString *attrStr = [builder composedAttributedString]; - NSRange setRangeOut; - NSString *setAttr = [attrStr attribute:@"attr" atIndex:0 effectiveRange:&setRangeOut]; - XCTAssertTrue(NSEqualRanges(setRange, setRangeOut), @"The out set range should equal the range we used originally"); - XCTAssertEqualObjects(setAttr, @"val2", @"the set value should be val2"); - - NSRange addRangeOut; - NSString *addAttr = [attrStr attribute:@"attr" atIndex:2 effectiveRange:&addRangeOut]; - XCTAssertTrue(NSEqualRanges(NSMakeRange(1, builder.length - 1), addRangeOut), @"the add range should only cover beyond the set range"); - XCTAssertEqualObjects(addAttr, @"val1", @"the added attribute should be present at index 2"); -} - -@end diff --git a/submodules/AsyncDisplayKit/Tests/ASNavigationControllerTests.mm b/submodules/AsyncDisplayKit/Tests/ASNavigationControllerTests.mm deleted file mode 100644 index d9ed2464c0..0000000000 --- a/submodules/AsyncDisplayKit/Tests/ASNavigationControllerTests.mm +++ /dev/null @@ -1,52 +0,0 @@ -// -// ASNavigationControllerTests.mm -// Texture -// -// Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -#import - -@interface ASNavigationControllerTests : XCTestCase -@end - -@implementation ASNavigationControllerTests - -- (void)testSetViewControllers { - ASViewController *firstController = [ASViewController new]; - ASViewController *secondController = [ASViewController new]; - NSArray *expectedViewControllerStack = @[firstController, secondController]; - ASNavigationController *navigationController = [ASNavigationController new]; - [navigationController setViewControllers:@[firstController, secondController]]; - XCTAssertEqual(navigationController.topViewController, secondController); - XCTAssertEqual(navigationController.visibleViewController, secondController); - XCTAssertTrue([navigationController.viewControllers isEqualToArray:expectedViewControllerStack]); -} - -- (void)testPopViewController { - ASViewController *firstController = [ASViewController new]; - ASViewController *secondController = [ASViewController new]; - NSArray *expectedViewControllerStack = @[firstController]; - ASNavigationController *navigationController = [ASNavigationController new]; - [navigationController setViewControllers:@[firstController, secondController]]; - [navigationController popViewControllerAnimated:false]; - XCTAssertEqual(navigationController.topViewController, firstController); - XCTAssertEqual(navigationController.visibleViewController, firstController); - XCTAssertTrue([navigationController.viewControllers isEqualToArray:expectedViewControllerStack]); -} - -- (void)testPushViewController { - ASViewController *firstController = [ASViewController new]; - ASViewController *secondController = [ASViewController new]; - NSArray *expectedViewControllerStack = @[firstController, secondController]; - ASNavigationController *navigationController = [[ASNavigationController new] initWithRootViewController:firstController]; - [navigationController pushViewController:secondController animated:false]; - XCTAssertEqual(navigationController.topViewController, secondController); - XCTAssertEqual(navigationController.visibleViewController, secondController); - XCTAssertTrue([navigationController.viewControllers isEqualToArray:expectedViewControllerStack]); -} - -@end diff --git a/submodules/AsyncDisplayKit/Tests/ASNetworkImageNodeTests.mm b/submodules/AsyncDisplayKit/Tests/ASNetworkImageNodeTests.mm deleted file mode 100644 index f794ba9e7f..0000000000 --- a/submodules/AsyncDisplayKit/Tests/ASNetworkImageNodeTests.mm +++ /dev/null @@ -1,135 +0,0 @@ -// -// ASNetworkImageNodeTests.mm -// Texture -// -// Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import -#import -#import -#import - -@interface ASNetworkImageNodeTests : XCTestCase - -@end - -@interface ASTestImageDownloader : NSObject -@end -@interface ASTestImageCache : NSObject -@end - -@implementation ASNetworkImageNodeTests { - ASNetworkImageNode *node; - id downloader; - id cache; -} - -- (void)setUp -{ - [super setUp]; - cache = [OCMockObject partialMockForObject:[[ASTestImageCache alloc] init]]; - downloader = [OCMockObject partialMockForObject:[[ASTestImageDownloader alloc] init]]; - node = [[ASNetworkImageNode alloc] initWithCache:cache downloader:downloader]; -} - -/// Test is flaky: https://github.com/facebook/AsyncDisplayKit/issues/2898 -- (void)DISABLED_testThatProgressBlockIsSetAndClearedCorrectlyOnVisibility -{ - node.URL = [NSURL URLWithString:@"http://imageA"]; - - // Enter preload range, wait for download start. - [[[downloader expect] andForwardToRealObject] downloadImageWithURL:[OCMArg isNotNil] callbackQueue:OCMOCK_ANY downloadProgress:OCMOCK_ANY completion:OCMOCK_ANY]; - [node enterInterfaceState:ASInterfaceStatePreload]; - [downloader verifyWithDelay:5]; - - // Make the node visible. - [[downloader expect] setProgressImageBlock:[OCMArg isNotNil] callbackQueue:OCMOCK_ANY withDownloadIdentifier:@0]; - [node enterInterfaceState:ASInterfaceStateInHierarchy]; - [downloader verify]; - - // Make the node invisible. - [[downloader expect] setProgressImageBlock:[OCMArg isNil] callbackQueue:OCMOCK_ANY withDownloadIdentifier:@0]; - [node exitInterfaceState:ASInterfaceStateInHierarchy]; - [downloader verify]; -} - -- (void)testThatProgressBlockIsSetAndClearedCorrectlyOnChangeURL -{ - [node layer]; - [node enterInterfaceState:ASInterfaceStateInHierarchy]; - - // Set URL while visible, should set progress block - [[downloader expect] setProgressImageBlock:[OCMArg isNotNil] callbackQueue:OCMOCK_ANY withDownloadIdentifier:@0]; - node.URL = [NSURL URLWithString:@"http://imageA"]; - [downloader verifyWithDelay:5]; - - // Change URL while visible, should clear prior block and set new one - [[downloader expect] setProgressImageBlock:[OCMArg isNil] callbackQueue:OCMOCK_ANY withDownloadIdentifier:@0]; - [[downloader expect] cancelImageDownloadForIdentifier:@0]; - [[downloader expect] setProgressImageBlock:[OCMArg isNotNil] callbackQueue:OCMOCK_ANY withDownloadIdentifier:@1]; - node.URL = [NSURL URLWithString:@"http://imageB"]; - [downloader verifyWithDelay:5]; -} - -- (void)testThatSettingAnImageWillStayForEnteringAndExitingPreloadState -{ - UIImage *image = [[UIImage alloc] init]; - ASNetworkImageNode *networkImageNode = [[ASNetworkImageNode alloc] init]; - networkImageNode.image = image; - [networkImageNode enterHierarchyState:ASHierarchyStateRangeManaged]; // Ensures didExitPreloadState is called - XCTAssertEqualObjects(image, networkImageNode.image); - [networkImageNode enterInterfaceState:ASInterfaceStatePreload]; - XCTAssertEqualObjects(image, networkImageNode.image); - [networkImageNode exitInterfaceState:ASInterfaceStatePreload]; - XCTAssertEqualObjects(image, networkImageNode.image); - [networkImageNode exitHierarchyState:ASHierarchyStateRangeManaged]; - XCTAssertEqualObjects(image, networkImageNode.image); -} - -- (void)testThatSettingADefaultImageWillStayForEnteringAndExitingPreloadState -{ - UIImage *image = [[UIImage alloc] init]; - ASNetworkImageNode *networkImageNode = [[ASNetworkImageNode alloc] init]; - networkImageNode.defaultImage = image; - [networkImageNode enterHierarchyState:ASHierarchyStateRangeManaged]; // Ensures didExitPreloadState is called - XCTAssertEqualObjects(image, networkImageNode.defaultImage); - [networkImageNode enterInterfaceState:ASInterfaceStatePreload]; - XCTAssertEqualObjects(image, networkImageNode.defaultImage); - [networkImageNode exitInterfaceState:ASInterfaceStatePreload]; - XCTAssertEqualObjects(image, networkImageNode.defaultImage); - [networkImageNode exitHierarchyState:ASHierarchyStateRangeManaged]; - XCTAssertEqualObjects(image, networkImageNode.defaultImage); -} - -@end - -@implementation ASTestImageCache - -- (void)cachedImageWithURL:(NSURL *)URL callbackQueue:(dispatch_queue_t)callbackQueue completion:(ASImageCacherCompletion)completion -{ - completion(nil); -} - -@end - -@implementation ASTestImageDownloader { - NSInteger _currentDownloadID; -} - -- (void)cancelImageDownloadForIdentifier:(id)downloadIdentifier -{ - // nop -} - -- (id)downloadImageWithURL:(NSURL *)URL callbackQueue:(dispatch_queue_t)callbackQueue downloadProgress:(ASImageDownloaderProgress)downloadProgress completion:(ASImageDownloaderCompletion)completion -{ - return @(_currentDownloadID++); -} - -- (void)setProgressImageBlock:(ASImageDownloaderProgressImage)progressBlock callbackQueue:(dispatch_queue_t)callbackQueue withDownloadIdentifier:(id)downloadIdentifier -{ - // nop -} -@end diff --git a/submodules/AsyncDisplayKit/Tests/ASOverlayLayoutSpecSnapshotTests.mm b/submodules/AsyncDisplayKit/Tests/ASOverlayLayoutSpecSnapshotTests.mm deleted file mode 100644 index a50baa9ef4..0000000000 --- a/submodules/AsyncDisplayKit/Tests/ASOverlayLayoutSpecSnapshotTests.mm +++ /dev/null @@ -1,39 +0,0 @@ -// -// ASOverlayLayoutSpecSnapshotTests.mm -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import "ASLayoutSpecSnapshotTestsHelper.h" - -#import -#import - -static const ASSizeRange kSize = {{320, 320}, {320, 320}}; - -@interface ASOverlayLayoutSpecSnapshotTests : ASLayoutSpecSnapshotTestCase -@end - -@implementation ASOverlayLayoutSpecSnapshotTests - -- (void)testOverlay -{ - ASDisplayNode *backgroundNode = ASDisplayNodeWithBackgroundColor([UIColor blueColor]); - ASDisplayNode *foregroundNode = ASDisplayNodeWithBackgroundColor([UIColor blackColor], {20, 20}); - - ASLayoutSpec *layoutSpec = - [ASOverlayLayoutSpec - overlayLayoutSpecWithChild:backgroundNode - overlay: - [ASCenterLayoutSpec - centerLayoutSpecWithCenteringOptions:ASCenterLayoutSpecCenteringXY - sizingOptions:{} - child:foregroundNode]]; - - [self testLayoutSpec:layoutSpec sizeRange:kSize subnodes:@[backgroundNode, foregroundNode] identifier: nil]; -} - -@end diff --git a/submodules/AsyncDisplayKit/Tests/ASPagerNodeTests.mm b/submodules/AsyncDisplayKit/Tests/ASPagerNodeTests.mm deleted file mode 100644 index 416efaae3d..0000000000 --- a/submodules/AsyncDisplayKit/Tests/ASPagerNodeTests.mm +++ /dev/null @@ -1,179 +0,0 @@ -// -// ASPagerNodeTests.mm -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import -#import - -@interface ASPagerNodeTestDataSource : NSObject -@end - -@implementation ASPagerNodeTestDataSource - -- (instancetype)init -{ - if (!(self = [super init])) { - return nil; - } - return self; -} - -- (NSInteger)numberOfPagesInPagerNode:(ASPagerNode *)pagerNode -{ - return 2; -} - -- (ASCellNode *)pagerNode:(ASPagerNode *)pagerNode nodeAtIndex:(NSInteger)index -{ - return [[ASCellNode alloc] init]; -} - -@end - -@interface ASPagerNodeTestController: UIViewController -@property (nonatomic) ASPagerNodeTestDataSource *testDataSource; -@property (nonatomic) ASPagerNode *pagerNode; -@end - -@implementation ASPagerNodeTestController - -- (instancetype)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil -{ - self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]; - if (self) { - // Populate these immediately so that they're not unexpectedly nil during tests. - self.testDataSource = [[ASPagerNodeTestDataSource alloc] init]; - - self.pagerNode = [[ASPagerNode alloc] init]; - self.pagerNode.dataSource = self.testDataSource; - - [self.view addSubnode:self.pagerNode]; - } - return self; -} - -@end - -@interface ASPagerNodeTests : XCTestCase -@property (nonatomic) ASPagerNode *pagerNode; - -@property (nonatomic) ASPagerNodeTestDataSource *testDataSource; -@end - -@implementation ASPagerNodeTests - -- (void)testPagerReturnsIndexOfPages -{ - ASPagerNodeTestController *testController = [self testController]; - - ASCellNode *cellNode = [testController.pagerNode nodeForPageAtIndex:0]; - - XCTAssertEqual([testController.pagerNode indexOfPageWithNode:cellNode], 0); -} - -- (void)testPagerReturnsNotFoundForCellThatDontExistInPager -{ - ASPagerNodeTestController *testController = [self testController]; - - ASCellNode *badNode = [[ASCellNode alloc] init]; - - XCTAssertEqual([testController.pagerNode indexOfPageWithNode:badNode], NSNotFound); -} - -- (void)testScrollPageToIndex -{ - ASPagerNodeTestController *testController = [self testController]; - testController.pagerNode.frame = CGRectMake(0, 0, 500, 500); - [testController.pagerNode scrollToPageAtIndex:1 animated:false]; - - XCTAssertEqual(testController.pagerNode.currentPageIndex, 1); -} - -- (ASPagerNodeTestController *)testController -{ - ASPagerNodeTestController *testController = [[ASPagerNodeTestController alloc] initWithNibName:nil bundle:nil]; - UIWindow *window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; - [window makeKeyAndVisible]; - window.rootViewController = testController; - - [testController.pagerNode reloadData]; - [testController.pagerNode setNeedsLayout]; - - return testController; -} - -// Disabled due to flakiness https://github.com/facebook/AsyncDisplayKit/issues/2818 -- (void)DISABLED_testThatRootPagerNodeDoesGetTheRightInsetWhilePoppingBack -{ - UICollectionViewCell *cell = nil; - - UIWindow *window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds]; - ASDisplayNode *node = [[ASDisplayNode alloc] init]; - node.automaticallyManagesSubnodes = YES; - - ASPagerNodeTestDataSource *dataSource = [[ASPagerNodeTestDataSource alloc] init]; - ASPagerNode *pagerNode = [[ASPagerNode alloc] init]; - pagerNode.dataSource = dataSource; - node.layoutSpecBlock = ^(ASDisplayNode *node, ASSizeRange constrainedSize){ - return [ASInsetLayoutSpec insetLayoutSpecWithInsets:UIEdgeInsetsZero child:pagerNode]; - }; - ASViewController *vc = [[ASViewController alloc] initWithNode:node]; - UINavigationController *nav = [[UINavigationController alloc] initWithRootViewController:vc]; - window.rootViewController = nav; - [window makeKeyAndVisible]; - [window layoutIfNeeded]; - - // Wait until view controller is visible - XCTestExpectation *e = [self expectationWithDescription:@"Transition completed"]; - dispatch_after(dispatch_time(DISPATCH_TIME_NOW, 0 * NSEC_PER_SEC), dispatch_get_main_queue(), ^{ - [e fulfill]; - }); - [self waitForExpectationsWithTimeout:2 handler:nil]; - - // Test initial values -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wdeprecated-declarations" - cell = [pagerNode.view cellForItemAtIndexPath:[NSIndexPath indexPathForItem:0 inSection:0]]; -#pragma clang diagnostic pop - XCTAssertEqualObjects(NSStringFromCGRect(window.bounds), NSStringFromCGRect(node.frame)); - XCTAssertEqualObjects(NSStringFromCGRect(window.bounds), NSStringFromCGRect(cell.frame)); - XCTAssertEqual(pagerNode.contentOffset.y, 0); - XCTAssertEqual(pagerNode.contentInset.top, 0); - - e = [self expectationWithDescription:@"Transition completed"]; - // Push another view controller - UIViewController *vc2 = [[UIViewController alloc] init]; - vc2.view.frame = nav.view.bounds; - vc2.view.backgroundColor = [UIColor blueColor]; - [nav pushViewController:vc2 animated:YES]; - - dispatch_after(dispatch_time(DISPATCH_TIME_NOW, 0.505 * NSEC_PER_SEC), dispatch_get_main_queue(), ^{ - [e fulfill]; - }); - [self waitForExpectationsWithTimeout:2 handler:nil]; - - // Pop view controller - e = [self expectationWithDescription:@"Transition completed"]; - [vc2.navigationController popViewControllerAnimated:YES]; - dispatch_after(dispatch_time(DISPATCH_TIME_NOW, 0.505 * NSEC_PER_SEC), dispatch_get_main_queue(), ^{ - [e fulfill]; - }); - [self waitForExpectationsWithTimeout:2 handler:nil]; - - // Test values again after popping the view controller -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wdeprecated-declarations" - cell = [pagerNode.view cellForItemAtIndexPath:[NSIndexPath indexPathForItem:0 inSection:0]]; -#pragma clang diagnostic pop - XCTAssertEqualObjects(NSStringFromCGRect(window.bounds), NSStringFromCGRect(node.frame)); - XCTAssertEqualObjects(NSStringFromCGRect(window.bounds), NSStringFromCGRect(cell.frame)); - XCTAssertEqual(pagerNode.contentOffset.y, 0); - XCTAssertEqual(pagerNode.contentInset.top, 0); -} - -@end diff --git a/submodules/AsyncDisplayKit/Tests/ASPerformanceTestContext.h b/submodules/AsyncDisplayKit/Tests/ASPerformanceTestContext.h deleted file mode 100644 index 49196d451c..0000000000 --- a/submodules/AsyncDisplayKit/Tests/ASPerformanceTestContext.h +++ /dev/null @@ -1,44 +0,0 @@ -// -// ASPerformanceTestContext.h -// Texture -// -// Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import -#import -#import - -#define ASXCTAssertRelativePerformanceInRange(test, caseName, min, max) \ - _XCTPrimitiveAssertLessThanOrEqual(self, test.results[caseName].relativePerformance, @#caseName, max, @#max);\ - _XCTPrimitiveAssertGreaterThanOrEqual(self, test.results[caseName].relativePerformance, @#caseName, min, @#min) - -NS_ASSUME_NONNULL_BEGIN - -typedef void (^ASTestPerformanceCaseBlock)(NSUInteger i, dispatch_block_t startMeasuring, dispatch_block_t stopMeasuring); - -@interface ASPerformanceTestResult : NSObject -@property (nonatomic, readonly) NSTimeInterval timePer1000; -@property (nonatomic, readonly) NSString *caseName; - -@property (nonatomic, readonly, getter=isReferenceCase) BOOL referenceCase; -@property (nonatomic, readonly) float relativePerformance; - -@property (nonatomic, readonly) NSMutableDictionary *userInfo; -@end - -@interface ASPerformanceTestContext : NSObject - -/** - * The first case you add here will be considered the reference case. - */ -- (void)addCaseWithName:(NSString *)caseName block:(AS_NOESCAPE ASTestPerformanceCaseBlock)block; - -@property (nonatomic, copy, readonly) NSDictionary *results; - -- (BOOL)areAllUserInfosEqual; - -@end - -NS_ASSUME_NONNULL_END diff --git a/submodules/AsyncDisplayKit/Tests/ASPerformanceTestContext.mm b/submodules/AsyncDisplayKit/Tests/ASPerformanceTestContext.mm deleted file mode 100644 index 15c6787596..0000000000 --- a/submodules/AsyncDisplayKit/Tests/ASPerformanceTestContext.mm +++ /dev/null @@ -1,135 +0,0 @@ -// -// ASPerformanceTestContext.mm -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import "ASPerformanceTestContext.h" - -#import - -#import -#import - -@interface ASPerformanceTestResult () -@property (nonatomic) NSTimeInterval timePer1000; -@property (nonatomic) NSString *caseName; - -@property (nonatomic, getter=isReferenceCase) BOOL referenceCase; -@property (nonatomic) float relativePerformance; -@end - -@implementation ASPerformanceTestResult - -- (instancetype)init -{ - self = [super init]; - if (self != nil) { - _userInfo = [[NSMutableDictionary alloc] init]; - } - return self; -} - -- (NSString *)description -{ - NSString *userInfoStr = [_userInfo.description stringByReplacingOccurrencesOfString:@"\n" withString:@" "]; - return [NSString stringWithFormat:@"<%-20s: time-per-1000=%04.2f rel-perf=%04.2f user-info=%@>", _caseName.UTF8String, _timePer1000, _relativePerformance, userInfoStr]; -} - -@end - -@implementation ASPerformanceTestContext { - NSMutableDictionary *_results; - NSInteger _iterationCount; - ASPerformanceTestResult * _Nullable _referenceResult; -} - -- (instancetype)init -{ - self = [super init]; - if (self != nil) { - _iterationCount = 1E4; - _results = [[NSMutableDictionary alloc] init]; - } - return self; -} - -- (NSDictionary *)results -{ - return _results; -} - -- (void)dealloc -{ - /** - * I know this seems wacky but it's a pain to have to put this in every single test method. - */ - NSLog(@"%@", self.description); -} - -- (BOOL)areAllUserInfosEqual -{ - ASDisplayNodeAssert(_results.count >= 2, nil); - NSEnumerator *resultsEnumerator = [_results objectEnumerator]; - NSDictionary *userInfo = [[resultsEnumerator nextObject] userInfo]; - for (ASPerformanceTestResult *otherResult in resultsEnumerator) { - if ([userInfo isEqualToDictionary:otherResult.userInfo] == NO) { - return NO; - } - } - return YES; -} - -- (void)addCaseWithName:(NSString *)caseName block:(AS_NOESCAPE ASTestPerformanceCaseBlock)block -{ - ASDisplayNodeAssert(_results[caseName] == nil, @"Already have a case named %@", caseName); - ASPerformanceTestResult *result = [[ASPerformanceTestResult alloc] init]; - result.caseName = caseName; - result.timePer1000 = [self _testPerformanceForCaseWithBlock:block] / (_iterationCount / 1000); - if (_referenceResult == nil) { - result.referenceCase = YES; - result.relativePerformance = 1.0f; - _referenceResult = result; - } else { - result.relativePerformance = _referenceResult.timePer1000 / result.timePer1000; - } - _results[caseName] = result; -} - -/// Returns total work time -- (CFTimeInterval)_testPerformanceForCaseWithBlock:(AS_NOESCAPE ASTestPerformanceCaseBlock)block -{ - __block CFTimeInterval time = 0; - for (NSInteger i = 0; i < _iterationCount; i++) { - __block CFTimeInterval start = 0; - __block BOOL calledStop = NO; - @autoreleasepool { - block(i, ^{ - ASDisplayNodeAssert(start == 0, @"Called startMeasuring block twice."); - start = CACurrentMediaTime(); - }, ^{ - time += (CACurrentMediaTime() - start); - ASDisplayNodeAssert(calledStop == NO, @"Called stopMeasuring block twice."); - ASDisplayNodeAssert(start != 0, @"Failed to call startMeasuring block"); - calledStop = YES; - }); - } - - ASDisplayNodeAssert(calledStop, @"Failed to call stopMeasuring block."); - } - return time; -} - -- (NSString *)description -{ - NSMutableString *str = [NSMutableString stringWithString:@"Results:\n"]; - for (ASPerformanceTestResult *result in [_results objectEnumerator]) { - [str appendFormat:@"\t%@\n", result]; - } - return str; -} - -@end diff --git a/submodules/AsyncDisplayKit/Tests/ASPhotosFrameworkImageRequestTests.mm b/submodules/AsyncDisplayKit/Tests/ASPhotosFrameworkImageRequestTests.mm deleted file mode 100644 index fe1cb408b4..0000000000 --- a/submodules/AsyncDisplayKit/Tests/ASPhotosFrameworkImageRequestTests.mm +++ /dev/null @@ -1,65 +0,0 @@ -// -// ASPhotosFrameworkImageRequestTests.mm -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#if AS_USE_PHOTOS - -#import -#import - -static NSString *const kTestAssetID = @"testAssetID"; - -@interface ASPhotosFrameworkImageRequestTests : XCTestCase - -@end - -@implementation ASPhotosFrameworkImageRequestTests - -#pragma mark Example Data - -+ (ASPhotosFrameworkImageRequest *)exampleImageRequest -{ - ASPhotosFrameworkImageRequest *req = [[ASPhotosFrameworkImageRequest alloc] initWithAssetIdentifier:kTestAssetID]; - req.options.networkAccessAllowed = YES; - req.options.normalizedCropRect = CGRectMake(0.2, 0.1, 0.6, 0.8); - req.targetSize = CGSizeMake(1024, 1536); - req.contentMode = PHImageContentModeAspectFill; - req.options.version = PHImageRequestOptionsVersionOriginal; - req.options.resizeMode = PHImageRequestOptionsResizeModeFast; - return req; -} - -+ (NSURL *)urlForExampleImageRequest -{ - NSString *str = [NSString stringWithFormat:@"ph://%@?width=1024&height=1536&version=2&contentmode=1&network=1&resizemode=1&deliverymode=0&crop_x=0.2&crop_y=0.1&crop_w=0.6&crop_h=0.8", kTestAssetID]; - return [NSURL URLWithString:str]; -} - -#pragma mark Test cases - -- (void)testThatConvertingToURLWorks -{ - XCTAssertEqualObjects([self.class exampleImageRequest].url, [self.class urlForExampleImageRequest]); -} - -- (void)testThatParsingFromURLWorks -{ - NSURL *url = [self.class urlForExampleImageRequest]; - XCTAssertEqualObjects([ASPhotosFrameworkImageRequest requestWithURL:url], [self.class exampleImageRequest]); -} - -- (void)testThatCopyingWorks -{ - ASPhotosFrameworkImageRequest *example = [self.class exampleImageRequest]; - ASPhotosFrameworkImageRequest *copy = [[self.class exampleImageRequest] copy]; - XCTAssertEqualObjects(example, copy); -} - -@end - -#endif diff --git a/submodules/AsyncDisplayKit/Tests/ASRatioLayoutSpecSnapshotTests.mm b/submodules/AsyncDisplayKit/Tests/ASRatioLayoutSpecSnapshotTests.mm deleted file mode 100644 index f5bad2723f..0000000000 --- a/submodules/AsyncDisplayKit/Tests/ASRatioLayoutSpecSnapshotTests.mm +++ /dev/null @@ -1,38 +0,0 @@ -// -// ASRatioLayoutSpecSnapshotTests.mm -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import "ASLayoutSpecSnapshotTestsHelper.h" - -#import - -static const ASSizeRange kFixedSize = {{0, 0}, {100, 100}}; - -@interface ASRatioLayoutSpecSnapshotTests : ASLayoutSpecSnapshotTestCase -@end - -@implementation ASRatioLayoutSpecSnapshotTests - -- (void)testRatioLayoutSpecWithRatio:(CGFloat)ratio childSize:(CGSize)childSize identifier:(NSString *)identifier -{ - ASDisplayNode *subnode = ASDisplayNodeWithBackgroundColor([UIColor greenColor], childSize); - - ASLayoutSpec *layoutSpec = [ASRatioLayoutSpec ratioLayoutSpecWithRatio:ratio child:subnode]; - - [self testLayoutSpec:layoutSpec sizeRange:kFixedSize subnodes:@[subnode] identifier:identifier]; -} - -- (void)testRatioLayout -{ - [self testRatioLayoutSpecWithRatio:0.5 childSize:CGSizeMake(100, 100) identifier:@"HalfRatio"]; - [self testRatioLayoutSpecWithRatio:2.0 childSize:CGSizeMake(100, 100) identifier:@"DoubleRatio"]; - [self testRatioLayoutSpecWithRatio:7.0 childSize:CGSizeMake(100, 100) identifier:@"SevenTimesRatio"]; - [self testRatioLayoutSpecWithRatio:10.0 childSize:CGSizeMake(20, 200) identifier:@"TenTimesRatioWithItemTooBig"]; -} - -@end diff --git a/submodules/AsyncDisplayKit/Tests/ASRecursiveUnfairLockTests.mm b/submodules/AsyncDisplayKit/Tests/ASRecursiveUnfairLockTests.mm deleted file mode 100644 index 3916b319e3..0000000000 --- a/submodules/AsyncDisplayKit/Tests/ASRecursiveUnfairLockTests.mm +++ /dev/null @@ -1,184 +0,0 @@ -// -// ASRecursiveUnfairLockTests.mm -// Texture -// -// Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import "ASTestCase.h" -#import -#import -#import - -@interface ASRecursiveUnfairLockTests : ASTestCase - -@end - -@implementation ASRecursiveUnfairLockTests { - ASRecursiveUnfairLock lock; -} - -- (void)setUp -{ - [super setUp]; - lock = AS_RECURSIVE_UNFAIR_LOCK_INIT; -} - -- (void)testTheAtomicIsLockFree -{ - XCTAssertTrue(atomic_is_lock_free(&lock._thread)); -} - -- (void)testRelockingFromSameThread -{ - ASRecursiveUnfairLockLock(&lock); - ASRecursiveUnfairLockLock(&lock); - ASRecursiveUnfairLockUnlock(&lock); - // Now try locking from another thread. - XCTestExpectation *e1 = [self expectationWithDescription:@"Other thread tried lock."]; - [NSThread detachNewThreadWithBlock:^{ - XCTAssertFalse(ASRecursiveUnfairLockTryLock(&self->lock)); - [e1 fulfill]; - }]; - [self waitForExpectationsWithTimeout:1 handler:nil]; - ASRecursiveUnfairLockUnlock(&lock); - - XCTestExpectation *e2 = [self expectationWithDescription:@"Other thread tried lock again"]; - [NSThread detachNewThreadWithBlock:^{ - XCTAssertTrue(ASRecursiveUnfairLockTryLock(&self->lock)); - ASRecursiveUnfairLockUnlock(&self->lock); - [e2 fulfill]; - }]; - [self waitForExpectationsWithTimeout:1 handler:nil]; -} - -- (void)testThatUnlockingWithoutHoldingMakesAssertion -{ -#ifdef NS_BLOCK_ASSERTIONS -#warning Assertions should be on for `testThatUnlockingWithoutHoldingMakesAssertion` - NSLog(@"Passing because assertions are off."); -#else - ASRecursiveUnfairLockLock(&lock); - XCTestExpectation *e1 = [self expectationWithDescription:@"Other thread tried lock."]; - [NSThread detachNewThreadWithBlock:^{ - XCTAssertThrows(ASRecursiveUnfairLockUnlock(&lock)); - [e1 fulfill]; - }]; - [self waitForExpectationsWithTimeout:10 handler:nil]; - ASRecursiveUnfairLockUnlock(&lock); -#endif -} - -#define CHAOS_TEST_BODY(contested, prefix, infix, postfix) \ -dispatch_group_t g = dispatch_group_create(); \ -for (int i = 0; i < (contested ? 16 : 2); i++) {\ -dispatch_group_enter(g);\ -[NSThread detachNewThreadWithBlock:^{\ - for (int i = 0; i < 20000; i++) {\ - prefix;\ - value += 150;\ - infix;\ - value -= 150;\ - postfix;\ - }\ - dispatch_group_leave(g);\ -}];\ -}\ -dispatch_group_wait(g, DISPATCH_TIME_FOREVER); - -#pragma mark - Correctness Tests - -- (void)testRecursiveUnfairLockContested -{ - __block int value = 0; - [self measureBlock:^{ - CHAOS_TEST_BODY(YES, ASRecursiveUnfairLockLock(&lock), {}, ASRecursiveUnfairLockUnlock(&lock)); - }]; - XCTAssertEqual(value, 0); -} - -- (void)testRecursiveUnfairLockUncontested -{ - __block int value = 0; - [self measureBlock:^{ - CHAOS_TEST_BODY(NO, ASRecursiveUnfairLockLock(&lock), {}, ASRecursiveUnfairLockUnlock(&lock)); - }]; - XCTAssertEqual(value, 0); -} - -#pragma mark - Lock performance tests - -#if RUN_LOCK_PERF_TESTS -- (void)testNoLockContested -{ - __block int value = 0; - [self measureBlock:^{ - CHAOS_TEST_BODY(YES, {}, {}, {}); - }]; - XCTAssertNotEqual(value, 0); -} - -- (void)testPlainUnfairLockContested -{ - __block int value = 0; - __block os_unfair_lock unfairLock = OS_UNFAIR_LOCK_INIT; - [self measureBlock:^{ - CHAOS_TEST_BODY(YES, os_unfair_lock_lock(&unfairLock), {}, os_unfair_lock_unlock(&unfairLock)); - }]; - XCTAssertEqual(value, 0); -} - -- (void)testRecursiveMutexContested -{ - __block int value = 0; - pthread_mutexattr_t attr; - pthread_mutexattr_init (&attr); - pthread_mutexattr_settype (&attr, PTHREAD_MUTEX_RECURSIVE); - __block pthread_mutex_t m; - pthread_mutex_init (&m, &attr); - pthread_mutexattr_destroy (&attr); - - [self measureBlock:^{ - CHAOS_TEST_BODY(YES, pthread_mutex_lock(&m), {}, pthread_mutex_unlock(&m)); - }]; - pthread_mutex_destroy(&m); -} - -- (void)testNoLockUncontested -{ - __block int value = 0; - [self measureBlock:^{ - CHAOS_TEST_BODY(NO, {}, {}, {}); - }]; - XCTAssertNotEqual(value, 0); -} - -- (void)testPlainUnfairLockUncontested -{ - __block int value = 0; - __block os_unfair_lock unfairLock = OS_UNFAIR_LOCK_INIT; - [self measureBlock:^{ - CHAOS_TEST_BODY(NO, os_unfair_lock_lock(&unfairLock), {}, os_unfair_lock_unlock(&unfairLock)); - }]; - XCTAssertEqual(value, 0); -} - -- (void)testRecursiveMutexUncontested -{ - __block int value = 0; - pthread_mutexattr_t attr; - pthread_mutexattr_init (&attr); - pthread_mutexattr_settype (&attr, PTHREAD_MUTEX_RECURSIVE); - __block pthread_mutex_t m; - pthread_mutex_init (&m, &attr); - pthread_mutexattr_destroy (&attr); - - [self measureBlock:^{ - CHAOS_TEST_BODY(NO, pthread_mutex_lock(&m), {}, pthread_mutex_unlock(&m)); - }]; - pthread_mutex_destroy(&m); -} - -#endif // RUN_LOCK_PERF_TESTS -@end diff --git a/submodules/AsyncDisplayKit/Tests/ASRelativeLayoutSpecSnapshotTests.mm b/submodules/AsyncDisplayKit/Tests/ASRelativeLayoutSpecSnapshotTests.mm deleted file mode 100644 index 93887a9ce8..0000000000 --- a/submodules/AsyncDisplayKit/Tests/ASRelativeLayoutSpecSnapshotTests.mm +++ /dev/null @@ -1,135 +0,0 @@ -// -// ASRelativeLayoutSpecSnapshotTests.mm -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import "ASLayoutSpecSnapshotTestsHelper.h" - -#import -#import -#import - -static const ASSizeRange kSize = {{100, 120}, {320, 160}}; - -@interface ASRelativeLayoutSpecSnapshotTests : ASLayoutSpecSnapshotTestCase -@end - -@implementation ASRelativeLayoutSpecSnapshotTests - -#pragma mark - XCTestCase - -- (void)testWithOptions -{ - [self testAllVerticalPositionsForHorizontalPosition:ASRelativeLayoutSpecPositionStart]; - [self testAllVerticalPositionsForHorizontalPosition:ASRelativeLayoutSpecPositionCenter]; - [self testAllVerticalPositionsForHorizontalPosition:ASRelativeLayoutSpecPositionEnd]; - -} - -- (void)testAllVerticalPositionsForHorizontalPosition:(ASRelativeLayoutSpecPosition)horizontalPosition -{ - [self testWithHorizontalPosition:horizontalPosition verticalPosition:ASRelativeLayoutSpecPositionStart sizingOptions:{}]; - [self testWithHorizontalPosition:horizontalPosition verticalPosition:ASRelativeLayoutSpecPositionCenter sizingOptions:{}]; - [self testWithHorizontalPosition:horizontalPosition verticalPosition:ASRelativeLayoutSpecPositionEnd sizingOptions:{}]; -} - -- (void)testWithSizingOptions -{ - [self testWithHorizontalPosition:ASRelativeLayoutSpecPositionStart - verticalPosition:ASRelativeLayoutSpecPositionStart - sizingOptions:ASRelativeLayoutSpecSizingOptionDefault]; - [self testWithHorizontalPosition:ASRelativeLayoutSpecPositionStart - verticalPosition:ASRelativeLayoutSpecPositionStart - sizingOptions:ASRelativeLayoutSpecSizingOptionMinimumWidth]; - [self testWithHorizontalPosition:ASRelativeLayoutSpecPositionStart - verticalPosition:ASRelativeLayoutSpecPositionStart - sizingOptions:ASRelativeLayoutSpecSizingOptionMinimumHeight]; - [self testWithHorizontalPosition:ASRelativeLayoutSpecPositionStart - verticalPosition:ASRelativeLayoutSpecPositionStart - sizingOptions:ASRelativeLayoutSpecSizingOptionMinimumSize]; -} - -- (void)testWithHorizontalPosition:(ASRelativeLayoutSpecPosition)horizontalPosition - verticalPosition:(ASRelativeLayoutSpecPosition)verticalPosition - sizingOptions:(ASRelativeLayoutSpecSizingOption)sizingOptions -{ - ASDisplayNode *backgroundNode = ASDisplayNodeWithBackgroundColor([UIColor redColor]); - ASDisplayNode *foregroundNode = ASDisplayNodeWithBackgroundColor([UIColor greenColor], CGSizeMake(70, 100)); - - ASLayoutSpec *layoutSpec = - [ASBackgroundLayoutSpec - backgroundLayoutSpecWithChild: - [ASRelativeLayoutSpec - relativePositionLayoutSpecWithHorizontalPosition:horizontalPosition - verticalPosition:verticalPosition - sizingOption:sizingOptions - child:foregroundNode] - background:backgroundNode]; - - [self testLayoutSpec:layoutSpec - sizeRange:kSize - subnodes:@[backgroundNode, foregroundNode] - identifier:suffixForPositionOptions(horizontalPosition, verticalPosition, sizingOptions)]; -} - -static NSString *suffixForPositionOptions(ASRelativeLayoutSpecPosition horizontalPosition, - ASRelativeLayoutSpecPosition verticalPosition, - ASRelativeLayoutSpecSizingOption sizingOptions) -{ - NSMutableString *suffix = [NSMutableString string]; - - if (horizontalPosition == ASRelativeLayoutSpecPositionCenter) { - [suffix appendString:@"CenterX"]; - } else if (horizontalPosition == ASRelativeLayoutSpecPositionEnd) { - [suffix appendString:@"EndX"]; - } - - if (verticalPosition == ASRelativeLayoutSpecPositionCenter) { - [suffix appendString:@"CenterY"]; - } else if (verticalPosition == ASRelativeLayoutSpecPositionEnd) { - [suffix appendString:@"EndY"]; - } - - if ((sizingOptions & ASRelativeLayoutSpecSizingOptionMinimumWidth) != 0) { - [suffix appendString:@"SizingMinimumWidth"]; - } - - if ((sizingOptions & ASRelativeLayoutSpecSizingOptionMinimumHeight) != 0) { - [suffix appendString:@"SizingMinimumHeight"]; - } - - return suffix; -} - -- (void)testMinimumSizeRangeIsGivenToChildWhenNotPositioning -{ - ASDisplayNode *backgroundNode = ASDisplayNodeWithBackgroundColor([UIColor redColor]); - ASDisplayNode *foregroundNode = ASDisplayNodeWithBackgroundColor([UIColor redColor], CGSizeMake(10, 10)); - foregroundNode.style.flexGrow = 1; - - ASLayoutSpec *childSpec = - [ASBackgroundLayoutSpec - backgroundLayoutSpecWithChild: - [ASStackLayoutSpec - stackLayoutSpecWithDirection:ASStackLayoutDirectionVertical - spacing:0 - justifyContent:ASStackLayoutJustifyContentStart - alignItems:ASStackLayoutAlignItemsStart - children:@[foregroundNode]] - background:backgroundNode]; - - ASRelativeLayoutSpec *layoutSpec = - [ASRelativeLayoutSpec - relativePositionLayoutSpecWithHorizontalPosition:ASRelativeLayoutSpecPositionNone - verticalPosition:ASRelativeLayoutSpecPositionNone - sizingOption:{} - child:childSpec]; - - [self testLayoutSpec:layoutSpec sizeRange:kSize subnodes:@[backgroundNode, foregroundNode] identifier:nil]; -} - -@end diff --git a/submodules/AsyncDisplayKit/Tests/ASRunLoopQueueTests.mm b/submodules/AsyncDisplayKit/Tests/ASRunLoopQueueTests.mm deleted file mode 100644 index 2881e30187..0000000000 --- a/submodules/AsyncDisplayKit/Tests/ASRunLoopQueueTests.mm +++ /dev/null @@ -1,201 +0,0 @@ -// -// ASRunLoopQueueTests.mm -// Texture -// -// Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import "ASTestCase.h" - -#import - -#import "ASDisplayNodeTestsHelper.h" - -static NSTimeInterval const kRunLoopRunTime = 0.001; // Allow the RunLoop to run for one millisecond each time. - -@interface QueueObject : NSObject -@property (nonatomic) BOOL queueObjectProcessed; -@end - -@implementation QueueObject -- (void)prepareForCATransactionCommit -{ - self.queueObjectProcessed = YES; -} -@end - -@interface ASRunLoopQueueTests : ASTestCase - -@end - -@implementation ASRunLoopQueueTests - -#pragma mark enqueue tests - -- (void)testEnqueueNilObjectsToQueue -{ - ASRunLoopQueue *queue = [[ASRunLoopQueue alloc] initWithRunLoop:CFRunLoopGetMain() retainObjects:YES handler:nil]; - id object = nil; - [queue enqueue:object]; - XCTAssertTrue(queue.isEmpty); -} - -- (void)testEnqueueSameObjectTwiceToDefaultQueue -{ - id object = [[NSObject alloc] init]; - __unsafe_unretained id weakObject = object; - __block NSUInteger dequeuedCount = 0; - ASRunLoopQueue *queue = [[ASRunLoopQueue alloc] initWithRunLoop:CFRunLoopGetMain() retainObjects:YES handler:^(id _Nonnull dequeuedItem, BOOL isQueueDrained) { - if (dequeuedItem == weakObject) { - dequeuedCount++; - } - }]; - [queue enqueue:object]; - [queue enqueue:object]; - [[NSRunLoop mainRunLoop] runUntilDate:[NSDate dateWithTimeIntervalSinceNow:kRunLoopRunTime]]; - XCTAssert(dequeuedCount == 1); -} - -- (void)testEnqueueSameObjectTwiceToNonExclusiveMembershipQueue -{ - id object = [[NSObject alloc] init]; - __unsafe_unretained id weakObject = object; - __block NSUInteger dequeuedCount = 0; - ASRunLoopQueue *queue = [[ASRunLoopQueue alloc] initWithRunLoop:CFRunLoopGetMain() retainObjects:YES handler:^(id _Nonnull dequeuedItem, BOOL isQueueDrained) { - if (dequeuedItem == weakObject) { - dequeuedCount++; - } - }]; - queue.ensureExclusiveMembership = NO; - [queue enqueue:object]; - [queue enqueue:object]; - [[NSRunLoop mainRunLoop] runUntilDate:[NSDate dateWithTimeIntervalSinceNow:kRunLoopRunTime]]; - XCTAssert(dequeuedCount == 2); -} - -#pragma mark processQueue tests - -- (void)testDefaultQueueProcessObjectsOneAtATime -{ - ASRunLoopQueue *queue = [[ASRunLoopQueue alloc] initWithRunLoop:CFRunLoopGetMain() retainObjects:YES handler:^(id _Nonnull dequeuedItem, BOOL isQueueDrained) { - [NSThread sleepForTimeInterval:kRunLoopRunTime * 2]; // So each element takes more time than the available - }]; - [queue enqueue:[[NSObject alloc] init]]; - [queue enqueue:[[NSObject alloc] init]]; - [[NSRunLoop mainRunLoop] runUntilDate:[NSDate dateWithTimeIntervalSinceNow:kRunLoopRunTime]]; - XCTAssertFalse(queue.isEmpty); -} - -- (void)testQueueProcessObjectsInBatchesOfSpecifiedSize -{ - ASRunLoopQueue *queue = [[ASRunLoopQueue alloc] initWithRunLoop:CFRunLoopGetMain() retainObjects:YES handler:^(id _Nonnull dequeuedItem, BOOL isQueueDrained) { - [NSThread sleepForTimeInterval:kRunLoopRunTime * 2]; // So each element takes more time than the available - }]; - queue.batchSize = 2; - [queue enqueue:[[NSObject alloc] init]]; - [queue enqueue:[[NSObject alloc] init]]; - [[NSRunLoop mainRunLoop] runUntilDate:[NSDate dateWithTimeIntervalSinceNow:kRunLoopRunTime]]; - XCTAssertTrue(queue.isEmpty); -} - -- (void)testQueueOnlySendsIsDrainedForLastObjectInBatch -{ - id objectA = [[NSObject alloc] init]; - id objectB = [[NSObject alloc] init]; - __unsafe_unretained id weakObjectA = objectA; - __unsafe_unretained id weakObjectB = objectB; - __block BOOL isQueueDrainedWhenProcessingA = NO; - __block BOOL isQueueDrainedWhenProcessingB = NO; - ASRunLoopQueue *queue = [[ASRunLoopQueue alloc] initWithRunLoop:CFRunLoopGetMain() retainObjects:YES handler:^(id _Nonnull dequeuedItem, BOOL isQueueDrained) { - if (dequeuedItem == weakObjectA) { - isQueueDrainedWhenProcessingA = isQueueDrained; - } else if (dequeuedItem == weakObjectB) { - isQueueDrainedWhenProcessingB = isQueueDrained; - } - }]; - queue.batchSize = 2; - [queue enqueue:objectA]; - [queue enqueue:objectB]; - [[NSRunLoop mainRunLoop] runUntilDate:[NSDate dateWithTimeIntervalSinceNow:kRunLoopRunTime]]; - XCTAssertFalse(isQueueDrainedWhenProcessingA); - XCTAssertTrue(isQueueDrainedWhenProcessingB); -} - -#pragma mark strong/weak tests - -- (void)testStrongQueueRetainsObjects -{ - id object = [[NSObject alloc] init]; - __unsafe_unretained id weakObject = object; - __block BOOL didProcessObject = NO; - ASRunLoopQueue *queue = [[ASRunLoopQueue alloc] initWithRunLoop:CFRunLoopGetMain() retainObjects:YES handler:^(id _Nonnull dequeuedItem, BOOL isQueueDrained) { - if (dequeuedItem == weakObject) { - didProcessObject = YES; - } - }]; - [queue enqueue:object]; - object = nil; - [[NSRunLoop mainRunLoop] runUntilDate:[NSDate dateWithTimeIntervalSinceNow:kRunLoopRunTime]]; - XCTAssertTrue(didProcessObject); -} - -- (void)testWeakQueueDoesNotRetainsObjects -{ - id object = [[NSObject alloc] init]; - __unsafe_unretained id weakObject = object; - __block BOOL didProcessObject = NO; - ASRunLoopQueue *queue = [[ASRunLoopQueue alloc] initWithRunLoop:CFRunLoopGetMain() retainObjects:NO handler:^(id _Nonnull dequeuedItem, BOOL isQueueDrained) { - if (dequeuedItem == weakObject) { - didProcessObject = YES; - } - }]; - [queue enqueue:object]; - object = nil; - [[NSRunLoop mainRunLoop] runUntilDate:[NSDate dateWithTimeIntervalSinceNow:kRunLoopRunTime]]; - XCTAssertFalse(didProcessObject); -} - -- (void)testWeakQueueWithAllDeallocatedObjectsIsDrained -{ - ASRunLoopQueue *queue = [[ASRunLoopQueue alloc] initWithRunLoop:CFRunLoopGetMain() retainObjects:NO handler:nil]; - id object = [[NSObject alloc] init]; - [queue enqueue:object]; - object = nil; - XCTAssertFalse(queue.isEmpty); - [[NSRunLoop mainRunLoop] runUntilDate:[NSDate dateWithTimeIntervalSinceNow:kRunLoopRunTime]]; - XCTAssertTrue(queue.isEmpty); -} - -- (void)testASCATransactionQueueDisable -{ - // Disable coalescing. - ASConfiguration *config = [[ASConfiguration alloc] init]; - config.experimentalFeatures = kNilOptions; - [ASConfigurationManager test_resetWithConfiguration:config]; - - ASCATransactionQueue *queue = [[ASCATransactionQueue alloc] init]; - QueueObject *object = [[QueueObject alloc] init]; - XCTAssertFalse(object.queueObjectProcessed); - [queue enqueue:object]; - XCTAssertTrue(object.queueObjectProcessed); - XCTAssertTrue([queue isEmpty]); - XCTAssertFalse(queue.enabled); -} - -- (void)testASCATransactionQueueProcess -{ - ASConfiguration *config = [[ASConfiguration alloc] initWithDictionary:nil]; - config.experimentalFeatures = ASExperimentalInterfaceStateCoalescing; - [ASConfigurationManager test_resetWithConfiguration:config]; - - ASCATransactionQueue *queue = [[ASCATransactionQueue alloc] init]; - QueueObject *object = [[QueueObject alloc] init]; - [queue enqueue:object]; - XCTAssertFalse(object.queueObjectProcessed); - ASCATransactionQueueWait(queue); - XCTAssertTrue(object.queueObjectProcessed); - XCTAssertTrue(queue.enabled); -} - -@end diff --git a/submodules/AsyncDisplayKit/Tests/ASScrollNodeTests.mm b/submodules/AsyncDisplayKit/Tests/ASScrollNodeTests.mm deleted file mode 100644 index fe2c4540c8..0000000000 --- a/submodules/AsyncDisplayKit/Tests/ASScrollNodeTests.mm +++ /dev/null @@ -1,168 +0,0 @@ -// -// ASScrollNodeTests.mm -// Texture -// -// Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import -#import - -#import - -#import "ASXCTExtensions.h" - -@interface ASScrollNodeTests : XCTestCase - -@property (nonatomic) ASScrollNode *scrollNode; -@property (nonatomic) ASDisplayNode *subnode; - -@end - -@implementation ASScrollNodeTests - -- (void)setUp -{ - ASDisplayNode *subnode = [[ASDisplayNode alloc] init]; - self.subnode = subnode; - - self.scrollNode = [[ASScrollNode alloc] init]; - self.scrollNode.scrollableDirections = ASScrollDirectionVerticalDirections; - self.scrollNode.automaticallyManagesContentSize = YES; - self.scrollNode.automaticallyManagesSubnodes = YES; - self.scrollNode.layoutSpecBlock = ^ASLayoutSpec * _Nonnull(__kindof ASDisplayNode * _Nonnull node, ASSizeRange constrainedSize) { - return [[ASWrapperLayoutSpec alloc] initWithLayoutElement:subnode]; - }; - [self.scrollNode view]; -} - -- (void)testSubnodeLayoutCalculatedWithUnconstrainedMaxSizeInScrollableDirection -{ - CGSize parentSize = CGSizeMake(100, 100); - ASSizeRange sizeRange = ASSizeRangeMake(parentSize); - - [self.scrollNode layoutThatFits:sizeRange parentSize:parentSize]; - - ASSizeRange subnodeSizeRange = sizeRange; - subnodeSizeRange.max.height = CGFLOAT_MAX; - XCTAssertEqual(self.scrollNode.scrollableDirections, ASScrollDirectionVerticalDirections); - ASXCTAssertEqualSizeRanges(self.subnode.constrainedSizeForCalculatedLayout, subnodeSizeRange); - - // Same test for horizontal scrollable directions - self.scrollNode.scrollableDirections = ASScrollDirectionHorizontalDirections; - [self.scrollNode layoutThatFits:sizeRange parentSize:parentSize]; - - subnodeSizeRange = sizeRange; - subnodeSizeRange.max.width = CGFLOAT_MAX; - - ASXCTAssertEqualSizeRanges(self.subnode.constrainedSizeForCalculatedLayout, subnodeSizeRange); -} - -- (void)testAutomaticallyManagesContentSizeUnderflow -{ - CGSize subnodeSize = CGSizeMake(100, 100); - CGSize parentSize = CGSizeMake(100, 200); - ASSizeRange sizeRange = ASSizeRangeUnconstrained; - - self.subnode.style.preferredSize = subnodeSize; - - [self.scrollNode layoutThatFits:sizeRange parentSize:parentSize]; - [self.scrollNode layout]; - - ASXCTAssertEqualSizes(self.scrollNode.calculatedSize, parentSize); - ASXCTAssertEqualSizes(self.scrollNode.view.contentSize, subnodeSize); -} - -- (void)testAutomaticallyManagesContentSizeOverflow -{ - CGSize subnodeSize = CGSizeMake(100, 500); - CGSize parentSize = CGSizeMake(100, 200); - ASSizeRange sizeRange = ASSizeRangeUnconstrained; - - self.subnode.style.preferredSize = subnodeSize; - - [self.scrollNode layoutThatFits:sizeRange parentSize:parentSize]; - [self.scrollNode layout]; - - ASXCTAssertEqualSizes(self.scrollNode.calculatedSize, parentSize); - ASXCTAssertEqualSizes(self.scrollNode.view.contentSize, subnodeSize); -} - -- (void)testAutomaticallyManagesContentSizeWithSizeRangeSmallerThanParentSize -{ - CGSize subnodeSize = CGSizeMake(100, 100); - CGSize parentSize = CGSizeMake(100, 500); - ASSizeRange sizeRange = ASSizeRangeMake(CGSizeMake(100, 100), CGSizeMake(100, 200)); - - self.subnode.style.preferredSize = subnodeSize; - - [self.scrollNode layoutThatFits:sizeRange parentSize:parentSize]; - [self.scrollNode layout]; - - ASXCTAssertEqualSizes(self.scrollNode.calculatedSize, sizeRange.max); - ASXCTAssertEqualSizes(self.scrollNode.view.contentSize, subnodeSize); -} - -- (void)testAutomaticallyManagesContentSizeWithSizeRangeBiggerThanParentSize -{ - CGSize subnodeSize = CGSizeMake(100, 200); - CGSize parentSize = CGSizeMake(100, 100); - ASSizeRange sizeRange = ASSizeRangeMake(CGSizeMake(100, 150)); - - self.subnode.style.preferredSize = subnodeSize; - - [self.scrollNode layoutThatFits:sizeRange parentSize:parentSize]; - [self.scrollNode layout]; - - ASXCTAssertEqualSizes(self.scrollNode.calculatedSize, sizeRange.min); - ASXCTAssertEqualSizes(self.scrollNode.view.contentSize, subnodeSize); -} - -- (void)testAutomaticallyManagesContentSizeWithInvalidCalculatedSizeForLayout -{ - CGSize subnodeSize = CGSizeMake(100, 200); - CGSize parentSize = CGSizeMake(CGFLOAT_MAX, CGFLOAT_MAX); - ASSizeRange sizeRange = ASSizeRangeUnconstrained; - - self.subnode.style.preferredSize = subnodeSize; - - [self.scrollNode layoutThatFits:sizeRange parentSize:parentSize]; - [self.scrollNode layout]; - - ASXCTAssertEqualSizes(self.scrollNode.calculatedSize, subnodeSize); - ASXCTAssertEqualSizes(self.scrollNode.view.contentSize, subnodeSize); -} - -- (void)testASScrollNodeAccessibility { - ASDisplayNode *scrollNode = [[ASDisplayNode alloc] init]; - ASDisplayNode *node = [[ASDisplayNode alloc] init]; - node.isAccessibilityContainer = YES; - node.accessibilityLabel = @"node"; - [scrollNode addSubnode:node]; - node.frame = CGRectMake(0,0,100,100); - ASTextNode2 *text = [[ASTextNode2 alloc] init]; - text.attributedText = [[NSAttributedString alloc] initWithString:@"text"]; - [node addSubnode:text]; - - ASTextNode2 *text2 = [[ASTextNode2 alloc] init]; - text2.attributedText = [[NSAttributedString alloc] initWithString:@"text2"]; - [node addSubnode:text2]; - __unused UIView *view = scrollNode.view; - XCTAssertTrue(node.view.accessibilityElements.firstObject, @"node"); - - // Following tests will only pass when accessibility is enabled. - // More details: https://github.com/TextureGroup/Texture/pull/1188 - - // A bunch of a11y containers each of which hold aggregated labels. - /* NSArray *a11yElements = [scrollNode.view accessibilityElements]; - XCTAssertTrue(a11yElements.count > 0, @"accessibilityElements should exist"); - - UIAccessibilityElement *container = a11yElements.firstObject; - XCTAssertTrue(container.isAccessibilityElement == false && container.accessibilityElements.count > 0); - UIAccessibilityElement *ae = container.accessibilityElements.firstObject; - XCTAssertTrue([[ae accessibilityLabel] isEqualToString:@"node, text, text2"]); - */ -} - -@end diff --git a/submodules/AsyncDisplayKit/Tests/ASSnapshotTestCase.h b/submodules/AsyncDisplayKit/Tests/ASSnapshotTestCase.h deleted file mode 100644 index 195e4b7918..0000000000 --- a/submodules/AsyncDisplayKit/Tests/ASSnapshotTestCase.h +++ /dev/null @@ -1,43 +0,0 @@ -// -// ASSnapshotTestCase.h -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wdocumentation" -#import -#pragma clang diagnostic pop - -#import "ASDisplayNodeTestsHelper.h" - -@class ASDisplayNode; - -NSOrderedSet *ASSnapshotTestCaseDefaultSuffixes(void); - -#define ASSnapshotVerifyNode(node__, identifier__) \ -{ \ - [ASSnapshotTestCase hackilySynchronouslyRecursivelyRenderNode:node__]; \ - FBSnapshotVerifyLayerWithOptions(node__.layer, identifier__, ASSnapshotTestCaseDefaultSuffixes(), 0) \ -} - -#define ASSnapshotVerifyLayer(layer__, identifier__) \ - FBSnapshotVerifyLayerWithOptions(layer__, identifier__, ASSnapshotTestCaseDefaultSuffixes(), 0); - -#define ASSnapshotVerifyView(view__, identifier__) \ - FBSnapshotVerifyViewWithOptions(view__, identifier__, ASSnapshotTestCaseDefaultSuffixes(), 0); - -#define ASSnapshotVerifyViewWithTolerance(view__, identifier__, tolerance__) \ - FBSnapshotVerifyViewWithOptions(view__, identifier__, ASSnapshotTestCaseDefaultSuffixes(), tolerance__); - -@interface ASSnapshotTestCase : FBSnapshotTestCase - -/** - * Hack for testing. ASDisplayNode lacks an explicit -render method, so we manually hit its layout & display codepaths. - */ -+ (void)hackilySynchronouslyRecursivelyRenderNode:(ASDisplayNode *)node; - -@end diff --git a/submodules/AsyncDisplayKit/Tests/ASSnapshotTestCase.mm b/submodules/AsyncDisplayKit/Tests/ASSnapshotTestCase.mm deleted file mode 100644 index 560c25988e..0000000000 --- a/submodules/AsyncDisplayKit/Tests/ASSnapshotTestCase.mm +++ /dev/null @@ -1,40 +0,0 @@ -// -// ASSnapshotTestCase.mm -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import "ASSnapshotTestCase.h" -#import -#import -#import -#import - -NSOrderedSet *ASSnapshotTestCaseDefaultSuffixes(void) -{ - NSMutableOrderedSet *suffixesSet = [[NSMutableOrderedSet alloc] init]; - // In some rare cases, slightly different rendering may occur on iOS 10 (text rasterization). - // If the test folders find any image that exactly matches, they pass; - // if an image is not present at all, or it fails, it moves on to check the others. - // This means the order doesn't matter besides reducing logging / performance. - if (AS_AT_LEAST_IOS10) { - [suffixesSet addObject:@"_iOS_10"]; - } - [suffixesSet addObject:@"_64"]; - return [suffixesSet copy]; -} - -@implementation ASSnapshotTestCase - -+ (void)hackilySynchronouslyRecursivelyRenderNode:(ASDisplayNode *)node -{ - ASDisplayNodePerformBlockOnEveryNode(nil, node, YES, ^(ASDisplayNode * _Nonnull node) { - [node.layer setNeedsDisplay]; - }); - [node recursivelyEnsureDisplaySynchronously:YES]; -} - -@end diff --git a/submodules/AsyncDisplayKit/Tests/ASStackLayoutSpecSnapshotTests.mm b/submodules/AsyncDisplayKit/Tests/ASStackLayoutSpecSnapshotTests.mm deleted file mode 100644 index ac6a2a254d..0000000000 --- a/submodules/AsyncDisplayKit/Tests/ASStackLayoutSpecSnapshotTests.mm +++ /dev/null @@ -1,1387 +0,0 @@ -// -// ASStackLayoutSpecSnapshotTests.mm -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import "ASLayoutSpecSnapshotTestsHelper.h" - -#import -#import -#import -#import -#import -#import - -@interface ASStackLayoutSpecSnapshotTests : ASLayoutSpecSnapshotTestCase -@end - -@implementation ASStackLayoutSpecSnapshotTests - -#pragma mark - Utility methods - -static NSArray *defaultSubnodes() -{ - return defaultSubnodesWithSameSize(CGSizeZero, 0); -} - -static NSArray *defaultSubnodesWithSameSize(CGSize subnodeSize, CGFloat flex) -{ - NSArray *subnodes = @[ - ASDisplayNodeWithBackgroundColor([UIColor redColor], subnodeSize), - ASDisplayNodeWithBackgroundColor([UIColor blueColor], subnodeSize), - ASDisplayNodeWithBackgroundColor([UIColor greenColor], subnodeSize) - ]; - for (ASDisplayNode *subnode in subnodes) { - subnode.style.flexGrow = flex; - subnode.style.flexShrink = flex; - } - return subnodes; -} - -static void setCGSizeToNode(CGSize size, ASDisplayNode *node) -{ - node.style.width = ASDimensionMakeWithPoints(size.width); - node.style.height = ASDimensionMakeWithPoints(size.height); -} - -static NSArray *defaultTextNodes() -{ - ASTextNode *textNode1 = [[ASTextNode alloc] init]; - textNode1.attributedText = [[NSAttributedString alloc] initWithString:@"Hello" - attributes:@{NSFontAttributeName: [UIFont systemFontOfSize:20]}]; - textNode1.backgroundColor = [UIColor redColor]; - textNode1.layerBacked = YES; - - ASTextNode *textNode2 = [[ASTextNode alloc] init]; - textNode2.attributedText = [[NSAttributedString alloc] initWithString:@"Why, hello there! How are you?" - attributes:@{NSFontAttributeName: [UIFont systemFontOfSize:12]}]; - textNode2.backgroundColor = [UIColor blueColor]; - textNode2.layerBacked = YES; - - return @[textNode1, textNode2]; -} - -- (void)testStackLayoutSpecWithJustify:(ASStackLayoutJustifyContent)justify - flexFactor:(CGFloat)flex - sizeRange:(ASSizeRange)sizeRange - identifier:(NSString *)identifier -{ - ASStackLayoutSpecStyle style = { - .direction = ASStackLayoutDirectionHorizontal, - .justifyContent = justify - }; - - NSArray *subnodes = defaultSubnodesWithSameSize({50, 50}, flex); - - [self testStackLayoutSpecWithStyle:style sizeRange:sizeRange subnodes:subnodes identifier:identifier]; -} - -- (void)testStackLayoutSpecWithStyle:(ASStackLayoutSpecStyle)style - sizeRange:(ASSizeRange)sizeRange - subnodes:(NSArray *)subnodes - identifier:(NSString *)identifier -{ - [self testStackLayoutSpecWithStyle:style children:subnodes sizeRange:sizeRange subnodes:subnodes identifier:identifier]; -} - -- (void)testStackLayoutSpecWithStyle:(ASStackLayoutSpecStyle)style - children:(NSArray *)children - sizeRange:(ASSizeRange)sizeRange - subnodes:(NSArray *)subnodes - identifier:(NSString *)identifier -{ - ASStackLayoutSpec *stackLayoutSpec = - [ASStackLayoutSpec - stackLayoutSpecWithDirection:style.direction - spacing:style.spacing - justifyContent:style.justifyContent - alignItems:style.alignItems - flexWrap:style.flexWrap - alignContent:style.alignContent - lineSpacing:style.lineSpacing - children:children]; - - [self testStackLayoutSpec:stackLayoutSpec sizeRange:sizeRange subnodes:subnodes identifier:identifier]; -} - -- (void)testStackLayoutSpecWithDirection:(ASStackLayoutDirection)direction - itemsHorizontalAlignment:(ASHorizontalAlignment)horizontalAlignment - itemsVerticalAlignment:(ASVerticalAlignment)verticalAlignment - identifier:(NSString *)identifier -{ - NSArray *subnodes = defaultSubnodesWithSameSize({50, 50}, 0); - - ASStackLayoutSpec *stackLayoutSpec = [[ASStackLayoutSpec alloc] init]; - stackLayoutSpec.direction = direction; - stackLayoutSpec.children = subnodes; - stackLayoutSpec.horizontalAlignment = horizontalAlignment; - stackLayoutSpec.verticalAlignment = verticalAlignment; - - CGSize exactSize = CGSizeMake(200, 200); - static ASSizeRange kSize = ASSizeRangeMake(exactSize, exactSize); - [self testStackLayoutSpec:stackLayoutSpec sizeRange:kSize subnodes:subnodes identifier:identifier]; -} - -- (void)testStackLayoutSpecWithBaselineAlignment:(ASStackLayoutAlignItems)baselineAlignment - identifier:(NSString *)identifier -{ - NSAssert(baselineAlignment == ASStackLayoutAlignItemsBaselineFirst || baselineAlignment == ASStackLayoutAlignItemsBaselineLast, @"Unexpected baseline alignment"); - NSArray *textNodes = defaultTextNodes(); - textNodes[1].style.flexShrink = 1.0; - - ASStackLayoutSpec *stackLayoutSpec = [ASStackLayoutSpec horizontalStackLayoutSpec]; - stackLayoutSpec.children = textNodes; - stackLayoutSpec.alignItems = baselineAlignment; - - static ASSizeRange kSize = ASSizeRangeMake(CGSizeMake(150, 0), CGSizeMake(150, CGFLOAT_MAX)); - [self testStackLayoutSpec:stackLayoutSpec sizeRange:kSize subnodes:textNodes identifier:identifier]; -} - -- (void)testStackLayoutSpec:(ASStackLayoutSpec *)stackLayoutSpec - sizeRange:(ASSizeRange)sizeRange - subnodes:(NSArray *)subnodes - identifier:(NSString *)identifier -{ - ASDisplayNode *backgroundNode = ASDisplayNodeWithBackgroundColor([UIColor whiteColor]); - ASLayoutSpec *layoutSpec = [ASBackgroundLayoutSpec backgroundLayoutSpecWithChild:stackLayoutSpec background:backgroundNode]; - - NSMutableArray *newSubnodes = [NSMutableArray arrayWithObject:backgroundNode]; - [newSubnodes addObjectsFromArray:subnodes]; - - [self testLayoutSpec:layoutSpec sizeRange:sizeRange subnodes:newSubnodes identifier:identifier]; -} - -- (void)testStackLayoutSpecWithAlignContent:(ASStackLayoutAlignContent)alignContent - lineSpacing:(CGFloat)lineSpacing - sizeRange:(ASSizeRange)sizeRange - identifier:(NSString *)identifier -{ - ASStackLayoutSpecStyle style = { - .direction = ASStackLayoutDirectionHorizontal, - .flexWrap = ASStackLayoutFlexWrapWrap, - .alignContent = alignContent, - .lineSpacing = lineSpacing, - }; - - CGSize subnodeSize = {50, 50}; - NSArray *subnodes = @[ - ASDisplayNodeWithBackgroundColor([UIColor redColor], subnodeSize), - ASDisplayNodeWithBackgroundColor([UIColor yellowColor], subnodeSize), - ASDisplayNodeWithBackgroundColor([UIColor blueColor], subnodeSize), - ASDisplayNodeWithBackgroundColor([UIColor magentaColor], subnodeSize), - ASDisplayNodeWithBackgroundColor([UIColor greenColor], subnodeSize), - ASDisplayNodeWithBackgroundColor([UIColor cyanColor], subnodeSize), - ]; - - [self testStackLayoutSpecWithStyle:style sizeRange:sizeRange subnodes:subnodes identifier:identifier]; -} - -- (void)testStackLayoutSpecWithAlignContent:(ASStackLayoutAlignContent)alignContent - sizeRange:(ASSizeRange)sizeRange - identifier:(NSString *)identifier -{ - [self testStackLayoutSpecWithAlignContent:alignContent lineSpacing:0.0 sizeRange:sizeRange identifier:identifier]; -} - -#pragma mark - - -- (void)testDefaultStackLayoutElementFlexProperties -{ - ASDisplayNode *displayNode = [[ASDisplayNode alloc] init]; - - XCTAssertEqual(displayNode.style.flexShrink, NO); - XCTAssertEqual(displayNode.style.flexGrow, NO); - - const ASDimension unconstrainedDimension = ASDimensionAuto; - const ASDimension flexBasis = displayNode.style.flexBasis; - XCTAssertEqual(flexBasis.unit, unconstrainedDimension.unit); - XCTAssertEqual(flexBasis.value, unconstrainedDimension.value); -} - -- (void)testUnderflowBehaviors -{ - // width 300px; height 0-300px - static ASSizeRange kSize = {{300, 0}, {300, 300}}; - [self testStackLayoutSpecWithJustify:ASStackLayoutJustifyContentStart flexFactor:0 sizeRange:kSize identifier:@"justifyStart"]; - [self testStackLayoutSpecWithJustify:ASStackLayoutJustifyContentCenter flexFactor:0 sizeRange:kSize identifier:@"justifyCenter"]; - [self testStackLayoutSpecWithJustify:ASStackLayoutJustifyContentEnd flexFactor:0 sizeRange:kSize identifier:@"justifyEnd"]; - [self testStackLayoutSpecWithJustify:ASStackLayoutJustifyContentStart flexFactor:1 sizeRange:kSize identifier:@"flex"]; - [self testStackLayoutSpecWithJustify:ASStackLayoutJustifyContentSpaceBetween flexFactor:0 sizeRange:kSize identifier:@"justifySpaceBetween"]; - [self testStackLayoutSpecWithJustify:ASStackLayoutJustifyContentSpaceAround flexFactor:0 sizeRange:kSize identifier:@"justifySpaceAround"]; -} - -- (void)testOverflowBehaviors -{ - // width 110px; height 0-300px - static ASSizeRange kSize = {{110, 0}, {110, 300}}; - [self testStackLayoutSpecWithJustify:ASStackLayoutJustifyContentStart flexFactor:0 sizeRange:kSize identifier:@"justifyStart"]; - [self testStackLayoutSpecWithJustify:ASStackLayoutJustifyContentCenter flexFactor:0 sizeRange:kSize identifier:@"justifyCenter"]; - [self testStackLayoutSpecWithJustify:ASStackLayoutJustifyContentEnd flexFactor:0 sizeRange:kSize identifier:@"justifyEnd"]; - [self testStackLayoutSpecWithJustify:ASStackLayoutJustifyContentStart flexFactor:1 sizeRange:kSize identifier:@"flex"]; - // On overflow, "space between" is identical to "content start" - [self testStackLayoutSpecWithJustify:ASStackLayoutJustifyContentSpaceBetween flexFactor:0 sizeRange:kSize identifier:@"justifyStart"]; - // On overflow, "space around" is identical to "content center" - [self testStackLayoutSpecWithJustify:ASStackLayoutJustifyContentSpaceAround flexFactor:0 sizeRange:kSize identifier:@"justifyCenter"]; -} - -- (void)testOverflowBehaviorsWhenAllFlexShrinkChildrenHaveBeenClampedToZeroButViolationStillExists -{ - ASStackLayoutSpecStyle style = {.direction = ASStackLayoutDirectionHorizontal}; - - NSArray *subnodes = defaultSubnodesWithSameSize({50, 50}, 0); - subnodes[1].style.flexShrink = 1; - - // Width is 75px--that's less than the sum of the widths of the children, which is 100px. - static ASSizeRange kSize = {{75, 0}, {75, 150}}; - [self testStackLayoutSpecWithStyle:style sizeRange:kSize subnodes:subnodes identifier:nil]; -} - -- (void)testFlexWithUnequalIntrinsicSizes -{ - ASStackLayoutSpecStyle style = {.direction = ASStackLayoutDirectionHorizontal}; - - NSArray *subnodes = defaultSubnodesWithSameSize({50, 50}, 1); - setCGSizeToNode({150, 150}, subnodes[1]); - - // width 300px; height 0-150px. - static ASSizeRange kUnderflowSize = {{300, 0}, {300, 150}}; - [self testStackLayoutSpecWithStyle:style sizeRange:kUnderflowSize subnodes:subnodes identifier:@"underflow"]; - - // width 200px; height 0-150px. - static ASSizeRange kOverflowSize = {{200, 0}, {200, 150}}; - [self testStackLayoutSpecWithStyle:style sizeRange:kOverflowSize subnodes:subnodes identifier:@"overflow"]; -} - -- (void)testCrossAxisSizeBehaviors -{ - ASStackLayoutSpecStyle style = {.direction = ASStackLayoutDirectionVertical}; - - NSArray *subnodes = defaultSubnodes(); - setCGSizeToNode({50, 50}, subnodes[0]); - setCGSizeToNode({100, 50}, subnodes[1]); - setCGSizeToNode({150, 50}, subnodes[2]); - - // width 0-300px; height 300px - static ASSizeRange kVariableHeight = {{0, 300}, {300, 300}}; - [self testStackLayoutSpecWithStyle:style sizeRange:kVariableHeight subnodes:subnodes identifier:@"variableHeight"]; - - // width 300px; height 300px - static ASSizeRange kFixedHeight = {{300, 300}, {300, 300}}; - [self testStackLayoutSpecWithStyle:style sizeRange:kFixedHeight subnodes:subnodes identifier:@"fixedHeight"]; -} - -- (void)testStackSpacing -{ - ASStackLayoutSpecStyle style = { - .direction = ASStackLayoutDirectionVertical, - .spacing = 10 - }; - - NSArray *subnodes = defaultSubnodes(); - setCGSizeToNode({50, 50}, subnodes[0]); - setCGSizeToNode({100, 50}, subnodes[1]); - setCGSizeToNode({150, 50}, subnodes[2]); - - // width 0-300px; height 300px - static ASSizeRange kVariableHeight = {{0, 300}, {300, 300}}; - [self testStackLayoutSpecWithStyle:style sizeRange:kVariableHeight subnodes:subnodes identifier:@"variableHeight"]; -} - -- (void)testStackSpacingWithChildrenHavingNilObjects -{ - // This should take a zero height since all children have a nil node. If it takes a height > 0, a blue background - // will show up, hence failing the test. - ASDisplayNode *backgroundNode = ASDisplayNodeWithBackgroundColor([UIColor blueColor]); - - ASLayoutSpec *layoutSpec = - [ASInsetLayoutSpec - insetLayoutSpecWithInsets:{10, 10, 10, 10} - child: - [ASBackgroundLayoutSpec - backgroundLayoutSpecWithChild: - [ASStackLayoutSpec - stackLayoutSpecWithDirection:ASStackLayoutDirectionVertical - spacing:10 - justifyContent:ASStackLayoutJustifyContentStart - alignItems:ASStackLayoutAlignItemsStretch - children:@[]] - background:backgroundNode]]; - - // width 300px; height 0-300px - static ASSizeRange kVariableHeight = {{300, 0}, {300, 300}}; - [self testLayoutSpec:layoutSpec sizeRange:kVariableHeight subnodes:@[backgroundNode] identifier:@"variableHeight"]; -} - -- (void)testChildSpacing -{ - // width 0-INF; height 0-INF - static ASSizeRange kAnySize = {{0, 0}, {INFINITY, INFINITY}}; - ASStackLayoutSpecStyle style = {.direction = ASStackLayoutDirectionVertical}; - - NSArray *subnodes = defaultSubnodes(); - setCGSizeToNode({50, 50}, subnodes[0]); - setCGSizeToNode({100, 70}, subnodes[1]); - setCGSizeToNode({150, 90}, subnodes[2]); - - subnodes[1].style.spacingBefore = 10; - subnodes[2].style.spacingBefore = 20; - [self testStackLayoutSpecWithStyle:style sizeRange:kAnySize subnodes:subnodes identifier:@"spacingBefore"]; - // Reset above spacing values - subnodes[1].style.spacingBefore = 0; - subnodes[2].style.spacingBefore = 0; - - subnodes[1].style.spacingAfter = 10; - subnodes[2].style.spacingAfter = 20; - [self testStackLayoutSpecWithStyle:style sizeRange:kAnySize subnodes:subnodes identifier:@"spacingAfter"]; - // Reset above spacing values - subnodes[1].style.spacingAfter = 0; - subnodes[2].style.spacingAfter = 0; - - style.spacing = 10; - subnodes[1].style.spacingBefore = -10; - subnodes[1].style.spacingAfter = -10; - [self testStackLayoutSpecWithStyle:style sizeRange:kAnySize subnodes:subnodes identifier:@"spacingBalancedOut"]; -} - -- (void)testJustifiedCenterWithChildSpacing -{ - ASStackLayoutSpecStyle style = { - .direction = ASStackLayoutDirectionVertical, - .justifyContent = ASStackLayoutJustifyContentCenter - }; - - NSArray *subnodes = defaultSubnodes(); - setCGSizeToNode({50, 50}, subnodes[0]); - setCGSizeToNode({100, 70}, subnodes[1]); - setCGSizeToNode({150, 90}, subnodes[2]); - - subnodes[0].style.spacingBefore = 0; - subnodes[1].style.spacingBefore = 20; - subnodes[2].style.spacingBefore = 30; - - // width 0-300px; height 300px - static ASSizeRange kVariableHeight = {{0, 300}, {300, 300}}; - [self testStackLayoutSpecWithStyle:style sizeRange:kVariableHeight subnodes:subnodes identifier:@"variableHeight"]; -} - -- (void)testJustifiedSpaceBetweenWithOneChild -{ - ASStackLayoutSpecStyle style = { - .direction = ASStackLayoutDirectionHorizontal, - .justifyContent = ASStackLayoutJustifyContentSpaceBetween - }; - - ASDisplayNode *child = ASDisplayNodeWithBackgroundColor([UIColor redColor], {50, 50}); - - // width 300px; height 0-INF - static ASSizeRange kVariableHeight = {{300, 0}, {300, INFINITY}}; - [self testStackLayoutSpecWithStyle:style sizeRange:kVariableHeight subnodes:@[child] identifier:nil]; -} - -- (void)testJustifiedSpaceAroundWithOneChild -{ - ASStackLayoutSpecStyle style = { - .direction = ASStackLayoutDirectionHorizontal, - .justifyContent = ASStackLayoutJustifyContentSpaceAround - }; - - ASDisplayNode *child = ASDisplayNodeWithBackgroundColor([UIColor redColor], {50, 50}); - - // width 300px; height 0-INF - static ASSizeRange kVariableHeight = {{300, 0}, {300, INFINITY}}; - [self testStackLayoutSpecWithStyle:style sizeRange:kVariableHeight subnodes:@[child] identifier:nil]; -} - -- (void)testJustifiedSpaceBetweenWithRemainingSpace -{ - // width 301px; height 0-300px; - static ASSizeRange kSize = {{301, 0}, {301, 300}}; - [self testStackLayoutSpecWithJustify:ASStackLayoutJustifyContentSpaceBetween flexFactor:0 sizeRange:kSize identifier:nil]; -} - -- (void)testJustifiedSpaceAroundWithRemainingSpace -{ - // width 305px; height 0-300px; - static ASSizeRange kSize = {{305, 0}, {305, 300}}; - [self testStackLayoutSpecWithJustify:ASStackLayoutJustifyContentSpaceAround flexFactor:0 sizeRange:kSize identifier:nil]; -} - -- (void)testChildThatChangesCrossSizeWhenMainSizeIsFlexed -{ - ASStackLayoutSpecStyle style = {.direction = ASStackLayoutDirectionHorizontal}; - - ASDisplayNode *subnode1 = ASDisplayNodeWithBackgroundColor([UIColor blueColor]); - ASDisplayNode *subnode2 = ASDisplayNodeWithBackgroundColor([UIColor redColor], {50, 50}); - - ASRatioLayoutSpec *child1 = [ASRatioLayoutSpec ratioLayoutSpecWithRatio:1.5 child:subnode1]; - child1.style.flexBasis = ASDimensionMakeWithFraction(1); - child1.style.flexGrow = 1; - child1.style.flexShrink = 1; - - static ASSizeRange kFixedWidth = {{150, 0}, {150, INFINITY}}; - [self testStackLayoutSpecWithStyle:style children:@[child1, subnode2] sizeRange:kFixedWidth subnodes:@[subnode1, subnode2] identifier:nil]; -} - -- (void)testAlignCenterWithFlexedMainDimension -{ - ASStackLayoutSpecStyle style = { - .direction = ASStackLayoutDirectionVertical, - .alignItems = ASStackLayoutAlignItemsCenter - }; - - NSArray *subnodes = @[ - ASDisplayNodeWithBackgroundColor([UIColor redColor], {100, 100}), - ASDisplayNodeWithBackgroundColor([UIColor blueColor], {50, 50}) - ]; - subnodes[0].style.flexShrink = 1; - subnodes[1].style.flexShrink = 1; - - static ASSizeRange kFixedWidth = {{150, 0}, {150, 100}}; - [self testStackLayoutSpecWithStyle:style sizeRange:kFixedWidth subnodes:subnodes identifier:nil]; -} - -- (void)testAlignCenterWithIndefiniteCrossDimension -{ - ASStackLayoutSpecStyle style = {.direction = ASStackLayoutDirectionHorizontal}; - - ASDisplayNode *subnode1 = ASDisplayNodeWithBackgroundColor([UIColor redColor], {100, 100}); - - ASDisplayNode *subnode2 = ASDisplayNodeWithBackgroundColor([UIColor blueColor], {50, 50}); - subnode2.style.alignSelf = ASStackLayoutAlignSelfCenter; - - NSArray *subnodes = @[subnode1, subnode2]; - static ASSizeRange kFixedWidth = {{150, 0}, {150, INFINITY}}; - [self testStackLayoutSpecWithStyle:style sizeRange:kFixedWidth subnodes:subnodes identifier:nil]; -} - -- (void)testAlignedStart -{ - ASStackLayoutSpecStyle style = { - .direction = ASStackLayoutDirectionVertical, - .justifyContent = ASStackLayoutJustifyContentCenter, - .alignItems = ASStackLayoutAlignItemsStart - }; - - NSArray *subnodes = defaultSubnodes(); - setCGSizeToNode({50, 50}, subnodes[0]); - setCGSizeToNode({100, 70}, subnodes[1]); - setCGSizeToNode({150, 90}, subnodes[2]); - - subnodes[0].style.spacingBefore = 0; - subnodes[1].style.spacingBefore = 20; - subnodes[2].style.spacingBefore = 30; - - static ASSizeRange kExactSize = {{300, 300}, {300, 300}}; - [self testStackLayoutSpecWithStyle:style sizeRange:kExactSize subnodes:subnodes identifier:nil]; -} - -- (void)testAlignedEnd -{ - ASStackLayoutSpecStyle style = { - .direction = ASStackLayoutDirectionVertical, - .justifyContent = ASStackLayoutJustifyContentCenter, - .alignItems = ASStackLayoutAlignItemsEnd - }; - - NSArray *subnodes = defaultSubnodes(); - setCGSizeToNode({50, 50}, subnodes[0]); - setCGSizeToNode({100, 70}, subnodes[1]); - setCGSizeToNode({150, 90}, subnodes[2]); - - subnodes[0].style.spacingBefore = 0; - subnodes[1].style.spacingBefore = 20; - subnodes[2].style.spacingBefore = 30; - - static ASSizeRange kExactSize = {{300, 300}, {300, 300}}; - [self testStackLayoutSpecWithStyle:style sizeRange:kExactSize subnodes:subnodes identifier:nil]; -} - -- (void)testAlignedCenter -{ - ASStackLayoutSpecStyle style = { - .direction = ASStackLayoutDirectionVertical, - .justifyContent = ASStackLayoutJustifyContentCenter, - .alignItems = ASStackLayoutAlignItemsCenter - }; - - NSArray *subnodes = defaultSubnodes(); - setCGSizeToNode({50, 50}, subnodes[0]); - setCGSizeToNode({100, 70}, subnodes[1]); - setCGSizeToNode({150, 90}, subnodes[2]); - - subnodes[0].style.spacingBefore = 0; - subnodes[1].style.spacingBefore = 20; - subnodes[2].style.spacingBefore = 30; - - static ASSizeRange kExactSize = {{300, 300}, {300, 300}}; - [self testStackLayoutSpecWithStyle:style sizeRange:kExactSize subnodes:subnodes identifier:nil]; -} - -- (void)testAlignedStretchNoChildExceedsMin -{ - ASStackLayoutSpecStyle style = { - .direction = ASStackLayoutDirectionVertical, - .justifyContent = ASStackLayoutJustifyContentCenter, - .alignItems = ASStackLayoutAlignItemsStretch - }; - - NSArray *subnodes = defaultSubnodes(); - setCGSizeToNode({50, 50}, subnodes[0]); - setCGSizeToNode({100, 70}, subnodes[1]); - setCGSizeToNode({150, 90}, subnodes[2]); - - subnodes[0].style.spacingBefore = 0; - subnodes[1].style.spacingBefore = 20; - subnodes[2].style.spacingBefore = 30; - - static ASSizeRange kVariableSize = {{200, 200}, {300, 300}}; - // all children should be 200px wide - [self testStackLayoutSpecWithStyle:style sizeRange:kVariableSize subnodes:subnodes identifier:nil]; -} - -- (void)testAlignedStretchOneChildExceedsMin -{ - ASStackLayoutSpecStyle style = { - .direction = ASStackLayoutDirectionVertical, - .justifyContent = ASStackLayoutJustifyContentCenter, - .alignItems = ASStackLayoutAlignItemsStretch - }; - - NSArray *subnodes = defaultSubnodes(); - setCGSizeToNode({50, 50}, subnodes[0]); - setCGSizeToNode({100, 70}, subnodes[1]); - setCGSizeToNode({150, 90}, subnodes[2]); - - subnodes[0].style.spacingBefore = 0; - subnodes[1].style.spacingBefore = 20; - subnodes[2].style.spacingBefore = 30; - - static ASSizeRange kVariableSize = {{50, 50}, {300, 300}}; - // all children should be 150px wide - [self testStackLayoutSpecWithStyle:style sizeRange:kVariableSize subnodes:subnodes identifier:nil]; -} - -- (void)testEmptyStack -{ - static ASSizeRange kVariableSize = {{50, 50}, {300, 300}}; - [self testStackLayoutSpecWithStyle:{} sizeRange:kVariableSize subnodes:@[] identifier:nil]; -} - -- (void)testFixedFlexBasisAppliedWhenFlexingItems -{ - ASStackLayoutSpecStyle style = {.direction = ASStackLayoutDirectionHorizontal}; - - NSArray *subnodes = defaultSubnodesWithSameSize({50, 50}, 0); - setCGSizeToNode({150, 150}, subnodes[1]); - - for (ASDisplayNode *subnode in subnodes) { - subnode.style.flexGrow = 1; - subnode.style.flexBasis = ASDimensionMakeWithPoints(10); - } - - // width 300px; height 0-150px. - static ASSizeRange kUnderflowSize = {{300, 0}, {300, 150}}; - [self testStackLayoutSpecWithStyle:style sizeRange:kUnderflowSize subnodes:subnodes identifier:@"underflow"]; - - // width 200px; height 0-150px. - static ASSizeRange kOverflowSize = {{200, 0}, {200, 150}}; - [self testStackLayoutSpecWithStyle:style sizeRange:kOverflowSize subnodes:subnodes identifier:@"overflow"]; -} - -- (void)testFractionalFlexBasisResolvesAgainstParentSize -{ - ASStackLayoutSpecStyle style = {.direction = ASStackLayoutDirectionHorizontal}; - - NSArray *subnodes = defaultSubnodesWithSameSize({50, 50}, 0); - for (ASDisplayNode *subnode in subnodes) { - subnode.style.flexGrow = 1; - } - - // This should override the intrinsic size of 50pts and instead compute to 50% = 100pts. - // The result should be that the red box is twice as wide as the blue and gree boxes after flexing. - subnodes[0].style.flexBasis = ASDimensionMakeWithFraction(0.5); - - static ASSizeRange kSize = {{200, 0}, {200, INFINITY}}; - [self testStackLayoutSpecWithStyle:style sizeRange:kSize subnodes:subnodes identifier:nil]; -} - -- (void)testFixedFlexBasisOverridesIntrinsicSizeForNonFlexingChildren -{ - ASStackLayoutSpecStyle style = {.direction = ASStackLayoutDirectionHorizontal}; - - NSArray *subnodes = defaultSubnodes(); - setCGSizeToNode({50, 50}, subnodes[0]); - setCGSizeToNode({150, 150}, subnodes[1]); - setCGSizeToNode({150, 50}, subnodes[2]); - - for (ASDisplayNode *subnode in subnodes) { - subnode.style.flexBasis = ASDimensionMakeWithPoints(20); - } - - static ASSizeRange kSize = {{300, 0}, {300, 150}}; - [self testStackLayoutSpecWithStyle:style sizeRange:kSize subnodes:subnodes identifier:nil]; -} - -- (void)testCrossAxisStretchingOccursAfterStackAxisFlexing -{ - // If cross axis stretching occurred *before* flexing, then the blue child would be stretched to 3000 points tall. - // Instead it should be stretched to 300 points tall, matching the red child and not overlapping the green inset. - - NSArray *subnodes = @[ - ASDisplayNodeWithBackgroundColor([UIColor greenColor]), // Inset background node - ASDisplayNodeWithBackgroundColor([UIColor blueColor]), // child1 of stack - ASDisplayNodeWithBackgroundColor([UIColor redColor], {500, 500}) // child2 of stack - ]; - - subnodes[1].style.width = ASDimensionMake(10); - - ASDisplayNode *child2 = subnodes[2]; - child2.style.flexGrow = 1; - child2.style.flexShrink = 1; - - // If cross axis stretching occurred *before* flexing, then the blue child would be stretched to 3000 points tall. - // Instead it should be stretched to 300 points tall, matching the red child and not overlapping the green inset. - ASLayoutSpec *layoutSpec = - [ASBackgroundLayoutSpec - backgroundLayoutSpecWithChild: - [ASInsetLayoutSpec - insetLayoutSpecWithInsets:UIEdgeInsetsMake(10, 10, 10, 10) - child: - [ASStackLayoutSpec - stackLayoutSpecWithDirection:ASStackLayoutDirectionHorizontal - spacing:0 - justifyContent:ASStackLayoutJustifyContentStart - alignItems:ASStackLayoutAlignItemsStretch - children:@[subnodes[1], child2]] - ] - background:subnodes[0]]; - - static ASSizeRange kSize = {{300, 0}, {300, INFINITY}}; - [self testLayoutSpec:layoutSpec sizeRange:kSize subnodes:subnodes identifier:nil]; -} - -- (void)testPositiveViolationIsDistributedEqually -{ - ASStackLayoutSpecStyle style = {.direction = ASStackLayoutDirectionHorizontal}; - - NSArray *subnodes = defaultSubnodesWithSameSize({50, 50}, 0); - subnodes[0].style.flexGrow = 1; - subnodes[2].style.flexGrow = 1; - - // In this scenario a width of 350 results in a positive violation of 200. - // Due to each flexible subnode specifying a flex grow factor of 1 the violation will be distributed evenly. - static ASSizeRange kSize = {{350, 350}, {350, 350}}; - [self testStackLayoutSpecWithStyle:style sizeRange:kSize subnodes:subnodes identifier:nil]; -} - -- (void)testPositiveViolationIsDistributedEquallyWithArbitraryFloats -{ - ASStackLayoutSpecStyle style = {.direction = ASStackLayoutDirectionHorizontal}; - - NSArray *subnodes = defaultSubnodesWithSameSize({50, 50}, 0); - subnodes[0].style.flexGrow = 0.5; - subnodes[2].style.flexGrow = 0.5; - - // In this scenario a width of 350 results in a positive violation of 200. - // Due to each flexible child component specifying a flex grow factor of 0.5 the violation will be distributed evenly. - static ASSizeRange kSize = {{350, 350}, {350, 350}}; - [self testStackLayoutSpecWithStyle:style sizeRange:kSize subnodes:subnodes identifier:nil]; -} - -- (void)testPositiveViolationIsDistributedProportionally -{ - ASStackLayoutSpecStyle style = {.direction = ASStackLayoutDirectionVertical}; - - NSArray *subnodes = defaultSubnodesWithSameSize({50, 50}, 0); - subnodes[0].style.flexGrow = 1; - subnodes[1].style.flexGrow = 2; - subnodes[2].style.flexGrow = 1; - - // In this scenario a width of 350 results in a positive violation of 200. - // The first and third subnodes specify a flex grow factor of 1 and will flex by 50. - // The second subnode specifies a flex grow factor of 2 and will flex by 100. - static ASSizeRange kSize = {{350, 350}, {350, 350}}; - [self testStackLayoutSpecWithStyle:style sizeRange:kSize subnodes:subnodes identifier:nil]; -} - -- (void)testPositiveViolationIsDistributedProportionallyWithArbitraryFloats -{ - ASStackLayoutSpecStyle style = {.direction = ASStackLayoutDirectionVertical}; - - NSArray *subnodes = defaultSubnodesWithSameSize({50, 50}, 0); - subnodes[0].style.flexGrow = 0.25; - subnodes[1].style.flexGrow = 0.50; - subnodes[2].style.flexGrow = 0.25; - - // In this scenario a width of 350 results in a positive violation of 200. - // The first and third child components specify a flex grow factor of 0.25 and will flex by 50. - // The second child component specifies a flex grow factor of 0.25 and will flex by 100. - static ASSizeRange kSize = {{350, 350}, {350, 350}}; - [self testStackLayoutSpecWithStyle:style sizeRange:kSize subnodes:subnodes identifier:nil]; -} - -- (void)testPositiveViolationIsDistributedEquallyAmongMixedChildren -{ - ASStackLayoutSpecStyle style = {.direction = ASStackLayoutDirectionHorizontal}; - - const CGSize kSubnodeSize = {50, 50}; - NSArray *subnodes = defaultSubnodesWithSameSize(kSubnodeSize, 0); - subnodes = [subnodes arrayByAddingObject:ASDisplayNodeWithBackgroundColor([UIColor yellowColor], kSubnodeSize)]; - - subnodes[0].style.flexShrink = 1; - subnodes[1].style.flexGrow = 1; - subnodes[2].style.flexShrink = 0; - subnodes[3].style.flexGrow = 1; - - // In this scenario a width of 400 results in a positive violation of 200. - // The first and third subnode specify a flex shrink factor of 1 and 0, respectively. They won't flex. - // The second and fourth subnode specify a flex grow factor of 1 and will flex by 100. - static ASSizeRange kSize = {{400, 400}, {400, 400}}; - [self testStackLayoutSpecWithStyle:style sizeRange:kSize subnodes:subnodes identifier:nil]; -} - -- (void)testPositiveViolationIsDistributedEquallyAmongMixedChildrenWithArbitraryFloats -{ - ASStackLayoutSpecStyle style = {.direction = ASStackLayoutDirectionHorizontal}; - - const CGSize kSubnodeSize = {50, 50}; - NSArray *subnodes = defaultSubnodesWithSameSize(kSubnodeSize, 0); - subnodes = [subnodes arrayByAddingObject:ASDisplayNodeWithBackgroundColor([UIColor yellowColor], kSubnodeSize)]; - - subnodes[0].style.flexShrink = 1.0; - subnodes[1].style.flexGrow = 0.5; - subnodes[2].style.flexShrink = 0.0; - subnodes[3].style.flexGrow = 0.5; - - // In this scenario a width of 400 results in a positive violation of 200. - // The first and third child components specify a flex shrink factor of 1 and 0, respectively. They won't flex. - // The second and fourth child components specify a flex grow factor of 0.5 and will flex by 100. - static ASSizeRange kSize = {{400, 400}, {400, 400}}; - [self testStackLayoutSpecWithStyle:style sizeRange:kSize subnodes:subnodes identifier:nil]; -} - -- (void)testPositiveViolationIsDistributedProportionallyAmongMixedChildren -{ - ASStackLayoutSpecStyle style = {.direction = ASStackLayoutDirectionVertical}; - - const CGSize kSubnodeSize = {50, 50}; - NSArray *subnodes = defaultSubnodesWithSameSize(kSubnodeSize, 0); - subnodes = [subnodes arrayByAddingObject:ASDisplayNodeWithBackgroundColor([UIColor yellowColor], kSubnodeSize)]; - - subnodes[0].style.flexShrink = 1; - subnodes[1].style.flexGrow = 3; - subnodes[2].style.flexShrink = 0; - subnodes[3].style.flexGrow = 1; - - // In this scenario a width of 400 results in a positive violation of 200. - // The first and third subnodes specify a flex shrink factor of 1 and 0, respectively. They won't flex. - // The second child subnode specifies a flex grow factor of 3 and will flex by 150. - // The fourth child subnode specifies a flex grow factor of 1 and will flex by 50. - static ASSizeRange kSize = {{400, 400}, {400, 400}}; - [self testStackLayoutSpecWithStyle:style sizeRange:kSize subnodes:subnodes identifier:nil]; -} - -- (void)testPositiveViolationIsDistributedProportionallyAmongMixedChildrenWithArbitraryFloats -{ - ASStackLayoutSpecStyle style = {.direction = ASStackLayoutDirectionVertical}; - - const CGSize kSubnodeSize = {50, 50}; - NSArray *subnodes = defaultSubnodesWithSameSize(kSubnodeSize, 0); - subnodes = [subnodes arrayByAddingObject:ASDisplayNodeWithBackgroundColor([UIColor yellowColor], kSubnodeSize)]; - - subnodes[0].style.flexShrink = 1.0; - subnodes[1].style.flexGrow = 0.75; - subnodes[2].style.flexShrink = 0.0; - subnodes[3].style.flexGrow = 0.25; - - // In this scenario a width of 400 results in a positive violation of 200. - // The first and third child components specify a flex shrink factor of 1 and 0, respectively. They won't flex. - // The second child component specifies a flex grow factor of 0.75 and will flex by 150. - // The fourth child component specifies a flex grow factor of 0.25 and will flex by 50. - static ASSizeRange kSize = {{400, 400}, {400, 400}}; - [self testStackLayoutSpecWithStyle:style sizeRange:kSize subnodes:subnodes identifier:nil]; -} - -- (void)testRemainingViolationIsAppliedProperlyToFirstFlexibleChild -{ - ASStackLayoutSpecStyle style = {.direction = ASStackLayoutDirectionVertical}; - - NSArray *subnodes = @[ - ASDisplayNodeWithBackgroundColor([UIColor greenColor], {50, 25}), - ASDisplayNodeWithBackgroundColor([UIColor blueColor], {50, 0}), - ASDisplayNodeWithBackgroundColor([UIColor redColor], {50, 100}) - ]; - - subnodes[0].style.flexGrow = 0; - subnodes[1].style.flexGrow = 1; - subnodes[2].style.flexGrow = 1; - - // In this scenario a width of 300 results in a positive violation of 175. - // The second and third subnodes specify a flex grow factor of 1 and will flex by 88 and 87, respectively. - static ASSizeRange kSize = {{300, 300}, {300, 300}}; - [self testStackLayoutSpecWithStyle:style sizeRange:kSize subnodes:subnodes identifier:nil]; -} - -- (void)testRemainingViolationIsAppliedProperlyToFirstFlexibleChildWithArbitraryFloats -{ - ASStackLayoutSpecStyle style = {.direction = ASStackLayoutDirectionVertical}; - - NSArray *subnodes = @[ - ASDisplayNodeWithBackgroundColor([UIColor greenColor], {50, 25}), - ASDisplayNodeWithBackgroundColor([UIColor blueColor], {50, 0}), - ASDisplayNodeWithBackgroundColor([UIColor redColor], {50, 100}) - ]; - - subnodes[0].style.flexGrow = 0.0; - subnodes[1].style.flexGrow = 0.5; - subnodes[2].style.flexGrow = 0.5; - - // In this scenario a width of 300 results in a positive violation of 175. - // The second and third child components specify a flex grow factor of 0.5 and will flex by 88 and 87, respectively. - static ASSizeRange kSize = {{300, 300}, {300, 300}}; - [self testStackLayoutSpecWithStyle:style sizeRange:kSize subnodes:subnodes identifier:nil]; -} - -- (void)testNegativeViolationIsDistributedBasedOnSize -{ - ASStackLayoutSpecStyle style = {.direction = ASStackLayoutDirectionHorizontal}; - - NSArray *subnodes = @[ - ASDisplayNodeWithBackgroundColor([UIColor greenColor], {300, 50}), - ASDisplayNodeWithBackgroundColor([UIColor blueColor], {100, 50}), - ASDisplayNodeWithBackgroundColor([UIColor redColor], {200, 50}) - ]; - - subnodes[0].style.flexShrink = 1; - subnodes[1].style.flexShrink = 0; - subnodes[2].style.flexShrink = 1; - - // In this scenario a width of 400 results in a negative violation of 200. - // The first and third subnodes specify a flex shrink factor of 1 and will flex by -120 and -80, respectively. - static ASSizeRange kSize = {{400, 400}, {400, 400}}; - [self testStackLayoutSpecWithStyle:style sizeRange:kSize subnodes:subnodes identifier:nil]; -} - -- (void)testNegativeViolationIsDistributedBasedOnSizeWithArbitraryFloats -{ - ASStackLayoutSpecStyle style = {.direction = ASStackLayoutDirectionHorizontal}; - - NSArray *subnodes = @[ - ASDisplayNodeWithBackgroundColor([UIColor greenColor], {300, 50}), - ASDisplayNodeWithBackgroundColor([UIColor blueColor], {100, 50}), - ASDisplayNodeWithBackgroundColor([UIColor redColor], {200, 50}) - ]; - - subnodes[0].style.flexShrink = 0.5; - subnodes[1].style.flexShrink = 0.0; - subnodes[2].style.flexShrink = 0.5; - - // In this scenario a width of 400 results in a negative violation of 200. - // The first and third child components specify a flex shrink factor of 0.5 and will flex by -120 and -80, respectively. - static ASSizeRange kSize = {{400, 400}, {400, 400}}; - [self testStackLayoutSpecWithStyle:style sizeRange:kSize subnodes:subnodes identifier:nil]; -} - -- (void)testNegativeViolationIsDistributedBasedOnSizeAndFlexFactor -{ - ASStackLayoutSpecStyle style = {.direction = ASStackLayoutDirectionVertical}; - - NSArray *subnodes = @[ - ASDisplayNodeWithBackgroundColor([UIColor greenColor], {50, 300}), - ASDisplayNodeWithBackgroundColor([UIColor blueColor], {50, 100}), - ASDisplayNodeWithBackgroundColor([UIColor redColor], {50, 200}) - ]; - - subnodes[0].style.flexShrink = 2; - subnodes[1].style.flexShrink = 1; - subnodes[2].style.flexShrink = 2; - - // In this scenario a width of 400 results in a negative violation of 200. - // The first and third subnodes specify a flex shrink factor of 2 and will flex by -109 and -72, respectively. - // The second subnode specifies a flex shrink factor of 1 and will flex by -18. - static ASSizeRange kSize = {{400, 400}, {400, 400}}; - [self testStackLayoutSpecWithStyle:style sizeRange:kSize subnodes:subnodes identifier:nil]; -} - -- (void)testNegativeViolationIsDistributedBasedOnSizeAndFlexFactorWithArbitraryFloats -{ - ASStackLayoutSpecStyle style = {.direction = ASStackLayoutDirectionVertical}; - - NSArray *subnodes = @[ - ASDisplayNodeWithBackgroundColor([UIColor greenColor], {50, 300}), - ASDisplayNodeWithBackgroundColor([UIColor blueColor], {50, 100}), - ASDisplayNodeWithBackgroundColor([UIColor redColor], {50, 200}) - ]; - - subnodes[0].style.flexShrink = 0.4; - subnodes[1].style.flexShrink = 0.2; - subnodes[2].style.flexShrink = 0.4; - - // In this scenario a width of 400 results in a negative violation of 200. - // The first and third child components specify a flex shrink factor of 0.4 and will flex by -109 and -72, respectively. - // The second child component specifies a flex shrink factor of 0.2 and will flex by -18. - static ASSizeRange kSize = {{400, 400}, {400, 400}}; - [self testStackLayoutSpecWithStyle:style sizeRange:kSize subnodes:subnodes identifier:nil]; -} - -- (void)testNegativeViolationIsDistributedBasedOnSizeAmongMixedChildrenChildren -{ - ASStackLayoutSpecStyle style = {.direction = ASStackLayoutDirectionHorizontal}; - - const CGSize kSubnodeSize = {150, 50}; - NSArray *subnodes = defaultSubnodesWithSameSize(kSubnodeSize, 0); - subnodes = [subnodes arrayByAddingObject:ASDisplayNodeWithBackgroundColor([UIColor yellowColor], kSubnodeSize)]; - - subnodes[0].style.flexGrow = 1; - subnodes[1].style.flexShrink = 1; - subnodes[2].style.flexGrow = 0; - subnodes[3].style.flexShrink = 1; - - // In this scenario a width of 400 results in a negative violation of 200. - // The first and third subnodes specify a flex grow factor of 1 and 0, respectively. They won't flex. - // The second and fourth subnodes specify a flex grow factor of 1 and will flex by -100. - static ASSizeRange kSize = {{400, 400}, {400, 400}}; - [self testStackLayoutSpecWithStyle:style sizeRange:kSize subnodes:subnodes identifier:nil]; -} - -- (void)testNegativeViolationIsDistributedBasedOnSizeAmongMixedChildrenWithArbitraryFloats -{ - ASStackLayoutSpecStyle style = {.direction = ASStackLayoutDirectionHorizontal}; - - const CGSize kSubnodeSize = {150, 50}; - NSArray *subnodes = defaultSubnodesWithSameSize(kSubnodeSize, 0); - subnodes = [subnodes arrayByAddingObject:ASDisplayNodeWithBackgroundColor([UIColor yellowColor], kSubnodeSize)]; - - subnodes[0].style.flexGrow = 1.0; - subnodes[1].style.flexShrink = 0.5; - subnodes[2].style.flexGrow = 0.0; - subnodes[3].style.flexShrink = 0.5; - - // In this scenario a width of 400 results in a negative violation of 200. - // The first and third child components specify a flex grow factor of 1 and 0, respectively. They won't flex. - // The second and fourth child components specify a flex shrink factor of 0.5 and will flex by -100. - static ASSizeRange kSize = {{400, 400}, {400, 400}}; - [self testStackLayoutSpecWithStyle:style sizeRange:kSize subnodes:subnodes identifier:nil]; -} - -- (void)testNegativeViolationIsDistributedBasedOnSizeAndFlexFactorAmongMixedChildren -{ - ASStackLayoutSpecStyle style = {.direction = ASStackLayoutDirectionVertical}; - - NSArray *subnodes = @[ - ASDisplayNodeWithBackgroundColor([UIColor greenColor], {50, 150}), - ASDisplayNodeWithBackgroundColor([UIColor blueColor], {50, 100}), - ASDisplayNodeWithBackgroundColor([UIColor redColor], {50, 150}), - ASDisplayNodeWithBackgroundColor([UIColor yellowColor], {50, 200}) - ]; - - subnodes[0].style.flexGrow = 1; - subnodes[1].style.flexShrink = 1; - subnodes[2].style.flexGrow = 0; - subnodes[3].style.flexShrink = 3; - - // In this scenario a width of 400 results in a negative violation of 200. - // The first and third subnodes specify a flex grow factor of 1 and 0, respectively. They won't flex. - // The second subnode specifies a flex grow factor of 1 and will flex by -28. - // The fourth subnode specifies a flex grow factor of 3 and will flex by -171. - static ASSizeRange kSize = {{400, 400}, {400, 400}}; - [self testStackLayoutSpecWithStyle:style sizeRange:kSize subnodes:subnodes identifier:nil]; -} - -- (void)testNegativeViolationIsDistributedBasedOnSizeAndFlexFactorAmongMixedChildrenArbitraryFloats -{ - ASStackLayoutSpecStyle style = {.direction = ASStackLayoutDirectionVertical}; - - NSArray *subnodes = @[ - ASDisplayNodeWithBackgroundColor([UIColor greenColor], {50, 150}), - ASDisplayNodeWithBackgroundColor([UIColor blueColor], {50, 100}), - ASDisplayNodeWithBackgroundColor([UIColor redColor], {50, 150}), - ASDisplayNodeWithBackgroundColor([UIColor yellowColor], {50, 200}) - ]; - - subnodes[0].style.flexGrow = 1.0; - subnodes[1].style.flexShrink = 0.25; - subnodes[2].style.flexGrow = 0.0; - subnodes[3].style.flexShrink = 0.75; - - // In this scenario a width of 400 results in a negative violation of 200. - // The first and third child components specify a flex grow factor of 1 and 0, respectively. They won't flex. - // The second child component specifies a flex shrink factor of 0.25 and will flex by -28. - // The fourth child component specifies a flex shrink factor of 0.75 and will flex by -171. - static ASSizeRange kSize = {{400, 400}, {400, 400}}; - [self testStackLayoutSpecWithStyle:style sizeRange:kSize subnodes:subnodes identifier:nil]; -} - -- (void)testNegativeViolationIsDistributedBasedOnSizeAndFlexFactorDoesNotShrinkToZero -{ - ASStackLayoutSpecStyle style = {.direction = ASStackLayoutDirectionHorizontal}; - - NSArray *subnodes = @[ - ASDisplayNodeWithBackgroundColor([UIColor greenColor], {300, 50}), - ASDisplayNodeWithBackgroundColor([UIColor blueColor], {100, 50}), - ASDisplayNodeWithBackgroundColor([UIColor redColor], {200, 50}) - ]; - - subnodes[0].style.flexShrink = 1; - subnodes[1].style.flexShrink = 2; - subnodes[2].style.flexShrink = 1; - - // In this scenario a width of 400 results in a negative violation of 200. - // The first and third subnodes specify a flex shrink factor of 1 and will flex by 50. - // The second subnode specifies a flex shrink factor of 2 and will flex by -57. It will have a width of 43. - static ASSizeRange kSize = {{400, 400}, {400, 400}}; - [self testStackLayoutSpecWithStyle:style sizeRange:kSize subnodes:subnodes identifier:nil]; -} - -- (void)testNegativeViolationIsDistributedBasedOnSizeAndFlexFactorDoesNotShrinkToZeroWithArbitraryFloats -{ - ASStackLayoutSpecStyle style = {.direction = ASStackLayoutDirectionHorizontal}; - - NSArray *subnodes = @[ - ASDisplayNodeWithBackgroundColor([UIColor greenColor], {300, 50}), - ASDisplayNodeWithBackgroundColor([UIColor blueColor], {100, 50}), - ASDisplayNodeWithBackgroundColor([UIColor redColor], {200, 50}) - ]; - - subnodes[0].style.flexShrink = 0.25; - subnodes[1].style.flexShrink = 0.50; - subnodes[2].style.flexShrink = 0.25; - - // In this scenario a width of 400 results in a negative violation of 200. - // The first and third child components specify a flex shrink factor of 0.25 and will flex by 50. - // The second child specifies a flex shrink factor of 0.50 and will flex by -57. It will have a width of 43. - static ASSizeRange kSize = {{400, 400}, {400, 400}}; - [self testStackLayoutSpecWithStyle:style sizeRange:kSize subnodes:subnodes identifier:nil]; -} - - -- (void)testNegativeViolationAndFlexFactorIsNotRespected -{ - ASStackLayoutSpecStyle style = {.direction = ASStackLayoutDirectionHorizontal}; - - NSArray *subnodes = @[ - ASDisplayNodeWithBackgroundColor([UIColor redColor], {50, 50}), - ASDisplayNodeWithBackgroundColor([UIColor yellowColor], CGSizeZero), - ]; - - subnodes[0].style.flexShrink = 0; - subnodes[1].style.flexShrink = 1; - - // In this scenario a width of 40 results in a negative violation of 10. - // The first child will not flex. - // The second child specifies a flex shrink factor of 1 but it has a zero size, so the factor won't be respected and it will not shrink. - static ASSizeRange kSize = {{40, 50}, {40, 50}}; - [self testStackLayoutSpecWithStyle:style sizeRange:kSize subnodes:subnodes identifier:nil]; -} - -- (void)testNestedStackLayoutStretchDoesNotViolateWidth -{ - ASStackLayoutSpec *stackLayoutSpec = [[ASStackLayoutSpec alloc] init]; // Default direction is horizontal - stackLayoutSpec.direction = ASStackLayoutDirectionHorizontal; - stackLayoutSpec.alignItems = ASStackLayoutAlignItemsStretch; - stackLayoutSpec.style.width = ASDimensionMake(100); - stackLayoutSpec.style.height = ASDimensionMake(100); - - ASDisplayNode *child = ASDisplayNodeWithBackgroundColor([UIColor redColor], {50, 50}); - stackLayoutSpec.children = @[child]; - - static ASSizeRange kSize = {{0, 0}, {300, INFINITY}}; - [self testStackLayoutSpec:stackLayoutSpec sizeRange:kSize subnodes:@[child] identifier:nil]; -} - -- (void)testHorizontalAndVerticalAlignments -{ - [self testStackLayoutSpecWithDirection:ASStackLayoutDirectionHorizontal itemsHorizontalAlignment:ASHorizontalAlignmentLeft itemsVerticalAlignment:ASVerticalAlignmentTop identifier:@"horizontalTopLeft"]; - [self testStackLayoutSpecWithDirection:ASStackLayoutDirectionHorizontal itemsHorizontalAlignment:ASHorizontalAlignmentMiddle itemsVerticalAlignment:ASVerticalAlignmentCenter identifier:@"horizontalCenter"]; - [self testStackLayoutSpecWithDirection:ASStackLayoutDirectionHorizontal itemsHorizontalAlignment:ASHorizontalAlignmentRight itemsVerticalAlignment:ASVerticalAlignmentBottom identifier:@"horizontalBottomRight"]; - [self testStackLayoutSpecWithDirection:ASStackLayoutDirectionVertical itemsHorizontalAlignment:ASHorizontalAlignmentLeft itemsVerticalAlignment:ASVerticalAlignmentTop identifier:@"verticalTopLeft"]; - [self testStackLayoutSpecWithDirection:ASStackLayoutDirectionVertical itemsHorizontalAlignment:ASHorizontalAlignmentMiddle itemsVerticalAlignment:ASVerticalAlignmentCenter identifier:@"verticalCenter"]; - [self testStackLayoutSpecWithDirection:ASStackLayoutDirectionVertical itemsHorizontalAlignment:ASHorizontalAlignmentRight itemsVerticalAlignment:ASVerticalAlignmentBottom identifier:@"verticalBottomRight"]; -} - -- (void)testDirectionChangeAfterSettingHorizontalAndVerticalAlignments -{ - ASStackLayoutSpec *stackLayoutSpec = [[ASStackLayoutSpec alloc] init]; // Default direction is horizontal - stackLayoutSpec.horizontalAlignment = ASHorizontalAlignmentRight; - stackLayoutSpec.verticalAlignment = ASVerticalAlignmentCenter; - XCTAssertEqual(stackLayoutSpec.alignItems, ASStackLayoutAlignItemsCenter); - XCTAssertEqual(stackLayoutSpec.justifyContent, ASStackLayoutJustifyContentEnd); - - stackLayoutSpec.direction = ASStackLayoutDirectionVertical; - XCTAssertEqual(stackLayoutSpec.alignItems, ASStackLayoutAlignItemsEnd); - XCTAssertEqual(stackLayoutSpec.justifyContent, ASStackLayoutJustifyContentCenter); -} - -- (void)testAlignItemsAndJustifyContentRestrictionsIfHorizontalAndVerticalAlignmentsAreUsed -{ - ASStackLayoutSpec *stackLayoutSpec = [[ASStackLayoutSpec alloc] init]; - - // No assertions should be thrown here because alignments are not used - stackLayoutSpec.alignItems = ASStackLayoutAlignItemsEnd; - stackLayoutSpec.justifyContent = ASStackLayoutJustifyContentEnd; - - // Set alignments and assert that assertions are thrown - stackLayoutSpec.horizontalAlignment = ASHorizontalAlignmentMiddle; - stackLayoutSpec.verticalAlignment = ASVerticalAlignmentCenter; - XCTAssertThrows(stackLayoutSpec.alignItems = ASStackLayoutAlignItemsEnd); - XCTAssertThrows(stackLayoutSpec.justifyContent = ASStackLayoutJustifyContentEnd); - - // Unset alignments. alignItems and justifyContent should not be changed - stackLayoutSpec.horizontalAlignment = ASHorizontalAlignmentNone; - stackLayoutSpec.verticalAlignment = ASVerticalAlignmentNone; - XCTAssertEqual(stackLayoutSpec.alignItems, ASStackLayoutAlignItemsCenter); - XCTAssertEqual(stackLayoutSpec.justifyContent, ASStackLayoutJustifyContentCenter); - - // Now that alignments are none, setting alignItems and justifyContent should be allowed again - stackLayoutSpec.alignItems = ASStackLayoutAlignItemsEnd; - stackLayoutSpec.justifyContent = ASStackLayoutJustifyContentEnd; - XCTAssertEqual(stackLayoutSpec.alignItems, ASStackLayoutAlignItemsEnd); - XCTAssertEqual(stackLayoutSpec.justifyContent, ASStackLayoutJustifyContentEnd); -} - -#pragma mark - Baseline alignment tests - -- (void)testBaselineAlignment -{ - [self testStackLayoutSpecWithBaselineAlignment:ASStackLayoutAlignItemsBaselineFirst identifier:@"baselineFirst"]; - [self testStackLayoutSpecWithBaselineAlignment:ASStackLayoutAlignItemsBaselineLast identifier:@"baselineLast"]; -} - -- (void)testNestedBaselineAlignments -{ - NSArray *textNodes = defaultTextNodes(); - - ASDisplayNode *stretchedNode = [[ASDisplayNode alloc] init]; - stretchedNode.layerBacked = YES; - stretchedNode.backgroundColor = [UIColor greenColor]; - stretchedNode.style.alignSelf = ASStackLayoutAlignSelfStretch; - stretchedNode.style.height = ASDimensionMake(100); - - ASStackLayoutSpec *verticalStack = [ASStackLayoutSpec verticalStackLayoutSpec]; - verticalStack.children = @[stretchedNode, textNodes[1]]; - verticalStack.style.flexShrink = 1.0; - - ASStackLayoutSpec *horizontalStack = [ASStackLayoutSpec horizontalStackLayoutSpec]; - horizontalStack.children = @[textNodes[0], verticalStack]; - horizontalStack.alignItems = ASStackLayoutAlignItemsBaselineLast; - - NSArray *subnodes = @[textNodes[0], textNodes[1], stretchedNode]; - - static ASSizeRange kSize = ASSizeRangeMake(CGSizeMake(150, 0), CGSizeMake(150, CGFLOAT_MAX)); - [self testStackLayoutSpec:horizontalStack sizeRange:kSize subnodes:subnodes identifier:nil]; -} - -- (void)testBaselineAlignmentWithSpaceBetween -{ - NSArray *textNodes = defaultTextNodes(); - - ASStackLayoutSpec *stackLayoutSpec = [ASStackLayoutSpec horizontalStackLayoutSpec]; - stackLayoutSpec.children = textNodes; - stackLayoutSpec.alignItems = ASStackLayoutAlignItemsBaselineFirst; - stackLayoutSpec.justifyContent = ASStackLayoutJustifyContentSpaceBetween; - - static ASSizeRange kSize = ASSizeRangeMake(CGSizeMake(300, 0), CGSizeMake(300, CGFLOAT_MAX)); - [self testStackLayoutSpec:stackLayoutSpec sizeRange:kSize subnodes:textNodes identifier:nil]; -} - -- (void)testBaselineAlignmentWithStretchedItem -{ - NSArray *textNodes = defaultTextNodes(); - - ASDisplayNode *stretchedNode = [[ASDisplayNode alloc] init]; - stretchedNode.layerBacked = YES; - stretchedNode.backgroundColor = [UIColor greenColor]; - stretchedNode.style.alignSelf = ASStackLayoutAlignSelfStretch; - stretchedNode.style.flexShrink = 1.0; - stretchedNode.style.flexGrow = 1.0; - - NSMutableArray *children = [NSMutableArray arrayWithArray:textNodes]; - [children insertObject:stretchedNode atIndex:1]; - - ASStackLayoutSpec *stackLayoutSpec = [ASStackLayoutSpec horizontalStackLayoutSpec]; - stackLayoutSpec.children = children; - stackLayoutSpec.alignItems = ASStackLayoutAlignItemsBaselineLast; - stackLayoutSpec.justifyContent = ASStackLayoutJustifyContentSpaceBetween; - - static ASSizeRange kSize = ASSizeRangeMake(CGSizeMake(300, 0), CGSizeMake(300, CGFLOAT_MAX)); - [self testStackLayoutSpec:stackLayoutSpec sizeRange:kSize subnodes:children identifier:nil]; -} - -#pragma mark - Flex wrap and item spacings test - -- (void)testFlexWrapWithItemSpacings -{ - ASStackLayoutSpecStyle style = { - .spacing = 50, - .direction = ASStackLayoutDirectionHorizontal, - .flexWrap = ASStackLayoutFlexWrapWrap, - .alignContent = ASStackLayoutAlignContentStart, - .lineSpacing = 5, - }; - - CGSize subnodeSize = {50, 50}; - NSArray *subnodes = @[ - ASDisplayNodeWithBackgroundColor([UIColor redColor], subnodeSize), - ASDisplayNodeWithBackgroundColor([UIColor yellowColor], subnodeSize), - ASDisplayNodeWithBackgroundColor([UIColor blueColor], subnodeSize), - ]; - - for (ASDisplayNode *subnode in subnodes) { - subnode.style.spacingBefore = 5; - subnode.style.spacingAfter = 5; - } - - // 3 items, each item has a size of {50, 50} - // width is 230px, enough to fit all items without taking all spacings into account - // Test that all spacings are included and therefore the last item is pushed to a second line. - // See: https://github.com/TextureGroup/Texture/pull/472 - static ASSizeRange kSize = {{230, 300}, {230, 300}}; - [self testStackLayoutSpecWithStyle:style sizeRange:kSize subnodes:subnodes identifier:nil]; -} - -- (void)testFlexWrapWithItemSpacingsBeingResetOnNewLines -{ - ASStackLayoutSpecStyle style = { - .spacing = 5, - .direction = ASStackLayoutDirectionHorizontal, - .flexWrap = ASStackLayoutFlexWrapWrap, - .alignContent = ASStackLayoutAlignContentStart, - .lineSpacing = 5, - }; - - CGSize subnodeSize = {50, 50}; - NSArray *subnodes = @[ - // 1st line - ASDisplayNodeWithBackgroundColor([UIColor redColor], subnodeSize), - ASDisplayNodeWithBackgroundColor([UIColor yellowColor], subnodeSize), - ASDisplayNodeWithBackgroundColor([UIColor blueColor], subnodeSize), - // 2nd line - ASDisplayNodeWithBackgroundColor([UIColor magentaColor], subnodeSize), - ASDisplayNodeWithBackgroundColor([UIColor greenColor], subnodeSize), - ASDisplayNodeWithBackgroundColor([UIColor cyanColor], subnodeSize), - // 3rd line - ASDisplayNodeWithBackgroundColor([UIColor brownColor], subnodeSize), - ASDisplayNodeWithBackgroundColor([UIColor orangeColor], subnodeSize), - ASDisplayNodeWithBackgroundColor([UIColor purpleColor], subnodeSize), - ]; - - for (ASDisplayNode *subnode in subnodes) { - subnode.style.spacingBefore = 5; - subnode.style.spacingAfter = 5; - } - - // 3 lines, each line has 3 items, each item has a size of {50, 50} - // width is 190px, enough to fit 3 items into a line - // Test that interitem spacing is reset on new lines. Otherwise, lines after the 1st line would have only 2 items. - // See: https://github.com/TextureGroup/Texture/pull/472 - static ASSizeRange kSize = {{190, 300}, {190, 300}}; - [self testStackLayoutSpecWithStyle:style sizeRange:kSize subnodes:subnodes identifier:nil]; -} - -#pragma mark - Content alignment tests - -- (void)testAlignContentUnderflow -{ - // 3 lines, each line has 2 items, each item has a size of {50, 50} - // width is 110px. It's 10px bigger than the required width of each line (110px vs 100px) to test that items are still correctly collected into lines - static ASSizeRange kSize = {{110, 300}, {110, 300}}; - [self testStackLayoutSpecWithAlignContent:ASStackLayoutAlignContentStart sizeRange:kSize identifier:@"alignContentStart"]; - [self testStackLayoutSpecWithAlignContent:ASStackLayoutAlignContentCenter sizeRange:kSize identifier:@"alignContentCenter"]; - [self testStackLayoutSpecWithAlignContent:ASStackLayoutAlignContentEnd sizeRange:kSize identifier:@"alignContentEnd"]; - [self testStackLayoutSpecWithAlignContent:ASStackLayoutAlignContentSpaceBetween sizeRange:kSize identifier:@"alignContentSpaceBetween"]; - [self testStackLayoutSpecWithAlignContent:ASStackLayoutAlignContentSpaceAround sizeRange:kSize identifier:@"alignContentSpaceAround"]; - [self testStackLayoutSpecWithAlignContent:ASStackLayoutAlignContentStretch sizeRange:kSize identifier:@"alignContentStretch"]; -} - -- (void)testAlignContentOverflow -{ - // 6 lines, each line has 1 item, each item has a size of {50, 50} - // width is 40px. It's 10px smaller than the width of each item (40px vs 50px) to test that items are still correctly collected into lines - static ASSizeRange kSize = {{40, 260}, {40, 260}}; - [self testStackLayoutSpecWithAlignContent:ASStackLayoutAlignContentStart sizeRange:kSize identifier:@"alignContentStart"]; - [self testStackLayoutSpecWithAlignContent:ASStackLayoutAlignContentCenter sizeRange:kSize identifier:@"alignContentCenter"]; - [self testStackLayoutSpecWithAlignContent:ASStackLayoutAlignContentEnd sizeRange:kSize identifier:@"alignContentEnd"]; - [self testStackLayoutSpecWithAlignContent:ASStackLayoutAlignContentSpaceBetween sizeRange:kSize identifier:@"alignContentSpaceBetween"]; - [self testStackLayoutSpecWithAlignContent:ASStackLayoutAlignContentSpaceAround sizeRange:kSize identifier:@"alignContentSpaceAround"]; -} - -- (void)testAlignContentWithUnconstrainedCrossSize -{ - // 3 lines, each line has 2 items, each item has a size of {50, 50} - // width is 110px. It's 10px bigger than the required width of each line (110px vs 100px) to test that items are still correctly collected into lines - // height is unconstrained. It causes no cross size violation and the end results are all similar to ASStackLayoutAlignContentStart. - static ASSizeRange kSize = {{110, 0}, {110, CGFLOAT_MAX}}; - [self testStackLayoutSpecWithAlignContent:ASStackLayoutAlignContentStart sizeRange:kSize identifier:nil]; - [self testStackLayoutSpecWithAlignContent:ASStackLayoutAlignContentCenter sizeRange:kSize identifier:nil]; - [self testStackLayoutSpecWithAlignContent:ASStackLayoutAlignContentEnd sizeRange:kSize identifier:nil]; - [self testStackLayoutSpecWithAlignContent:ASStackLayoutAlignContentSpaceBetween sizeRange:kSize identifier:nil]; - [self testStackLayoutSpecWithAlignContent:ASStackLayoutAlignContentSpaceAround sizeRange:kSize identifier:nil]; - [self testStackLayoutSpecWithAlignContent:ASStackLayoutAlignContentStretch sizeRange:kSize identifier:nil]; -} - -- (void)testAlignContentStretchAndOtherAlignments -{ - ASStackLayoutSpecStyle style = { - .direction = ASStackLayoutDirectionHorizontal, - .flexWrap = ASStackLayoutFlexWrapWrap, - .alignContent = ASStackLayoutAlignContentStretch, - .alignItems = ASStackLayoutAlignItemsStart, - }; - - CGSize subnodeSize = {50, 50}; - NSArray *subnodes = @[ - // 1st line - ASDisplayNodeWithBackgroundColor([UIColor redColor], subnodeSize), - ASDisplayNodeWithBackgroundColor([UIColor yellowColor], subnodeSize), - // 2nd line - ASDisplayNodeWithBackgroundColor([UIColor blueColor], subnodeSize), - ASDisplayNodeWithBackgroundColor([UIColor magentaColor], subnodeSize), - // 3rd line - ASDisplayNodeWithBackgroundColor([UIColor greenColor], subnodeSize), - ASDisplayNodeWithBackgroundColor([UIColor cyanColor], subnodeSize), - ]; - - subnodes[1].style.alignSelf = ASStackLayoutAlignSelfStart; - subnodes[3].style.alignSelf = ASStackLayoutAlignSelfCenter; - subnodes[5].style.alignSelf = ASStackLayoutAlignSelfEnd; - - // 3 lines, each line has 2 items, each item has a size of {50, 50} - // width is 110px. It's 10px bigger than the required width of each line (110px vs 100px) to test that items are still correctly collected into lines - static ASSizeRange kSize = {{110, 300}, {110, 300}}; - [self testStackLayoutSpecWithStyle:style sizeRange:kSize subnodes:subnodes identifier:nil]; -} - -#pragma mark - Line spacing tests - -- (void)testAlignContentAndLineSpacingUnderflow -{ - // 3 lines, each line has 2 items, each item has a size of {50, 50} - // 10px between lines - // width is 110px. It's 10px bigger than the required width of each line (110px vs 100px) to test that items are still correctly collected into lines - static ASSizeRange kSize = {{110, 320}, {110, 320}}; - [self testStackLayoutSpecWithAlignContent:ASStackLayoutAlignContentStart lineSpacing:10 sizeRange:kSize identifier:@"alignContentStart"]; - [self testStackLayoutSpecWithAlignContent:ASStackLayoutAlignContentCenter lineSpacing:10 sizeRange:kSize identifier:@"alignContentCenter"]; - [self testStackLayoutSpecWithAlignContent:ASStackLayoutAlignContentEnd lineSpacing:10 sizeRange:kSize identifier:@"alignContentEnd"]; - [self testStackLayoutSpecWithAlignContent:ASStackLayoutAlignContentSpaceBetween lineSpacing:10 sizeRange:kSize identifier:@"alignContentSpaceBetween"]; - [self testStackLayoutSpecWithAlignContent:ASStackLayoutAlignContentSpaceAround lineSpacing:10 sizeRange:kSize identifier:@"alignContentSpaceAround"]; - [self testStackLayoutSpecWithAlignContent:ASStackLayoutAlignContentStretch lineSpacing:10 sizeRange:kSize identifier:@"alignContentStretch"]; -} - -- (void)testAlignContentAndLineSpacingOverflow -{ - // 6 lines, each line has 1 item, each item has a size of {50, 50} - // 10px between lines - // width is 40px. It's 10px smaller than the width of each item (40px vs 50px) to test that items are still correctly collected into lines - static ASSizeRange kSize = {{40, 310}, {40, 310}}; - [self testStackLayoutSpecWithAlignContent:ASStackLayoutAlignContentStart lineSpacing:10 sizeRange:kSize identifier:@"alignContentStart"]; - [self testStackLayoutSpecWithAlignContent:ASStackLayoutAlignContentCenter lineSpacing:10 sizeRange:kSize identifier:@"alignContentCenter"]; - [self testStackLayoutSpecWithAlignContent:ASStackLayoutAlignContentEnd lineSpacing:10 sizeRange:kSize identifier:@"alignContentEnd"]; - [self testStackLayoutSpecWithAlignContent:ASStackLayoutAlignContentSpaceBetween lineSpacing:10 sizeRange:kSize identifier:@"alignContentSpaceBetween"]; - [self testStackLayoutSpecWithAlignContent:ASStackLayoutAlignContentSpaceAround lineSpacing:10 sizeRange:kSize identifier:@"alignContentSpaceAround"]; -} - -@end diff --git a/submodules/AsyncDisplayKit/Tests/ASTLayoutFixture.h b/submodules/AsyncDisplayKit/Tests/ASTLayoutFixture.h deleted file mode 100644 index 23b2024126..0000000000 --- a/submodules/AsyncDisplayKit/Tests/ASTLayoutFixture.h +++ /dev/null @@ -1,60 +0,0 @@ -// -// ASTLayoutFixture.h -// Texture -// -// Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -#import "ASTestCase.h" -#import "ASLayoutTestNode.h" - -NS_ASSUME_NONNULL_BEGIN - -AS_SUBCLASSING_RESTRICTED -@interface ASTLayoutFixture : NSObject - -/// The correct layout. The root should be unpositioned (same as -calculatedLayout). -@property (nonatomic, nullable) ASLayout *layout; - -/// The layoutSpecBlocks for non-leaf nodes. -@property (nonatomic, readonly) NSMapTable *layoutSpecBlocks; - -@property (nonatomic, readonly) ASLayoutTestNode *rootNode; - -@property (nonatomic, readonly) NSSet *allNodes; - -/// Get the (correct) layout for the specified node. -- (ASLayout *)layoutForNode:(ASLayoutTestNode *)node; - -/// Add this to the list of expected size ranges for the given node. -- (void)addSizeRange:(ASSizeRange)sizeRange forNode:(ASLayoutTestNode *)node; - -/// If you have a node that wants a size different than it gets, set it here. -/// For any leaf nodes that you don't call this on, the node will return the correct size -/// based on the fixture's layout. This is useful for triggering multipass stack layout. -- (void)setReturnedSize:(CGSize)size forNode:(ASLayoutTestNode *)node; - -/// Get the first expected size range for the node. -- (ASSizeRange)firstSizeRangeForNode:(ASLayoutTestNode *)node; - -/// Enumerate all the size ranges for all the nodes using the provided block. -- (void)withSizeRangesForAllNodesUsingBlock:(void (^)(ASLayoutTestNode *node, ASSizeRange sizeRange))block; - -/// Enumerate all the size ranges for the node. -- (void)withSizeRangesForNode:(ASLayoutTestNode *)node block:(void (^)(ASSizeRange sizeRange))block; - -/// Configure the nodes for this fixture. Set testSize on leaf nodes, layoutSpecBlock on container nodes. -- (void)apply; - -@end - -@interface ASLayout (TestHelpers) - -@property (nonatomic, readonly) NSArray *allNodes; - -@end - -NS_ASSUME_NONNULL_END diff --git a/submodules/AsyncDisplayKit/Tests/ASTLayoutFixture.mm b/submodules/AsyncDisplayKit/Tests/ASTLayoutFixture.mm deleted file mode 100644 index 7b12cd4b59..0000000000 --- a/submodules/AsyncDisplayKit/Tests/ASTLayoutFixture.mm +++ /dev/null @@ -1,139 +0,0 @@ -// -// ASTLayoutFixture.mm -// Texture -// -// Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import "ASTLayoutFixture.h" - -@interface ASTLayoutFixture () - -/// The size ranges against which nodes are expected to be measured. -@property (nonatomic, readonly) NSMapTable *> *sizeRanges; - -/// The overridden returned sizes for nodes where you want to trigger multipass layout. -@property (nonatomic, readonly) NSMapTable *returnedSizes; - -@end - -@implementation ASTLayoutFixture - -- (instancetype)init -{ - if (self = [super init]) { - _sizeRanges = [NSMapTable mapTableWithKeyOptions:NSMapTableObjectPointerPersonality valueOptions:NSMapTableStrongMemory]; - _layoutSpecBlocks = [NSMapTable mapTableWithKeyOptions:NSMapTableObjectPointerPersonality valueOptions:NSMapTableStrongMemory]; - _returnedSizes = [NSMapTable mapTableWithKeyOptions:NSMapTableObjectPointerPersonality valueOptions:NSMapTableStrongMemory]; - - } - return self; -} - -- (void)addSizeRange:(ASSizeRange)sizeRange forNode:(ASLayoutTestNode *)node -{ - auto ranges = [_sizeRanges objectForKey:node]; - if (ranges == nil) { - ranges = [[NSMutableArray alloc] init]; - [_sizeRanges setObject:ranges forKey:node]; - } - [ranges addObject:[NSValue valueWithBytes:&sizeRange objCType:@encode(ASSizeRange)]]; -} - -- (void)setReturnedSize:(CGSize)size forNode:(ASLayoutTestNode *)node -{ - [_returnedSizes setObject:[NSValue valueWithCGSize:size] forKey:node]; -} - -- (ASSizeRange)firstSizeRangeForNode:(ASLayoutTestNode *)node -{ - const auto val = [_sizeRanges objectForKey:node].firstObject; - ASSizeRange r; - [val getValue:&r]; - return r; -} - -- (void)withSizeRangesForAllNodesUsingBlock:(void (^)(ASLayoutTestNode * _Nonnull, ASSizeRange))block -{ - for (ASLayoutTestNode *node in self.allNodes) { - [self withSizeRangesForNode:node block:^(ASSizeRange sizeRange) { - block(node, sizeRange); - }]; - } -} - -- (void)withSizeRangesForNode:(ASLayoutTestNode *)node block:(void (^)(ASSizeRange))block -{ - for (NSValue *value in [_sizeRanges objectForKey:node]) { - ASSizeRange r; - [value getValue:&r]; - block(r); - } -} - -- (ASLayout *)layoutForNode:(ASLayoutTestNode *)node -{ - NSMutableArray *allLayouts = [NSMutableArray array]; - [ASTLayoutFixture collectAllLayoutsFromLayout:self.layout array:allLayouts]; - for (ASLayout *layout in allLayouts) { - if (layout.layoutElement == node) { - return layout; - } - } - return nil; -} - -/// A very dumb tree iteration approach. NSEnumerator or something would be way better. -+ (void)collectAllLayoutsFromLayout:(ASLayout *)layout array:(NSMutableArray *)array -{ - [array addObject:layout]; - for (ASLayout *sublayout in layout.sublayouts) { - [self collectAllLayoutsFromLayout:sublayout array:array]; - } -} - -- (ASLayoutTestNode *)rootNode -{ - return (ASLayoutTestNode *)self.layout.layoutElement; -} - -- (NSSet *)allNodes -{ - const auto allLayouts = [NSMutableArray array]; - [ASTLayoutFixture collectAllLayoutsFromLayout:self.layout array:allLayouts]; - return [NSSet setWithArray:[allLayouts valueForKey:@"layoutElement"]]; -} - -- (void)apply -{ - // Update layoutSpecBlock for parent nodes, set automatic subnode management - for (ASDisplayNode *node in _layoutSpecBlocks) { - const auto block = [_layoutSpecBlocks objectForKey:node]; - if (node.layoutSpecBlock != block) { - node.automaticallyManagesSubnodes = YES; - node.layoutSpecBlock = block; - [node setNeedsLayout]; - } - } - - [self setTestSizesOfLeafNodesInLayout:self.layout]; -} - -/// Go through the given layout, and for all the leaf nodes, set their preferredSize -/// to the layout size if needed, then call -setNeedsLayout -- (void)setTestSizesOfLeafNodesInLayout:(ASLayout *)layout -{ - const auto node = (ASLayoutTestNode *)layout.layoutElement; - if (layout.sublayouts.count == 0) { - const auto override = [self.returnedSizes objectForKey:node]; - node.testSize = override ? override.CGSizeValue : layout.size; - } else { - node.testSize = CGSizeZero; - for (ASLayout *sublayout in layout.sublayouts) { - [self setTestSizesOfLeafNodesInLayout:sublayout]; - } - } -} - -@end diff --git a/submodules/AsyncDisplayKit/Tests/ASTabBarControllerTests.mm b/submodules/AsyncDisplayKit/Tests/ASTabBarControllerTests.mm deleted file mode 100644 index 764ab9b545..0000000000 --- a/submodules/AsyncDisplayKit/Tests/ASTabBarControllerTests.mm +++ /dev/null @@ -1,41 +0,0 @@ -// -// ASTabBarControllerTests.mm -// Texture -// -// Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import -#import -#import - -@interface ASTabBarControllerTests: XCTestCase - -@end - -@implementation ASTabBarControllerTests - -- (void)testTabBarControllerSelectIndex { - ASViewController *firstViewController = [ASViewController new]; - ASViewController *secondViewController = [ASViewController new]; - NSArray *viewControllers = @[firstViewController, secondViewController]; - ASTabBarController *tabBarController = [ASTabBarController new]; - [tabBarController setViewControllers:viewControllers]; - [tabBarController setSelectedIndex:1]; - XCTAssertTrue([tabBarController.viewControllers isEqualToArray:viewControllers]); - XCTAssertEqual(tabBarController.selectedViewController, secondViewController); -} - -- (void)testTabBarControllerSelectViewController { - ASViewController *firstViewController = [ASViewController new]; - ASViewController *secondViewController = [ASViewController new]; - NSArray *viewControllers = @[firstViewController, secondViewController]; - ASTabBarController *tabBarController = [ASTabBarController new]; - [tabBarController setViewControllers:viewControllers]; - [tabBarController setSelectedViewController:secondViewController]; - XCTAssertTrue([tabBarController.viewControllers isEqualToArray:viewControllers]); - XCTAssertEqual(tabBarController.selectedViewController, secondViewController); -} - -@end diff --git a/submodules/AsyncDisplayKit/Tests/ASTableViewTests.mm b/submodules/AsyncDisplayKit/Tests/ASTableViewTests.mm deleted file mode 100644 index 7295b20ba5..0000000000 --- a/submodules/AsyncDisplayKit/Tests/ASTableViewTests.mm +++ /dev/null @@ -1,930 +0,0 @@ -// -// ASTableViewTests.mm -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wdocumentation" -#import -#pragma clang diagnostic pop - -#import -#import -#import -#import -#import -#import -#import -#import - -#import "ASXCTExtensions.h" - -#define NumberOfSections 10 -#define NumberOfReloadIterations 50 - -@interface ASTestDataController : ASDataController -@property (nonatomic) int numberOfAllNodesRelayouts; -@end - -@implementation ASTestDataController - -- (void)relayoutAllNodesWithInvalidationBlock:(nullable void (^)())invalidationBlock -{ - _numberOfAllNodesRelayouts++; - [super relayoutAllNodesWithInvalidationBlock:invalidationBlock]; -} - -@end - -@interface UITableView (Testing) -// This will start recording all editing calls to UITableView -// into the provided array. -// Make sure to call [UITableView deswizzleInstanceMethods] to reset this. -+ (void)as_recordEditingCallsIntoArray:(NSMutableArray *)selectors; -@end - -@interface ASTestTableView : ASTableView -@property (nonatomic) void (^willDeallocBlock)(ASTableView *tableView); -@end - -@implementation ASTestTableView - -- (instancetype)__initWithFrame:(CGRect)frame style:(UITableViewStyle)style -{ - - return [super _initWithFrame:frame style:style dataControllerClass:[ASTestDataController class] owningNode:nil eventLog:nil]; -} - -- (ASTestDataController *)testDataController -{ - return (ASTestDataController *)self.dataController; -} - -- (void)dealloc -{ - if (_willDeallocBlock) { - _willDeallocBlock(self); - } -} - -@end - -@interface ASTableViewTestDelegate : NSObject -@property (nonatomic) void (^willDeallocBlock)(ASTableViewTestDelegate *delegate); -@property (nonatomic) CGFloat headerHeight; -@property (nonatomic) CGFloat footerHeight; -@end - -@implementation ASTableViewTestDelegate - -- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section -{ - return 0; -} - -- (ASCellNode *)tableView:(ASTableView *)tableView nodeForRowAtIndexPath:(NSIndexPath *)indexPath -{ - return nil; -} - -- (ASCellNodeBlock)tableView:(ASTableView *)tableView nodeBlockForRowAtIndexPath:(NSIndexPath *)indexPath -{ - return nil; -} - -- (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section -{ - return _footerHeight; -} - -- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section -{ - return _headerHeight; -} - -- (void)dealloc -{ - if (_willDeallocBlock) { - _willDeallocBlock(self); - } -} - -@end - -@interface ASTestTextCellNode : ASTextCellNode -/** Calculated by counting how many times -layoutSpecThatFits: is called on the main thread. */ -@property (nonatomic) int numberOfLayoutsOnMainThread; -@end - -@implementation ASTestTextCellNode - -- (ASLayoutSpec *)layoutSpecThatFits:(ASSizeRange)constrainedSize -{ - if ([NSThread isMainThread]) { - _numberOfLayoutsOnMainThread++; - } - return [super layoutSpecThatFits:constrainedSize]; -} - -@end - -@interface ASTableViewFilledDataSource : NSObject -@property (nonatomic) BOOL usesSectionIndex; -@property (nonatomic) NSInteger numberOfSections; -@property (nonatomic) NSInteger rowsPerSection; -@property (nonatomic, nullable) ASCellNodeBlock(^nodeBlockForItem)(NSIndexPath *); -@end - -@implementation ASTableViewFilledDataSource - -- (instancetype)init -{ - self = [super init]; - if (self != nil) { - _numberOfSections = NumberOfSections; - _rowsPerSection = 20; - } - return self; -} - -- (BOOL)respondsToSelector:(SEL)aSelector -{ - if (aSelector == @selector(sectionIndexTitlesForTableView:) || aSelector == @selector(tableView:sectionForSectionIndexTitle:atIndex:)) { - return _usesSectionIndex; - } else { - return [super respondsToSelector:aSelector]; - } -} - -- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView -{ - return _numberOfSections; -} - -- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section -{ - return _rowsPerSection; -} - -- (ASCellNode *)tableView:(ASTableView *)tableView nodeForRowAtIndexPath:(NSIndexPath *)indexPath -{ - ASTestTextCellNode *textCellNode = [ASTestTextCellNode new]; - textCellNode.text = indexPath.description; - - return textCellNode; -} - -- (ASCellNodeBlock)tableView:(ASTableView *)tableView nodeBlockForRowAtIndexPath:(NSIndexPath *)indexPath -{ - if (_nodeBlockForItem) { - return _nodeBlockForItem(indexPath); - } - - return ^{ - ASTestTextCellNode *textCellNode = [ASTestTextCellNode new]; - textCellNode.text = [NSString stringWithFormat:@"{%d, %d}", (int)indexPath.section, (int)indexPath.row]; - textCellNode.backgroundColor = [UIColor whiteColor]; - return textCellNode; - }; -} - -- (nullable NSArray *)sectionIndexTitlesForTableView:(UITableView *)tableView -{ - return @[ @"A", @"B", @"C" ]; -} - -- (NSInteger)tableView:(UITableView *)tableView sectionForSectionIndexTitle:(NSString *)title atIndex:(NSInteger)index -{ - return 0; -} - -@end - -@interface ASTableViewFilledDelegate : NSObject -@end - -@implementation ASTableViewFilledDelegate - -- (ASSizeRange)tableView:(ASTableView *)tableView constrainedSizeForRowAtIndexPath:(NSIndexPath *)indexPath -{ - return ASSizeRangeMake(CGSizeMake(10, 42)); -} - -@end - -@interface ASTableViewTests : XCTestCase -@property (nonatomic, retain) ASTableView *testTableView; -@end - -@implementation ASTableViewTests - -- (void)testDataSourceImplementsNecessaryMethods -{ - ASTestTableView *tableView = [[ASTestTableView alloc] __initWithFrame:CGRectMake(0, 0, 100, 400) - style:UITableViewStylePlain]; - - - - ASTableViewFilledDataSource *dataSource = (ASTableViewFilledDataSource *)[NSObject new]; - XCTAssertThrows((tableView.asyncDataSource = dataSource)); - - dataSource = [ASTableViewFilledDataSource new]; - XCTAssertNoThrow((tableView.asyncDataSource = dataSource)); -} - -- (void)testConstrainedSizeForRowAtIndexPath -{ - // Initial width of the table view is non-zero and all nodes are measured with this size. - // Any subsequent size change must trigger a relayout. - // Width and height are swapped so that a later size change will simulate a rotation - ASTestTableView *tableView = [[ASTestTableView alloc] __initWithFrame:CGRectMake(0, 0, 100, 400) - style:UITableViewStylePlain]; - - ASTableViewFilledDelegate *delegate = [ASTableViewFilledDelegate new]; - ASTableViewFilledDataSource *dataSource = [ASTableViewFilledDataSource new]; - - tableView.asyncDelegate = delegate; - tableView.asyncDataSource = dataSource; - - [tableView reloadData]; - [tableView waitUntilAllUpdatesAreCommitted]; - [tableView setNeedsLayout]; - [tableView layoutIfNeeded]; - - CGFloat separatorHeight = 1.0 / ASScreenScale(); - for (int section = 0; section < NumberOfSections; section++) { - for (int row = 0; row < [tableView numberOfRowsInSection:section]; row++) { - NSIndexPath *indexPath = [NSIndexPath indexPathForRow:row inSection:section]; - CGRect rect = [tableView rectForRowAtIndexPath:indexPath]; - XCTAssertEqual(rect.size.width, 100); // specified width should be ignored for table - XCTAssertEqual(rect.size.height, 42 + separatorHeight); - } - } -} - -// TODO: Convert this to ARC. -- (void)DISABLED_testTableViewDoesNotRetainItselfAndDelegate -{ - ASTestTableView *tableView = [[ASTestTableView alloc] __initWithFrame:CGRectZero style:UITableViewStylePlain]; - - __block BOOL tableViewDidDealloc = NO; - tableView.willDeallocBlock = ^(ASTableView *v){ - tableViewDidDealloc = YES; - }; - - ASTableViewTestDelegate *delegate = [[ASTableViewTestDelegate alloc] init]; - - __block BOOL delegateDidDealloc = NO; - delegate.willDeallocBlock = ^(ASTableViewTestDelegate *d){ - delegateDidDealloc = YES; - }; - - tableView.asyncDataSource = delegate; - tableView.asyncDelegate = delegate; - -// [delegate release]; - XCTAssertTrue(delegateDidDealloc, @"unexpected delegate lifetime:%@", delegate); - -// XCTAssertNoThrow([tableView release], @"unexpected exception when deallocating table view:%@", tableView); - XCTAssertTrue(tableViewDidDealloc, @"unexpected table view lifetime:%@", tableView); -} - -- (NSIndexSet *)randomIndexSet -{ - NSInteger randA = arc4random_uniform(NumberOfSections - 1); - NSInteger randB = arc4random_uniform(NumberOfSections - 1); - - return [NSIndexSet indexSetWithIndexesInRange:NSMakeRange(MIN(randA, randB), MAX(randA, randB) - MIN(randA, randB))]; -} - -- (NSArray *)randomIndexPathsExisting:(BOOL)existing rowCount:(NSInteger)rowCount -{ - NSMutableArray *indexPaths = [NSMutableArray array]; - [[self randomIndexSet] enumerateIndexesUsingBlock:^(NSUInteger idx, BOOL *stop) { - NSIndexPath *sectionIndex = [[NSIndexPath alloc] initWithIndex:idx]; - for (NSUInteger i = (existing ? 0 : rowCount); i < (existing ? rowCount : rowCount * 2); i++) { - // Maximize evility by sporadically skipping indicies 1/3rd of the time, but only if reloading existing rows - if (existing && arc4random_uniform(2) == 0) { - continue; - } - - NSIndexPath *indexPath = [sectionIndex indexPathByAddingIndex:i]; - [indexPaths addObject:indexPath]; - } - }]; - return indexPaths; -} - -- (void)DISABLED_testReloadData -{ - // Keep the viewport moderately sized so that new cells are loaded on scrolling - ASTableView *tableView = [[ASTestTableView alloc] __initWithFrame:CGRectMake(0, 0, 100, 500) - style:UITableViewStylePlain]; - - ASTableViewFilledDataSource *dataSource = [ASTableViewFilledDataSource new]; - - tableView.asyncDelegate = dataSource; - tableView.asyncDataSource = dataSource; - - XCTestExpectation *reloadDataExpectation = [self expectationWithDescription:@"reloadData"]; - - [tableView reloadDataWithCompletion:^{ - NSLog(@"*** Reload Complete ***"); - [reloadDataExpectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:5 handler:^(NSError *error) { - if (error) { - XCTFail(@"Expectation failed: %@", error); - } - }]; - - for (int i = 0; i < NumberOfReloadIterations; ++i) { - UITableViewRowAnimation rowAnimation = (arc4random_uniform(2) == 0 ? UITableViewRowAnimationMiddle : UITableViewRowAnimationNone); - BOOL animatedScroll = (arc4random_uniform(2) == 0 ? YES : NO); - BOOL reloadRowsInsteadOfSections = (arc4random_uniform(2) == 0 ? YES : NO); - NSTimeInterval runLoopDelay = ((arc4random_uniform(2) == 0) ? (1.0 / (1 + arc4random_uniform(500))) : 0); - BOOL useBeginEndUpdates = (arc4random_uniform(3) == 0 ? YES : NO); - - // instrument our instrumentation ;) - //NSLog(@"Iteration %03d: %@|%@|%@|%@|%g", i, (rowAnimation == UITableViewRowAnimationNone) ? @"NONE " : @"MIDDLE", animatedScroll ? @"ASCR" : @" ", reloadRowsInsteadOfSections ? @"ROWS" : @"SECS", useBeginEndUpdates ? @"BEGEND" : @" ", runLoopDelay); - - if (useBeginEndUpdates) { - [tableView beginUpdates]; - } - - if (reloadRowsInsteadOfSections) { - NSArray *indexPaths = [self randomIndexPathsExisting:YES rowCount:dataSource.rowsPerSection]; - //NSLog(@"reloading rows: %@", indexPaths); - [tableView reloadRowsAtIndexPaths:indexPaths withRowAnimation:rowAnimation]; - } else { - NSIndexSet *sections = [self randomIndexSet]; - //NSLog(@"reloading sections: %@", sections); - [tableView reloadSections:sections withRowAnimation:rowAnimation]; - } - - [tableView setContentOffset:CGPointMake(0, arc4random_uniform(tableView.contentSize.height - tableView.bounds.size.height)) animated:animatedScroll]; - - if (runLoopDelay > 0) { - // Run other stuff on the main queue for between 2ms and 1000ms. - [[NSRunLoop currentRunLoop] runUntilDate:[NSDate dateWithTimeIntervalSinceNow:runLoopDelay]]; - } - - if (useBeginEndUpdates) { - [tableView endUpdates]; - } - } -} - -- (void)testRelayoutAllNodesWithNonZeroSizeInitially -{ - // Initial width of the table view is non-zero and all nodes are measured with this size. - // Any subsequence size change must trigger a relayout. - CGSize tableViewFinalSize = CGSizeMake(100, 500); - // Width and height are swapped so that a later size change will simulate a rotation - ASTestTableView *tableView = [[ASTestTableView alloc] __initWithFrame:CGRectMake(0, 0, tableViewFinalSize.height, tableViewFinalSize.width) - style:UITableViewStylePlain]; - - ASTableViewFilledDataSource *dataSource = [ASTableViewFilledDataSource new]; - - tableView.asyncDelegate = dataSource; - tableView.asyncDataSource = dataSource; - - [tableView layoutIfNeeded]; - - XCTAssertEqual(tableView.testDataController.numberOfAllNodesRelayouts, 0); - [self triggerSizeChangeAndAssertRelayoutAllNodesForTableView:tableView newSize:tableViewFinalSize]; -} - -- (void)testRelayoutVisibleRowsWhenEditingModeIsChanged -{ - CGSize tableViewSize = CGSizeMake(100, 500); - ASTestTableView *tableView = [[ASTestTableView alloc] __initWithFrame:CGRectMake(0, 0, tableViewSize.width, tableViewSize.height) - style:UITableViewStylePlain]; - ASTableViewFilledDataSource *dataSource = [ASTableViewFilledDataSource new]; - // Currently this test requires that the text in the cell node fills the - // visible width, so we use the long description for the index path. - dataSource.nodeBlockForItem = ^(NSIndexPath *indexPath) { - return (ASCellNodeBlock)^{ - ASTestTextCellNode *textCellNode = [[ASTestTextCellNode alloc] init]; - textCellNode.text = indexPath.description; - return textCellNode; - }; - }; - tableView.asyncDelegate = dataSource; - tableView.asyncDataSource = dataSource; - - [self triggerFirstLayoutMeasurementForTableView:tableView]; - - NSArray *visibleNodes = [tableView visibleNodes]; - XCTAssertGreaterThan(visibleNodes.count, 0); - - // Cause table view to enter editing mode. - // Visibile nodes should be re-measured on main thread with the new (smaller) content view width. - // Other nodes are untouched. - XCTestExpectation *relayoutAfterEnablingEditingExpectation = [self expectationWithDescription:@"relayoutAfterEnablingEditing"]; - [tableView beginUpdates]; - [tableView setEditing:YES]; - [tableView endUpdatesAnimated:YES completion:^(BOOL completed) { - for (int section = 0; section < NumberOfSections; section++) { - for (int row = 0; row < dataSource.rowsPerSection; row++) { - NSIndexPath *indexPath = [NSIndexPath indexPathForRow:row inSection:section]; - ASTestTextCellNode *node = (ASTestTextCellNode *)[tableView nodeForRowAtIndexPath:indexPath]; - if ([visibleNodes containsObject:node]) { - XCTAssertEqual(node.numberOfLayoutsOnMainThread, 1); - XCTAssertLessThan(node.constrainedSizeForCalculatedLayout.max.width, tableViewSize.width); - } else { - XCTAssertEqual(node.numberOfLayoutsOnMainThread, 0); - XCTAssertEqual(node.constrainedSizeForCalculatedLayout.max.width, tableViewSize.width); - } - } - } - [relayoutAfterEnablingEditingExpectation fulfill]; - }]; - [self waitForExpectationsWithTimeout:5 handler:^(NSError *error) { - if (error) { - XCTFail(@"Expectation failed: %@", error); - } - }]; - - // Cause table view to leave editing mode. - // Visibile nodes should be re-measured again. - // All nodes should have max constrained width equals to the table view width. - XCTestExpectation *relayoutAfterDisablingEditingExpectation = [self expectationWithDescription:@"relayoutAfterDisablingEditing"]; - [tableView beginUpdates]; - [tableView setEditing:NO]; - [tableView endUpdatesAnimated:YES completion:^(BOOL completed) { - for (int section = 0; section < NumberOfSections; section++) { - for (int row = 0; row < dataSource.rowsPerSection; row++) { - NSIndexPath *indexPath = [NSIndexPath indexPathForRow:row inSection:section]; - ASTestTextCellNode *node = (ASTestTextCellNode *)[tableView nodeForRowAtIndexPath:indexPath]; - BOOL visible = [visibleNodes containsObject:node]; - XCTAssertEqual(node.numberOfLayoutsOnMainThread, visible ? 2: 0); - XCTAssertEqual(node.constrainedSizeForCalculatedLayout.max.width, tableViewSize.width); - } - } - [relayoutAfterDisablingEditingExpectation fulfill]; - }]; - [self waitForExpectationsWithTimeout:5 handler:^(NSError *error) { - if (error) { - XCTFail(@"Expectation failed: %@", error); - } - }]; -} - -- (void)DISABLED_testRelayoutRowsAfterEditingModeIsChangedAndTheyBecomeVisible -{ - CGSize tableViewSize = CGSizeMake(100, 500); - ASTestTableView *tableView = [[ASTestTableView alloc] __initWithFrame:CGRectMake(0, 0, tableViewSize.width, tableViewSize.height) - style:UITableViewStylePlain]; - ASTableViewFilledDataSource *dataSource = [ASTableViewFilledDataSource new]; - - tableView.asyncDelegate = dataSource; - tableView.asyncDataSource = dataSource; - - [self triggerFirstLayoutMeasurementForTableView:tableView]; - - // Cause table view to enter editing mode and then scroll to the bottom. - // The last node should be re-measured on main thread with the new (smaller) content view width. - NSIndexPath *lastRowIndexPath = [NSIndexPath indexPathForRow:(dataSource.rowsPerSection - 1) inSection:(NumberOfSections - 1)]; - XCTestExpectation *relayoutExpectation = [self expectationWithDescription:@"relayout"]; - [tableView beginUpdates]; - [tableView setEditing:YES]; - [tableView setContentOffset:CGPointMake(0, CGFLOAT_MAX) animated:YES]; - [tableView endUpdatesAnimated:YES completion:^(BOOL completed) { - ASTestTextCellNode *node = (ASTestTextCellNode *)[tableView nodeForRowAtIndexPath:lastRowIndexPath]; - XCTAssertEqual(node.numberOfLayoutsOnMainThread, 1); - XCTAssertLessThan(node.constrainedSizeForCalculatedLayout.max.width, tableViewSize.width); - [relayoutExpectation fulfill]; - }]; - [self waitForExpectationsWithTimeout:5 handler:^(NSError *error) { - if (error) { - XCTFail(@"Expectation failed: %@", error); - } - }]; -} - -- (void)testIndexPathForNode -{ - CGSize tableViewSize = CGSizeMake(100, 500); - ASTestTableView *tableView = [[ASTestTableView alloc] initWithFrame:CGRectMake(0, 0, tableViewSize.width, tableViewSize.height) - style:UITableViewStylePlain]; - ASTableViewFilledDataSource *dataSource = [ASTableViewFilledDataSource new]; - - tableView.asyncDelegate = dataSource; - tableView.asyncDataSource = dataSource; - - [tableView reloadDataWithCompletion:^{ - for (NSUInteger i = 0; i < NumberOfSections; i++) { - for (NSUInteger j = 0; j < dataSource.rowsPerSection; j++) { - NSIndexPath *indexPath = [NSIndexPath indexPathForRow:j inSection:i]; - ASCellNode *cellNode = [tableView nodeForRowAtIndexPath:indexPath]; - NSIndexPath *reportedIndexPath = [tableView indexPathForNode:cellNode]; - XCTAssertEqual(indexPath.row, reportedIndexPath.row); - } - } - self.testTableView = nil; - }]; -} - -- (void)triggerFirstLayoutMeasurementForTableView:(ASTableView *)tableView{ - XCTestExpectation *reloadDataExpectation = [self expectationWithDescription:@"reloadData"]; - [tableView reloadDataWithCompletion:^{ - for (int section = 0; section < NumberOfSections; section++) { - for (int row = 0; row < [tableView numberOfRowsInSection:section]; row++) { - NSIndexPath *indexPath = [NSIndexPath indexPathForRow:row inSection:section]; - ASTestTextCellNode *node = (ASTestTextCellNode *)[tableView nodeForRowAtIndexPath:indexPath]; - XCTAssertEqual(node.numberOfLayoutsOnMainThread, 0); - XCTAssertEqual(node.constrainedSizeForCalculatedLayout.max.width, tableView.frame.size.width); - } - } - [reloadDataExpectation fulfill]; - }]; - [self waitForExpectationsWithTimeout:5 handler:^(NSError *error) { - if (error) { - XCTFail(@"Expectation failed: %@", error); - } - }]; - [tableView setNeedsLayout]; - [tableView layoutIfNeeded]; - [tableView waitUntilAllUpdatesAreCommitted]; -} - -- (void)triggerSizeChangeAndAssertRelayoutAllNodesForTableView:(ASTestTableView *)tableView newSize:(CGSize)newSize -{ - XCTestExpectation *nodesMeasuredUsingNewConstrainedSizeExpectation = [self expectationWithDescription:@"nodesMeasuredUsingNewConstrainedSize"]; - - [tableView beginUpdates]; - - CGRect frame = tableView.frame; - frame.size = newSize; - tableView.frame = frame; - [tableView layoutIfNeeded]; - - [tableView endUpdatesAnimated:NO completion:^(BOOL completed) { - XCTAssertEqual(tableView.testDataController.numberOfAllNodesRelayouts, 1); - - for (int section = 0; section < NumberOfSections; section++) { - for (int row = 0; row < [tableView numberOfRowsInSection:section]; row++) { - NSIndexPath *indexPath = [NSIndexPath indexPathForRow:row inSection:section]; - ASTestTextCellNode *node = (ASTestTextCellNode *)[tableView nodeForRowAtIndexPath:indexPath]; - XCTAssertLessThanOrEqual(node.numberOfLayoutsOnMainThread, 1); - XCTAssertEqual(node.constrainedSizeForCalculatedLayout.max.width, newSize.width); - } - } - [nodesMeasuredUsingNewConstrainedSizeExpectation fulfill]; - }]; - [self waitForExpectationsWithTimeout:5 handler:^(NSError *error) { - if (error) { - XCTFail(@"Expectation failed: %@", error); - } - }]; -} - -/** - * This may seem silly, but we had issues where the runtime sometimes wouldn't correctly report - * conformances declared on categories. - */ -- (void)testThatTableNodeConformsToExpectedProtocols -{ - ASTableNode *node = [[ASTableNode alloc] initWithStyle:UITableViewStylePlain]; - XCTAssert([node conformsToProtocol:@protocol(ASRangeControllerUpdateRangeProtocol)]); -} - -- (void)testThatInitialDataLoadHappensInOneShot -{ - NSMutableArray *selectors = [NSMutableArray array]; - ASTableNode *node = [[ASTableNode alloc] initWithStyle:UITableViewStylePlain]; - - ASTableViewFilledDataSource *dataSource = [ASTableViewFilledDataSource new]; - node.frame = CGRectMake(0, 0, 100, 100); - - node.dataSource = dataSource; - node.delegate = dataSource; - - [UITableView as_recordEditingCallsIntoArray:selectors]; - XCTAssertGreaterThan(node.numberOfSections, 0); - [node waitUntilAllUpdatesAreProcessed]; - XCTAssertGreaterThan(node.view.numberOfSections, 0); - - // The first reloadData call helps prevent UITableView from calling it multiple times while ASDataController is working. - // The second reloadData call is the real one. - NSArray *expectedSelectors = @[ NSStringFromSelector(@selector(reloadData)), - NSStringFromSelector(@selector(reloadData)) ]; - XCTAssertEqualObjects(selectors, expectedSelectors); - - [UITableView deswizzleAllInstanceMethods]; -} - -- (void)testThatReloadDataHappensInOneShot -{ - NSMutableArray *selectors = [NSMutableArray array]; - ASTableNode *node = [[ASTableNode alloc] initWithStyle:UITableViewStylePlain]; - - ASTableViewFilledDataSource *dataSource = [ASTableViewFilledDataSource new]; - node.frame = CGRectMake(0, 0, 100, 100); - - node.dataSource = dataSource; - node.delegate = dataSource; - - // Load initial data. - XCTAssertGreaterThan(node.numberOfSections, 0); - [node waitUntilAllUpdatesAreProcessed]; - XCTAssertGreaterThan(node.view.numberOfSections, 0); - - // Reload data. - [UITableView as_recordEditingCallsIntoArray:selectors]; - [node reloadData]; - [node waitUntilAllUpdatesAreProcessed]; - - // Assert that the beginning of the call pattern is correct. - // There is currently noise that comes after that we will allow for this test. - NSArray *expectedSelectors = @[ NSStringFromSelector(@selector(reloadData)) ]; - XCTAssertEqualObjects(selectors, expectedSelectors); - - [UITableView deswizzleAllInstanceMethods]; -} - -/** - * This tests an issue where, if the table is loaded before the first layout pass, - * the nodes are first measured with a constrained width of 0 which isn't ideal. - */ -- (void)testThatNodeConstrainedSizesAreCorrectIfReloadIsPreempted -{ - ASTableNode *node = [[ASTableNode alloc] initWithStyle:UITableViewStylePlain]; - - ASTableViewFilledDataSource *dataSource = [ASTableViewFilledDataSource new]; - CGFloat cellWidth = 320; - node.frame = CGRectMake(0, 0, cellWidth, 480); - - node.dataSource = dataSource; - node.delegate = dataSource; - - // Trigger data load BEFORE first layout pass, to ensure constrained size is correct. - XCTAssertGreaterThan(node.numberOfSections, 0); - [node waitUntilAllUpdatesAreProcessed]; - - ASSizeRange expectedSizeRange = ASSizeRangeMake(CGSizeMake(cellWidth, 0)); - expectedSizeRange.max.height = CGFLOAT_MAX; - - for (NSInteger i = 0; i < node.numberOfSections; i++) { - for (NSInteger j = 0; j < [node numberOfRowsInSection:i]; j++) { - NSIndexPath *indexPath = [NSIndexPath indexPathForItem:j inSection:i]; - ASTestTextCellNode *cellNode = (id)[node nodeForRowAtIndexPath:indexPath]; - ASXCTAssertEqualSizeRanges(cellNode.constrainedSizeForCalculatedLayout, expectedSizeRange); - XCTAssertEqual(cellNode.numberOfLayoutsOnMainThread, 0); - } - } -} - -- (void)testSectionIndexHandling -{ - ASTableNode *node = [[ASTableNode alloc] initWithStyle:UITableViewStylePlain]; - - ASTableViewFilledDataSource *dataSource = [ASTableViewFilledDataSource new]; - dataSource.usesSectionIndex = YES; - node.frame = CGRectMake(0, 0, 320, 480); - - node.dataSource = dataSource; - node.delegate = dataSource; - - // Trigger data load - XCTAssertGreaterThan(node.numberOfSections, 0); - XCTAssertGreaterThan([node numberOfRowsInSection:0], 0); - - // UITableView's section index view is added only after some rows were inserted to the table. - // All nodes loaded and measured during the initial reloadData used an outdated constrained width (i.e full width: 320). - // So we need to force a new layout pass so that the table will pick up a new constrained size and apply to its node. - [node setNeedsLayout]; - [node.view layoutIfNeeded]; - [node waitUntilAllUpdatesAreProcessed]; - - UITableViewCell *cell = [node.view cellForRowAtIndexPath:[NSIndexPath indexPathForItem:0 inSection:0]]; - XCTAssertNotNil(cell); - - CGFloat cellWidth = cell.contentView.frame.size.width; - XCTAssert(cellWidth > 0 && cellWidth < 320, @"Expected cell width to be about 305. Width: %@", @(cellWidth)); - - ASSizeRange expectedSizeRange = ASSizeRangeMake(CGSizeMake(cellWidth, 0)); - expectedSizeRange.max.height = CGFLOAT_MAX; - - for (NSInteger i = 0; i < node.numberOfSections; i++) { - for (NSInteger j = 0; j < [node numberOfRowsInSection:i]; j++) { - NSIndexPath *indexPath = [NSIndexPath indexPathForItem:j inSection:i]; - ASTestTextCellNode *cellNode = (id)[node nodeForRowAtIndexPath:indexPath]; - ASXCTAssertEqualSizeRanges(cellNode.constrainedSizeForCalculatedLayout, expectedSizeRange); - // We will have to accept a relayout on main thread, since the index bar won't show - // up until some of the cells are inserted. - XCTAssertLessThanOrEqual(cellNode.numberOfLayoutsOnMainThread, 1); - } - } -} - -- (void)testThatNilBatchUpdatesCanBeSubmitted -{ - ASTableNode *node = [[ASTableNode alloc] initWithStyle:UITableViewStylePlain]; - - // Passing nil blocks should not crash - [node performBatchUpdates:nil completion:nil]; - [node performBatchAnimated:NO updates:nil completion:nil]; -} - -// https://github.com/facebook/AsyncDisplayKit/issues/2252#issuecomment-263689979 -- (void)testIssue2252 -{ - // Hard-code an iPhone 7 screen. There's something particular about this geometry that causes the issue to repro. - UIWindow *window = [[UIWindow alloc] initWithFrame:CGRectMake(0, 0, 375, 667)]; - - ASTableNode *node = [[ASTableNode alloc] initWithStyle:UITableViewStyleGrouped]; - node.frame = window.bounds; - ASTableViewTestDelegate *del = [[ASTableViewTestDelegate alloc] init]; - del.headerHeight = 32; - del.footerHeight = 0.01; - node.delegate = del; - ASTableViewFilledDataSource *ds = [[ASTableViewFilledDataSource alloc] init]; - ds.rowsPerSection = 1; - node.dataSource = ds; - ASViewController *vc = [[ASViewController alloc] initWithNode:node]; - UITabBarController *tabCtrl = [[UITabBarController alloc] init]; - tabCtrl.viewControllers = @[ vc ]; - tabCtrl.tabBar.translucent = NO; - window.rootViewController = tabCtrl; - [window makeKeyAndVisible]; - - [window layoutIfNeeded]; - [node waitUntilAllUpdatesAreProcessed]; - XCTAssertEqual(node.view.numberOfSections, NumberOfSections); - ASXCTAssertEqualRects(CGRectMake(0, 32, 375, 44), [node rectForRowAtIndexPath:[NSIndexPath indexPathForItem:0 inSection:0]], @"This text requires very specific geometry. The rect for the first row should match up."); - - __unused XCTestExpectation *e = [self expectationWithDescription:@"Did a bunch of rounds of updates."]; - NSInteger totalCount = 20; - __block NSInteger count = 0; - dispatch_source_t timer = dispatch_source_create(DISPATCH_SOURCE_TYPE_TIMER, 0, 0, dispatch_get_main_queue()); - dispatch_source_set_timer(timer, DISPATCH_TIME_NOW, 0.2 * NSEC_PER_SEC, 0.01 * NSEC_PER_SEC); - dispatch_source_set_event_handler(timer, ^{ - [node performBatchUpdates:^{ - [node reloadSections:[NSIndexSet indexSetWithIndexesInRange:NSMakeRange(0, NumberOfSections)] withRowAnimation:UITableViewRowAnimationNone]; - } completion:^(BOOL finished) { - if (++count == totalCount) { - dispatch_cancel(timer); - dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(2 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ - [e fulfill]; - }); - } - }]; - }); - dispatch_resume(timer); - [self waitForExpectationsWithTimeout:60 handler:nil]; -} - -- (void)testThatInvalidUpdateExceptionReasonContainsDataSourceClassName -{ - ASTableNode *node = [[ASTableNode alloc] initWithStyle:UITableViewStyleGrouped]; - node.bounds = CGRectMake(0, 0, 100, 100); - ASTableViewFilledDataSource *ds = [[ASTableViewFilledDataSource alloc] init]; - node.dataSource = ds; - - // Force node to load initial data. - [node.view layoutIfNeeded]; - - // Submit an invalid update, ensure exception name matches and that data source is included in the reason. - @try { - [node deleteSections:[NSIndexSet indexSetWithIndex:1000] withRowAnimation:UITableViewRowAnimationNone]; - XCTFail(@"Expected validation to fail."); - } @catch (NSException *e) { - XCTAssertEqual(e.name, ASCollectionInvalidUpdateException); - XCTAssert([e.reason containsString:NSStringFromClass([ds class])], @"Expected validation reason to contain the data source class name. Got:\n%@", e.reason); - } -} - -- (void)testAutomaticallyAdjustingContentOffset -{ - ASTableNode *node = [[ASTableNode alloc] initWithStyle:UITableViewStylePlain]; - node.automaticallyAdjustsContentOffset = YES; - node.bounds = CGRectMake(0, 0, 100, 100); - ASTableViewFilledDataSource *ds = [[ASTableViewFilledDataSource alloc] init]; - node.dataSource = ds; - - [node.view layoutIfNeeded]; - [node waitUntilAllUpdatesAreProcessed]; - CGFloat rowHeight = [node.view rectForRowAtIndexPath:[NSIndexPath indexPathForRow:0 inSection:0]].size.height; - // Scroll to row (0,1) + 10pt - node.contentOffset = CGPointMake(0, rowHeight + 10); - - [node performBatchAnimated:NO updates:^{ - // Delete row 0 from all sections. - // This is silly but it's a consequence of how ASTableViewFilledDataSource is built. - ds.rowsPerSection -= 1; - for (NSInteger i = 0; i < NumberOfSections; i++) { - [node deleteRowsAtIndexPaths:@[ [NSIndexPath indexPathForItem:0 inSection:i]] withRowAnimation:UITableViewRowAnimationAutomatic]; - } - } completion:nil]; - [node waitUntilAllUpdatesAreProcessed]; - - // Now that row (0,0) is deleted, we should have slid up to be at just 10 - // i.e. we should have subtracted the deleted row height from our content offset. - XCTAssertEqual(node.contentOffset.y, 10); -} - -- (void)testTableViewReloadDoesReloadIfEditableTextNodeIsFirstResponder -{ - ASEditableTextNode *editableTextNode = [[ASEditableTextNode alloc] init]; - - UIWindow *window = [[UIWindow alloc] initWithFrame:CGRectMake(0, 0, 375, 667)]; - ASTableNode *node = [[ASTableNode alloc] initWithStyle:UITableViewStyleGrouped]; - node.frame = window.bounds; - [window addSubnode:node]; - - ASTableViewFilledDataSource *dataSource = [ASTableViewFilledDataSource new]; - dataSource.rowsPerSection = 1; - dataSource.numberOfSections = 1; - // Currently this test requires that the text in the cell node fills the - // visible width, so we use the long description for the index path. - dataSource.nodeBlockForItem = ^(NSIndexPath *indexPath) { - return (ASCellNodeBlock)^{ - ASCellNode *cellNode = [[ASCellNode alloc] init]; - cellNode.automaticallyManagesSubnodes = YES; - cellNode.layoutSpecBlock = ^ASLayoutSpec * _Nonnull(__kindof ASDisplayNode * _Nonnull node, ASSizeRange constrainedSize) { - return [ASInsetLayoutSpec insetLayoutSpecWithInsets:UIEdgeInsetsMake(10, 10, 10, 10) child:editableTextNode]; - }; - return cellNode; - }; - }; - node.delegate = dataSource; - node.dataSource = dataSource; - - // Reload the data for the initial load - [node reloadData]; - [node waitUntilAllUpdatesAreProcessed]; - [node setNeedsLayout]; - [node layoutIfNeeded]; - - // Set the textView as first responder - [editableTextNode.textView becomeFirstResponder]; - - // Change data source count and try to reload a second time - dataSource.rowsPerSection = 2; - [node reloadData]; - [node waitUntilAllUpdatesAreProcessed]; - - // Check that numberOfRows in section 0 is 2 - XCTAssertEqual([node numberOfRowsInSection:0], 2); - XCTAssertEqual([node.view numberOfRowsInSection:0], 2); -} - -@end - -@implementation UITableView (Testing) - -+ (void)as_recordEditingCallsIntoArray:(NSMutableArray *)selectors -{ - [UITableView swizzleInstanceMethod:@selector(reloadData) withReplacement:JGMethodReplacementProviderBlock { - return JGMethodReplacement(void, UITableView *) { - JGOriginalImplementation(void); - [selectors addObject:NSStringFromSelector(_cmd)]; - }; - }]; - [UITableView swizzleInstanceMethod:@selector(beginUpdates) withReplacement:JGMethodReplacementProviderBlock { - return JGMethodReplacement(void, UITableView *) { - JGOriginalImplementation(void); - [selectors addObject:NSStringFromSelector(_cmd)]; - }; - }]; - [UITableView swizzleInstanceMethod:@selector(endUpdates) withReplacement:JGMethodReplacementProviderBlock { - return JGMethodReplacement(void, UITableView *) { - JGOriginalImplementation(void); - [selectors addObject:NSStringFromSelector(_cmd)]; - }; - }]; - [UITableView swizzleInstanceMethod:@selector(insertRowsAtIndexPaths:withRowAnimation:) withReplacement:JGMethodReplacementProviderBlock { - return JGMethodReplacement(void, UITableView *, NSArray *indexPaths, UITableViewRowAnimation anim) { - JGOriginalImplementation(void, indexPaths, anim); - [selectors addObject:NSStringFromSelector(_cmd)]; - }; - }]; - [UITableView swizzleInstanceMethod:@selector(deleteRowsAtIndexPaths:withRowAnimation:) withReplacement:JGMethodReplacementProviderBlock { - return JGMethodReplacement(void, UITableView *, NSArray *indexPaths, UITableViewRowAnimation anim) { - JGOriginalImplementation(void, indexPaths, anim); - [selectors addObject:NSStringFromSelector(_cmd)]; - }; - }]; - [UITableView swizzleInstanceMethod:@selector(insertSections:withRowAnimation:) withReplacement:JGMethodReplacementProviderBlock { - return JGMethodReplacement(void, UITableView *, NSIndexSet *indexes, UITableViewRowAnimation anim) { - JGOriginalImplementation(void, indexes, anim); - [selectors addObject:NSStringFromSelector(_cmd)]; - }; - }]; - [UITableView swizzleInstanceMethod:@selector(deleteSections:withRowAnimation:) withReplacement:JGMethodReplacementProviderBlock { - return JGMethodReplacement(void, UITableView *, NSIndexSet *indexes, UITableViewRowAnimation anim) { - JGOriginalImplementation(void, indexes, anim); - [selectors addObject:NSStringFromSelector(_cmd)]; - }; - }]; -} - -@end diff --git a/submodules/AsyncDisplayKit/Tests/ASTableViewThrashTests.mm b/submodules/AsyncDisplayKit/Tests/ASTableViewThrashTests.mm deleted file mode 100644 index 8d7064cd00..0000000000 --- a/submodules/AsyncDisplayKit/Tests/ASTableViewThrashTests.mm +++ /dev/null @@ -1,154 +0,0 @@ -// -// ASTableViewThrashTests.mm -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import -#import -#import -#import -#import - -#import "ASThrashUtility.h" - -@interface ASTableViewThrashTests: XCTestCase -@end - -@implementation ASTableViewThrashTests -{ - // The current update, which will be logged in case of a failure. - ASThrashUpdate *_update; - BOOL _failed; -} - -#pragma mark Overrides - -- (void)tearDown -{ - if (_failed && _update != nil) { - NSLog(@"Failed update %@: %@", _update, _update.logFriendlyBase64Representation); - } - _failed = NO; - _update = nil; -} - -// NOTE: Despite the documentation, this is not always called if an exception is caught. -- (void)recordFailureWithDescription:(NSString *)description inFile:(NSString *)filePath atLine:(NSUInteger)lineNumber expected:(BOOL)expected -{ - _failed = YES; - [super recordFailureWithDescription:description inFile:filePath atLine:lineNumber expected:expected]; -} - -#pragma mark Test Methods - -// Disabled temporarily due to issue where cell nodes are not marked invisible before deallocation. -- (void)testInitialDataRead -{ - ASThrashDataSource *ds = [[ASThrashDataSource alloc] initTableViewDataSourceWithData:[ASThrashTestSection sectionsWithCount:kInitialSectionCount]]; - [self verifyDataSource:ds]; -} - -/// Replays the Base64 representation of an ASThrashUpdate from "ASThrashTestRecordedCase" file -- (void)testRecordedThrashCase -{ - NSURL *caseURL = [[NSBundle bundleForClass:[self class]] URLForResource:@"ASThrashTestRecordedCase" withExtension:nil subdirectory:@"TestResources"]; - NSString *base64 = [NSString stringWithContentsOfURL:caseURL encoding:NSUTF8StringEncoding error:NULL]; - - _update = [ASThrashUpdate thrashUpdateWithBase64String:base64]; - if (_update == nil) { - return; - } - - ASThrashDataSource *ds = [[ASThrashDataSource alloc] initTableViewDataSourceWithData:_update.oldData]; - ds.tableView.test_enableSuperUpdateCallLogging = YES; - [self applyUpdate:_update toDataSource:ds]; - [self verifyDataSource:ds]; -} - -// Disabled temporarily due to issue where cell nodes are not marked invisible before deallocation. -- (void)testThrashingWildly -{ - for (NSInteger i = 0; i < kThrashingIterationCount; i++) { - [self setUp]; - @autoreleasepool { - NSArray *sections = [ASThrashTestSection sectionsWithCount:kInitialSectionCount]; - _update = [[ASThrashUpdate alloc] initWithData:sections]; - ASThrashDataSource *ds = [[ASThrashDataSource alloc] initTableViewDataSourceWithData:sections]; - - [self applyUpdate:_update toDataSource:ds]; - [self verifyDataSource:ds]; - [self expectationForPredicate:[ds predicateForDeallocatedHierarchy] evaluatedWithObject:(id)kCFNull handler:nil]; - } - [self waitForExpectationsWithTimeout:3 handler:nil]; - - [self tearDown]; - } -} - -#pragma mark Helpers - -- (void)applyUpdate:(ASThrashUpdate *)update toDataSource:(ASThrashDataSource *)dataSource -{ - TableView *tableView = dataSource.tableView; - - [tableView beginUpdates]; - dataSource.data = update.data; - - [tableView insertSections:update.insertedSectionIndexes withRowAnimation:UITableViewRowAnimationNone]; - - [tableView deleteSections:update.deletedSectionIndexes withRowAnimation:UITableViewRowAnimationNone]; - - [tableView reloadSections:update.replacedSectionIndexes withRowAnimation:UITableViewRowAnimationNone]; - - [update.insertedItemIndexes enumerateObjectsUsingBlock:^(NSMutableIndexSet * _Nonnull indexes, NSUInteger idx, BOOL * _Nonnull stop) { - NSArray *indexPaths = [indexes indexPathsInSection:idx]; - [tableView insertRowsAtIndexPaths:indexPaths withRowAnimation:UITableViewRowAnimationNone]; - }]; - - [update.deletedItemIndexes enumerateObjectsUsingBlock:^(NSMutableIndexSet * _Nonnull indexes, NSUInteger sec, BOOL * _Nonnull stop) { - NSArray *indexPaths = [indexes indexPathsInSection:sec]; - [tableView deleteRowsAtIndexPaths:indexPaths withRowAnimation:UITableViewRowAnimationNone]; - }]; - - [update.replacedItemIndexes enumerateObjectsUsingBlock:^(NSMutableIndexSet * _Nonnull indexes, NSUInteger sec, BOOL * _Nonnull stop) { - NSArray *indexPaths = [indexes indexPathsInSection:sec]; - [tableView reloadRowsAtIndexPaths:indexPaths withRowAnimation:UITableViewRowAnimationNone]; - }]; - @try { - [tableView endUpdatesAnimated:NO completion:nil]; -#if !USE_UIKIT_REFERENCE - [tableView waitUntilAllUpdatesAreCommitted]; -#endif - } @catch (NSException *exception) { - _failed = YES; - @throw exception; - } -} - -- (void)verifyDataSource:(ASThrashDataSource *)ds -{ - TableView *tableView = ds.tableView; - NSArray *data = [ds data]; - XCTAssertEqual(data.count, tableView.numberOfSections); - for (NSInteger i = 0; i < tableView.numberOfSections; i++) { - XCTAssertEqual([tableView numberOfRowsInSection:i], data[i].items.count); - XCTAssertEqual([tableView rectForHeaderInSection:i].size.height, data[i].headerHeight); - - for (NSInteger j = 0; j < [tableView numberOfRowsInSection:i]; j++) { - NSIndexPath *indexPath = [NSIndexPath indexPathForItem:j inSection:i]; - ASThrashTestItem *item = data[i].items[j]; -#if USE_UIKIT_REFERENCE - XCTAssertEqual([tableView rectForRowAtIndexPath:indexPath].size.height, item.rowHeight); -#else - ASThrashTestNode *node = (ASThrashTestNode *)[tableView nodeForRowAtIndexPath:indexPath]; - XCTAssertEqualObjects(node.item, item, @"Wrong node at index path %@", indexPath); -#endif - } - } -} - -@end diff --git a/submodules/AsyncDisplayKit/Tests/ASTextKitCoreTextAdditionsTests.mm b/submodules/AsyncDisplayKit/Tests/ASTextKitCoreTextAdditionsTests.mm deleted file mode 100644 index 8b0c47be8d..0000000000 --- a/submodules/AsyncDisplayKit/Tests/ASTextKitCoreTextAdditionsTests.mm +++ /dev/null @@ -1,74 +0,0 @@ -// -// ASTextKitCoreTextAdditionsTests.mm -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -#import - -#import - -#if AS_ENABLE_TEXTNODE - -BOOL floatsCloseEnough(CGFloat float1, CGFloat float2) { - CGFloat epsilon = 0.00001; - return (fabs(float1 - float2) < epsilon); -} - -@interface ASTextKitCoreTextAdditionsTests : XCTestCase - -@end - -@implementation ASTextKitCoreTextAdditionsTests - -- (void)testAttributeCleansing -{ - UIFont *font = [UIFont systemFontOfSize:12.0]; - NSMutableAttributedString *testString = [[NSMutableAttributedString alloc] initWithString:@"Test" attributes:@{NSFontAttributeName:font}]; - CFRange cfRange = CFRangeMake(0, testString.length); - CGColorRef blueColor = CGColorRetain([UIColor blueColor].CGColor); - CFAttributedStringSetAttribute((CFMutableAttributedStringRef)testString, - cfRange, - kCTForegroundColorAttributeName, - blueColor); - UIColor *color = [UIColor colorWithCGColor:blueColor]; - - NSAttributedString *actualCleansedString = ASCleanseAttributedStringOfCoreTextAttributes(testString); - XCTAssertTrue([[actualCleansedString attribute:NSForegroundColorAttributeName atIndex:0 effectiveRange:NULL] isEqual:color], @"Expected the %@ core text attribute to be cleansed from the string %@\n Should match %@", kCTForegroundColorFromContextAttributeName, actualCleansedString, color); - CGColorRelease(blueColor); -} - -- (void)testNoAttributeCleansing -{ - NSMutableAttributedString *testString = [[NSMutableAttributedString alloc] initWithString:@"Test" attributes:@{NSFontAttributeName:[UIFont systemFontOfSize:12.0], - NSForegroundColorAttributeName : [UIColor blueColor]}]; - - NSAttributedString *actualCleansedString = ASCleanseAttributedStringOfCoreTextAttributes(testString); - XCTAssertTrue([testString isEqualToAttributedString:actualCleansedString], @"Expected the output string %@ to be the same as the input %@ if there are no core text attributes", actualCleansedString, testString); -} - -- (void)testNSParagraphStyleNoCleansing -{ - NSMutableParagraphStyle *paragraphStyle = [[NSMutableParagraphStyle alloc] init]; - paragraphStyle.lineSpacing = 10.0; - - //NSUnderlineStyleAttributeName flags the unsupported CT attribute check - NSDictionary *attributes = @{NSParagraphStyleAttributeName:paragraphStyle, - NSUnderlineStyleAttributeName:@(NSUnderlineStyleSingle)}; - - NSAttributedString *attributedString = [[NSAttributedString alloc] initWithString:@"Test" attributes:attributes]; - NSAttributedString *cleansedString = ASCleanseAttributedStringOfCoreTextAttributes(attributedString); - - NSParagraphStyle *cleansedParagraphStyle = [cleansedString attribute:NSParagraphStyleAttributeName atIndex:0 effectiveRange:NULL]; - - XCTAssertTrue(floatsCloseEnough(cleansedParagraphStyle.lineSpacing, paragraphStyle.lineSpacing), @"Expected the output line spacing: %f to be equal to the input line spacing: %f", cleansedParagraphStyle.lineSpacing, paragraphStyle.lineSpacing); -} - -@end - -#endif diff --git a/submodules/AsyncDisplayKit/Tests/ASTextKitFontSizeAdjusterTests.mm b/submodules/AsyncDisplayKit/Tests/ASTextKitFontSizeAdjusterTests.mm deleted file mode 100644 index c91ff99a49..0000000000 --- a/submodules/AsyncDisplayKit/Tests/ASTextKitFontSizeAdjusterTests.mm +++ /dev/null @@ -1,51 +0,0 @@ -// -// ASTextKitFontSizeAdjusterTests.mm -// Texture -// -// Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import -#import - -#if AS_ENABLE_TEXTNODE - -@interface ASFontSizeAdjusterTests : XCTestCase - -@end - -@implementation ASFontSizeAdjusterTests - -- (void)testFontSizeAdjusterAttributes -{ - NSMutableParagraphStyle *paragraphStyle = [NSMutableParagraphStyle new]; - paragraphStyle.lineHeightMultiple = 2.0; - paragraphStyle.lineSpacing = 2.0; - paragraphStyle.paragraphSpacing = 4.0; - paragraphStyle.firstLineHeadIndent = 6.0; - paragraphStyle.headIndent = 8.0; - paragraphStyle.tailIndent = 10.0; - paragraphStyle.minimumLineHeight = 12.0; - paragraphStyle.maximumLineHeight = 14.0; - - NSMutableAttributedString *string = [[NSMutableAttributedString alloc] initWithString:@"Lorem ipsum dolor sit amet" - attributes:@{ NSParagraphStyleAttributeName: paragraphStyle }]; - - [ASTextKitFontSizeAdjuster adjustFontSizeForAttributeString:string withScaleFactor:0.5]; - - NSParagraphStyle *adjustedParagraphStyle = [string attribute:NSParagraphStyleAttributeName atIndex:0 effectiveRange:nil]; - - XCTAssertEqual(adjustedParagraphStyle.lineHeightMultiple, 2.0); - XCTAssertEqual(adjustedParagraphStyle.lineSpacing, 1.0); - XCTAssertEqual(adjustedParagraphStyle.paragraphSpacing, 2.0); - XCTAssertEqual(adjustedParagraphStyle.firstLineHeadIndent, 3.0); - XCTAssertEqual(adjustedParagraphStyle.headIndent, 4.0); - XCTAssertEqual(adjustedParagraphStyle.tailIndent, 5.0); - XCTAssertEqual(adjustedParagraphStyle.minimumLineHeight, 6.0); - XCTAssertEqual(adjustedParagraphStyle.maximumLineHeight, 7.0); -} - -@end - -#endif diff --git a/submodules/AsyncDisplayKit/Tests/ASTextKitTests.mm b/submodules/AsyncDisplayKit/Tests/ASTextKitTests.mm deleted file mode 100644 index efd93cf809..0000000000 --- a/submodules/AsyncDisplayKit/Tests/ASTextKitTests.mm +++ /dev/null @@ -1,231 +0,0 @@ -// -// ASTextKitTests.mm -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import -#import - -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wdocumentation" -#import -#pragma clang diagnostic pop - -#import - -#if AS_ENABLE_TEXTNODE - -#import -#import -#import -#import - -#import - -@interface ASTextKitTests : XCTestCase - -@end - -static UITextView *UITextViewWithAttributes(const ASTextKitAttributes &attributes, - const CGSize constrainedSize, - NSDictionary *linkTextAttributes) -{ - UITextView *textView = [[UITextView alloc] initWithFrame:{ .size = constrainedSize }]; - textView.backgroundColor = [UIColor clearColor]; - textView.textContainer.lineBreakMode = attributes.lineBreakMode; - textView.textContainer.lineFragmentPadding = 0.f; - textView.textContainer.maximumNumberOfLines = attributes.maximumNumberOfLines; - textView.textContainerInset = UIEdgeInsetsZero; - textView.layoutManager.usesFontLeading = NO; - textView.attributedText = attributes.attributedString; - textView.linkTextAttributes = linkTextAttributes; - return textView; -} - -static UIImage *UITextViewImageWithAttributes(const ASTextKitAttributes &attributes, - const CGSize constrainedSize, - NSDictionary *linkTextAttributes) -{ - UITextView *textView = UITextViewWithAttributes(attributes, constrainedSize, linkTextAttributes); - UIGraphicsBeginImageContextWithOptions(constrainedSize, NO, 0); - CGContextRef context = UIGraphicsGetCurrentContext(); - - CGContextSaveGState(context); - { - [textView.layer renderInContext:context]; - } - CGContextRestoreGState(context); - - UIImage *snapshot = UIGraphicsGetImageFromCurrentImageContext(); - UIGraphicsEndImageContext(); - - return snapshot; -} - -static UIImage *ASTextKitImageWithAttributes(const ASTextKitAttributes &attributes, const CGSize constrainedSize) -{ - ASTextKitRenderer *renderer = [[ASTextKitRenderer alloc] initWithTextKitAttributes:attributes - constrainedSize:constrainedSize]; - UIGraphicsBeginImageContextWithOptions(constrainedSize, NO, 0); - CGContextRef context = UIGraphicsGetCurrentContext(); - - CGContextSaveGState(context); - { - [renderer drawInContext:context bounds:{.size = constrainedSize}]; - } - CGContextRestoreGState(context); - - UIImage *snapshot = UIGraphicsGetImageFromCurrentImageContext(); - UIGraphicsEndImageContext(); - - return snapshot; -} - -// linkTextAttributes are only applied to UITextView -static BOOL checkAttributes(const ASTextKitAttributes &attributes, const CGSize constrainedSize, NSDictionary *linkTextAttributes) -{ - FBSnapshotTestController *controller = [[FBSnapshotTestController alloc] init]; - UIImage *labelImage = UITextViewImageWithAttributes(attributes, constrainedSize, linkTextAttributes); - UIImage *textKitImage = ASTextKitImageWithAttributes(attributes, constrainedSize); - return [controller compareReferenceImage:labelImage toImage:textKitImage tolerance:0.0 error:nil]; -} - -@implementation ASTextKitTests - -- (void)testSimpleStrings -{ - ASTextKitAttributes attributes { - .attributedString = [[NSAttributedString alloc] initWithString:@"hello" attributes:@{NSFontAttributeName : [UIFont systemFontOfSize:12]}] - }; - XCTAssert(checkAttributes(attributes, { 100, 100 }, nil)); -} - -- (void)testChangingAPropertyChangesHash -{ - NSAttributedString *as = [[NSAttributedString alloc] initWithString:@"hello" attributes:@{NSFontAttributeName : [UIFont systemFontOfSize:12]}]; - - ASTextKitAttributes attrib1 { - .attributedString = as, - .lineBreakMode = NSLineBreakByClipping, - }; - ASTextKitAttributes attrib2 { - .attributedString = as, - }; - - XCTAssertNotEqual(attrib1.hash(), attrib2.hash(), @"Hashes should differ when NSLineBreakByClipping changes."); -} - -- (void)testSameStringHashesSame -{ - ASTextKitAttributes attrib1 { - .attributedString = [[NSAttributedString alloc] initWithString:@"hello" attributes:@{NSFontAttributeName : [UIFont systemFontOfSize:12]}], - }; - ASTextKitAttributes attrib2 { - .attributedString = [[NSAttributedString alloc] initWithString:@"hello" attributes:@{NSFontAttributeName : [UIFont systemFontOfSize:12]}], - }; - - XCTAssertEqual(attrib1.hash(), attrib2.hash(), @"Hashes should be the same!"); -} - - -- (void)testStringsWithVariableAttributes -{ - NSMutableAttributedString *attrStr = [[NSMutableAttributedString alloc] initWithString:@"hello" attributes:@{NSFontAttributeName : [UIFont systemFontOfSize:12]}]; - for (int i = 0; i < attrStr.length; i++) { - // Color each character something different - CGFloat factor = ((CGFloat)i) / ((CGFloat)attrStr.length); - [attrStr addAttribute:NSForegroundColorAttributeName - value:[UIColor colorWithRed:factor - green:1.0 - factor - blue:0.0 - alpha:1.0] - range:NSMakeRange(i, 1)]; - } - ASTextKitAttributes attributes { - .attributedString = attrStr - }; - XCTAssert(checkAttributes(attributes, { 100, 100 }, nil)); -} - -- (void)testLinkInTextUsesForegroundColor -{ - NSDictionary *linkTextAttributes = @{ NSForegroundColorAttributeName : [UIColor redColor], - // UITextView adds underline by default and we can't get rid of it - // so we have to choose a style and color and match it in the text kit version - // for this test - NSUnderlineStyleAttributeName : @(NSUnderlineStyleSingle), - NSUnderlineColorAttributeName: [UIColor blueColor], - }; - NSDictionary *textAttributes = @{NSFontAttributeName : [UIFont systemFontOfSize:12], - }; - - NSString *prefixString = @"click "; - NSString *linkString = @"this link"; - NSString *textString = [prefixString stringByAppendingString:linkString]; - - NSMutableAttributedString *attrStr = [[NSMutableAttributedString alloc] initWithString:textString attributes:textAttributes]; - NSURL *linkURL = [NSURL URLWithString:@"https://github.com/facebook/AsyncDisplayKit/issues/967"]; - NSRange selectedRange = (NSRange){prefixString.length, linkString.length}; - - [attrStr addAttribute:NSLinkAttributeName value:linkURL range:selectedRange]; - - for (NSString *attributeName in linkTextAttributes.keyEnumerator) { - [attrStr addAttribute:attributeName - value:linkTextAttributes[attributeName] - range:selectedRange]; - } - - ASTextKitAttributes textKitattributes { - .attributedString = attrStr - }; - - XCTAssert(checkAttributes(textKitattributes, { 100, 100 }, linkTextAttributes)); -} - -- (void)testRectsForRangeBeyondTruncationSizeReturnsNonZeroNumberOfRects -{ - NSAttributedString *attributedString = - [[NSAttributedString alloc] - initWithString:@"90's cray photo booth tote bag bespoke Carles. Plaid wayfarers Odd Future master cleanse tattooed four dollar toast small batch kale chips leggings meh photo booth occupy irony. " attributes:@{ASTextKitEntityAttributeName : [[ASTextKitEntityAttribute alloc] initWithEntity:@"entity"]}]; - ASTextKitRenderer *renderer = - [[ASTextKitRenderer alloc] - initWithTextKitAttributes:{ - .attributedString = attributedString, - .maximumNumberOfLines = 1, - .truncationAttributedString = [[NSAttributedString alloc] initWithString:@"... Continue Reading"] - } - constrainedSize:{ 100, 100 }]; - XCTAssert([renderer rectsForTextRange:NSMakeRange(0, attributedString.length) measureOption:ASTextKitRendererMeasureOptionBlock].count > 0); -} - -- (void)testTextKitComponentsCanCalculateSizeInBackground -{ - NSAttributedString *attributedString = - [[NSAttributedString alloc] - initWithString:@"90's cray photo booth tote bag bespoke Carles. Plaid wayfarers Odd Future master cleanse tattooed four dollar toast small batch kale chips leggings meh photo booth occupy irony. " attributes:@{ASTextKitEntityAttributeName : [[ASTextKitEntityAttribute alloc] initWithEntity:@"entity"]}]; - ASTextKitComponents *components = [ASTextKitComponents componentsWithAttributedSeedString:attributedString textContainerSize:CGSizeZero]; - components.textView = [[ASTextKitComponentsTextView alloc] initWithFrame:CGRectZero textContainer:components.textContainer]; - components.textView.frame = CGRectMake(0, 0, 20, 1000); - - XCTestExpectation *expectation = [self expectationWithDescription:@"Components deallocated in background"]; - - ASPerformBlockOnBackgroundThread(^{ - // Use an autorelease pool here to ensure temporary components are (and can be) released in background - @autoreleasepool { - [components sizeForConstrainedWidth:100]; - [components sizeForConstrainedWidth:50 forMaxNumberOfLines:5]; - } - - [expectation fulfill]; - }); - - [self waitForExpectationsWithTimeout:1 handler:nil]; -} - -@end - -#endif diff --git a/submodules/AsyncDisplayKit/Tests/ASTextKitTruncationTests.mm b/submodules/AsyncDisplayKit/Tests/ASTextKitTruncationTests.mm deleted file mode 100644 index a9d5544c3e..0000000000 --- a/submodules/AsyncDisplayKit/Tests/ASTextKitTruncationTests.mm +++ /dev/null @@ -1,165 +0,0 @@ -// -// ASTextKitTruncationTests.mm -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import -#import - -#import - -#if AS_ENABLE_TEXTNODE - -#import - -@interface ASTextKitTruncationTests : XCTestCase - -@end - -@implementation ASTextKitTruncationTests - -- (NSString *)_sentenceString -{ - return @"90's cray photo booth tote bag bespoke Carles. Plaid wayfarers Odd Future master cleanse tattooed four dollar toast small batch kale chips leggings meh photo booth occupy irony."; -} - -- (NSAttributedString *)_sentenceAttributedString -{ - return [[NSAttributedString alloc] initWithString:[self _sentenceString] attributes:@{}]; -} - -- (NSAttributedString *)_simpleTruncationAttributedString -{ - return [[NSAttributedString alloc] initWithString:@"..." attributes:@{}]; -} - -- (void)testEmptyTruncationStringSameAsStraightTextKitTailTruncation -{ - CGSize constrainedSize = CGSizeMake(100, 50); - NSAttributedString *attributedString = [self _sentenceAttributedString]; - ASTextKitContext *context = [[ASTextKitContext alloc] initWithAttributedString:attributedString - lineBreakMode:NSLineBreakByWordWrapping - maximumNumberOfLines:0 - exclusionPaths:nil - constrainedSize:constrainedSize]; - __block NSRange textKitVisibleRange; - [context performBlockWithLockedTextKitComponents:^(NSLayoutManager *layoutManager, NSTextStorage *textStorage, NSTextContainer *textContainer) { - textKitVisibleRange = [layoutManager characterRangeForGlyphRange:[layoutManager glyphRangeForTextContainer:textContainer] - actualGlyphRange:NULL]; - }]; - ASTextKitTailTruncater *tailTruncater = [[ASTextKitTailTruncater alloc] initWithContext:context - truncationAttributedString:nil - avoidTailTruncationSet:nil]; - [tailTruncater truncate]; - XCTAssert(NSEqualRanges(textKitVisibleRange, tailTruncater.visibleRanges[0])); - XCTAssert(NSEqualRanges(textKitVisibleRange, tailTruncater.firstVisibleRange)); -} - -- (void)testSimpleTailTruncation -{ - CGSize constrainedSize = CGSizeMake(100, 60); - NSAttributedString *attributedString = [self _sentenceAttributedString]; - ASTextKitContext *context = [[ASTextKitContext alloc] initWithAttributedString:attributedString - lineBreakMode:NSLineBreakByWordWrapping - maximumNumberOfLines:0 - exclusionPaths:nil - constrainedSize:constrainedSize]; - ASTextKitTailTruncater *tailTruncater = [[ASTextKitTailTruncater alloc] initWithContext:context - truncationAttributedString:[self _simpleTruncationAttributedString] - avoidTailTruncationSet:[NSCharacterSet characterSetWithCharactersInString:@""]]; - [tailTruncater truncate]; - __block NSString *drawnString; - [context performBlockWithLockedTextKitComponents:^(NSLayoutManager *layoutManager, NSTextStorage *textStorage, NSTextContainer *textContainer) { - drawnString = textStorage.string; - }]; - NSString *expectedString = @"90's cray photo booth tote bag bespoke Carles. Plaid wayfarers..."; - XCTAssertEqualObjects(expectedString, drawnString); - XCTAssert(NSEqualRanges(NSMakeRange(0, 62), tailTruncater.visibleRanges[0])); - XCTAssert(NSEqualRanges(NSMakeRange(0, 62), tailTruncater.firstVisibleRange)); -} - -- (void)testAvoidedCharTailWordBoundaryTruncation -{ - CGSize constrainedSize = CGSizeMake(100, 50); - NSAttributedString *attributedString = [self _sentenceAttributedString]; - ASTextKitContext *context = [[ASTextKitContext alloc] initWithAttributedString:attributedString - lineBreakMode:NSLineBreakByWordWrapping - maximumNumberOfLines:0 - exclusionPaths:nil - constrainedSize:constrainedSize]; - ASTextKitTailTruncater *tailTruncater = [[ASTextKitTailTruncater alloc] initWithContext:context - truncationAttributedString:[self _simpleTruncationAttributedString] - avoidTailTruncationSet:[NSCharacterSet characterSetWithCharactersInString:@"."]]; - [tailTruncater truncate]; - __block NSString *drawnString; - [context performBlockWithLockedTextKitComponents:^(NSLayoutManager *layoutManager, NSTextStorage *textStorage, NSTextContainer *textContainer) { - drawnString = textStorage.string; - }]; - // This should have removed the additional "." in the string right after Carles. - NSString *expectedString = @"90's cray photo booth tote bag bespoke Carles..."; - XCTAssertEqualObjects(expectedString, drawnString); -} - -- (void)testAvoidedCharTailCharBoundaryTruncation -{ - CGSize constrainedSize = CGSizeMake(50, 50); - NSAttributedString *attributedString = [self _sentenceAttributedString]; - ASTextKitContext *context = [[ASTextKitContext alloc] initWithAttributedString:attributedString - lineBreakMode:NSLineBreakByCharWrapping - maximumNumberOfLines:0 - exclusionPaths:nil - constrainedSize:constrainedSize]; - ASTextKitTailTruncater *tailTruncater = [[ASTextKitTailTruncater alloc] initWithContext:context - truncationAttributedString:[self _simpleTruncationAttributedString] - avoidTailTruncationSet:[NSCharacterSet characterSetWithCharactersInString:@"."]]; - [tailTruncater truncate]; - __block NSString *drawnString; - [context performBlockWithLockedTextKitComponents:^(NSLayoutManager *layoutManager, NSTextStorage *textStorage, NSTextContainer *textContainer) { - drawnString = textStorage.string; - }]; - // This should have removed the additional "." in the string right after Carles. - NSString *expectedString = @"90's cray photo booth t..."; - XCTAssertEqualObjects(expectedString, drawnString); -} - -- (void)testHandleZeroSizeConstrainedSize -{ - CGSize constrainedSize = CGSizeZero; - NSAttributedString *attributedString = [self _sentenceAttributedString]; - - ASTextKitContext *context = [[ASTextKitContext alloc] initWithAttributedString:attributedString - lineBreakMode:NSLineBreakByWordWrapping - maximumNumberOfLines:0 - exclusionPaths:nil - constrainedSize:constrainedSize]; - ASTextKitTailTruncater *tailTruncater = [[ASTextKitTailTruncater alloc] initWithContext:context - truncationAttributedString:[self _simpleTruncationAttributedString] - avoidTailTruncationSet:nil]; - XCTAssertNoThrow([tailTruncater truncate]); - XCTAssert(tailTruncater.visibleRanges.size() == 0); - NSEqualRanges(NSMakeRange(0, 0), tailTruncater.firstVisibleRange); -} - -- (void)testHandleZeroHeightConstrainedSize -{ - CGSize constrainedSize = CGSizeMake(50, 0); - NSAttributedString *attributedString = [self _sentenceAttributedString]; - ASTextKitContext *context = [[ASTextKitContext alloc] initWithAttributedString:attributedString - lineBreakMode:NSLineBreakByCharWrapping - maximumNumberOfLines:0 - exclusionPaths:nil - constrainedSize:constrainedSize]; - - ASTextKitTailTruncater *tailTruncater = [[ASTextKitTailTruncater alloc] initWithContext:context - truncationAttributedString:[self _simpleTruncationAttributedString] - avoidTailTruncationSet:[NSCharacterSet characterSetWithCharactersInString:@"."]]; - XCTAssertNoThrow([tailTruncater truncate]); -} - -@end - -#endif diff --git a/submodules/AsyncDisplayKit/Tests/ASTextNode2SnapshotTests.mm b/submodules/AsyncDisplayKit/Tests/ASTextNode2SnapshotTests.mm deleted file mode 100644 index 9b48a82e4a..0000000000 --- a/submodules/AsyncDisplayKit/Tests/ASTextNode2SnapshotTests.mm +++ /dev/null @@ -1,301 +0,0 @@ -// -// ASTextNode2SnapshotTests.mm -// Texture -// -// Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - - -#import "ASTestCase.h" -#import "ASSnapshotTestCase.h" -#import - -@interface ASTextNode2SnapshotTests : ASSnapshotTestCase - -@end - -@interface LineBreakConfig : NSObject - -@property (nonatomic, assign) NSUInteger numberOfLines; -@property (nonatomic, assign) NSLineBreakMode lineBreakMode; - -+ (NSArray *)configs; - -- (instancetype)initWithNumberOfLines:(NSUInteger)numberOfLines lineBreakMode:(NSLineBreakMode)lineBreakMode; -- (NSString *)breakModeDescription; - -@end - -@implementation LineBreakConfig - -+ (NSArray *)configs -{ - static dispatch_once_t init_predicate; - static NSArray *allConfigs = nil; - - dispatch_once(&init_predicate, ^{ - NSMutableArray *setup = [NSMutableArray new]; - for (int i = 0; i <= 3; i++) { - for (int j = NSLineBreakByWordWrapping; j <= NSLineBreakByTruncatingMiddle; j++) { - if (j == NSLineBreakByClipping) continue; - [setup addObject:[[LineBreakConfig alloc] initWithNumberOfLines:i lineBreakMode:(NSLineBreakMode) j]]; - } - - allConfigs = [NSArray arrayWithArray:setup]; - } - }); - return allConfigs; -} - -- (instancetype)initWithNumberOfLines:(NSUInteger)numberOfLines lineBreakMode:(NSLineBreakMode)lineBreakMode -{ - self = [super init]; - if (self != nil) { - _numberOfLines = numberOfLines; - _lineBreakMode = lineBreakMode; - - return self; - } - return nil; -} - -- (NSString *)breakModeDescription { - NSString *lineBreak = nil; - switch (self.lineBreakMode) { - case NSLineBreakByTruncatingHead: - lineBreak = @"NSLineBreakByTruncatingHead"; - break; - case NSLineBreakByCharWrapping: - lineBreak = @"NSLineBreakByCharWrapping"; - break; - case NSLineBreakByClipping: - lineBreak = @"NSLineBreakByClipping"; - break; - case NSLineBreakByWordWrapping: - lineBreak = @"NSLineBreakByWordWrapping"; - break; - case NSLineBreakByTruncatingTail: - lineBreak = @"NSLineBreakByTruncatingTail"; - break; - case NSLineBreakByTruncatingMiddle: - lineBreak = @"NSLineBreakByTruncatingMiddle"; - break; - default: - lineBreak = @"Unknown?"; - break; - } - return lineBreak; -} - -- (NSString *)description -{ - return [NSString stringWithFormat:@"numberOfLines: %lu\nlineBreakMode: %@", (unsigned long) self.numberOfLines, [self breakModeDescription]]; -} - -@end - -@implementation ASTextNode2SnapshotTests - -- (void)setUp -{ - [super setUp]; - - // This will use ASTextNode2 for snapshot tests. - // All tests are duplicated from ASTextNodeSnapshotTests. - ASConfiguration *config = [[ASConfiguration alloc] initWithDictionary:nil]; -#if AS_ENABLE_TEXTNODE - config.experimentalFeatures = ASExperimentalTextNode; -#endif - [ASConfigurationManager test_resetWithConfiguration:config]; - - self.recordMode = NO; -} - -- (void)tearDown -{ - [super tearDown]; - ASConfiguration *config = [[ASConfiguration alloc] initWithDictionary:nil]; - config.experimentalFeatures = kNilOptions; - [ASConfigurationManager test_resetWithConfiguration:config]; -} - -- (void)testTextContainerInset_ASTextNode2 -{ - // trivial test case to ensure ASSnapshotTestCase works - ASTextNode *textNode = [[ASTextNode alloc] init]; - textNode.attributedText = [[NSAttributedString alloc] initWithString:@"judar" - attributes:@{NSFontAttributeName: [UIFont italicSystemFontOfSize:24]}]; - textNode.textContainerInset = UIEdgeInsetsMake(0, 2, 0, 2); - ASDisplayNodeSizeToFitSizeRange(textNode, ASSizeRangeMake(CGSizeZero, CGSizeMake(CGFLOAT_MAX, CGFLOAT_MAX))); - - ASSnapshotVerifyNode(textNode, nil); -} - -- (void)testTextTruncationModes_ASTextNode2 -{ - UIView *container = [[UIView alloc] initWithFrame:(CGRect) {CGPointZero, (CGSize) {375.0f, 667.0f}}]; - - UILabel *textNodeLabel = [[UILabel alloc] init]; - UILabel *uiLabelLabel = [[UILabel alloc] init]; - UILabel *description = [[UILabel alloc] init]; - textNodeLabel.text = @"ASTextNode2:"; - textNodeLabel.font = [UIFont boldSystemFontOfSize:16.0]; - textNodeLabel.textColor = [UIColor colorWithRed:0.0 green:0.7 blue:0.0 alpha:1.0]; - uiLabelLabel.text = @"UILabel:"; - uiLabelLabel.font = [UIFont boldSystemFontOfSize:16.0]; - uiLabelLabel.textColor = [UIColor colorWithRed:0.0 green:0.7 blue:0.0 alpha:1.0]; - - description.text = @""; - description.font = [UIFont italicSystemFontOfSize:16.0]; - description.numberOfLines = 0; - - uiLabelLabel.textColor = [UIColor colorWithRed:0.0 green:0.7 blue:0.0 alpha:1.0]; - - UILabel *reference = [[UILabel alloc] init]; - ASTextNode *textNode = [[ASTextNode alloc] init]; // ASTextNode2 - - NSMutableAttributedString *refString = [[NSMutableAttributedString alloc] initWithString:@"Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua." - attributes:@{ NSFontAttributeName : [UIFont systemFontOfSize:18.0f] }]; - NSMutableAttributedString *asString = [refString mutableCopy]; - - reference.attributedText = refString; - textNode.attributedText = asString; - - CGSize size = (CGSize) {container.bounds.size.width, 120.0}; - CGPoint origin = (CGPoint) {CGRectGetWidth(container.bounds) / 2 - size.width / 2, CGRectGetHeight(container.bounds) / 2 - size.height / 2}; // center - - textNode.frame = (CGRect) {origin, size}; - reference.frame = CGRectOffset(textNode.frame, 0, -160.0f); - - textNodeLabel.bounds = (CGRect) {CGPointZero, (CGSize) {container.bounds.size.width, textNodeLabel.font.lineHeight}}; - origin = (CGPoint) {textNode.frame.origin.x, textNode.frame.origin.y - textNodeLabel.bounds.size.height}; - textNodeLabel.frame = (CGRect) {origin, textNodeLabel.bounds.size}; - - uiLabelLabel.bounds = (CGRect) {CGPointZero, (CGSize) {container.bounds.size.width, uiLabelLabel.font.lineHeight}}; - origin = (CGPoint) {reference.frame.origin.x, reference.frame.origin.y - uiLabelLabel.bounds.size.height}; - uiLabelLabel.frame = (CGRect) {origin, uiLabelLabel.bounds.size}; - - uiLabelLabel.bounds = (CGRect) {CGPointZero, (CGSize) {container.bounds.size.width, uiLabelLabel.font.lineHeight}}; - origin = (CGPoint) {textNode.frame.origin.x, textNode.frame.origin.y - uiLabelLabel.bounds.size.height}; - uiLabelLabel.frame = (CGRect) {origin, uiLabelLabel.bounds.size}; - - uiLabelLabel.bounds = (CGRect) {CGPointZero, (CGSize) {container.bounds.size.width, uiLabelLabel.font.lineHeight}}; - origin = (CGPoint) {reference.frame.origin.x, reference.frame.origin.y - uiLabelLabel.bounds.size.height}; - uiLabelLabel.frame = (CGRect) {origin, uiLabelLabel.bounds.size}; - - description.bounds = textNode.bounds; - description.frame = (CGRect) {(CGPoint) {0, container.bounds.size.height * 0.8}, description.bounds.size}; - - [container addSubview:reference]; - [container addSubview:textNode.view]; - [container addSubview:textNodeLabel]; - [container addSubview:uiLabelLabel]; - [container addSubview:description]; - - NSArray *c = [LineBreakConfig configs]; - for (LineBreakConfig *config in c) { - reference.lineBreakMode = textNode.truncationMode = config.lineBreakMode; - reference.numberOfLines = textNode.maximumNumberOfLines = config.numberOfLines; - description.text = config.description; - [container setNeedsLayout]; - NSString *identifier = [NSString stringWithFormat:@"%@_%luLines", [config breakModeDescription], (unsigned long)config.numberOfLines]; - [ASSnapshotTestCase hackilySynchronouslyRecursivelyRenderNode:textNode]; - ASSnapshotVerifyViewWithTolerance(container, identifier, 0.01); - } -} - -- (void)testTextContainerInsetIsIncludedWithSmallerConstrainedSize_ASTextNode2 -{ - UIView *backgroundView = [[UIView alloc] initWithFrame:CGRectZero]; - backgroundView.layer.as_allowsHighlightDrawing = YES; - - ASTextNode *textNode = [[ASTextNode alloc] init]; - textNode.attributedText = [[NSAttributedString alloc] initWithString:@"judar judar judar judar judar judar" - attributes:@{ NSFontAttributeName : [UIFont systemFontOfSize:30] }]; - - textNode.textContainerInset = UIEdgeInsetsMake(10, 10, 10, 10); - - ASLayout *layout = [textNode layoutThatFits:ASSizeRangeMake(CGSizeZero, CGSizeMake(100, 80))]; - textNode.frame = CGRectMake(50, 50, layout.size.width, layout.size.height); - - [backgroundView addSubview:textNode.view]; - backgroundView.frame = UIEdgeInsetsInsetRect(textNode.bounds, UIEdgeInsetsMake(-50, -50, -50, -50)); - - textNode.highlightRange = NSMakeRange(0, textNode.attributedText.length); - - [ASSnapshotTestCase hackilySynchronouslyRecursivelyRenderNode:textNode]; - ASSnapshotVerifyLayer(backgroundView.layer, nil); -} - -- (void)testTextContainerInsetHighlight_ASTextNode2 -{ - UIView *backgroundView = [[UIView alloc] initWithFrame:CGRectZero]; - backgroundView.layer.as_allowsHighlightDrawing = YES; - - ASTextNode *textNode = [[ASTextNode alloc] init]; - textNode.attributedText = [[NSAttributedString alloc] initWithString:@"yolo" - attributes:@{ NSFontAttributeName : [UIFont systemFontOfSize:30] }]; - - textNode.textContainerInset = UIEdgeInsetsMake(5, 10, 10, 5); - ASLayout *layout = [textNode layoutThatFits:ASSizeRangeMake(CGSizeZero, CGSizeMake(INFINITY, INFINITY))]; - textNode.frame = CGRectMake(50, 50, layout.size.width, layout.size.height); - - [backgroundView addSubview:textNode.view]; - backgroundView.frame = UIEdgeInsetsInsetRect(textNode.bounds, UIEdgeInsetsMake(-50, -50, -50, -50)); - - textNode.highlightRange = NSMakeRange(0, textNode.attributedText.length); - - [ASSnapshotTestCase hackilySynchronouslyRecursivelyRenderNode:textNode]; - ASSnapshotVerifyView(backgroundView, nil); -} - -// This test is disabled because the fast-path is disabled. -- (void)DISABLED_testThatFastPathTruncationWorks_ASTextNode2 -{ - ASTextNode *textNode = [[ASTextNode alloc] init]; - textNode.attributedText = [[NSAttributedString alloc] initWithString:@"Quality is Important" attributes:@{ NSForegroundColorAttributeName: [UIColor blueColor], NSFontAttributeName: [UIFont italicSystemFontOfSize:24] }]; - [textNode layoutThatFits:ASSizeRangeMake(CGSizeZero, CGSizeMake(100, 50))]; - ASSnapshotVerifyNode(textNode, nil); -} - -- (void)testThatSlowPathTruncationWorks_ASTextNode2 -{ - ASTextNode *textNode = [[ASTextNode alloc] init]; - textNode.attributedText = [[NSAttributedString alloc] initWithString:@"Quality is Important" attributes:@{ NSForegroundColorAttributeName: [UIColor blueColor], NSFontAttributeName: [UIFont italicSystemFontOfSize:24] }]; - // Set exclusion paths to trigger slow path - textNode.exclusionPaths = @[ [UIBezierPath bezierPath] ]; - ASDisplayNodeSizeToFitSizeRange(textNode, ASSizeRangeMake(CGSizeZero, CGSizeMake(100, 50))); - ASSnapshotVerifyNode(textNode, nil); -} - -- (void)testShadowing_ASTextNode2 -{ - ASTextNode *textNode = [[ASTextNode alloc] init]; - textNode.attributedText = [[NSAttributedString alloc] initWithString:@"Quality is Important"]; - textNode.shadowColor = [UIColor blackColor].CGColor; - textNode.shadowOpacity = 0.3; - textNode.shadowRadius = 3; - textNode.shadowOffset = CGSizeMake(0, 1); - ASDisplayNodeSizeToFitSizeRange(textNode, ASSizeRangeMake(CGSizeZero, CGSizeMake(INFINITY, INFINITY))); - ASSnapshotVerifyNode(textNode, nil); -} - -/** - * https://github.com/TextureGroup/Texture/issues/822 - */ -- (void)DISABLED_testThatTruncationTokenAttributesPrecedeThoseInheritedFromTextWhenTruncateTailMode_ASTextNode2 -{ - ASTextNode *textNode = [[ASTextNode alloc] init]; - textNode.style.maxSize = CGSizeMake(20, 80); - NSMutableAttributedString *mas = [[NSMutableAttributedString alloc] initWithString:@"Quality is an important "]; - [mas appendAttributedString:[[NSAttributedString alloc] initWithString:@"thing" attributes:@{ NSBackgroundColorAttributeName : UIColor.yellowColor}]]; - textNode.attributedText = mas; - textNode.truncationMode = NSLineBreakByTruncatingTail; - - textNode.truncationAttributedText = [[NSAttributedString alloc] initWithString:@"\u2026" attributes:@{ NSBackgroundColorAttributeName: UIColor.greenColor }]; - ASDisplayNodeSizeToFitSizeRange(textNode, ASSizeRangeMake(CGSizeZero, CGSizeMake(INFINITY, INFINITY))); - ASSnapshotVerifyNode(textNode, nil); -} - -@end diff --git a/submodules/AsyncDisplayKit/Tests/ASTextNode2Tests.mm b/submodules/AsyncDisplayKit/Tests/ASTextNode2Tests.mm deleted file mode 100644 index b8f08ed451..0000000000 --- a/submodules/AsyncDisplayKit/Tests/ASTextNode2Tests.mm +++ /dev/null @@ -1,94 +0,0 @@ -// -// ASTextNode2Tests.mm -// TextureTests -// -// Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -#import - -#import -#import -#import - -#import "ASTestCase.h" - -@interface ASTextNode2Tests : XCTestCase - -@property(nonatomic) ASTextNode2 *textNode; -@property(nonatomic, copy) NSAttributedString *attributedText; - -@end - -@implementation ASTextNode2Tests - -- (void)setUp -{ - [super setUp]; - _textNode = [[ASTextNode2 alloc] init]; - - UIFontDescriptor *desc = [UIFontDescriptor fontDescriptorWithName:@"Didot" size:18]; - NSArray *arr = @[ @{ - UIFontFeatureTypeIdentifierKey : @(kLetterCaseType), - UIFontFeatureSelectorIdentifierKey : @(kSmallCapsSelector) - } ]; - desc = [desc fontDescriptorByAddingAttributes:@{UIFontDescriptorFeatureSettingsAttribute : arr}]; - UIFont *f = [UIFont fontWithDescriptor:desc size:0]; - NSDictionary *d = @{NSFontAttributeName : f}; - NSMutableAttributedString *mas = [[NSMutableAttributedString alloc] - initWithString: - @"Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor " - @"incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud " - @"exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure " - @"dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. " - @"Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt " - @"mollit anim id est laborum." - attributes:d]; - NSMutableParagraphStyle *para = [NSMutableParagraphStyle new]; - para.alignment = NSTextAlignmentCenter; - para.lineSpacing = 1.0; - [mas addAttribute:NSParagraphStyleAttributeName value:para range:NSMakeRange(0, mas.length - 1)]; - - // Vary the linespacing on the last line - NSMutableParagraphStyle *lastLinePara = [NSMutableParagraphStyle new]; - lastLinePara.alignment = para.alignment; - lastLinePara.lineSpacing = 5.0; - [mas addAttribute:NSParagraphStyleAttributeName - value:lastLinePara - range:NSMakeRange(mas.length - 1, 1)]; - - _attributedText = mas; - _textNode.attributedText = _attributedText; -} - -- (void)testTruncation -{ - XCTAssertTrue([(ASTextNode *)_textNode shouldTruncateForConstrainedSize:ASSizeRangeMake(CGSizeMake(100, 100))], @"Text Node should truncate"); - - _textNode.frame = CGRectMake(0, 0, 100, 100); - XCTAssertTrue(_textNode.isTruncated, @"Text Node should be truncated"); -} - -- (void)testAccessibility -{ - XCTAssertTrue(_textNode.isAccessibilityElement, @"Should be an accessibility element"); - XCTAssertTrue(_textNode.accessibilityTraits == UIAccessibilityTraitStaticText, - @"Should have static text accessibility trait, instead has %llu", - _textNode.accessibilityTraits); - XCTAssertTrue(_textNode.defaultAccessibilityTraits == UIAccessibilityTraitStaticText, - @"Default accessibility traits should return static text accessibility trait, " - @"instead returns %llu", - _textNode.defaultAccessibilityTraits); - - XCTAssertTrue([_textNode.accessibilityLabel isEqualToString:_attributedText.string], - @"Accessibility label is incorrectly set to \n%@\n when it should be \n%@\n", - _textNode.accessibilityLabel, _attributedText.string); - XCTAssertTrue([_textNode.defaultAccessibilityLabel isEqualToString:_attributedText.string], - @"Default accessibility label incorrectly returns \n%@\n when it should be \n%@\n", - _textNode.defaultAccessibilityLabel, _attributedText.string); -} - -@end diff --git a/submodules/AsyncDisplayKit/Tests/ASTextNodePerformanceTests.mm b/submodules/AsyncDisplayKit/Tests/ASTextNodePerformanceTests.mm deleted file mode 100644 index 961d192aa7..0000000000 --- a/submodules/AsyncDisplayKit/Tests/ASTextNodePerformanceTests.mm +++ /dev/null @@ -1,234 +0,0 @@ -// -// ASTextNodePerformanceTests.mm -// Texture -// -// Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import -#import "ASPerformanceTestContext.h" -#import -#import -#import -#import - -#import "ASXCTExtensions.h" - -/** - * NOTE: This test case is not run during the "test" action. You have to run it manually (click the little diamond.) - */ - -@interface ASTextNodePerformanceTests : XCTestCase - -@end - -@implementation ASTextNodePerformanceTests - -#pragma mark Performance Tests - -static NSString *const kTestCaseUIKit = @"UIKit"; -static NSString *const kTestCaseASDK = @"ASDK"; -static NSString *const kTestCaseUIKitPrivateCaching = @"UIKitPrivateCaching"; -static NSString *const kTestCaseUIKitWithNoContext = @"UIKitNoContext"; -static NSString *const kTestCaseUIKitWithFreshContext = @"UIKitFreshContext"; -static NSString *const kTestCaseUIKitWithReusedContext = @"UIKitReusedContext"; - -+ (NSArray *)realisticDataSet -{ - static NSArray *array; - static dispatch_once_t onceToken; - dispatch_once(&onceToken, ^{ - NSString *file = [[NSBundle bundleForClass:self] pathForResource:@"AttributedStringsFixture0" ofType:@"plist" inDirectory:@"TestResources"]; - if (file != nil) { - array = [NSKeyedUnarchiver unarchiveObjectWithFile:file]; - } - NSAssert([array isKindOfClass:[NSArray class]], nil); - NSSet *unique = [NSSet setWithArray:array]; - NSLog(@"Loaded realistic text data set with %d attributed strings, %d unique.", (int)array.count, (int)unique.count); - }); - return array; -} - -- (void)testPerformance_RealisticData -{ - NSArray *data = [self.class realisticDataSet]; - - CGSize maxSize = CGSizeMake(355, CGFLOAT_MAX); - CGSize __block uiKitSize, __block asdkSize; - - ASPerformanceTestContext *ctx = [[ASPerformanceTestContext alloc] init]; - [ctx addCaseWithName:kTestCaseUIKit block:^(NSUInteger i, dispatch_block_t _Nonnull startMeasuring, dispatch_block_t _Nonnull stopMeasuring) { - NSAttributedString *text = data[i % data.count]; - startMeasuring(); - uiKitSize = [text boundingRectWithSize:maxSize options:NSStringDrawingUsesLineFragmentOrigin | NSStringDrawingTruncatesLastVisibleLine context:nil].size; - stopMeasuring(); - }]; - uiKitSize.width = ASCeilPixelValue(uiKitSize.width); - uiKitSize.height = ASCeilPixelValue(uiKitSize.height); - ctx.results[kTestCaseUIKit].userInfo[@"size"] = NSStringFromCGSize(uiKitSize); - - [ctx addCaseWithName:kTestCaseASDK block:^(NSUInteger i, dispatch_block_t _Nonnull startMeasuring, dispatch_block_t _Nonnull stopMeasuring) { - ASTextNode *node = [[ASTextNode alloc] init]; - NSAttributedString *text = data[i % data.count]; - startMeasuring(); - node.attributedText = text; - asdkSize = [node layoutThatFits:ASSizeRangeMake(CGSizeZero, maxSize)].size; - stopMeasuring(); - }]; - ctx.results[kTestCaseASDK].userInfo[@"size"] = NSStringFromCGSize(asdkSize); - - ASXCTAssertEqualSizes(uiKitSize, asdkSize); - ASXCTAssertRelativePerformanceInRange(ctx, kTestCaseASDK, 0.2, 0.5); -} - -- (void)testPerformance_TwoParagraphLatinNoTruncation -{ - NSAttributedString *text = [ASTextNodePerformanceTests twoParagraphLatinText]; - - CGSize maxSize = CGSizeMake(355, CGFLOAT_MAX); - CGSize __block uiKitSize, __block asdkSize; - - ASPerformanceTestContext *ctx = [[ASPerformanceTestContext alloc] init]; - [ctx addCaseWithName:kTestCaseUIKit block:^(NSUInteger i, dispatch_block_t _Nonnull startMeasuring, dispatch_block_t _Nonnull stopMeasuring) { - startMeasuring(); - uiKitSize = [text boundingRectWithSize:maxSize options:NSStringDrawingUsesLineFragmentOrigin | NSStringDrawingTruncatesLastVisibleLine context:nil].size; - stopMeasuring(); - }]; - uiKitSize.width = ASCeilPixelValue(uiKitSize.width); - uiKitSize.height = ASCeilPixelValue(uiKitSize.height); - ctx.results[kTestCaseUIKit].userInfo[@"size"] = NSStringFromCGSize(uiKitSize); - - [ctx addCaseWithName:kTestCaseASDK block:^(NSUInteger i, dispatch_block_t _Nonnull startMeasuring, dispatch_block_t _Nonnull stopMeasuring) { - ASTextNode *node = [[ASTextNode alloc] init]; - startMeasuring(); - node.attributedText = text; - asdkSize = [node layoutThatFits:ASSizeRangeMake(CGSizeZero, maxSize)].size; - stopMeasuring(); - }]; - ctx.results[kTestCaseASDK].userInfo[@"size"] = NSStringFromCGSize(asdkSize); - - ASXCTAssertEqualSizes(uiKitSize, asdkSize); - ASXCTAssertRelativePerformanceInRange(ctx, kTestCaseASDK, 0.5, 0.9); -} - -- (void)testPerformance_OneParagraphLatinWithTruncation -{ - NSAttributedString *text = [ASTextNodePerformanceTests oneParagraphLatinText]; - - CGSize maxSize = CGSizeMake(355, 150); - CGSize __block uiKitSize, __block asdkSize; - - ASPerformanceTestContext *testCtx = [[ASPerformanceTestContext alloc] init]; - [testCtx addCaseWithName:kTestCaseUIKit block:^(NSUInteger i, dispatch_block_t _Nonnull startMeasuring, dispatch_block_t _Nonnull stopMeasuring) { - startMeasuring(); - uiKitSize = [text boundingRectWithSize:maxSize options:NSStringDrawingUsesLineFragmentOrigin | NSStringDrawingTruncatesLastVisibleLine context:nil].size; - stopMeasuring(); - }]; - uiKitSize.width = ASCeilPixelValue(uiKitSize.width); - uiKitSize.height = ASCeilPixelValue(uiKitSize.height); - testCtx.results[kTestCaseUIKit].userInfo[@"size"] = NSStringFromCGSize(uiKitSize); - - [testCtx addCaseWithName:kTestCaseASDK block:^(NSUInteger i, dispatch_block_t _Nonnull startMeasuring, dispatch_block_t _Nonnull stopMeasuring) { - ASTextNode *node = [[ASTextNode alloc] init]; - startMeasuring(); - node.attributedText = text; - asdkSize = [node layoutThatFits:ASSizeRangeMake(CGSizeZero, maxSize)].size; - stopMeasuring(); - }]; - testCtx.results[kTestCaseASDK].userInfo[@"size"] = NSStringFromCGSize(asdkSize); - - XCTAssert(CGSizeEqualToSizeWithIn(uiKitSize, asdkSize, 5)); - ASXCTAssertRelativePerformanceInRange(testCtx, kTestCaseASDK, 0.1, 0.3); -} - -- (void)testThatNotUsingAStringDrawingContextHasSimilarPerformanceToHavingOne -{ - ASPerformanceTestContext *ctx = [[ASPerformanceTestContext alloc] init]; - - NSAttributedString *text = [ASTextNodePerformanceTests oneParagraphLatinText]; - CGSize maxSize = CGSizeMake(355, 150); - NSStringDrawingOptions options = NSStringDrawingUsesLineFragmentOrigin | NSStringDrawingTruncatesLastVisibleLine; - __block CGSize size; - // nil context - [ctx addCaseWithName:kTestCaseUIKitWithNoContext block:^(NSUInteger i, dispatch_block_t _Nonnull startMeasuring, dispatch_block_t _Nonnull stopMeasuring) { - startMeasuring(); - size = [text boundingRectWithSize:maxSize options:options context:nil].size; - stopMeasuring(); - }]; - ctx.results[kTestCaseUIKitWithNoContext].userInfo[@"size"] = NSStringFromCGSize(size); - - // Fresh context - [ctx addCaseWithName:kTestCaseUIKitWithFreshContext block:^(NSUInteger i, dispatch_block_t _Nonnull startMeasuring, dispatch_block_t _Nonnull stopMeasuring) { - NSStringDrawingContext *stringDrawingCtx = [[NSStringDrawingContext alloc] init]; - startMeasuring(); - size = [text boundingRectWithSize:maxSize options:options context:stringDrawingCtx].size; - stopMeasuring(); - }]; - ctx.results[kTestCaseUIKitWithFreshContext].userInfo[@"size"] = NSStringFromCGSize(size); - - // Reused context - NSStringDrawingContext *stringDrawingCtx = [[NSStringDrawingContext alloc] init]; - [ctx addCaseWithName:kTestCaseUIKitWithReusedContext block:^(NSUInteger i, dispatch_block_t _Nonnull startMeasuring, dispatch_block_t _Nonnull stopMeasuring) { - startMeasuring(); - size = [text boundingRectWithSize:maxSize options:options context:stringDrawingCtx].size; - stopMeasuring(); - }]; - ctx.results[kTestCaseUIKitWithReusedContext].userInfo[@"size"] = NSStringFromCGSize(size); - - XCTAssertTrue([ctx areAllUserInfosEqual]); - ASXCTAssertRelativePerformanceInRange(ctx, kTestCaseUIKitWithReusedContext, 0.8, 1.2); - ASXCTAssertRelativePerformanceInRange(ctx, kTestCaseUIKitWithFreshContext, 0.8, 1.2); -} - -- (void)testThatUIKitPrivateLayoutCachingIsAwesome -{ - NSAttributedString *text = [ASTextNodePerformanceTests oneParagraphLatinText]; - ASPerformanceTestContext *ctx = [[ASPerformanceTestContext alloc] init]; - CGSize maxSize = CGSizeMake(355, 150); - __block CGSize uncachedSize, cachedSize; - NSStringDrawingOptions options = NSStringDrawingUsesLineFragmentOrigin | NSStringDrawingTruncatesLastVisibleLine; - - // No caching, reused ctx - NSStringDrawingContext *defaultCtx = [[NSStringDrawingContext alloc] init]; - XCTAssertFalse([[defaultCtx valueForKey:@"cachesLayout"] boolValue]); - [ctx addCaseWithName:kTestCaseUIKit block:^(NSUInteger i, dispatch_block_t _Nonnull startMeasuring, dispatch_block_t _Nonnull stopMeasuring) { - startMeasuring(); - uncachedSize = [text boundingRectWithSize:maxSize options:options context:defaultCtx].size; - stopMeasuring(); - }]; - XCTAssertFalse([[defaultCtx valueForKey:@"cachesLayout"] boolValue]); - ctx.results[kTestCaseUIKit].userInfo[@"size"] = NSStringFromCGSize(uncachedSize); - - // Caching - NSStringDrawingContext *cachingCtx = [[NSStringDrawingContext alloc] init]; - [cachingCtx setValue:@YES forKey:@"cachesLayout"]; - [ctx addCaseWithName:kTestCaseUIKitPrivateCaching block:^(NSUInteger i, dispatch_block_t _Nonnull startMeasuring, dispatch_block_t _Nonnull stopMeasuring) { - startMeasuring(); - cachedSize = [text boundingRectWithSize:maxSize options:options context:cachingCtx].size; - stopMeasuring(); - }]; - ctx.results[kTestCaseUIKitPrivateCaching].userInfo[@"size"] = NSStringFromCGSize(cachedSize); - - XCTAssertTrue([ctx areAllUserInfosEqual]); - ASXCTAssertRelativePerformanceInRange(ctx, kTestCaseUIKitPrivateCaching, 1.2, FLT_MAX); -} - -#pragma mark Fixture Data - -+ (NSMutableAttributedString *)oneParagraphLatinText -{ - NSDictionary *attributes = @{ - NSFontAttributeName: [UIFont systemFontOfSize:14] - }; - return [[NSMutableAttributedString alloc] initWithString:@"Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aliquam gravida, metus non tincidunt tincidunt, arcu quam vulputate magna, nec semper libero mi in lorem. Quisque turpis erat, congue sit amet eros at, gravida gravida lacus. Maecenas maximus lectus in efficitur pulvinar. Nam elementum massa eget luctus condimentum. Curabitur egestas mauris urna. Fusce lacus ante, laoreet vitae leo quis, mattis aliquam est. Donec bibendum augue at elit lacinia lobortis. Cras imperdiet ac justo eget sollicitudin. Pellentesque malesuada nec tellus vitae dictum. Proin vestibulum tempus odio in condimentum. Interdum et malesuada fames ac ante ipsum primis in faucibus. Duis vel turpis at velit dignissim rutrum. Nunc lorem felis, molestie eget ornare id, luctus at nunc. Maecenas suscipit nisi sit amet nulla cursus, id eleifend odio laoreet." attributes:attributes]; -} - -+ (NSMutableAttributedString *)twoParagraphLatinText -{ - NSDictionary *attributes = @{ - NSFontAttributeName: [UIFont systemFontOfSize:14] - }; - return [[NSMutableAttributedString alloc] initWithString:@"Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aliquam gravida, metus non tincidunt tincidunt, arcu quam vulputate magna, nec semper libero mi in lorem. Quisque turpis erat, congue sit amet eros at, gravida gravida lacus. Maecenas maximus lectus in efficitur pulvinar. Nam elementum massa eget luctus condimentum. Curabitur egestas mauris urna. Fusce lacus ante, laoreet vitae leo quis, mattis aliquam est. Donec bibendum augue at elit lacinia lobortis. Cras imperdiet ac justo eget sollicitudin. Pellentesque malesuada nec tellus vitae dictum. Proin vestibulum tempus odio in condimentum. Interdum et malesuada fames ac ante ipsum primis in faucibus. Duis vel turpis at velit dignissim rutrum. Nunc lorem felis, molestie eget ornare id, luctus at nunc. Maecenas suscipit nisi sit amet nulla cursus, id eleifend odio laoreet.\n\nPellentesque auctor pulvinar velit, venenatis elementum ex tempus eu. Vestibulum iaculis hendrerit tortor quis sagittis. Pellentesque quam sem, varius ac orci nec, tincidunt ultricies mauris. Aliquam est nunc, eleifend et posuere sed, vestibulum eu elit. Pellentesque pharetra bibendum finibus. Aliquam interdum metus ac feugiat congue. Donec suscipit neque quis mauris volutpat, at molestie tortor aliquam. Aenean posuere nulla a ex posuere finibus. Integer tincidunt quam urna, et vulputate enim tempor sit amet. Nullam ut tellus ac arcu fringilla cursus." attributes:attributes]; -} -@end diff --git a/submodules/AsyncDisplayKit/Tests/ASTextNodeSnapshotTests.mm b/submodules/AsyncDisplayKit/Tests/ASTextNodeSnapshotTests.mm deleted file mode 100644 index 1b21ac35f2..0000000000 --- a/submodules/AsyncDisplayKit/Tests/ASTextNodeSnapshotTests.mm +++ /dev/null @@ -1,147 +0,0 @@ -// -// ASTextNodeSnapshotTests.mm -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import "ASSnapshotTestCase.h" -#import - -@interface ASTextNodeSnapshotTests : ASSnapshotTestCase - -@end - -@implementation ASTextNodeSnapshotTests - -- (void)setUp -{ - [super setUp]; - - self.recordMode = NO; -} - -- (void)testTextContainerInset -{ - // trivial test case to ensure ASSnapshotTestCase works - ASTextNode *textNode = [[ASTextNode alloc] init]; - textNode.attributedText = [[NSAttributedString alloc] initWithString:@"judar" - attributes:@{NSFontAttributeName : [UIFont italicSystemFontOfSize:24]}]; - textNode.textContainerInset = UIEdgeInsetsMake(0, 2, 0, 2); - ASDisplayNodeSizeToFitSizeRange(textNode, ASSizeRangeMake(CGSizeZero, CGSizeMake(CGFLOAT_MAX, CGFLOAT_MAX))); - - ASSnapshotVerifyNode(textNode, nil); -} - -- (void)testTextContainerInsetIsIncludedWithSmallerConstrainedSize -{ - UIView *backgroundView = [[UIView alloc] initWithFrame:CGRectZero]; - backgroundView.layer.as_allowsHighlightDrawing = YES; - - ASTextNode *textNode = [[ASTextNode alloc] init]; - textNode.attributedText = [[NSAttributedString alloc] initWithString:@"judar judar judar judar judar judar" - attributes:@{ NSFontAttributeName : [UIFont systemFontOfSize:30] }]; - - textNode.textContainerInset = UIEdgeInsetsMake(10, 10, 10, 10); - - ASLayout *layout = [textNode layoutThatFits:ASSizeRangeMake(CGSizeZero, CGSizeMake(100, 80))]; - textNode.frame = CGRectMake(50, 50, layout.size.width, layout.size.height); - - [backgroundView addSubview:textNode.view]; - backgroundView.frame = UIEdgeInsetsInsetRect(textNode.bounds, UIEdgeInsetsMake(-50, -50, -50, -50)); - - textNode.highlightRange = NSMakeRange(0, textNode.attributedText.length); - - [ASSnapshotTestCase hackilySynchronouslyRecursivelyRenderNode:textNode]; - ASSnapshotVerifyLayer(backgroundView.layer, nil); -} - -- (void)testTextContainerInsetHighlight -{ - UIView *backgroundView = [[UIView alloc] initWithFrame:CGRectZero]; - backgroundView.layer.as_allowsHighlightDrawing = YES; - - ASTextNode *textNode = [[ASTextNode alloc] init]; - textNode.attributedText = [[NSAttributedString alloc] initWithString:@"yolo" - attributes:@{ NSFontAttributeName : [UIFont systemFontOfSize:30] }]; - - textNode.textContainerInset = UIEdgeInsetsMake(5, 10, 10, 5); - ASLayout *layout = [textNode layoutThatFits:ASSizeRangeMake(CGSizeZero, CGSizeMake(INFINITY, INFINITY))]; - textNode.frame = CGRectMake(50, 50, layout.size.width, layout.size.height); - - [backgroundView addSubview:textNode.view]; - backgroundView.frame = UIEdgeInsetsInsetRect(textNode.bounds, UIEdgeInsetsMake(-50, -50, -50, -50)); - - textNode.highlightRange = NSMakeRange(0, textNode.attributedText.length); - - [ASSnapshotTestCase hackilySynchronouslyRecursivelyRenderNode:textNode]; - ASSnapshotVerifyView(backgroundView, nil); -} - -// This test is disabled because the fast-path is disabled. -- (void)DISABLED_testThatFastPathTruncationWorks -{ - ASTextNode *textNode = [[ASTextNode alloc] init]; - textNode.attributedText = [[NSAttributedString alloc] initWithString:@"Quality is Important" attributes:@{ NSForegroundColorAttributeName: [UIColor blueColor], NSFontAttributeName: [UIFont italicSystemFontOfSize:24] }]; - [textNode layoutThatFits:ASSizeRangeMake(CGSizeZero, CGSizeMake(100, 50))]; - ASSnapshotVerifyNode(textNode, nil); -} - -- (void)testThatSlowPathTruncationWorks -{ - ASTextNode *textNode = [[ASTextNode alloc] init]; - textNode.attributedText = [[NSAttributedString alloc] initWithString:@"Quality is Important" attributes:@{ NSForegroundColorAttributeName: [UIColor blueColor], NSFontAttributeName: [UIFont italicSystemFontOfSize:24] }]; - // Set exclusion paths to trigger slow path - textNode.exclusionPaths = @[ [UIBezierPath bezierPath] ]; - ASDisplayNodeSizeToFitSizeRange(textNode, ASSizeRangeMake(CGSizeZero, CGSizeMake(100, 50))); - ASSnapshotVerifyNode(textNode, nil); -} - -- (void)testShadowing -{ - ASTextNode *textNode = [[ASTextNode alloc] init]; - textNode.attributedText = [[NSAttributedString alloc] initWithString:@"Quality is Important"]; - textNode.shadowColor = [UIColor blackColor].CGColor; - textNode.shadowOpacity = 0.3; - textNode.shadowRadius = 3; - textNode.shadowOffset = CGSizeMake(0, 1); - ASDisplayNodeSizeToFitSizeRange(textNode, ASSizeRangeMake(CGSizeZero, CGSizeMake(INFINITY, INFINITY))); - ASSnapshotVerifyNode(textNode, nil); -} - -/** - * https://github.com/TextureGroup/Texture/issues/822 - */ -- (void)DISABLED_testThatTruncationTokenAttributesPrecedeThoseInheritedFromTextWhenTruncateTailMode -{ - ASTextNode *textNode = [[ASTextNode alloc] init]; - textNode.style.maxSize = CGSizeMake(20, 80); - NSMutableAttributedString *mas = [[NSMutableAttributedString alloc] initWithString:@"Quality is an important "]; - [mas appendAttributedString:[[NSAttributedString alloc] initWithString:@"thing" attributes:@{ NSBackgroundColorAttributeName : UIColor.yellowColor}]]; - textNode.attributedText = mas; - textNode.truncationMode = NSLineBreakByTruncatingTail; - - textNode.truncationAttributedText = [[NSAttributedString alloc] initWithString:@"\u2026" attributes:@{ NSBackgroundColorAttributeName: UIColor.greenColor }]; - ASDisplayNodeSizeToFitSizeRange(textNode, ASSizeRangeMake(CGSizeZero, CGSizeMake(INFINITY, INFINITY))); - ASSnapshotVerifyNode(textNode, nil); -} - -- (void)testFontPointSizeScaling -{ - NSMutableParagraphStyle *paragraphStyle = [NSMutableParagraphStyle new]; - paragraphStyle.lineHeightMultiple = 0.5; - paragraphStyle.lineSpacing = 2.0; - - ASTextNode *textNode = [[ASTextNode alloc] init]; - textNode.style.maxSize = CGSizeMake(60, 80); - textNode.pointSizeScaleFactors = @[@0.5]; - textNode.attributedText = [[NSAttributedString alloc] initWithString:@"Quality is an important thing" - attributes:@{ NSParagraphStyleAttributeName: paragraphStyle }]; - - ASDisplayNodeSizeToFitSizeRange(textNode, ASSizeRangeMake(CGSizeZero, CGSizeMake(INFINITY, INFINITY))); - ASSnapshotVerifyNode(textNode, nil); -} - -@end diff --git a/submodules/AsyncDisplayKit/Tests/ASTextNodeTests.mm b/submodules/AsyncDisplayKit/Tests/ASTextNodeTests.mm deleted file mode 100644 index dd6ae4c942..0000000000 --- a/submodules/AsyncDisplayKit/Tests/ASTextNodeTests.mm +++ /dev/null @@ -1,324 +0,0 @@ -// -// ASTextNodeTests.mm -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -#import -#import - -#import -#import -#import -#import -#import - -#import "ASTestCase.h" - - - -@interface ASTextNodeTestDelegate : NSObject - -@property (nonatomic, copy, readonly) NSString *tappedLinkAttribute; -@property (nonatomic, readonly) id tappedLinkValue; - -@end -@interface ASTextNodeSubclass : ASTextNode -@end -@interface ASTextNodeSecondSubclass : ASTextNodeSubclass -@end - -@implementation ASTextNodeTestDelegate - -- (void)textNode:(ASTextNode *)textNode tappedLinkAttribute:(NSString *)attribute value:(id)value atPoint:(CGPoint)point textRange:(NSRange)textRange -{ - _tappedLinkAttribute = attribute; - _tappedLinkValue = value; -} - -- (BOOL)textNode:(ASTextNode *)textNode shouldHighlightLinkAttribute:(NSString *)attribute value:(id)value atPoint:(CGPoint)point -{ - return YES; -} - -@end - -@interface ASTextNodeTests : XCTestCase - -@property (nonatomic) ASTextNode *textNode; -@property (nonatomic, copy) NSAttributedString *attributedText; -@property (nonatomic) NSMutableArray *textNodeBucket; - -@end - -@implementation ASTextNodeTests - -- (void)setUp -{ - [super setUp]; - _textNode = [[ASTextNode alloc] init]; - _textNodeBucket = [[NSMutableArray alloc] init]; - - UIFontDescriptor *desc = - [UIFontDescriptor fontDescriptorWithName:@"Didot" size:18]; - NSArray *arr = - @[@{UIFontFeatureTypeIdentifierKey:@(kLetterCaseType), - UIFontFeatureSelectorIdentifierKey:@(kSmallCapsSelector)}]; - desc = - [desc fontDescriptorByAddingAttributes: - @{UIFontDescriptorFeatureSettingsAttribute:arr}]; - UIFont *f = [UIFont fontWithDescriptor:desc size:0]; - NSDictionary *d = @{NSFontAttributeName: f}; - NSMutableAttributedString *mas = - [[NSMutableAttributedString alloc] initWithString:@"Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum." attributes:d]; - NSMutableParagraphStyle *para = [NSMutableParagraphStyle new]; - para.alignment = NSTextAlignmentCenter; - para.lineSpacing = 1.0; - [mas addAttribute:NSParagraphStyleAttributeName value:para - range:NSMakeRange(0, mas.length - 1)]; - - // Vary the linespacing on the last line - NSMutableParagraphStyle *lastLinePara = [NSMutableParagraphStyle new]; - lastLinePara.alignment = para.alignment; - lastLinePara.lineSpacing = 5.0; - [mas addAttribute:NSParagraphStyleAttributeName value:lastLinePara - range:NSMakeRange(mas.length - 1, 1)]; - - _attributedText = mas; - _textNode.attributedText = _attributedText; -} - -#pragma mark - ASTextNode - -- (void)testAllocASTextNode -{ - ASTextNode *node = [[ASTextNode alloc] init]; - XCTAssertTrue([[node class] isSubclassOfClass:[ASTextNode class]], @"ASTextNode alloc should return an instance of ASTextNode, instead returned %@", [node class]); -} - -#pragma mark - ASTextNode - -- (void)testTruncation -{ - XCTAssertTrue([_textNode shouldTruncateForConstrainedSize:ASSizeRangeMake(CGSizeMake(100, 100))], @""); - - _textNode.frame = CGRectMake(0, 0, 100, 100); - XCTAssertTrue(_textNode.isTruncated, @"Text Node should be truncated"); -} - -- (void)testSettingTruncationMessage -{ - NSAttributedString *truncation = [[NSAttributedString alloc] initWithString:@"..." attributes:nil]; - _textNode.truncationAttributedText = truncation; - XCTAssertTrue([_textNode.truncationAttributedText isEqualToAttributedString:truncation], @"Failed to set truncation message"); -} - -- (void)testSettingAdditionalTruncationMessage -{ - NSAttributedString *additionalTruncationMessage = [[NSAttributedString alloc] initWithString:@"read more" attributes:nil]; - _textNode.additionalTruncationMessage = additionalTruncationMessage; - XCTAssertTrue([_textNode.additionalTruncationMessage isEqualToAttributedString:additionalTruncationMessage], @"Failed to set additionalTruncationMessage message"); -} - -- (void)testCalculatedSizeIsGreaterThanOrEqualToConstrainedSize -{ - for (NSInteger i = 10; i < 500; i += 50) { - CGSize constrainedSize = CGSizeMake(i, i); - CGSize calculatedSize = [_textNode layoutThatFits:ASSizeRangeMake(CGSizeZero, constrainedSize)].size; - XCTAssertTrue(calculatedSize.width <= constrainedSize.width, @"Calculated width (%f) should be less than or equal to constrained width (%f)", calculatedSize.width, constrainedSize.width); - XCTAssertTrue(calculatedSize.height <= constrainedSize.height, @"Calculated height (%f) should be less than or equal to constrained height (%f)", calculatedSize.height, constrainedSize.height); - } -} - -- (void)testRecalculationOfSizeIsSameAsOriginallyCalculatedSize -{ - for (NSInteger i = 10; i < 500; i += 50) { - CGSize constrainedSize = CGSizeMake(i, i); - CGSize calculatedSize = [_textNode layoutThatFits:ASSizeRangeMake(CGSizeZero, constrainedSize)].size; - CGSize recalculatedSize = [_textNode layoutThatFits:ASSizeRangeMake(CGSizeZero, constrainedSize)].size; - - XCTAssertTrue(CGSizeEqualToSizeWithIn(calculatedSize, recalculatedSize, 4.0), @"Recalculated size %@ should be same as original size %@", NSStringFromCGSize(recalculatedSize), NSStringFromCGSize(calculatedSize)); - } -} - -- (void)testRecalculationOfSizeIsSameAsOriginallyCalculatedFloatingPointSize -{ - for (CGFloat i = 10; i < 500; i *= 1.3) { - CGSize constrainedSize = CGSizeMake(i, i); - CGSize calculatedSize = [_textNode layoutThatFits:ASSizeRangeMake(CGSizeZero, constrainedSize)].size; - CGSize recalculatedSize = [_textNode layoutThatFits:ASSizeRangeMake(CGSizeZero, constrainedSize)].size; - - XCTAssertTrue(CGSizeEqualToSizeWithIn(calculatedSize, recalculatedSize, 11.0), @"Recalculated size %@ should be same as original size %@", NSStringFromCGSize(recalculatedSize), NSStringFromCGSize(calculatedSize)); - } -} - -- (void)testMeasureWithZeroSizeAndPlaceholder -{ - _textNode.placeholderEnabled = YES; - - XCTAssertNoThrow([_textNode layoutThatFits:ASSizeRangeMake(CGSizeZero, CGSizeZero)], @"Measure with zero size and placeholder enabled should not throw an exception"); - XCTAssertNoThrow([_textNode layoutThatFits:ASSizeRangeMake(CGSizeZero, CGSizeMake(0, 100))], @"Measure with zero width and placeholder enabled should not throw an exception"); - XCTAssertNoThrow([_textNode layoutThatFits:ASSizeRangeMake(CGSizeZero, CGSizeMake(100, 0))], @"Measure with zero height and placeholder enabled should not throw an exception"); -} - -- (void)testAccessibility -{ - _textNode.attributedText = _attributedText; - XCTAssertTrue(_textNode.isAccessibilityElement, @"Should be an accessibility element"); - XCTAssertTrue(_textNode.accessibilityTraits == UIAccessibilityTraitStaticText, @"Should have static text accessibility trait, instead has %llu", _textNode.accessibilityTraits); - - XCTAssertTrue([_textNode.accessibilityLabel isEqualToString:_attributedText.string], @"Accessibility label is incorrectly set to \n%@\n when it should be \n%@\n", _textNode.accessibilityLabel, _attributedText.string); -} - -- (void)testLinkAttribute -{ - NSString *linkAttributeName = @"MockLinkAttributeName"; - NSString *linkAttributeValue = @"MockLinkAttributeValue"; - NSString *linkString = @"Link"; - NSRange linkRange = NSMakeRange(0, linkString.length); - NSAttributedString *attributedString = [[NSAttributedString alloc] initWithString:linkString attributes:@{ linkAttributeName : linkAttributeValue}]; - _textNode.attributedText = attributedString; - _textNode.linkAttributeNames = @[linkAttributeName]; - - ASTextNodeTestDelegate *delegate = [ASTextNodeTestDelegate new]; - _textNode.delegate = delegate; - - ASLayout *layout = [_textNode layoutThatFits:ASSizeRangeMake(CGSizeZero, CGSizeMake(100, 100))]; - _textNode.frame = CGRectMake(0, 0, layout.size.width, layout.size.height); - - NSRange returnedLinkRange; - NSString *returnedAttributeName; - NSString *returnedLinkAttributeValue = [_textNode linkAttributeValueAtPoint:CGPointMake(3, 3) attributeName:&returnedAttributeName range:&returnedLinkRange]; - XCTAssertTrue([linkAttributeName isEqualToString:returnedAttributeName], @"Expecting a link attribute name of %@, returned %@", linkAttributeName, returnedAttributeName); - XCTAssertTrue([linkAttributeValue isEqualToString:returnedLinkAttributeValue], @"Expecting a link attribute value of %@, returned %@", linkAttributeValue, returnedLinkAttributeValue); - XCTAssertTrue(NSEqualRanges(linkRange, returnedLinkRange), @"Expected a range of %@, got a link range of %@", NSStringFromRange(linkRange), NSStringFromRange(returnedLinkRange)); -} - -- (void)testTapNotOnALinkAttribute -{ - NSString *linkAttributeName = @"MockLinkAttributeName"; - NSString *linkAttributeValue = @"MockLinkAttributeValue"; - NSString *linkString = @"Link notalink"; - NSMutableAttributedString *attributedString = [[NSMutableAttributedString alloc] initWithString:linkString]; - [attributedString addAttribute:linkAttributeName value:linkAttributeValue range:NSMakeRange(0, 4)]; - _textNode.attributedText = attributedString; - _textNode.linkAttributeNames = @[linkAttributeName]; - - ASTextNodeTestDelegate *delegate = [ASTextNodeTestDelegate new]; - _textNode.delegate = delegate; - - CGSize calculatedSize = [_textNode layoutThatFits:ASSizeRangeMake(CGSizeZero, CGSizeMake(100, 100))].size; - NSRange returnedLinkRange = NSMakeRange(NSNotFound, 0); - NSRange expectedRange = NSMakeRange(NSNotFound, 0); - NSString *returnedAttributeName; - CGPoint pointNearEndOfString = CGPointMake(calculatedSize.width - 3, calculatedSize.height / 2); - NSString *returnedLinkAttributeValue = [_textNode linkAttributeValueAtPoint:pointNearEndOfString attributeName:&returnedAttributeName range:&returnedLinkRange]; - XCTAssertFalse(returnedAttributeName, @"Expecting no link attribute name, returned %@", returnedAttributeName); - XCTAssertFalse(returnedLinkAttributeValue, @"Expecting no link attribute value, returned %@", returnedLinkAttributeValue); - XCTAssertTrue(NSEqualRanges(expectedRange, returnedLinkRange), @"Expected a range of %@, got a link range of %@", NSStringFromRange(expectedRange), NSStringFromRange(returnedLinkRange)); - - XCTAssertFalse(delegate.tappedLinkAttribute, @"Expected the delegate to be told that %@ was tapped, instead it thinks the tapped attribute is %@", linkAttributeName, delegate.tappedLinkAttribute); - XCTAssertFalse(delegate.tappedLinkValue, @"Expected the delegate to be told that the value %@ was tapped, instead it thinks the tapped attribute value is %@", linkAttributeValue, delegate.tappedLinkValue); -} - -#pragma mark exclusion Paths - -- (void)testSettingExclusionPaths -{ - NSArray *exclusionPaths = @[[UIBezierPath bezierPathWithRect:CGRectMake(10, 20, 30, 40)]]; - _textNode.exclusionPaths = exclusionPaths; - XCTAssertTrue([_textNode.exclusionPaths isEqualToArray:exclusionPaths], @"Failed to set exclusion paths"); -} - -- (void)testAddingExclusionPathsShouldInvalidateAndIncreaseTheSize -{ - CGSize constrainedSize = CGSizeMake(100, CGFLOAT_MAX); - CGSize sizeWithoutExclusionPaths = [_textNode layoutThatFits:ASSizeRangeMake(CGSizeZero, constrainedSize)].size; - _textNode.exclusionPaths = @[[UIBezierPath bezierPathWithRect:CGRectMake(50, 20, 30, 40)]]; - CGSize sizeWithExclusionPaths = [_textNode layoutThatFits:ASSizeRangeMake(CGSizeZero, constrainedSize)].size; - - XCTAssertGreaterThan(sizeWithExclusionPaths.height, sizeWithoutExclusionPaths.height, @"Setting exclusions paths should invalidate the calculated size and return a greater size"); -} - -#if AS_ENABLE_TEXTNODE -- (void)testThatTheExperimentWorksCorrectly -{ - ASConfiguration *config = [ASConfiguration new]; - config.experimentalFeatures = ASExperimentalTextNode; - [ASConfigurationManager test_resetWithConfiguration:config]; - - ASTextNode *plainTextNode = [[ASTextNode alloc] init]; - XCTAssertEqualObjects(plainTextNode.class, [ASTextNode2 class]); - - ASTextNodeSecondSubclass *sc2 = [[ASTextNodeSecondSubclass alloc] init]; - XCTAssertEqualObjects([ASTextNodeSubclass superclass], [ASTextNode2 class]); - XCTAssertEqualObjects(sc2.superclass, [ASTextNodeSubclass class]); -} - -- (void)testTextNodeSwitchWorksInMultiThreadEnvironment -{ - ASConfiguration *config = [ASConfiguration new]; - config.experimentalFeatures = ASExperimentalTextNode; - [ASConfigurationManager test_resetWithConfiguration:config]; - XCTestExpectation *exp = [self expectationWithDescription:@"wait for full bucket"]; - - dispatch_queue_t queue = dispatch_queue_create("com.texture.AsyncDisplayKit.ASTextNodeTestsQueue", DISPATCH_QUEUE_CONCURRENT); - dispatch_group_t g = dispatch_group_create(); - for (int i = 0; i < 20; i++) { - dispatch_group_async(g, queue, ^{ - ASTextNode *textNode = [[ASTextNodeSecondSubclass alloc] init]; - XCTAssert([textNode isKindOfClass:[ASTextNode2 class]]); - @synchronized(self.textNodeBucket) { - [self.textNodeBucket addObject:textNode]; - if (self.textNodeBucket.count == 20) { - [exp fulfill]; - } - } - }); - } - [self waitForExpectations:@[exp] timeout:3]; - exp = nil; - [self.textNodeBucket removeAllObjects]; -} - -- (void)testTextNodeSwitchWorksInMultiThreadEnvironment2 -{ - ASConfiguration *config = [ASConfiguration new]; - config.experimentalFeatures = ASExperimentalTextNode; - [ASConfigurationManager test_resetWithConfiguration:config]; - XCTestExpectation *exp = [self expectationWithDescription:@"wait for full bucket"]; - - NSLock *lock = [[NSLock alloc] init]; - NSMutableArray *textNodeBucket = [[NSMutableArray alloc] init]; - - dispatch_queue_t queue = dispatch_queue_create("com.texture.AsyncDisplayKit.ASTextNodeTestsQueue", DISPATCH_QUEUE_CONCURRENT); - dispatch_group_t g = dispatch_group_create(); - for (int i = 0; i < 20; i++) { - dispatch_group_async(g, queue, ^{ - ASTextNode *textNode = [[ASTextNodeSecondSubclass alloc] init]; - XCTAssert([textNode isKindOfClass:[ASTextNode2 class]]); - [lock lock]; - [textNodeBucket addObject:textNode]; - if (textNodeBucket.count == 20) { - [exp fulfill]; - } - [lock unlock]; - }); - } - [self waitForExpectations:@[exp] timeout:3]; - exp = nil; - [textNodeBucket removeAllObjects]; -} -#endif - -@end - -@implementation ASTextNodeSubclass -@end -@implementation ASTextNodeSecondSubclass -@end diff --git a/submodules/AsyncDisplayKit/Tests/ASTextNodeWordKernerTests.mm b/submodules/AsyncDisplayKit/Tests/ASTextNodeWordKernerTests.mm deleted file mode 100644 index 7b9773574b..0000000000 --- a/submodules/AsyncDisplayKit/Tests/ASTextNodeWordKernerTests.mm +++ /dev/null @@ -1,149 +0,0 @@ -// -// ASTextNodeWordKernerTests.mm -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -#import -#import -#import - -#pragma mark - Tests - -@interface ASTextNodeWordKernerTests : XCTestCase - -@property (nonatomic) ASTextNodeWordKerner *layoutManagerDelegate; -@property (nonatomic) ASTextKitComponents *components; -@property (nonatomic, copy) NSAttributedString *attributedString; - -@end - -@implementation ASTextNodeWordKernerTests - -- (void)setUp -{ - [super setUp]; - _layoutManagerDelegate = [[ASTextNodeWordKerner alloc] init]; - _components.layoutManager.delegate = _layoutManagerDelegate; -} - -- (void)setupTextKitComponentsWithoutWordKerning -{ - CGSize size = CGSizeMake(200, 200); - NSDictionary *attributes = nil; - NSString *seedString = @"Hello world"; - NSMutableAttributedString *attributedString = [[NSMutableAttributedString alloc] initWithString:seedString attributes:attributes]; - _components = [ASTextKitComponents componentsWithAttributedSeedString:attributedString textContainerSize:size]; -} - -- (void)setupTextKitComponentsWithWordKerning -{ - CGSize size = CGSizeMake(200, 200); - NSDictionary *attributes = @{ASTextNodeWordKerningAttributeName: @".5"}; - NSString *seedString = @"Hello world"; - NSMutableAttributedString *attributedString = [[NSMutableAttributedString alloc] initWithString:seedString attributes:attributes]; - _components = [ASTextKitComponents componentsWithAttributedSeedString:attributedString textContainerSize:size]; -} - -- (void)setupTextKitComponentsWithWordKerningDifferentFontSizes -{ - CGSize size = CGSizeMake(200, 200); - NSDictionary *attributes = @{ASTextNodeWordKerningAttributeName: @".5"}; - NSString *seedString = @" "; - NSMutableAttributedString *attributedString = [[NSMutableAttributedString alloc] initWithString:seedString attributes:attributes]; - UIFont *bigFont = [UIFont systemFontOfSize:36]; - UIFont *normalFont = [UIFont systemFontOfSize:12]; - [attributedString addAttribute:NSFontAttributeName value:bigFont range:NSMakeRange(0, 1)]; - [attributedString addAttribute:NSFontAttributeName value:normalFont range:NSMakeRange(1, 1)]; - _components = [ASTextKitComponents componentsWithAttributedSeedString:attributedString textContainerSize:size]; -} - -- (void)testSomeGlyphsToChangeIfWordKerning -{ - [self setupTextKitComponentsWithWordKerning]; - - NSInteger glyphsToChange = [self _layoutManagerShouldGenerateGlyphs]; - XCTAssertTrue(glyphsToChange > 0, @"Should have changed the properties on some glyphs"); -} - -- (void)testSpaceBoundingBoxForNoWordKerning -{ - CGSize size = CGSizeMake(200, 200); - UIFont *font = [UIFont systemFontOfSize:12.0]; - NSDictionary *attributes = @{NSFontAttributeName : font}; - NSMutableAttributedString *attributedString = [[NSMutableAttributedString alloc] initWithString:@" " attributes:attributes]; - _components = [ASTextKitComponents componentsWithAttributedSeedString:attributedString textContainerSize:size]; - CGFloat expectedWidth = [@" " sizeWithAttributes:@{ NSFontAttributeName : font }].width; - - CGRect boundingBox = [_layoutManagerDelegate layoutManager:_components.layoutManager boundingBoxForControlGlyphAtIndex:0 forTextContainer:_components.textContainer proposedLineFragment:CGRectZero glyphPosition:CGPointZero characterIndex:0]; - - XCTAssertEqualWithAccuracy(boundingBox.size.width, expectedWidth, FLT_EPSILON, @"Word kerning shouldn't alter the default width of %f. Encountered space width was %f", expectedWidth, boundingBox.size.width); -} - -- (void)testSpaceBoundingBoxForWordKerning -{ - CGSize size = CGSizeMake(200, 200); - UIFont *font = [UIFont systemFontOfSize:12]; - - CGFloat kernValue = 0.5; - NSDictionary *attributes = @{ASTextNodeWordKerningAttributeName: @(kernValue), - NSFontAttributeName : font}; - NSMutableAttributedString *attributedString = [[NSMutableAttributedString alloc] initWithString:@" " attributes:attributes]; - _components = [ASTextKitComponents componentsWithAttributedSeedString:attributedString textContainerSize:size]; - CGFloat expectedWidth = [@" " sizeWithAttributes:@{ NSFontAttributeName : font }].width + kernValue; - - CGRect boundingBox = [_layoutManagerDelegate layoutManager:_components.layoutManager boundingBoxForControlGlyphAtIndex:0 forTextContainer:_components.textContainer proposedLineFragment:CGRectZero glyphPosition:CGPointZero characterIndex:0]; - XCTAssertEqualWithAccuracy(boundingBox.size.width, expectedWidth, FLT_EPSILON, @"Word kerning shouldn't alter the default width of %f. Encountered space width was %f", expectedWidth, boundingBox.size.width); -} - -- (NSInteger)_layoutManagerShouldGenerateGlyphs -{ - NSRange stringRange = NSMakeRange(0, _components.textStorage.length); - NSRange glyphRange = [_components.layoutManager glyphRangeForCharacterRange:stringRange actualCharacterRange:NULL]; - NSInteger glyphCount = glyphRange.length; - NSUInteger *characterIndexes = (NSUInteger *)malloc(sizeof(NSUInteger) * glyphCount); - for (NSUInteger i=0; i < stringRange.length; i++) { - characterIndexes[i] = i; - } - NSGlyphProperty *glyphProperties = (NSGlyphProperty *)malloc(sizeof(NSGlyphProperty) * glyphCount); - CGGlyph *glyphs = (CGGlyph *)malloc(sizeof(CGGlyph) * glyphCount); - NSInteger glyphsToChange = [_layoutManagerDelegate layoutManager:_components.layoutManager shouldGenerateGlyphs:glyphs properties:glyphProperties characterIndexes:characterIndexes font:[UIFont systemFontOfSize:12.0] forGlyphRange:stringRange]; - free(characterIndexes); - free(glyphProperties); - free(glyphs); - return glyphsToChange; -} - -- (void)testPerCharacterWordKerning -{ - [self setupTextKitComponentsWithWordKerningDifferentFontSizes]; - CGPoint glyphPosition = CGPointZero; - NSUInteger bigSpaceIndex = 0; - NSUInteger normalSpaceIndex = 1; - CGRect bigBoundingBox = [_layoutManagerDelegate layoutManager:_components.layoutManager boundingBoxForControlGlyphAtIndex:bigSpaceIndex forTextContainer:_components.textContainer proposedLineFragment:CGRectZero glyphPosition:glyphPosition characterIndex:bigSpaceIndex]; - CGRect normalBoundingBox = [_layoutManagerDelegate layoutManager:_components.layoutManager boundingBoxForControlGlyphAtIndex:normalSpaceIndex forTextContainer:_components.textContainer proposedLineFragment:CGRectZero glyphPosition:glyphPosition characterIndex:normalSpaceIndex]; - XCTAssertTrue(bigBoundingBox.size.width > normalBoundingBox.size.width, @"Unbolded and bolded spaces should have different kerning"); -} - -- (void)testWordKerningDoesNotAlterGlyphOrigin -{ - CGSize size = CGSizeMake(200, 200); - NSDictionary *attributes = @{ASTextNodeWordKerningAttributeName: @".5"}; - NSString *seedString = @" "; - NSMutableAttributedString *attributedString = [[NSMutableAttributedString alloc] initWithString:seedString attributes:attributes]; - UIFont *normalFont = [UIFont systemFontOfSize:12]; - [attributedString addAttribute:NSFontAttributeName value:normalFont range:NSMakeRange(0, 1)]; - _components = [ASTextKitComponents componentsWithAttributedSeedString:attributedString textContainerSize:size]; - - CGPoint glyphPosition = CGPointMake(42, 54); - - CGRect boundingBox = [_layoutManagerDelegate layoutManager:_components.layoutManager boundingBoxForControlGlyphAtIndex:0 forTextContainer:_components.textContainer proposedLineFragment:CGRectZero glyphPosition:glyphPosition characterIndex:0]; - XCTAssertTrue(CGPointEqualToPoint(glyphPosition, boundingBox.origin), @"Word kerning shouldn't alter the origin point of a glyph"); -} - -@end diff --git a/submodules/AsyncDisplayKit/Tests/ASThrashUtility.h b/submodules/AsyncDisplayKit/Tests/ASThrashUtility.h deleted file mode 100644 index 09e7847750..0000000000 --- a/submodules/AsyncDisplayKit/Tests/ASThrashUtility.h +++ /dev/null @@ -1,111 +0,0 @@ -// -// Tests/ASThrashUtility.h -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import -#import - -NS_ASSUME_NONNULL_BEGIN - -#define kInitialSectionCount 10 -#define kInitialItemCount 10 -#define kMinimumItemCount 5 -#define kMinimumSectionCount 3 -#define kFickleness 0.1 -#define kThrashingIterationCount 10 - -// Set to 1 to use UITableView and see if the issue still exists. -#define USE_UIKIT_REFERENCE 0 - -#if USE_UIKIT_REFERENCE -#define TableView UITableView -#define CollectionView UICollectionView -#define kCellReuseID @"ASThrashTestCellReuseID" -#else -#define TableView ASTableView -#define CollectionView ASCollectionNode -#endif - -static NSInteger ASThrashUpdateCurrentSerializationVersion = 1; - -@class ASThrashTestSection; -static atomic_uint ASThrashTestItemNextID; -@interface ASThrashTestItem: NSObject -@property (nonatomic, readonly) NSInteger itemID; - -+ (NSMutableArray *)itemsWithCount:(NSInteger)count; - -- (CGFloat)rowHeight; -@end - - -@interface ASThrashTestSection: NSObject -@property (nonatomic, readonly) NSMutableArray *items; -@property (nonatomic, readonly) NSInteger sectionID; - -+ (NSMutableArray *)sectionsWithCount:(NSInteger)count; - -- (instancetype)initWithCount:(NSInteger)count; -- (CGFloat)headerHeight; -@end - -@interface ASThrashDataSource: NSObject -#if USE_UIKIT_REFERENCE - -#else - -#endif - -@property (nonatomic, readonly) UIWindow *window; -@property (nonatomic, readonly) TableView *tableView; -@property (nonatomic, readonly) CollectionView *collectionView; -@property (nonatomic) NSArray *data; -// Only access on main -@property (nonatomic) ASWeakSet *allNodes; - -- (instancetype)initTableViewDataSourceWithData:(NSArray *)data; -- (instancetype)initCollectionViewDataSourceWithData:(NSArray * _Nullable)data; -- (NSPredicate *)predicateForDeallocatedHierarchy; -@end - -@interface NSIndexSet (ASThrashHelpers) -- (NSArray *)indexPathsInSection:(NSInteger)section; -/// `insertMode` means that for each index selected, the max goes up by one. -+ (NSMutableIndexSet *)randomIndexesLessThan:(NSInteger)max probability:(float)probability insertMode:(BOOL)insertMode; -@end - -#if !USE_UIKIT_REFERENCE -@interface ASThrashTestNode: ASCellNode -@property (nonatomic) ASThrashTestItem *item; -@end -#endif - -@interface ASThrashUpdate : NSObject -@property (nonatomic, readonly) NSArray *oldData; -@property (nonatomic, readonly) NSMutableArray *data; -@property (nonatomic, readonly) NSMutableIndexSet *deletedSectionIndexes; -@property (nonatomic, readonly) NSMutableIndexSet *replacedSectionIndexes; -/// The sections used to replace the replaced sections. -@property (nonatomic, readonly) NSMutableArray *replacingSections; -@property (nonatomic, readonly) NSMutableIndexSet *insertedSectionIndexes; -@property (nonatomic, readonly) NSMutableArray *insertedSections; -@property (nonatomic, readonly) NSMutableArray *deletedItemIndexes; -@property (nonatomic, readonly) NSMutableArray *replacedItemIndexes; -/// The items used to replace the replaced items. -@property (nonatomic, readonly) NSMutableArray *> *replacingItems; -@property (nonatomic, readonly) NSMutableArray *insertedItemIndexes; -@property (nonatomic, readonly) NSMutableArray *> *insertedItems; - -- (instancetype)initWithData:(NSArray *)data; - -+ (ASThrashUpdate *)thrashUpdateWithBase64String:(NSString *)base64; -- (NSString *)base64Representation; -- (NSString *)logFriendlyBase64Representation; -@end - -NS_ASSUME_NONNULL_END diff --git a/submodules/AsyncDisplayKit/Tests/ASThrashUtility.m b/submodules/AsyncDisplayKit/Tests/ASThrashUtility.m deleted file mode 100644 index c555d3f776..0000000000 --- a/submodules/AsyncDisplayKit/Tests/ASThrashUtility.m +++ /dev/null @@ -1,467 +0,0 @@ -// -// ASTableViewThrashTests.mm -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import "ASThrashUtility.h" -#import -#import - -static NSString *ASThrashArrayDescription(NSArray *array) -{ - NSMutableString *str = [NSMutableString stringWithString:@"(\n"]; - NSInteger i = 0; - for (id obj in array) { - [str appendFormat:@"\t[%ld]: \"%@\",\n", (long)i, obj]; - i += 1; - } - [str appendString:@")"]; - return str; -} - -@implementation ASThrashTestItem - -+ (BOOL)supportsSecureCoding -{ - return YES; -} - -- (instancetype)init -{ - self = [super init]; - if (self != nil) { - _itemID = atomic_fetch_add(&ASThrashTestItemNextID, 1); - } - return self; -} - -- (instancetype)initWithCoder:(NSCoder *)aDecoder -{ - self = [super init]; - if (self != nil) { - _itemID = [aDecoder decodeIntegerForKey:@"itemID"]; - NSAssert(_itemID > 0, @"Failed to decode %@", self); - } - return self; -} - -- (void)encodeWithCoder:(NSCoder *)aCoder -{ - [aCoder encodeInteger:_itemID forKey:@"itemID"]; -} - -+ (NSMutableArray *)itemsWithCount:(NSInteger)count -{ - NSMutableArray *result = [NSMutableArray arrayWithCapacity:count]; - for (NSInteger i = 0; i < count; i += 1) { - [result addObject:[[ASThrashTestItem alloc] init]]; - } - return result; -} - -- (CGFloat)rowHeight -{ - return (self.itemID % 400) ?: 44; -} - -- (NSString *)description -{ - return [NSString stringWithFormat:@"", (unsigned long)_itemID]; -} - -@end - -static atomic_uint ASThrashTestSectionNextID = 1; -@implementation ASThrashTestSection - -/// Create an array of sections with the given count -+ (NSMutableArray *)sectionsWithCount:(NSInteger)count -{ - NSMutableArray *result = [NSMutableArray arrayWithCapacity:count]; - for (NSInteger i = 0; i < count; i += 1) { - [result addObject:[[ASThrashTestSection alloc] initWithCount:kInitialItemCount]]; - } - return result; -} - -- (instancetype)initWithCount:(NSInteger)count -{ - self = [super init]; - if (self != nil) { - _sectionID = atomic_fetch_add(&ASThrashTestSectionNextID, 1); - _items = [ASThrashTestItem itemsWithCount:count]; - } - return self; -} - -- (instancetype)init -{ - return [self initWithCount:0]; -} - -- (instancetype)initWithCoder:(NSCoder *)aDecoder -{ - self = [super init]; - if (self != nil) { - _items = [aDecoder decodeObjectOfClass:[NSArray class] forKey:@"items"]; - _sectionID = [aDecoder decodeIntegerForKey:@"sectionID"]; - NSAssert(_sectionID > 0, @"Failed to decode %@", self); - } - return self; -} - -+ (BOOL)supportsSecureCoding -{ - return YES; -} - -- (void)encodeWithCoder:(NSCoder *)aCoder -{ - [aCoder encodeObject:_items forKey:@"items"]; - [aCoder encodeInteger:_sectionID forKey:@"sectionID"]; -} - -- (CGFloat)headerHeight -{ - return self.sectionID % 400 ?: 44; -} - -- (NSString *)description -{ - return [NSString stringWithFormat:@"
", (unsigned long)_sectionID, (unsigned long)self.items.count, ASThrashArrayDescription(self.items)]; -} - -- (id)copyWithZone:(NSZone *)zone -{ - ASThrashTestSection *copy = [[ASThrashTestSection alloc] init]; - copy->_sectionID = _sectionID; - copy->_items = [_items mutableCopy]; - return copy; -} - -- (BOOL)isEqual:(id)object -{ - if ([object isKindOfClass:[ASThrashTestSection class]]) { - return [(ASThrashTestSection *)object sectionID] == _sectionID; - } else { - return NO; - } -} - -@end - -@implementation NSIndexSet (ASThrashHelpers) - -- (NSArray *)indexPathsInSection:(NSInteger)section -{ - NSMutableArray *result = [NSMutableArray arrayWithCapacity:self.count]; - [self enumerateIndexesUsingBlock:^(NSUInteger idx, BOOL * _Nonnull stop) { - [result addObject:[NSIndexPath indexPathForItem:idx inSection:section]]; - }]; - return result; -} - -/// `insertMode` means that for each index selected, the max goes up by one. -+ (NSMutableIndexSet *)randomIndexesLessThan:(NSInteger)max probability:(float)probability insertMode:(BOOL)insertMode -{ - NSMutableIndexSet *indexes = [[NSMutableIndexSet alloc] init]; - u_int32_t cutoff = probability * 100; - for (NSInteger i = 0; i < max; i++) { - if (arc4random_uniform(100) < cutoff) { - [indexes addIndex:i]; - if (insertMode) { - max += 1; - } - } - } - return indexes; -} - -@end - -@implementation ASThrashDataSource - -- (instancetype)initTableViewDataSourceWithData:(NSArray *)data -{ - self = [super init]; - if (self != nil) { - _data = [[NSArray alloc] initWithArray:data copyItems:YES]; - _window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds]; - _tableView = [[TableView alloc] initWithFrame:_window.bounds style:UITableViewStylePlain]; - _allNodes = [[ASWeakSet alloc] init]; - [_window addSubview:_tableView]; -#if USE_UIKIT_REFERENCE - _tableView.dataSource = self; - _tableView.delegate = self; - [_tableView registerClass:[UITableViewCell class] forCellReuseIdentifier:kCellReuseID]; -#else - _tableView.asyncDelegate = self; - _tableView.asyncDataSource = self; - [_tableView reloadData]; - [_tableView waitUntilAllUpdatesAreCommitted]; -#endif - [_tableView layoutIfNeeded]; - } - return self; -} - -- (instancetype)initCollectionViewDataSourceWithData:(NSArray *)data -{ - self = [super init]; - if (self != nil) { - _data = data != nil ? [[NSArray alloc] initWithArray:data copyItems:YES] : [[NSArray alloc] init]; - _window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds]; - _collectionView = [[CollectionView alloc] initWithCollectionViewLayout:[[UICollectionViewFlowLayout alloc] init]]; - _allNodes = [[ASWeakSet alloc] init]; - [_window addSubview:_tableView]; - _collectionView.delegate = self; - _collectionView.dataSource = self; -#if USE_UIKIT_REFERENCE - [_collectionView registerClass:[UITableViewCell class] forCellReuseIdentifier:kCellReuseID]; -#else - [_collectionView reloadData]; - [_collectionView waitUntilAllUpdatesAreProcessed]; -#endif - [_collectionView layoutIfNeeded]; - } - return self; -} - -- (void)setData:(NSArray *)data -{ - _data = data; -} - -- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section -{ - return self.data[section].items.count; -} - - -- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView -{ - return self.data.count; -} - -- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section -{ - return self.data[section].headerHeight; -} - -- (NSInteger)collectionNode:(ASCollectionNode *)collectionNode numberOfItemsInSection:(NSInteger)section -{ - return self.data[section].items.count; -} - - -- (NSInteger)numberOfSectionsInCollectionNode:(ASCollectionNode *)collectionNode -{ - return self.data.count; -} - -/// Object passed into predicate is ignored. -- (NSPredicate *)predicateForDeallocatedHierarchy -{ - ASWeakSet *allNodes = self.allNodes; - __weak UIWindow *window = _window; - __weak ASTableView *view = _tableView; - return [NSPredicate predicateWithBlock:^BOOL(id _Nullable evaluatedObject, NSDictionary * _Nullable bindings) { - return window == nil && view == nil && allNodes.isEmpty; - }]; -} - -#if USE_UIKIT_REFERENCE - -- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath -{ - return [tableView dequeueReusableCellWithIdentifier:kCellReuseID forIndexPath:indexPath]; -} - -- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath -{ - ASThrashTestItem *item = self.data[indexPath.section].items[indexPath.item]; - return item.rowHeight; -} - -#else - -- (ASCellNode *)collectionNode:(ASCollectionNode *)collectionNode nodeForItemAtIndexPath:(NSIndexPath *)indexPath -{ - ASThrashTestNode *node = [[ASThrashTestNode alloc] init]; - node.item = self.data[indexPath.section].items[indexPath.row]; - [self.allNodes addObject:node]; - return node; -} - -- (ASCellNode *)tableView:(ASTableView *)tableView nodeForRowAtIndexPath:(NSIndexPath *)indexPath -{ - ASThrashTestNode *node = [[ASThrashTestNode alloc] init]; - node.item = self.data[indexPath.section].items[indexPath.item]; - [self.allNodes addObject:node]; - return node; -} - -#endif - -@end - -#if !USE_UIKIT_REFERENCE -@implementation ASThrashTestNode - -- (CGSize)calculateSizeThatFits:(CGSize)constrainedSize -{ - ASDisplayNodeAssertFalse(isinf(constrainedSize.width)); - return CGSizeMake(constrainedSize.width, 44); -} - -@end -#endif - -@implementation ASThrashUpdate - -- (instancetype)initWithData:(NSArray *)data -{ - self = [super init]; - if (self != nil) { - _data = [[NSMutableArray alloc] initWithArray:data copyItems:YES]; - _oldData = [[NSArray alloc] initWithArray:data copyItems:YES]; - - _deletedItemIndexes = [NSMutableArray array]; - _replacedItemIndexes = [NSMutableArray array]; - _insertedItemIndexes = [NSMutableArray array]; - _replacingItems = [NSMutableArray array]; - _insertedItems = [NSMutableArray array]; - - // Randomly reload some items - for (ASThrashTestSection *section in _data) { - NSMutableIndexSet *indexes = [NSIndexSet randomIndexesLessThan:section.items.count probability:kFickleness insertMode:NO]; - NSArray *newItems = [ASThrashTestItem itemsWithCount:indexes.count]; - [section.items replaceObjectsAtIndexes:indexes withObjects:newItems]; - [_replacingItems addObject:newItems]; - [_replacedItemIndexes addObject:indexes]; - } - - // Randomly replace some sections - _replacedSectionIndexes = [NSIndexSet randomIndexesLessThan:_data.count probability:kFickleness insertMode:NO]; - _replacingSections = [ASThrashTestSection sectionsWithCount:_replacedSectionIndexes.count]; - [_data replaceObjectsAtIndexes:_replacedSectionIndexes withObjects:_replacingSections]; - - // Randomly delete some items - [_data enumerateObjectsUsingBlock:^(ASThrashTestSection * _Nonnull section, NSUInteger idx, BOOL * _Nonnull stop) { - if (section.items.count >= kMinimumItemCount) { - NSMutableIndexSet *indexes = [NSIndexSet randomIndexesLessThan:section.items.count probability:kFickleness insertMode:NO]; - - /// Cannot reload & delete the same item. - [indexes removeIndexes:_replacedItemIndexes[idx]]; - - [section.items removeObjectsAtIndexes:indexes]; - [_deletedItemIndexes addObject:indexes]; - } else { - [_deletedItemIndexes addObject:[NSMutableIndexSet indexSet]]; - } - }]; - - // Randomly delete some sections - if (_data.count >= kMinimumSectionCount) { - _deletedSectionIndexes = [NSIndexSet randomIndexesLessThan:_data.count probability:kFickleness insertMode:NO]; - } else { - _deletedSectionIndexes = [NSMutableIndexSet indexSet]; - } - // Cannot replace & delete the same section. - [_deletedSectionIndexes removeIndexes:_replacedSectionIndexes]; - - // Cannot delete/replace item in deleted/replaced section - [_deletedSectionIndexes enumerateIndexesUsingBlock:^(NSUInteger idx, BOOL * _Nonnull stop) { - [_replacedItemIndexes[idx] removeAllIndexes]; - [_deletedItemIndexes[idx] removeAllIndexes]; - }]; - [_replacedSectionIndexes enumerateIndexesUsingBlock:^(NSUInteger idx, BOOL * _Nonnull stop) { - [_replacedItemIndexes[idx] removeAllIndexes]; - [_deletedItemIndexes[idx] removeAllIndexes]; - }]; - [_data removeObjectsAtIndexes:_deletedSectionIndexes]; - - // Randomly insert some sections - _insertedSectionIndexes = [NSIndexSet randomIndexesLessThan:(_data.count + 1) probability:kFickleness insertMode:YES]; - _insertedSections = [ASThrashTestSection sectionsWithCount:_insertedSectionIndexes.count]; - [_data insertObjects:_insertedSections atIndexes:_insertedSectionIndexes]; - - // Randomly insert some items - for (ASThrashTestSection *section in _data) { - // Only insert items into the old sections – not replaced/inserted sections. - if ([_oldData containsObject:section]) { - NSMutableIndexSet *indexes = [NSIndexSet randomIndexesLessThan:(section.items.count + 1) probability:kFickleness insertMode:YES]; - NSArray *newItems = [ASThrashTestItem itemsWithCount:indexes.count]; - [section.items insertObjects:newItems atIndexes:indexes]; - [_insertedItems addObject:newItems]; - [_insertedItemIndexes addObject:indexes]; - } else { - [_insertedItems addObject:@[]]; - [_insertedItemIndexes addObject:[NSMutableIndexSet indexSet]]; - } - } - } - return self; -} - -+ (BOOL)supportsSecureCoding -{ - return YES; -} - -+ (ASThrashUpdate *)thrashUpdateWithBase64String:(NSString *)base64 -{ - return [NSKeyedUnarchiver unarchiveObjectWithData:[[NSData alloc] initWithBase64EncodedString:base64 options:kNilOptions]]; -} - -- (NSString *)base64Representation -{ - return [[NSKeyedArchiver archivedDataWithRootObject:self] base64EncodedStringWithOptions:kNilOptions]; -} - -- (void)encodeWithCoder:(NSCoder *)aCoder -{ - NSDictionary *dict = [self dictionaryWithValuesForKeys:@[ - @"oldData", - @"data", - @"deletedSectionIndexes", - @"replacedSectionIndexes", - @"replacingSections", - @"insertedSectionIndexes", - @"insertedSections", - @"deletedItemIndexes", - @"replacedItemIndexes", - @"replacingItems", - @"insertedItemIndexes", - @"insertedItems" - ]]; - [aCoder encodeObject:dict forKey:@"_dict"]; - [aCoder encodeInteger:ASThrashUpdateCurrentSerializationVersion forKey:@"_version"]; -} - -- (instancetype)initWithCoder:(NSCoder *)aDecoder -{ - self = [super init]; - if (self != nil) { - NSAssert(ASThrashUpdateCurrentSerializationVersion == [aDecoder decodeIntegerForKey:@"_version"], @"This thrash update was archived from a different version and can't be read. Sorry."); - NSDictionary *dict = [aDecoder decodeObjectOfClass:[NSDictionary class] forKey:@"_dict"]; - [self setValuesForKeysWithDictionary:dict]; - } - return self; -} - -- (NSString *)description -{ - return [NSString stringWithFormat:@"", self, ASThrashArrayDescription(_oldData), ASThrashArrayDescription(_deletedItemIndexes), _deletedSectionIndexes, ASThrashArrayDescription(_replacedItemIndexes), _replacedSectionIndexes, ASThrashArrayDescription(_insertedItemIndexes), _insertedSectionIndexes, ASThrashArrayDescription(_data)]; -} - -- (NSString *)logFriendlyBase64Representation -{ - return [NSString stringWithFormat:@"\n\n**********\nBase64 Representation:\n**********\n%@\n**********\nEnd Base64 Representation\n**********", self.base64Representation]; -} - -@end diff --git a/submodules/AsyncDisplayKit/Tests/ASUICollectionViewTests.mm b/submodules/AsyncDisplayKit/Tests/ASUICollectionViewTests.mm deleted file mode 100644 index 6f99590a84..0000000000 --- a/submodules/AsyncDisplayKit/Tests/ASUICollectionViewTests.mm +++ /dev/null @@ -1,141 +0,0 @@ -// -// ASUICollectionViewTests.mm -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import -#import -#import "NSInvocation+ASTestHelpers.h" - -@interface ASUICollectionViewTests : XCTestCase - -@end - -@implementation ASUICollectionViewTests - -/// Test normal item-affiliated supplementary node -- (void)testNormalTwoIndexSupplementaryElement -{ - [self _testSupplementaryNodeAtIndexPath:[NSIndexPath indexPathForItem:0 inSection:1] sectionCount:2 expectException:NO]; -} - -/// If your supp is indexPathForItem:inSection:, the section index must be in bounds -- (void)testThatSupplementariesWithItemIndexesMustBeWithinNormalSections -{ - [self _testSupplementaryNodeAtIndexPath:[NSIndexPath indexPathForItem:0 inSection:3] sectionCount:2 expectException:YES]; -} - -/// If your supp is indexPathWithIndex:, that's OK even if that section is out of bounds! -- (void)testThatSupplementariesWithOneIndexAreOKOutOfSectionBounds -{ - [self _testSupplementaryNodeAtIndexPath:[NSIndexPath indexPathWithIndex:3] sectionCount:2 expectException:NO]; -} - -- (void)testThatNestedBatchCompletionsAreCalledInOrder -{ - UICollectionViewLayout *layout = [[UICollectionViewLayout alloc] init]; - id layoutMock = [OCMockObject partialMockForObject:layout]; - - UICollectionView *cv = [[UICollectionView alloc] initWithFrame:CGRectMake(0, 0, 100, 100) collectionViewLayout:layoutMock]; - id dataSource = [OCMockObject niceMockForProtocol:@protocol(UICollectionViewDataSource)]; - - cv.dataSource = dataSource; - - XCTestExpectation *inner0 = [self expectationWithDescription:@"Inner completion 0 is called"]; - XCTestExpectation *inner1 = [self expectationWithDescription:@"Inner completion 1 is called"]; - XCTestExpectation *outer = [self expectationWithDescription:@"Outer completion is called"]; - - NSMutableArray *completions = [NSMutableArray array]; - - [cv performBatchUpdates:^{ - [cv performBatchUpdates:^{ - - } completion:^(BOOL finished) { - [completions addObject:inner0]; - [inner0 fulfill]; - }]; - [cv performBatchUpdates:^{ - - } completion:^(BOOL finished) { - [completions addObject:inner1]; - [inner1 fulfill]; - }]; - } completion:^(BOOL finished) { - [completions addObject:outer]; - [outer fulfill]; - }]; - - [self waitForExpectationsWithTimeout:5 handler:nil]; - XCTAssertEqualObjects(completions, (@[ outer, inner0, inner1 ]), @"Expected completion order to be correct"); -} - -- (void)_testSupplementaryNodeAtIndexPath:(NSIndexPath *)indexPath sectionCount:(NSInteger)sectionCount expectException:(BOOL)shouldFail -{ - UICollectionViewLayoutAttributes *attr = [UICollectionViewLayoutAttributes layoutAttributesForSupplementaryViewOfKind:@"SuppKind" withIndexPath:indexPath]; - attr.frame = CGRectMake(0, 0, 20, 20); - UICollectionViewLayout *layout = [[UICollectionViewLayout alloc] init]; - id layoutMock = [OCMockObject partialMockForObject:layout]; - - [[[[layoutMock expect] ignoringNonObjectArgs] andReturn:@[ attr ]] layoutAttributesForElementsInRect:CGRectZero]; - UICollectionView *cv = [[UICollectionView alloc] initWithFrame:CGRectMake(0, 0, 100, 100) collectionViewLayout:layoutMock]; - [cv registerClass:[UICollectionReusableView class] forSupplementaryViewOfKind:@"SuppKind" withReuseIdentifier:@"ReuseID"]; - - id dataSource = [OCMockObject niceMockForProtocol:@protocol(UICollectionViewDataSource)]; - __block id view = nil; - [[[dataSource expect] andDo:^(NSInvocation *invocation) { - NSIndexPath *indexPath = [invocation as_argumentAtIndexAsObject:4]; - view = [cv dequeueReusableSupplementaryViewOfKind:@"SuppKind" withReuseIdentifier:@"ReuseID" forIndexPath:indexPath]; - [invocation setReturnValue:&view]; - }] collectionView:cv viewForSupplementaryElementOfKind:@"SuppKind" atIndexPath:indexPath]; - [[[dataSource expect] andReturnValue:[NSNumber numberWithInteger:sectionCount]] numberOfSectionsInCollectionView:cv]; - - cv.dataSource = dataSource; - if (shouldFail) { - XCTAssertThrowsSpecificNamed([cv layoutIfNeeded], NSException, NSInternalInconsistencyException); - // Early return because behavior after exception is thrown is undefined. - return; - } - - [cv layoutIfNeeded]; - XCTAssertEqualObjects(attr, [cv layoutAttributesForSupplementaryElementOfKind:@"SuppKind" atIndexPath:indexPath]); - XCTAssertEqual(view, [cv supplementaryViewForElementKind:@"SuppKind" atIndexPath:indexPath]); - [dataSource verify]; - [layoutMock verify]; -} - -- (void)testThatIssuingAnUpdateBeforeInitialReloadIsUnacceptable -{ - UICollectionViewFlowLayout *layout = [[UICollectionViewFlowLayout alloc] init]; - UICollectionView *cv = [[UICollectionView alloc] initWithFrame:CGRectMake(0, 0, 100, 100) collectionViewLayout:layout]; - id dataSource = [OCMockObject niceMockForProtocol:@protocol(UICollectionViewDataSource)]; - - // Setup empty data source – 0 sections, 0 items - [[[dataSource stub] andDo:^(NSInvocation *invocation) { - NSIndexPath *indexPath = [invocation as_argumentAtIndexAsObject:3]; - __autoreleasing UICollectionViewCell *view = [cv dequeueReusableCellWithReuseIdentifier:@"CellID" forIndexPath:indexPath]; - [invocation setReturnValue:&view]; - }] collectionView:cv cellForItemAtIndexPath:OCMOCK_ANY]; - [[[dataSource stub] andReturnValue:[NSNumber numberWithInteger:0]] numberOfSectionsInCollectionView:cv]; - [[[dataSource stub] andReturnValue:[NSNumber numberWithInteger:0]] collectionView:cv numberOfItemsInSection:0]; - [cv registerClass:[UICollectionViewCell class] forCellWithReuseIdentifier:@"CellID"]; - cv.dataSource = dataSource; - - // Update data source – 1 section, 0 items - [[[dataSource stub] andReturnValue:[NSNumber numberWithInteger:1]] numberOfSectionsInCollectionView:cv]; - - /** - * Inform collection view – insert section 0 - * Throws exception because collection view never saw the data source have 0 sections. - * so it's going to read "oldSectionCount" now and get 1. It will also read - * "newSectionCount" and get 1. Then it'll throw because "oldSectionCount(1) + insertedCount(1) != newSectionCount(1)". - * To workaround this, you could add `[cv numberOfSections]` before the data source is updated to - * trigger the collection view to read oldSectionCount=0. - */ - XCTAssertThrowsSpecificNamed([cv insertSections:[NSIndexSet indexSetWithIndex:0]], NSException, NSInternalInconsistencyException); -} - -@end diff --git a/submodules/AsyncDisplayKit/Tests/ASVideoNodeTests.mm b/submodules/AsyncDisplayKit/Tests/ASVideoNodeTests.mm deleted file mode 100644 index 60c7f89c42..0000000000 --- a/submodules/AsyncDisplayKit/Tests/ASVideoNodeTests.mm +++ /dev/null @@ -1,428 +0,0 @@ -// -// ASVideoNodeTests.mm -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -#import -#import -#import - -#import - -#import "ASDisplayNodeTestsHelper.h" - -#if AS_USE_VIDEO -@interface ASVideoNodeTests : XCTestCase -{ - ASVideoNode *_videoNode; - AVURLAsset *_firstAsset; - AVAsset *_secondAsset; - NSURL *_url; - NSArray *_requestedKeys; -} -@end - -@interface ASVideoNode () { - ASDisplayNode *_playerNode; - AVPlayer *_player; -} - - -@property ASInterfaceState interfaceState; -@property (readonly) ASDisplayNode *spinner; -@property ASDisplayNode *playerNode; -@property AVPlayer *player; -@property BOOL shouldBePlaying; - -- (void)setVideoPlaceholderImage:(UIImage *)image; -- (void)prepareToPlayAsset:(AVAsset *)asset withKeys:(NSArray *)requestedKeys; - -@end - -@implementation ASVideoNodeTests - -- (void)setUp -{ - _videoNode = [[ASVideoNode alloc] init]; - _firstAsset = [AVURLAsset assetWithURL:[NSURL URLWithString:@"firstURL"]]; - _secondAsset = [AVAsset assetWithURL:[NSURL URLWithString:@"secondURL"]]; - _url = [NSURL URLWithString:@"testURL"]; - _requestedKeys = @[ @"playable" ]; -} - -- (void)testOnPlayIfVideoIsNotReadyInitializeSpinnerAndAddAsSubnode -{ - _videoNode.asset = _firstAsset; - [self doOnPlayIfVideoIsNotReadyInitializeSpinnerAndAddAsSubnodeWithUrl]; -} - -- (void)testOnPlayIfVideoIsNotReadyInitializeSpinnerAndAddAsSubnodeWithUrl -{ - _videoNode.asset = [AVAsset assetWithURL:_url]; - [self doOnPlayIfVideoIsNotReadyInitializeSpinnerAndAddAsSubnodeWithUrl]; -} - -- (void)doOnPlayIfVideoIsNotReadyInitializeSpinnerAndAddAsSubnodeWithUrl -{ - _videoNode.interfaceState = ASInterfaceStatePreload; - [_videoNode play]; -} - - -- (void)testOnPauseSpinnerIsPausedIfPresent -{ - _videoNode.asset = _firstAsset; - [self doOnPauseSpinnerIsPausedIfPresentWithURL]; -} - -- (void)testOnPauseSpinnerIsPausedIfPresentWithURL -{ - _videoNode.asset = [AVAsset assetWithURL:_url]; - [self doOnPauseSpinnerIsPausedIfPresentWithURL]; -} - -- (void)doOnPauseSpinnerIsPausedIfPresentWithURL -{ - _videoNode.interfaceState = ASInterfaceStatePreload; - - [_videoNode play]; - [_videoNode pause]; - -} - - -- (void)testOnVideoReadySpinnerIsStoppedAndRemoved -{ - _videoNode.asset = _firstAsset; - [self doOnVideoReadySpinnerIsStoppedAndRemovedWithURL]; -} - -- (void)testOnVideoReadySpinnerIsStoppedAndRemovedWithURL -{ - _videoNode.asset = [AVAsset assetWithURL:_url]; - [self doOnVideoReadySpinnerIsStoppedAndRemovedWithURL]; -} - -- (void)doOnVideoReadySpinnerIsStoppedAndRemovedWithURL -{ - _videoNode.interfaceState = ASInterfaceStatePreload; - - [_videoNode play]; - [_videoNode observeValueForKeyPath:@"status" ofObject:[_videoNode currentItem] change:@{NSKeyValueChangeNewKey : @(AVPlayerItemStatusReadyToPlay)} context:NULL]; -} - - -- (void)testPlayerDefaultsToNil -{ - _videoNode.asset = _firstAsset; - XCTAssertNil(_videoNode.player); -} - -- (void)testPlayerDefaultsToNilWithURL -{ - _videoNode.asset = [AVAsset assetWithURL:_url]; - XCTAssertNil(_videoNode.player); -} - -- (void)testPlayerIsCreatedAsynchronouslyInPreload -{ - AVAsset *asset = _firstAsset; - - id assetMock = [OCMockObject partialMockForObject:asset]; - id videoNodeMock = [OCMockObject partialMockForObject:_videoNode]; - - [[[assetMock stub] andReturnValue:@YES] isPlayable]; - [[[videoNodeMock expect] andForwardToRealObject] prepareToPlayAsset:assetMock withKeys:_requestedKeys]; - - _videoNode.asset = assetMock; - _videoNode.interfaceState = ASInterfaceStatePreload; - - [videoNodeMock verifyWithDelay:1.0f]; - - XCTAssertNotNil(_videoNode.player); -} - -- (void)testPlayerIsCreatedAsynchronouslyInPreloadWithURL -{ - AVAsset *asset = [AVAsset assetWithURL:_url]; - - id assetMock = [OCMockObject partialMockForObject:asset]; - id videoNodeMock = [OCMockObject partialMockForObject:_videoNode]; - - [[[assetMock stub] andReturnValue:@YES] isPlayable]; - [[[videoNodeMock expect] andForwardToRealObject] prepareToPlayAsset:assetMock withKeys:_requestedKeys]; - - _videoNode.asset = assetMock; - _videoNode.interfaceState = ASInterfaceStatePreload; - - [videoNodeMock verifyWithDelay:1.0f]; - - XCTAssertNotNil(_videoNode.player); -} - -- (void)testPlayerLayerNodeIsAddedOnDidLoadIfVisibleAndAutoPlaying -{ - _videoNode.asset = _firstAsset; - [self doPlayerLayerNodeIsAddedOnDidLoadIfVisibleAndAutoPlayingWithURL]; -} - -- (void)testPlayerLayerNodeIsAddedOnDidLoadIfVisibleAndAutoPlayingWithURL -{ - _videoNode.asset = [AVAsset assetWithURL:_url]; - [self doPlayerLayerNodeIsAddedOnDidLoadIfVisibleAndAutoPlayingWithURL]; -} - -- (void)doPlayerLayerNodeIsAddedOnDidLoadIfVisibleAndAutoPlayingWithURL -{ - [_videoNode setInterfaceState:ASInterfaceStateNone]; - [_videoNode didLoad]; - - XCTAssert(![_videoNode.subnodes containsObject:_videoNode.playerNode]); -} - - -- (void)testPlayerLayerNodeIsNotAddedIfVisibleButShouldNotBePlaying -{ - _videoNode.asset = _firstAsset; - [self doPlayerLayerNodeIsNotAddedIfVisibleButShouldNotBePlaying]; -} - -- (void)testPlayerLayerNodeIsNotAddedIfVisibleButShouldNotBePlayingWithUrl -{ - _videoNode.asset = [AVAsset assetWithURL:_url]; - [self doPlayerLayerNodeIsNotAddedIfVisibleButShouldNotBePlaying]; -} - -- (void)doPlayerLayerNodeIsNotAddedIfVisibleButShouldNotBePlaying -{ - [_videoNode pause]; - [_videoNode layer]; - [_videoNode setInterfaceState:ASInterfaceStateVisible | ASInterfaceStateDisplay]; - - XCTAssert(![_videoNode.subnodes containsObject:_videoNode.playerNode]); -} - - -- (void)testVideoStartsPlayingOnDidDidBecomeVisibleWhenShouldAutoplay -{ - _videoNode.asset = _firstAsset; - [self doVideoStartsPlayingOnDidDidBecomeVisibleWhenShouldAutoplay]; -} - -- (void)testVideoStartsPlayingOnDidDidBecomeVisibleWhenShouldAutoplayWithURL -{ - _videoNode.asset = [AVAsset assetWithURL:_url]; - [self doVideoStartsPlayingOnDidDidBecomeVisibleWhenShouldAutoplay]; -} - -- (void)doVideoStartsPlayingOnDidDidBecomeVisibleWhenShouldAutoplay -{ - _videoNode.shouldAutoplay = YES; - _videoNode.playerNode = [[ASDisplayNode alloc] initWithLayerBlock:^CALayer *{ - AVPlayerLayer *playerLayer = [[AVPlayerLayer alloc] init]; - return playerLayer; - }]; - _videoNode.playerNode.layer.frame = CGRectZero; - - [_videoNode layer]; - [_videoNode didEnterVisibleState]; - - XCTAssertTrue(_videoNode.shouldBePlaying); -} - -- (void)testVideoShouldPauseWhenItLeavesVisibleButShouldKnowPlayingShouldRestartLater -{ - _videoNode.asset = _firstAsset; - [self doVideoShouldPauseWhenItLeavesVisibleButShouldKnowPlayingShouldRestartLater]; -} - -- (void)testVideoShouldPauseWhenItLeavesVisibleButShouldKnowPlayingShouldRestartLaterWithURL -{ - _videoNode.asset = [AVAsset assetWithURL:_url]; - [self doVideoShouldPauseWhenItLeavesVisibleButShouldKnowPlayingShouldRestartLater]; -} - -- (void)doVideoShouldPauseWhenItLeavesVisibleButShouldKnowPlayingShouldRestartLater -{ - [_videoNode play]; - - [_videoNode interfaceStateDidChange:ASInterfaceStateNone fromState:ASInterfaceStateVisible]; - - XCTAssertFalse(_videoNode.isPlaying); - XCTAssertTrue(_videoNode.shouldBePlaying); -} - - -- (void)testVideoThatIsPlayingWhenItLeavesVisibleRangeStartsAgainWhenItComesBack -{ - _videoNode.asset = _firstAsset; - [self doVideoThatIsPlayingWhenItLeavesVisibleRangeStartsAgainWhenItComesBack]; -} - -- (void)testVideoThatIsPlayingWhenItLeavesVisibleRangeStartsAgainWhenItComesBackWithURL -{ - _videoNode.asset = [AVAsset assetWithURL:_url]; - [self doVideoThatIsPlayingWhenItLeavesVisibleRangeStartsAgainWhenItComesBack]; -} - -- (void)doVideoThatIsPlayingWhenItLeavesVisibleRangeStartsAgainWhenItComesBack -{ - [_videoNode play]; - - [_videoNode interfaceStateDidChange:ASInterfaceStateVisible fromState:ASInterfaceStateNone]; - [_videoNode interfaceStateDidChange:ASInterfaceStateNone fromState:ASInterfaceStateVisible]; - - XCTAssertTrue(_videoNode.shouldBePlaying); -} - -- (void)testMutingShouldMutePlayer -{ - [_videoNode setPlayer:[[AVPlayer alloc] init]]; - - _videoNode.muted = YES; - - XCTAssertTrue(_videoNode.player.muted); -} - -- (void)testUnMutingShouldUnMutePlayer -{ - [_videoNode setPlayer:[[AVPlayer alloc] init]]; - - _videoNode.muted = YES; - _videoNode.muted = NO; - - XCTAssertFalse(_videoNode.player.muted); -} - -- (void)testVideoThatDoesNotAutorepeatsShouldPauseOnPlaybackEnd -{ - id assetMock = [OCMockObject partialMockForObject:_firstAsset]; - [[[assetMock stub] andReturnValue:@YES] isPlayable]; - - _videoNode.asset = assetMock; - _videoNode.shouldAutorepeat = NO; - - [_videoNode layer]; - [_videoNode setInterfaceState:ASInterfaceStateVisible | ASInterfaceStateDisplay | ASInterfaceStatePreload]; - [_videoNode prepareToPlayAsset:assetMock withKeys:_requestedKeys]; - [_videoNode play]; - - XCTAssertTrue(_videoNode.isPlaying); - - [[NSNotificationCenter defaultCenter] postNotificationName:AVPlayerItemDidPlayToEndTimeNotification object:_videoNode.currentItem]; - - XCTAssertFalse(_videoNode.isPlaying); - XCTAssertEqual(0, CMTimeGetSeconds(_videoNode.player.currentTime)); -} - -- (void)testVideoThatAutorepeatsShouldRepeatOnPlaybackEnd -{ - id assetMock = [OCMockObject partialMockForObject:_firstAsset]; - [[[assetMock stub] andReturnValue:@YES] isPlayable]; - - _videoNode.asset = assetMock; - _videoNode.shouldAutorepeat = YES; - - [_videoNode layer]; - [_videoNode setInterfaceState:ASInterfaceStateVisible | ASInterfaceStateDisplay | ASInterfaceStatePreload]; - [_videoNode prepareToPlayAsset:assetMock withKeys:_requestedKeys]; - [_videoNode play]; - - [[NSNotificationCenter defaultCenter] postNotificationName:AVPlayerItemDidPlayToEndTimeNotification object:_videoNode.currentItem]; - - XCTAssertTrue(_videoNode.isPlaying); -} - -- (void)testVideoResumedWhenBufferIsLikelyToKeepUp -{ - id assetMock = [OCMockObject partialMockForObject:_firstAsset]; - [[[assetMock stub] andReturnValue:@YES] isPlayable]; - - _videoNode.asset = assetMock; - - [_videoNode layer]; - [_videoNode setInterfaceState:ASInterfaceStateVisible | ASInterfaceStateDisplay | ASInterfaceStatePreload]; - [_videoNode prepareToPlayAsset:assetMock withKeys:_requestedKeys]; - ASCATransactionQueueWait(nil); - [_videoNode pause]; - _videoNode.shouldBePlaying = YES; - XCTAssertFalse(_videoNode.isPlaying); - - [_videoNode observeValueForKeyPath:@"playbackLikelyToKeepUp" ofObject:[_videoNode currentItem] change:@{NSKeyValueChangeNewKey : @YES} context:NULL]; - - XCTAssertTrue(_videoNode.isPlaying); -} - -- (void)testSettingVideoGravityChangesPlaceholderContentMode -{ - [_videoNode setVideoPlaceholderImage:[[UIImage alloc] init]]; - XCTAssertEqual(UIViewContentModeScaleAspectFit, _videoNode.contentMode); - - _videoNode.gravity = AVLayerVideoGravityResize; - XCTAssertEqual(UIViewContentModeScaleToFill, _videoNode.contentMode); - - _videoNode.gravity = AVLayerVideoGravityResizeAspect; - XCTAssertEqual(UIViewContentModeScaleAspectFit, _videoNode.contentMode); - - _videoNode.gravity = AVLayerVideoGravityResizeAspectFill; - XCTAssertEqual(UIViewContentModeScaleAspectFill, _videoNode.contentMode); -} - -- (void)testChangingAssetsChangesPlaceholderImage -{ - UIImage *firstImage = [[UIImage alloc] init]; - - _videoNode.asset = _firstAsset; - [_videoNode setVideoPlaceholderImage:firstImage]; - XCTAssertEqual(firstImage, _videoNode.image); - - _videoNode.asset = _secondAsset; - XCTAssertNotEqual(firstImage, _videoNode.image); -} - -- (void)testClearingPreloadedContentShouldClearAssetData -{ - AVAsset *asset = _firstAsset; - - id assetMock = [OCMockObject partialMockForObject:asset]; - id videoNodeMock = [OCMockObject partialMockForObject:_videoNode]; - - [[[assetMock stub] andReturnValue:@YES] isPlayable]; - [[[videoNodeMock expect] andForwardToRealObject] prepareToPlayAsset:assetMock withKeys:_requestedKeys]; - - _videoNode.asset = assetMock; - [_videoNode didEnterPreloadState]; - [_videoNode setVideoPlaceholderImage:[[UIImage alloc] init]]; - - [videoNodeMock verifyWithDelay:1.0f]; - - XCTAssertNotNil(_videoNode.player); - XCTAssertNotNil(_videoNode.currentItem); - XCTAssertNotNil(_videoNode.image); - - [_videoNode didExitPreloadState]; - XCTAssertNil(_videoNode.player); - XCTAssertNil(_videoNode.currentItem); -} - -- (void)testDelegateProperlySetForClassHierarchy -{ - _videoNode.delegate = self; - - XCTAssertTrue([_videoNode.delegate conformsToProtocol:@protocol(ASVideoNodeDelegate)]); - XCTAssertTrue([_videoNode.delegate conformsToProtocol:@protocol(ASNetworkImageNodeDelegate)]); - XCTAssertTrue([((ASNetworkImageNode*)_videoNode).delegate conformsToProtocol:@protocol(ASNetworkImageNodeDelegate)]); - - XCTAssertEqual(_videoNode.delegate, self); - XCTAssertEqual(((ASNetworkImageNode*)_videoNode).delegate, self); -} - -@end - -#endif \ No newline at end of file diff --git a/submodules/AsyncDisplayKit/Tests/ASViewControllerTests.mm b/submodules/AsyncDisplayKit/Tests/ASViewControllerTests.mm deleted file mode 100644 index f6b26e9756..0000000000 --- a/submodules/AsyncDisplayKit/Tests/ASViewControllerTests.mm +++ /dev/null @@ -1,88 +0,0 @@ -// -// ASViewControllerTests.mm -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -#import - -#import - -#import "NSInvocation+ASTestHelpers.h" - -@interface ASViewControllerTests : XCTestCase - -@end - -@implementation ASViewControllerTests - -- (void)testThatAutomaticSubnodeManagementScrollViewInsetsAreApplied -{ - UIWindow *window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds]; - ASDisplayNode *node = [[ASDisplayNode alloc] init]; - node.automaticallyManagesSubnodes = YES; - ASScrollNode *scrollNode = [[ASScrollNode alloc] init]; - node.layoutSpecBlock = ^(ASDisplayNode *node, ASSizeRange constrainedSize){ - return [ASInsetLayoutSpec insetLayoutSpecWithInsets:UIEdgeInsetsZero child:scrollNode]; - }; - ASViewController *vc = [[ASViewController alloc] initWithNode:node]; - window.rootViewController = [[UINavigationController alloc] initWithRootViewController:vc]; - [window makeKeyAndVisible]; - [window layoutIfNeeded]; - XCTAssertEqualObjects(NSStringFromCGRect(window.bounds), NSStringFromCGRect(node.frame)); - XCTAssertNotEqual(scrollNode.view.contentInset.top, 0); -} - -- (void)testThatViewControllerFrameIsRightAfterCustomTransitionWithNonextendedEdges -{ - UIWindow *window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds]; - ASDisplayNode *node = [[ASDisplayNode alloc] init]; - - ASViewController *vc = [[ASViewController alloc] initWithNode:node]; - vc.node.backgroundColor = [UIColor greenColor]; - vc.edgesForExtendedLayout = UIRectEdgeNone; - - UIViewController * oldVC = [[UIViewController alloc] init]; - UINavigationController *nav = [[UINavigationController alloc] initWithRootViewController:oldVC]; - id navDelegate = [OCMockObject niceMockForProtocol:@protocol(UINavigationControllerDelegate)]; - id animator = [OCMockObject niceMockForProtocol:@protocol(UIViewControllerAnimatedTransitioning)]; - [[[[navDelegate expect] ignoringNonObjectArgs] andReturn:animator] navigationController:[OCMArg any] animationControllerForOperation:UINavigationControllerOperationPush fromViewController:[OCMArg any] toViewController:[OCMArg any]]; - [[[animator expect] andReturnValue:@0.3] transitionDuration:[OCMArg any]]; - XCTestExpectation *e = [self expectationWithDescription:@"Transition completed"]; - [[[animator expect] andDo:^(NSInvocation *invocation) { - id ctx = [invocation as_argumentAtIndexAsObject:2]; - UIView *container = [ctx containerView]; - [container addSubview:vc.view]; - vc.view.alpha = 0; - vc.view.frame = [ctx finalFrameForViewController:vc]; - [UIView animateWithDuration:0.3 animations:^{ - vc.view.alpha = 1; - oldVC.view.alpha = 0; - } completion:^(BOOL finished) { - [oldVC.view removeFromSuperview]; - [ctx completeTransition:finished]; - [e fulfill]; - }]; - }] animateTransition:[OCMArg any]]; - nav.delegate = navDelegate; - window.rootViewController = nav; - [window makeKeyAndVisible]; - [[NSRunLoop mainRunLoop] runMode:NSDefaultRunLoopMode beforeDate:[NSDate date]]; - [nav pushViewController:vc animated:YES]; - - [self waitForExpectationsWithTimeout:2 handler:nil]; - - CGFloat navHeight = CGRectGetMaxY([nav.navigationBar convertRect:nav.navigationBar.bounds toView:window]); - CGRect expectedRect, slice; - CGRectDivide(window.bounds, &slice, &expectedRect, navHeight, CGRectMinYEdge); - XCTAssertEqualObjects(NSStringFromCGRect(expectedRect), NSStringFromCGRect(node.frame)); - [navDelegate verify]; - [animator verify]; -} - -@end diff --git a/submodules/AsyncDisplayKit/Tests/ASWeakMapTests.mm b/submodules/AsyncDisplayKit/Tests/ASWeakMapTests.mm deleted file mode 100644 index fd0c0835be..0000000000 --- a/submodules/AsyncDisplayKit/Tests/ASWeakMapTests.mm +++ /dev/null @@ -1,54 +0,0 @@ -// -// ASWeakMapTests.mm -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import -#import - -NS_ASSUME_NONNULL_BEGIN - -@interface ASWeakMapTests : XCTestCase - -@end - -@implementation ASWeakMapTests - -- (void)testKeyAndValueAreReleasedWhenEntryIsReleased -{ - ASWeakMap *weakMap = [[ASWeakMap alloc] init]; - - __weak NSObject *weakKey; - __weak NSObject *weakValue; - @autoreleasepool { - NSObject *key = [[NSObject alloc] init]; - NSObject *value = [[NSObject alloc] init]; - ASWeakMapEntry *entry = [weakMap setObject:value forKey:key]; - XCTAssertEqual([weakMap entryForKey:key], entry); - - weakKey = key; - weakValue = value; -} - XCTAssertNil(weakKey); - XCTAssertNil(weakValue); -} - -- (void)testKeyEquality -{ - ASWeakMap *weakMap = [[ASWeakMap alloc] init]; - NSString *keyA = @"key"; - NSString *keyB = [keyA copy]; // `isEqual` but not pointer equal - NSObject *value = [[NSObject alloc] init]; - - ASWeakMapEntry *entryA = [weakMap setObject:value forKey:keyA]; - ASWeakMapEntry *entryB = [weakMap entryForKey:keyB]; - XCTAssertEqual(entryA, entryB); -} - -@end - -NS_ASSUME_NONNULL_END diff --git a/submodules/AsyncDisplayKit/Tests/ASWeakSetTests.mm b/submodules/AsyncDisplayKit/Tests/ASWeakSetTests.mm deleted file mode 100644 index 31af91de0f..0000000000 --- a/submodules/AsyncDisplayKit/Tests/ASWeakSetTests.mm +++ /dev/null @@ -1,135 +0,0 @@ -// -// ASWeakSetTests.mm -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import -#import - -@interface ASWeakSetTests : XCTestCase - -@end - -@implementation ASWeakSetTests - -- (void)testAddingACoupleRetainedObjects -{ - ASWeakSet *weakSet = [ASWeakSet new]; - NSString *hello = @"hello"; - NSString *world = @"hello"; - [weakSet addObject:hello]; - [weakSet addObject:world]; - XCTAssert([weakSet containsObject:hello]); - XCTAssert([weakSet containsObject:world]); - XCTAssert(![weakSet containsObject:@"apple"]); -} - -- (void)testThatCountIncorporatesDeallocatedObjects -{ - ASWeakSet *weakSet = [ASWeakSet new]; - XCTAssertEqual(weakSet.count, 0); - NSObject *a = [NSObject new]; - NSObject *b = [NSObject new]; - [weakSet addObject:a]; - [weakSet addObject:b]; - XCTAssertEqual(weakSet.count, 2); - - @autoreleasepool { - NSObject *doomedObject = [NSObject new]; - [weakSet addObject:doomedObject]; - XCTAssertEqual(weakSet.count, 3); - } - - XCTAssertEqual(weakSet.count, 2); -} - -- (void)testThatIsEmptyIncorporatesDeallocatedObjects -{ - ASWeakSet *weakSet = [ASWeakSet new]; - XCTAssertTrue(weakSet.isEmpty); - @autoreleasepool { - NSObject *doomedObject = [NSObject new]; - [weakSet addObject:doomedObject]; - XCTAssertFalse(weakSet.isEmpty); - } - XCTAssertTrue(weakSet.isEmpty); -} - -- (void)testThatContainsObjectWorks -{ - ASWeakSet *weakSet = [ASWeakSet new]; - NSObject *a = [NSObject new]; - NSObject *b = [NSObject new]; - [weakSet addObject:a]; - XCTAssertTrue([weakSet containsObject:a]); - XCTAssertFalse([weakSet containsObject:b]); -} - -- (void)testThatRemoveObjectWorks -{ - ASWeakSet *weakSet = [ASWeakSet new]; - NSObject *a = [NSObject new]; - NSObject *b = [NSObject new]; - [weakSet addObject:a]; - [weakSet addObject:b]; - XCTAssertTrue([weakSet containsObject:a]); - XCTAssertTrue([weakSet containsObject:b]); - XCTAssertEqual(weakSet.count, 2); - - [weakSet removeObject:b]; - XCTAssertTrue([weakSet containsObject:a]); - XCTAssertFalse([weakSet containsObject:b]); - XCTAssertEqual(weakSet.count, 1); -} - -- (void)testThatFastEnumerationWorks -{ - ASWeakSet *weakSet = [ASWeakSet new]; - NSObject *a = [NSObject new]; - NSObject *b = [NSObject new]; - [weakSet addObject:a]; - [weakSet addObject:b]; - - @autoreleasepool { - NSObject *doomedObject = [NSObject new]; - [weakSet addObject:doomedObject]; - XCTAssertEqual(weakSet.count, 3); - } - - NSInteger i = 0; - NSMutableSet *awaitingObjects = [NSMutableSet setWithObjects:a, b, nil]; - for (NSObject *object in weakSet) { - XCTAssertTrue([awaitingObjects containsObject:object]); - [awaitingObjects removeObject:object]; - i += 1; - } - - XCTAssertEqual(i, 2); -} - -- (void)testThatRemoveAllObjectsWorks -{ - ASWeakSet *weakSet = [ASWeakSet new]; - NSObject *a = [NSObject new]; - NSObject *b = [NSObject new]; - [weakSet addObject:a]; - [weakSet addObject:b]; - XCTAssertEqual(weakSet.count, 2); - - [weakSet removeAllObjects]; - - XCTAssertEqual(weakSet.count, 0); - - NSInteger i = 0; - for (__unused NSObject *object in weakSet) { - i += 1; - } - - XCTAssertEqual(i, 0); -} - -@end diff --git a/submodules/AsyncDisplayKit/Tests/ASWrapperSpecSnapshotTests.mm b/submodules/AsyncDisplayKit/Tests/ASWrapperSpecSnapshotTests.mm deleted file mode 100644 index 91ddd45fe5..0000000000 --- a/submodules/AsyncDisplayKit/Tests/ASWrapperSpecSnapshotTests.mm +++ /dev/null @@ -1,52 +0,0 @@ -// -// ASWrapperSpecSnapshotTests.mm -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - - -#import "ASLayoutSpecSnapshotTestsHelper.h" -#import - -@interface ASWrapperSpecSnapshotTests : ASLayoutSpecSnapshotTestCase -@end - -@implementation ASWrapperSpecSnapshotTests - -- (void)testWrapperSpecWithOneElementShouldSizeToElement -{ - ASDisplayNode *child = ASDisplayNodeWithBackgroundColor([UIColor redColor], {50, 50}); - - ASSizeRange sizeRange = ASSizeRangeMake(CGSizeZero, CGSizeMake(INFINITY, INFINITY)); - [self testWithChildren:@[child] sizeRange:sizeRange identifier:nil]; -} - -- (void)testWrapperSpecWithMultipleElementsShouldSizeToLargestElement -{ - ASDisplayNode *firstChild = ASDisplayNodeWithBackgroundColor([UIColor redColor], {50, 50}); - ASDisplayNode *secondChild = ASDisplayNodeWithBackgroundColor([UIColor greenColor], {100, 100}); - - ASSizeRange sizeRange = ASSizeRangeMake(CGSizeZero, CGSizeMake(INFINITY, INFINITY)); - [self testWithChildren:@[secondChild, firstChild] sizeRange:sizeRange identifier:nil]; -} - -- (void)testWithChildren:(NSArray *)children sizeRange:(ASSizeRange)sizeRange identifier:(NSString *)identifier -{ - ASDisplayNode *backgroundNode = ASDisplayNodeWithBackgroundColor([UIColor whiteColor]); - - NSMutableArray *subnodes = [NSMutableArray arrayWithArray:children]; - [subnodes insertObject:backgroundNode atIndex:0]; - - ASLayoutSpec *layoutSpec = - [ASBackgroundLayoutSpec backgroundLayoutSpecWithChild: - [ASWrapperLayoutSpec - wrapperWithLayoutElements:children] - background:backgroundNode]; - - [self testLayoutSpec:layoutSpec sizeRange:sizeRange subnodes:subnodes identifier:identifier]; -} - -@end diff --git a/submodules/AsyncDisplayKit/Tests/ArrayDiffingTests.mm b/submodules/AsyncDisplayKit/Tests/ArrayDiffingTests.mm deleted file mode 100644 index 5151449d79..0000000000 --- a/submodules/AsyncDisplayKit/Tests/ArrayDiffingTests.mm +++ /dev/null @@ -1,311 +0,0 @@ -// -// ArrayDiffingTests.mm -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -#import - -@interface NSArray (ArrayDiffingTests) -- (NSIndexSet *)_asdk_commonIndexesWithArray:(NSArray *)array compareBlock:(BOOL (^)(id lhs, id rhs))comparison; -@end - -@interface ArrayDiffingTests : XCTestCase - -@end - -@implementation ArrayDiffingTests - -- (void)testDiffingCommonIndexes -{ - NSArray *tests = @[ - @[ - @[@"bob", @"alice", @"dave"], - @[@"bob", @"alice", @"dave", @"gary"], - @[@0, @1, @2] - ], - @[ - @[@"bob", @"alice", @"dave"], - @[@"bob", @"gary", @"dave"], - @[@0, @2] - ], - @[ - @[@"bob", @"alice"], - @[@"gary", @"dave"], - @[], - ], - @[ - @[@"bob", @"alice", @"dave"], - @[], - @[], - ], - @[ - @[], - @[@"bob", @"alice", @"dave"], - @[], - ], - ]; - - for (NSArray *test in tests) { - NSIndexSet *indexSet = [test[0] _asdk_commonIndexesWithArray:test[1] compareBlock:^BOOL(id lhs, id rhs) { - return [lhs isEqual:rhs]; - }]; - NSMutableIndexSet *mutableIndexSet = [indexSet mutableCopy]; - - for (NSNumber *index in (NSArray *)test[2]) { - XCTAssert([indexSet containsIndex:[index integerValue]]); - [mutableIndexSet removeIndex:[index integerValue]]; - } - - XCTAssert([mutableIndexSet count] == 0, @"Unaccounted deletions: %@", mutableIndexSet); - } -} - -- (void)testDiffingInsertionsAndDeletions { - NSArray *tests = @[ - @[ - @[@"bob", @"alice", @"dave"], - @[@"bob", @"alice", @"dave", @"gary"], - @[@3], - @[], - ], - @[ - @[@"a", @"b", @"c", @"d"], - @[@"d", @"c", @"b", @"a"], - @[@1, @2, @3], - @[@0, @1, @2], - ], - @[ - @[@"bob", @"alice", @"dave"], - @[@"bob", @"gary", @"alice", @"dave"], - @[@1], - @[], - ], - @[ - @[@"bob", @"alice", @"dave"], - @[@"bob", @"alice"], - @[], - @[@2], - ], - @[ - @[@"bob", @"alice", @"dave"], - @[], - @[], - @[@0, @1, @2], - ], - @[ - @[@"bob", @"alice", @"dave"], - @[@"gary", @"alice", @"dave", @"jack"], - @[@0, @3], - @[@0], - ], - @[ - @[@"bob", @"alice", @"dave", @"judy", @"lynda", @"tony"], - @[@"gary", @"bob", @"suzy", @"tony"], - @[@0, @2], - @[@1, @2, @3, @4], - ], - @[ - @[@"bob", @"alice", @"dave", @"judy"], - @[@"judy", @"dave", @"alice", @"bob"], - @[@1, @2, @3], - @[@0, @1, @2], - ], - ]; - - long n = 0; - for (NSArray *test in tests) { - NSIndexSet *insertions, *deletions; - [test[0] asdk_diffWithArray:test[1] insertions:&insertions deletions:&deletions]; - NSMutableIndexSet *mutableInsertions = [insertions mutableCopy]; - NSMutableIndexSet *mutableDeletions = [deletions mutableCopy]; - - for (NSNumber *index in (NSArray *)test[2]) { - XCTAssert([mutableInsertions containsIndex:[index integerValue]], @"Test #%ld: insertions %@ does not contain %@", - n, insertions, index); - [mutableInsertions removeIndex:[index integerValue]]; - } - for (NSNumber *index in (NSArray *)test[3]) { - XCTAssert([mutableDeletions containsIndex:[index integerValue]], @"Test #%ld: deletions %@ does not contain %@", - n, deletions, index - ); - [mutableDeletions removeIndex:[index integerValue]]; - } - - XCTAssert([mutableInsertions count] == 0, @"Test #%ld: Unaccounted insertions: %@", n, mutableInsertions); - XCTAssert([mutableDeletions count] == 0, @"Test #%ld: Unaccounted deletions: %@", n, mutableDeletions); - n++; - } -} - -- (void)testDiffingInsertsDeletesAndMoves -{ - NSArray *tests = @[ - @[ - @[@"a", @"b"], - @[@"b", @"a"], - @[], - @[], - @[[NSIndexPath indexPathWithIndexes:(NSUInteger[]) {1, 0} length:2], - [NSIndexPath indexPathWithIndexes:(NSUInteger[]) {0, 1} length:2] - ]], - @[ - @[@"bob", @"alice", @"dave"], - @[@"bob", @"alice", @"dave", @"gary"], - @[@3], - @[], - @[]], - @[ - @[@"a", @"b", @"c", @"d"], - @[@"d", @"c", @"b", @"a"], - @[], - @[], - @[[NSIndexPath indexPathWithIndexes:(NSUInteger[]){3, 0} length:2], - [NSIndexPath indexPathWithIndexes:(NSUInteger[]){2, 1} length:2], - [NSIndexPath indexPathWithIndexes:(NSUInteger[]){1, 2} length:2], - [NSIndexPath indexPathWithIndexes:(NSUInteger[]){0, 3} length:2] - ]], - @[ - @[@"bob", @"alice", @"dave"], - @[@"bob", @"gary", @"dave", @"alice"], - @[@1], - @[], - @[[NSIndexPath indexPathWithIndexes:(NSUInteger[]) {1, 3} length:2] - ]], - @[ - @[@"bob", @"alice", @"dave"], - @[@"bob", @"alice"], - @[], - @[@2], - @[]], - @[ - @[@"bob", @"alice", @"dave"], - @[], - @[], - @[@0, @1, @2], - @[]], - @[ - @[@"bob", @"alice", @"dave"], - @[@"gary", @"alice", @"dave", @"jack"], - @[@0, @3], - @[@0], - @[]], - @[ - @[@"bob", @"alice", @"dave", @"judy", @"lynda", @"tony"], - @[@"gary", @"bob", @"suzy", @"tony"], - @[@0, @2], - @[@1, @2, @3, @4], - @[[NSIndexPath indexPathWithIndexes:(NSUInteger[]){0, 1} length:2], - [NSIndexPath indexPathWithIndexes:(NSUInteger[]){5, 3} length:2] - ]], - @[ - @[@"bob", @"alice", @"dave", @"judy"], - @[@"judy", @"dave", @"alice", @"bob"], - @[], - @[], - @[[NSIndexPath indexPathWithIndexes:(NSUInteger[]){3, 0} length:2], - [NSIndexPath indexPathWithIndexes:(NSUInteger[]){2, 1} length:2], - [NSIndexPath indexPathWithIndexes:(NSUInteger[]){1, 2} length:2], - [NSIndexPath indexPathWithIndexes:(NSUInteger[]){0, 3} length:2] - ]] - - ]; - - long n = 0; - for (NSArray *test in tests) { - NSIndexSet *insertions, *deletions; - NSArray *moves; - [test[0] asdk_diffWithArray:test[1] insertions:&insertions deletions:&deletions moves:&moves]; - NSMutableIndexSet *mutableInsertions = [insertions mutableCopy]; - NSMutableIndexSet *mutableDeletions = [deletions mutableCopy]; - - for (NSNumber *index in (NSArray *) test[2]) { - XCTAssert([mutableInsertions containsIndex:[index integerValue]], @"Test #%ld, insertions does not contain %ld", - n, (long)[index integerValue]); - [mutableInsertions removeIndex:(NSUInteger) [index integerValue]]; - } - for (NSNumber *index in (NSArray *) test[3]) { - XCTAssert([mutableDeletions containsIndex:[index integerValue]], @"Test #%ld, deletions does not contain %ld", - n, (long)[index integerValue]); - [mutableDeletions removeIndex:(NSUInteger) [index integerValue]]; - } - - XCTAssert([mutableInsertions count] == 0, @"Test #%ld, Unaccounted insertions: %@", n, mutableInsertions); - XCTAssert([mutableDeletions count] == 0, @"Test #%ld, Unaccounted deletions: %@", n, mutableDeletions); - - XCTAssert([moves isEqual:test[4]], @"Test #%ld, %@ !isEqual: %@", n, moves, test[4]); - n++; - } -} - -- (void)testArrayDiffingRebuildingWithRandomElements -{ - NSArray *original = @[]; - NSArray *pending = @[]; - - NSIndexSet *insertions = nil; - NSIndexSet *deletions = nil; - NSArray *moves; - - for (int testNumber = 0; testNumber <= 25; testNumber++) { - int len = arc4random_uniform(10); - for (int j = 0; j < len; j++) { - original = [original arrayByAddingObject:@(arc4random_uniform(25))]; - } - len = arc4random_uniform(10); - for (int j = 0; j < len; j++) { - pending = [pending arrayByAddingObject:@(arc4random_uniform(25))]; - } - // Some sequences that presented issues in the past: - if (testNumber == 0) { - original = @[@20, @11, @14, @2, @14, @5, @4, @18, @0]; - pending = @[@9, @18, @18, @19, @20, @18, @22, @10, @3]; - } - if (testNumber == 1) { - original = @[@5, @9, @21, @11, @5, @9, @8]; - pending = @[@2, @12, @17, @19, @9, @1, @8, @5, @21]; - } - if (testNumber == 2) { - original = @[@14, @14, @12, @8, @20, @4, @0, @10]; - pending = @[@14]; - } - - [original asdk_diffWithArray:pending insertions:&insertions deletions:&deletions moves:&moves]; - - NSMutableArray *deletionsList = [NSMutableArray new]; - [deletions enumerateIndexesUsingBlock:^(NSUInteger idx, BOOL *stop) { - [deletionsList addObject:@(idx)]; - }]; - NSMutableArray *insertionsList = [NSMutableArray new]; - [insertions enumerateIndexesUsingBlock:^(NSUInteger idx, BOOL *stop) { - [insertionsList addObject:@(idx)]; - }]; - - NSUInteger i = 0; - NSUInteger j = 0; - NSMutableArray *test = [NSMutableArray new]; - for (NSUInteger count = 0; count < [pending count]; count++) { - if (i < [insertionsList count] && [insertionsList[i] unsignedIntegerValue] == count) { - [test addObject:pending[[insertionsList[i] unsignedIntegerValue]]]; - i++; - } else if (j < [moves count] && [moves[j] indexAtPosition:1] == count) { - [test addObject:original[[moves[j] indexAtPosition:0]]]; - j++; - } else { - [test addObject:original[count]]; - } - } - - XCTAssert([test isEqualToArray:pending], @"Did not mutate to expected new array:\n [%@] -> [%@], actual: [%@]\ninsertions: %@\nmoves: %@\ndeletions: %@", - [original componentsJoinedByString:@","], [pending componentsJoinedByString:@","], [test componentsJoinedByString:@","], - insertions, moves, deletions); - original = @[]; - pending = @[]; - } -} -@end diff --git a/submodules/AsyncDisplayKit/Tests/AsyncDisplayKitTests-Info.plist b/submodules/AsyncDisplayKit/Tests/AsyncDisplayKitTests-Info.plist deleted file mode 100644 index 169b6f710e..0000000000 --- a/submodules/AsyncDisplayKit/Tests/AsyncDisplayKitTests-Info.plist +++ /dev/null @@ -1,22 +0,0 @@ - - - - - CFBundleDevelopmentRegion - en - CFBundleExecutable - ${EXECUTABLE_NAME} - CFBundleIdentifier - $(PRODUCT_BUNDLE_IDENTIFIER) - CFBundleInfoDictionaryVersion - 6.0 - CFBundlePackageType - BNDL - CFBundleShortVersionString - 1.0 - CFBundleSignature - ???? - CFBundleVersion - 1 - - diff --git a/submodules/AsyncDisplayKit/Tests/AsyncDisplayKitTests-Prefix.pch b/submodules/AsyncDisplayKit/Tests/AsyncDisplayKitTests-Prefix.pch deleted file mode 100644 index 625be4d28b..0000000000 --- a/submodules/AsyncDisplayKit/Tests/AsyncDisplayKitTests-Prefix.pch +++ /dev/null @@ -1,9 +0,0 @@ -// -// Prefix header -// -// The contents of this file are implicitly included at the beginning of every source file. -// - -#ifdef __OBJC__ - #import -#endif diff --git a/submodules/AsyncDisplayKit/Tests/Common/ASDisplayNode+OCMock.mm b/submodules/AsyncDisplayKit/Tests/Common/ASDisplayNode+OCMock.mm deleted file mode 100644 index 8776fd7bde..0000000000 --- a/submodules/AsyncDisplayKit/Tests/Common/ASDisplayNode+OCMock.mm +++ /dev/null @@ -1,27 +0,0 @@ -// -// ASDisplayNode+OCMock.mm -// Texture -// -// Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -/** - * For some reason, when creating partial mocks of nodes, OCMock fails to find - * these class methods that it swizzled! - */ -@implementation ASDisplayNode (OCMock) - -+ (Class)ocmock_replaced_viewClass -{ - return [_ASDisplayView class]; -} - -+ (Class)ocmock_replaced_layerClass -{ - return [_ASDisplayLayer class]; -} - -@end diff --git a/submodules/AsyncDisplayKit/Tests/Common/ASTestCase.h b/submodules/AsyncDisplayKit/Tests/Common/ASTestCase.h deleted file mode 100644 index 72fcd259f9..0000000000 --- a/submodules/AsyncDisplayKit/Tests/Common/ASTestCase.h +++ /dev/null @@ -1,27 +0,0 @@ -// -// ASTestCase.h -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -// Not strictly necessary, but convenient -#import - -#import - -#import "OCMockObject+ASAdditions.h" - -NS_ASSUME_NONNULL_BEGIN - -@interface ASTestCase : XCTestCase - -@property (class, nonatomic, nullable, readonly) ASTestCase *currentTestCase; - -@end - -NS_ASSUME_NONNULL_END diff --git a/submodules/AsyncDisplayKit/Tests/Common/ASTestCase.mm b/submodules/AsyncDisplayKit/Tests/Common/ASTestCase.mm deleted file mode 100644 index 30b42bde4c..0000000000 --- a/submodules/AsyncDisplayKit/Tests/Common/ASTestCase.mm +++ /dev/null @@ -1,109 +0,0 @@ -// -// ASTestCase.mm -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import "ASTestCase.h" -#import -#import -#import -#import "OCMockObject+ASAdditions.h" - -static __weak ASTestCase *currentTestCase; - -@implementation ASTestCase { - ASWeakSet *registeredMockObjects; -} - -- (void)setUp -{ - [super setUp]; - currentTestCase = self; - registeredMockObjects = [ASWeakSet new]; -} - -- (void)tearDown -{ - [ASConfigurationManager test_resetWithConfiguration:nil]; - - // Clear out all application windows. Note: the system will retain these sometimes on its - // own but we'll do our best. - for (UIWindow *window in [UIApplication sharedApplication].windows) { - [window resignKeyWindow]; - window.hidden = YES; - window.rootViewController = nil; - for (UIView *view in window.subviews) { - [view removeFromSuperview]; - } - } - - // Set nil for all our subclasses' ivars. Use setValue:forKey: so memory is managed correctly. - // This is important to do _inside_ the test-perform, so that we catch any issues caused by the - // deallocation, and so that we're inside the @autoreleasepool for the test invocation. - Class c = [self class]; - while (c != [ASTestCase class]) { - unsigned int ivarCount; - Ivar *ivars = class_copyIvarList(c, &ivarCount); - for (unsigned int i = 0; i < ivarCount; i++) { - Ivar ivar = ivars[i]; - NSString *key = [NSString stringWithCString:ivar_getName(ivar) encoding:NSUTF8StringEncoding]; - if (OCMIsObjectType(ivar_getTypeEncoding(ivar))) { - [self setValue:nil forKey:key]; - } - } - if (ivars) { - free(ivars); - } - - c = [c superclass]; - } - - for (OCMockObject *mockObject in registeredMockObjects) { - OCMVerifyAll(mockObject); - [mockObject stopMocking]; - - // Invocations retain arguments, which may cause retain cycles. - // Manually clear them all out. - NSMutableArray *invocations = object_getIvar(mockObject, class_getInstanceVariable(OCMockObject.class, "invocations")); - [invocations removeAllObjects]; - } - - // Go ahead and spin the run loop before finishing, so the system - // unregisters/cleans up whatever possible. - [NSRunLoop.mainRunLoop runMode:NSDefaultRunLoopMode beforeDate:NSDate.distantPast]; - - [super tearDown]; -} - -- (void)invokeTest -{ - // This will call setup, run, then teardown. - @autoreleasepool { - [super invokeTest]; - } - - // Now that the autorelease pool is drained, drain the dealloc queue also. - [[ASDeallocQueue sharedDeallocationQueue] drain]; -} - -+ (ASTestCase *)currentTestCase -{ - return currentTestCase; -} - -@end - -@implementation ASTestCase (OCMockObjectRegistering) - -- (void)registerMockObject:(id)mockObject -{ - @synchronized (registeredMockObjects) { - [registeredMockObjects addObject:mockObject]; - } -} - -@end diff --git a/submodules/AsyncDisplayKit/Tests/Common/ASXCTExtensions.h b/submodules/AsyncDisplayKit/Tests/Common/ASXCTExtensions.h deleted file mode 100644 index 2d882f922a..0000000000 --- a/submodules/AsyncDisplayKit/Tests/Common/ASXCTExtensions.h +++ /dev/null @@ -1,36 +0,0 @@ -// -// ASXCTExtensions.h -// Texture -// -// Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -#define ASXCTAssertEqualSizes(s0, s1, ...) \ - _XCTPrimitiveAssertEqualObjects(self, NSStringFromCGSize(s0), @#s0, NSStringFromCGSize(s1), @#s1, __VA_ARGS__) - -#define ASXCTAssertNotEqualSizes(s0, s1, ...) \ - _XCTPrimitiveAssertNotEqualObjects(self, NSStringFromCGSize(s0), @#s0, NSStringFromCGSize(s1), @#s1, __VA_ARGS__) - -#define ASXCTAssertEqualPoints(p0, p1, ...) \ - _XCTPrimitiveAssertEqualObjects(self, NSStringFromCGPoint(p0), @#p0, NSStringFromCGPoint(p1), @#p1, __VA_ARGS__) - -#define ASXCTAssertNotEqualPoints(p0, p1, ...) \ - _XCTPrimitiveAssertNotEqualObjects(self, NSStringFromCGPoint(p0), @#p0, NSStringFromCGPoint(p1), @#p1, __VA_ARGS__) - -#define ASXCTAssertEqualRects(r0, r1, ...) \ - _XCTPrimitiveAssertEqualObjects(self, NSStringFromCGRect(r0), @#r0, NSStringFromCGRect(r1), @#r1, __VA_ARGS__) - -#define ASXCTAssertNotEqualRects(r0, r1, ...) \ - _XCTPrimitiveAssertNotEqualObjects(self, NSStringFromCGRect(r0), @#r0, NSStringFromCGRect(r1), @#r1, __VA_ARGS__) - -#define ASXCTAssertEqualDimensions(r0, r1, ...) \ - _XCTPrimitiveAssertEqualObjects(self, NSStringFromASDimension(r0), @#r0, NSStringFromASDimension(r1), @#r1, __VA_ARGS__) - -#define ASXCTAssertNotEqualDimensions(r0, r1, ...) \ - _XCTPrimitiveAssertNotEqualObjects(self, NSStringFromASDimension(r0), @#r0, NSStringFromASDimension(r1), @#r1, __VA_ARGS__) - -#define ASXCTAssertEqualSizeRanges(r0, r1, ...) \ - _XCTPrimitiveAssertEqualObjects(self, NSStringFromASSizeRange(r0), @#r0, NSStringFromASSizeRange(r1), @#r1, __VA_ARGS__) diff --git a/submodules/AsyncDisplayKit/Tests/Common/NSInvocation+ASTestHelpers.h b/submodules/AsyncDisplayKit/Tests/Common/NSInvocation+ASTestHelpers.h deleted file mode 100644 index 3248cdd283..0000000000 --- a/submodules/AsyncDisplayKit/Tests/Common/NSInvocation+ASTestHelpers.h +++ /dev/null @@ -1,32 +0,0 @@ -// -// NSInvocation+ASTestHelpers.h -// Texture -// -// Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -NS_ASSUME_NONNULL_BEGIN - -@interface NSInvocation (ASTestHelpers) - -/** - * Formats the argument at the given index as an object and returns it. - * - * Currently only supports arguments that are themselves objects, but handles - * getting the argument into ARC safely. - */ -- (nullable id)as_argumentAtIndexAsObject:(NSInteger)index; - -/** - * Sets the return value, simulating ARC behavior. - * - * Currently only supports invocations whose return values are already object types. - */ -- (void)as_setReturnValueWithObject:(nullable id)object; - -@end - -NS_ASSUME_NONNULL_END diff --git a/submodules/AsyncDisplayKit/Tests/Common/NSInvocation+ASTestHelpers.mm b/submodules/AsyncDisplayKit/Tests/Common/NSInvocation+ASTestHelpers.mm deleted file mode 100644 index dc5a4279f7..0000000000 --- a/submodules/AsyncDisplayKit/Tests/Common/NSInvocation+ASTestHelpers.mm +++ /dev/null @@ -1,32 +0,0 @@ -// -// NSInvocation+ASTestHelpers.mm -// Texture -// -// Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import "NSInvocation+ASTestHelpers.h" - -@implementation NSInvocation (ASTestHelpers) - -- (id)as_argumentAtIndexAsObject:(NSInteger)index -{ - void *buf; - [self getArgument:&buf atIndex:index]; - return (__bridge id)buf; -} - -- (void)as_setReturnValueWithObject:(id)object -{ - if (object == nil) { - const void *fixedBuf = NULL; - [self setReturnValue:&fixedBuf]; - } else { - // Retain, then autorelease. - const void *fixedBuf = CFAutorelease((__bridge_retained void *)object); - [self setReturnValue:&fixedBuf]; - } -} - -@end diff --git a/submodules/AsyncDisplayKit/Tests/Common/OCMockObject+ASAdditions.h b/submodules/AsyncDisplayKit/Tests/Common/OCMockObject+ASAdditions.h deleted file mode 100644 index 2ad99e676e..0000000000 --- a/submodules/AsyncDisplayKit/Tests/Common/OCMockObject+ASAdditions.h +++ /dev/null @@ -1,56 +0,0 @@ -// -// OCMockObject+ASAdditions.h -// Texture -// -// Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -@interface OCMockObject (ASAdditions) - -/** - * NOTE: All OCMockObjects created during an ASTestCase call OCMVerifyAll during -tearDown. - */ - -/** - * A method to manually specify which optional protocol methods should return YES - * from -respondsToSelector:. - * - * If you don't call this method, the default OCMock behavior is to - * "implement" all optional protocol methods, which makes it impossible to - * test scenarios where only a subset of optional protocol methods are implemented. - * - * You should only call this on protocol mocks. - */ -- (void)addImplementedOptionalProtocolMethods:(SEL)aSelector, ... NS_REQUIRES_NIL_TERMINATION; - -/// An optional block to modify description text. Only used in OCClassMockObject currently. -@property NSString *(^modifyDescriptionBlock)(OCMockObject *object, NSString *baseDescription); - -@end - -/** - * Additional stub recorders useful in ASDK. - */ -@interface OCMStubRecorder (ASProperties) - -/** - * Add a debug-break side effect to this stub/expectation. - * - * You will usually need to jump to frame 12 "fr s 12" - */ -#define andDebugBreak() _andDebugBreak() -@property (nonatomic, readonly) OCMStubRecorder *(^ _andDebugBreak)(void); - -#define ignoringNonObjectArgs() _ignoringNonObjectArgs() -@property (nonatomic, readonly) OCMStubRecorder *(^ _ignoringNonObjectArgs)(void); - -#define onMainThread() _onMainThread() -@property (nonatomic, readonly) OCMStubRecorder *(^ _onMainThread)(void); - -#define offMainThread() _offMainThread() -@property (nonatomic, readonly) OCMStubRecorder *(^ _offMainThread)(void); - -@end diff --git a/submodules/AsyncDisplayKit/Tests/Common/OCMockObject+ASAdditions.mm b/submodules/AsyncDisplayKit/Tests/Common/OCMockObject+ASAdditions.mm deleted file mode 100644 index e6d3f711d3..0000000000 --- a/submodules/AsyncDisplayKit/Tests/Common/OCMockObject+ASAdditions.mm +++ /dev/null @@ -1,237 +0,0 @@ -// -// OCMockObject+ASAdditions.mm -// Texture -// -// Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import "OCMockObject+ASAdditions.h" - -#import -#import -#import "ASTestCase.h" -#import -#import "debugbreak.h" - -@interface ASTestCase (OCMockObjectRegistering) - -- (void)registerMockObject:(id)mockObject; - -@end - -@implementation OCMockObject (ASAdditions) - -+ (void)load -{ - // [OCProtocolMockObject respondsToSelector:] <-> [(self) swizzled_protocolMockRespondsToSelector:] - Method orig = class_getInstanceMethod(OCMockObject.protocolMockObjectClass, @selector(respondsToSelector:)); - Method newMethod = class_getInstanceMethod(self, @selector(swizzled_protocolMockRespondsToSelector:)); - method_exchangeImplementations(orig, newMethod); - - // init <-> swizzled_init - { - Method origInit = class_getInstanceMethod([OCMockObject class], @selector(init)); - Method newInit = class_getInstanceMethod(self, @selector(swizzled_init)); - method_exchangeImplementations(origInit, newInit); - } - - // (class mock) description <-> swizzled_classMockDescription - { - Method orig = class_getInstanceMethod(OCMockObject.classMockObjectClass, @selector(description)); - Method newMethod = class_getInstanceMethod(self, @selector(swizzled_classMockDescription)); - method_exchangeImplementations(orig, newMethod); - } -} - -/// Since OCProtocolMockObject is private, use this method to get the class. -+ (Class)protocolMockObjectClass -{ - static Class c; - static dispatch_once_t onceToken; - dispatch_once(&onceToken, ^{ - c = NSClassFromString(@"OCProtocolMockObject"); - NSAssert(c != Nil, nil); - }); - return c; -} - -/// Since OCClassMockObject is private, use this method to get the class. -+ (Class)classMockObjectClass -{ - static Class c; - static dispatch_once_t onceToken; - dispatch_once(&onceToken, ^{ - c = NSClassFromString(@"OCClassMockObject"); - NSAssert(c != Nil, nil); - }); - return c; -} - -/// Whether the user has opted-in to specify which optional methods are implemented for this object. -- (BOOL)hasSpecifiedOptionalProtocolMethods -{ - return objc_getAssociatedObject(self, @selector(optionalImplementedMethods)) != nil; -} - -/// The optional protocol selectors the user has added via -addImplementedOptionalProtocolMethods: -- (NSMutableSet *)optionalImplementedMethods -{ - NSMutableSet *result = objc_getAssociatedObject(self, _cmd); - if (result == nil) { - result = [NSMutableSet set]; - objc_setAssociatedObject(self, _cmd, result, OBJC_ASSOCIATION_RETAIN_NONATOMIC); - } - return result; -} - -- (void)addImplementedOptionalProtocolMethods:(SEL)aSelector, ... -{ - // Can't use isKindOfClass: since we're a proxy. - NSAssert(object_getClass(self) == OCMockObject.protocolMockObjectClass, @"Cannot call this method on non-protocol mocks."); - NSMutableSet *methods = self.optionalImplementedMethods; - - // First arg is not returned by va_arg, needs to be handled separately. - if (aSelector != NULL) { - [methods addObject:NSStringFromSelector(aSelector)]; - } - - va_list args; - va_start(args, aSelector); - SEL s; - while((s = va_arg(args, SEL))) - { - [methods addObject:NSStringFromSelector(s)]; - } - va_end(args); -} - -- (BOOL)implementsOptionalProtocolMethod:(SEL)aSelector -{ - NSAssert(self.hasSpecifiedOptionalProtocolMethods, @"Shouldn't call this method if the user hasn't opted-in to specifying optional protocol methods."); - - // Check our collection first. It'll be in here if they explicitly marked the method as implemented. - for (NSString *str in self.optionalImplementedMethods) { - if (sel_isEqual(NSSelectorFromString(str), aSelector)) { - return YES; - } - } - - // If they didn't explicitly mark it implemented, check if they stubbed/expected it. That counts too, but - // we still want them to have the option to declare that the method exists without - // stubbing it or making an expectation, so the rest of OCMock's mechanisms work as expected. - return [self handleSelector:aSelector]; -} - -- (BOOL)swizzled_protocolMockRespondsToSelector:(SEL)aSelector -{ - // Can't use isKindOfClass: since we're a proxy. - NSAssert(object_getClass(self) == OCMockObject.protocolMockObjectClass, @"Swizzled method should only ever be called for protocol mocks."); - - // If they haven't called our public method to opt-in, use the default behavior. - if (!self.hasSpecifiedOptionalProtocolMethods) { - return [self swizzled_protocolMockRespondsToSelector:aSelector]; - } - - Ivar i = class_getInstanceVariable([self class], "mockedProtocol"); - NSAssert(i != NULL, nil); - Protocol *mockedProtocol = object_getIvar(self, i); - NSAssert(mockedProtocol != NULL, nil); - - // Check if it's an optional protocol method. If not, just return the default implementation (which has now swapped). - struct objc_method_description methodDescription; - methodDescription = protocol_getMethodDescription(mockedProtocol, aSelector, NO, YES); - if (methodDescription.name == NULL) { - methodDescription = protocol_getMethodDescription(mockedProtocol, aSelector, NO, NO); - if (methodDescription.name == NULL) { - return [self swizzled_protocolMockRespondsToSelector:aSelector]; - } - } - - // It's an optional instance or class method. Override the return value. - return [self implementsOptionalProtocolMethod:aSelector]; -} - -// Whenever a mock object is initted, register it with the current test case -// so that it gets verified and its invocations are cleared during -tearDown. -- (instancetype)swizzled_init -{ - [self swizzled_init]; - [ASTestCase.currentTestCase registerMockObject:self]; - return self; -} - -- (NSString *)swizzled_classMockDescription -{ - NSString *orig = [self swizzled_classMockDescription]; - __auto_type block = self.modifyDescriptionBlock; - if (block) { - return block(self, orig); - } - return orig; -} - -- (void)setModifyDescriptionBlock:(NSString *(^)(OCMockObject *, NSString *))modifyDescriptionBlock -{ - objc_setAssociatedObject(self, @selector(modifyDescriptionBlock), modifyDescriptionBlock, OBJC_ASSOCIATION_COPY); -} - -- (NSString *(^)(OCMockObject *, NSString *))modifyDescriptionBlock -{ - return objc_getAssociatedObject(self, _cmd); -} - -@end - -@implementation OCMStubRecorder (ASProperties) - -@dynamic _ignoringNonObjectArgs; - -- (OCMStubRecorder *(^)(void))_ignoringNonObjectArgs -{ - id (^theBlock)(void) = ^ () - { - return [self ignoringNonObjectArgs]; - }; - return theBlock; -} - -@dynamic _onMainThread; - -- (OCMStubRecorder *(^)(void))_onMainThread -{ - id (^theBlock)(void) = ^ () - { - return [self andDo:^(NSInvocation *invocation) { - ASDisplayNodeAssertMainThread(); - }]; - }; - return theBlock; -} - -@dynamic _offMainThread; - -- (OCMStubRecorder *(^)(void))_offMainThread -{ - id (^theBlock)(void) = ^ () - { - return [self andDo:^(NSInvocation *invocation) { - ASDisplayNodeAssertNotMainThread(); - }]; - }; - return theBlock; -} - -@dynamic _andDebugBreak; - -- (OCMStubRecorder *(^)(void))_andDebugBreak -{ - id (^theBlock)(void) = ^ () - { - return [self andDo:^(NSInvocation *invocation) { - debug_break(); - }]; - }; - return theBlock; -} -@end diff --git a/submodules/AsyncDisplayKit/Tests/Common/debugbreak.h b/submodules/AsyncDisplayKit/Tests/Common/debugbreak.h deleted file mode 100644 index 96f1e9e59a..0000000000 --- a/submodules/AsyncDisplayKit/Tests/Common/debugbreak.h +++ /dev/null @@ -1,142 +0,0 @@ -// -// debugbreak.h -// Texture -// -// Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -/* Copyright (c) 2011-2015, Scott Tsai - * - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef DEBUG_BREAK_H -#define DEBUG_BREAK_H - -#ifdef _MSC_VER - -#define debug_break __debugbreak - -#else - -#include - -#ifdef __cplusplus -extern "C" { -#endif - -enum { - /* gcc optimizers consider code after __builtin_trap() dead. - * Making __builtin_trap() unsuitable for breaking into the debugger */ - DEBUG_BREAK_PREFER_BUILTIN_TRAP_TO_SIGTRAP = 0, -}; - -#if defined(__i386__) || defined(__x86_64__) -enum { HAVE_TRAP_INSTRUCTION = 1, }; -__attribute__((gnu_inline, always_inline)) -__inline__ static void trap_instruction(void) -{ - __asm__ volatile("int $0x03"); -} -#elif defined(__thumb__) -enum { HAVE_TRAP_INSTRUCTION = 1, }; -/* FIXME: handle __THUMB_INTERWORK__ */ -__attribute__((gnu_inline, always_inline)) -__inline__ static void trap_instruction(void) -{ - /* See 'arm-linux-tdep.c' in GDB source. - * Both instruction sequences below work. */ -#if 1 - /* 'eabi_linux_thumb_le_breakpoint' */ - __asm__ volatile(".inst 0xde01"); -#else - /* 'eabi_linux_thumb2_le_breakpoint' */ - __asm__ volatile(".inst.w 0xf7f0a000"); -#endif - - /* Known problem: - * After a breakpoint hit, can't stepi, step, or continue in GDB. - * 'step' stuck on the same instruction. - * - * Workaround: a new GDB command, - * 'debugbreak-step' is defined in debugbreak-gdb.py - * that does: - * (gdb) set $instruction_len = 2 - * (gdb) tbreak *($pc + $instruction_len) - * (gdb) jump *($pc + $instruction_len) - */ -} -#elif defined(__arm__) && !defined(__thumb__) -enum { HAVE_TRAP_INSTRUCTION = 1, }; -__attribute__((gnu_inline, always_inline)) -__inline__ static void trap_instruction(void) -{ - /* See 'arm-linux-tdep.c' in GDB source, - * 'eabi_linux_arm_le_breakpoint' */ - __asm__ volatile(".inst 0xe7f001f0"); - /* Has same known problem and workaround - * as Thumb mode */ -} -#elif defined(__aarch64__) -enum { HAVE_TRAP_INSTRUCTION = 1, }; -__attribute__((gnu_inline, always_inline)) -__inline__ static void trap_instruction(void) -{ - /* See 'aarch64-tdep.c' in GDB source, - * 'aarch64_default_breakpoint' */ - __asm__ volatile(".inst 0xd4200000"); -} -#else -enum { HAVE_TRAP_INSTRUCTION = 0, }; -#endif - -__attribute__((gnu_inline, always_inline)) -__inline__ static void debug_break(void) -{ - if (HAVE_TRAP_INSTRUCTION) { - trap_instruction(); - } else if (DEBUG_BREAK_PREFER_BUILTIN_TRAP_TO_SIGTRAP) { - /* raises SIGILL on Linux x86{,-64}, to continue in gdb: - * (gdb) handle SIGILL stop nopass - * */ - __builtin_trap(); - } else { - #ifdef _WIN32 - /* SIGTRAP available only on POSIX-compliant operating systems - * use builtin trap instead */ - __builtin_trap(); - #else - raise(SIGTRAP); - #endif - } -} - -#ifdef __cplusplus -} -#endif - -#endif - -#endif diff --git a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASAbsoluteLayoutSpecSnapshotTests/testChildrenMeasuredWithAutoMaxSize@2x.png b/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASAbsoluteLayoutSpecSnapshotTests/testChildrenMeasuredWithAutoMaxSize@2x.png deleted file mode 100644 index 2b60cf2bcf..0000000000 Binary files a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASAbsoluteLayoutSpecSnapshotTests/testChildrenMeasuredWithAutoMaxSize@2x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASAbsoluteLayoutSpecSnapshotTests/testSizingBehaviour_overflowChildren@2x.png b/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASAbsoluteLayoutSpecSnapshotTests/testSizingBehaviour_overflowChildren@2x.png deleted file mode 100644 index 1687dc24f6..0000000000 Binary files a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASAbsoluteLayoutSpecSnapshotTests/testSizingBehaviour_overflowChildren@2x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASAbsoluteLayoutSpecSnapshotTests/testSizingBehaviour_underflowChildren@2x.png b/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASAbsoluteLayoutSpecSnapshotTests/testSizingBehaviour_underflowChildren@2x.png deleted file mode 100644 index 2233813979..0000000000 Binary files a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASAbsoluteLayoutSpecSnapshotTests/testSizingBehaviour_underflowChildren@2x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASAbsoluteLayoutSpecSnapshotTests/testSizingBehaviour_wrappedChildren@2x.png b/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASAbsoluteLayoutSpecSnapshotTests/testSizingBehaviour_wrappedChildren@2x.png deleted file mode 100644 index 3d76853c01..0000000000 Binary files a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASAbsoluteLayoutSpecSnapshotTests/testSizingBehaviour_wrappedChildren@2x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASBackgroundLayoutSpecSnapshotTests/testBackground@2x.png b/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASBackgroundLayoutSpecSnapshotTests/testBackground@2x.png deleted file mode 100644 index 198e5394cc..0000000000 Binary files a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASBackgroundLayoutSpecSnapshotTests/testBackground@2x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASCenterLayoutSpecSnapshotTests/testMinimumSizeRangeIsGivenToChildWhenNotCentering@2x.png b/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASCenterLayoutSpecSnapshotTests/testMinimumSizeRangeIsGivenToChildWhenNotCentering@2x.png deleted file mode 100644 index 02717f8fdb..0000000000 Binary files a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASCenterLayoutSpecSnapshotTests/testMinimumSizeRangeIsGivenToChildWhenNotCentering@2x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASCenterLayoutSpecSnapshotTests/testWithOptions@2x.png b/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASCenterLayoutSpecSnapshotTests/testWithOptions@2x.png deleted file mode 100644 index 50cb613c24..0000000000 Binary files a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASCenterLayoutSpecSnapshotTests/testWithOptions@2x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASCenterLayoutSpecSnapshotTests/testWithOptions_CenteringX@2x.png b/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASCenterLayoutSpecSnapshotTests/testWithOptions_CenteringX@2x.png deleted file mode 100644 index 69e7392384..0000000000 Binary files a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASCenterLayoutSpecSnapshotTests/testWithOptions_CenteringX@2x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASCenterLayoutSpecSnapshotTests/testWithOptions_CenteringXCenteringY@2x.png b/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASCenterLayoutSpecSnapshotTests/testWithOptions_CenteringXCenteringY@2x.png deleted file mode 100644 index 311ef9ed32..0000000000 Binary files a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASCenterLayoutSpecSnapshotTests/testWithOptions_CenteringXCenteringY@2x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASCenterLayoutSpecSnapshotTests/testWithOptions_CenteringY@2x.png b/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASCenterLayoutSpecSnapshotTests/testWithOptions_CenteringY@2x.png deleted file mode 100644 index 28036afad5..0000000000 Binary files a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASCenterLayoutSpecSnapshotTests/testWithOptions_CenteringY@2x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASCenterLayoutSpecSnapshotTests/testWithSizingOptions@2x.png b/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASCenterLayoutSpecSnapshotTests/testWithSizingOptions@2x.png deleted file mode 100644 index 50cb613c24..0000000000 Binary files a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASCenterLayoutSpecSnapshotTests/testWithSizingOptions@2x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASCenterLayoutSpecSnapshotTests/testWithSizingOptions_SizingMinimumX@2x.png b/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASCenterLayoutSpecSnapshotTests/testWithSizingOptions_SizingMinimumX@2x.png deleted file mode 100644 index 270b15feb6..0000000000 Binary files a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASCenterLayoutSpecSnapshotTests/testWithSizingOptions_SizingMinimumX@2x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASCenterLayoutSpecSnapshotTests/testWithSizingOptions_SizingMinimumXSizingMinimumY@2x.png b/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASCenterLayoutSpecSnapshotTests/testWithSizingOptions_SizingMinimumXSizingMinimumY@2x.png deleted file mode 100644 index 7fddbff94e..0000000000 Binary files a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASCenterLayoutSpecSnapshotTests/testWithSizingOptions_SizingMinimumXSizingMinimumY@2x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASCenterLayoutSpecSnapshotTests/testWithSizingOptions_SizingMinimumY@2x.png b/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASCenterLayoutSpecSnapshotTests/testWithSizingOptions_SizingMinimumY@2x.png deleted file mode 100644 index b14c267b42..0000000000 Binary files a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASCenterLayoutSpecSnapshotTests/testWithSizingOptions_SizingMinimumY@2x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASDisplayNodeSnapshotTests/testBasicHierarchySnapshotTesting@2x.png b/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASDisplayNodeSnapshotTests/testBasicHierarchySnapshotTesting@2x.png deleted file mode 100644 index e5f40f70fd..0000000000 Binary files a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASDisplayNodeSnapshotTests/testBasicHierarchySnapshotTesting@2x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASImageNodeSnapshotTests/testForcedScaling_first@2x.png b/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASImageNodeSnapshotTests/testForcedScaling_first@2x.png deleted file mode 100644 index 896dc7abf0..0000000000 Binary files a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASImageNodeSnapshotTests/testForcedScaling_first@2x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASImageNodeSnapshotTests/testForcedScaling_second@2x.png b/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASImageNodeSnapshotTests/testForcedScaling_second@2x.png deleted file mode 100644 index 79d4c747d8..0000000000 Binary files a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASImageNodeSnapshotTests/testForcedScaling_second@2x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASImageNodeSnapshotTests/testRenderLogoSquare@2x.png b/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASImageNodeSnapshotTests/testRenderLogoSquare@2x.png deleted file mode 100644 index 896dc7abf0..0000000000 Binary files a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASImageNodeSnapshotTests/testRenderLogoSquare@2x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASImageNodeSnapshotTests/testRoundedCornerBlock@2x.png b/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASImageNodeSnapshotTests/testRoundedCornerBlock@2x.png deleted file mode 100644 index b4c17dd803..0000000000 Binary files a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASImageNodeSnapshotTests/testRoundedCornerBlock@2x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASImageNodeSnapshotTests/testTintColorBlock@2x.png b/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASImageNodeSnapshotTests/testTintColorBlock@2x.png deleted file mode 100644 index 0cc74697a6..0000000000 Binary files a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASImageNodeSnapshotTests/testTintColorBlock@2x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASInsetLayoutSpecSnapshotTests/testInsetsWithFixedSize_10-10-10-10@2x.png b/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASInsetLayoutSpecSnapshotTests/testInsetsWithFixedSize_10-10-10-10@2x.png deleted file mode 100644 index ec0a4cf3c7..0000000000 Binary files a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASInsetLayoutSpecSnapshotTests/testInsetsWithFixedSize_10-10-10-10@2x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASInsetLayoutSpecSnapshotTests/testInsetsWithFixedSize_10-10-10-inf@2x.png b/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASInsetLayoutSpecSnapshotTests/testInsetsWithFixedSize_10-10-10-inf@2x.png deleted file mode 100644 index fb4775c0f5..0000000000 Binary files a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASInsetLayoutSpecSnapshotTests/testInsetsWithFixedSize_10-10-10-inf@2x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASInsetLayoutSpecSnapshotTests/testInsetsWithFixedSize_10-10-inf-10@2x.png b/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASInsetLayoutSpecSnapshotTests/testInsetsWithFixedSize_10-10-inf-10@2x.png deleted file mode 100644 index 993d4c0592..0000000000 Binary files a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASInsetLayoutSpecSnapshotTests/testInsetsWithFixedSize_10-10-inf-10@2x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASInsetLayoutSpecSnapshotTests/testInsetsWithFixedSize_10-10-inf-inf@2x.png b/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASInsetLayoutSpecSnapshotTests/testInsetsWithFixedSize_10-10-inf-inf@2x.png deleted file mode 100644 index d0b2cbd912..0000000000 Binary files a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASInsetLayoutSpecSnapshotTests/testInsetsWithFixedSize_10-10-inf-inf@2x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASInsetLayoutSpecSnapshotTests/testInsetsWithFixedSize_10-inf-10-10@2x.png b/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASInsetLayoutSpecSnapshotTests/testInsetsWithFixedSize_10-inf-10-10@2x.png deleted file mode 100644 index 537326b3db..0000000000 Binary files a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASInsetLayoutSpecSnapshotTests/testInsetsWithFixedSize_10-inf-10-10@2x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASInsetLayoutSpecSnapshotTests/testInsetsWithFixedSize_10-inf-10-inf@2x.png b/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASInsetLayoutSpecSnapshotTests/testInsetsWithFixedSize_10-inf-10-inf@2x.png deleted file mode 100644 index b38c9ccb1c..0000000000 Binary files a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASInsetLayoutSpecSnapshotTests/testInsetsWithFixedSize_10-inf-10-inf@2x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASInsetLayoutSpecSnapshotTests/testInsetsWithFixedSize_10-inf-inf-10@2x.png b/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASInsetLayoutSpecSnapshotTests/testInsetsWithFixedSize_10-inf-inf-10@2x.png deleted file mode 100644 index 797e7ac410..0000000000 Binary files a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASInsetLayoutSpecSnapshotTests/testInsetsWithFixedSize_10-inf-inf-10@2x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASInsetLayoutSpecSnapshotTests/testInsetsWithFixedSize_10-inf-inf-inf@2x.png b/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASInsetLayoutSpecSnapshotTests/testInsetsWithFixedSize_10-inf-inf-inf@2x.png deleted file mode 100644 index 8c88149380..0000000000 Binary files a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASInsetLayoutSpecSnapshotTests/testInsetsWithFixedSize_10-inf-inf-inf@2x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASInsetLayoutSpecSnapshotTests/testInsetsWithFixedSize_inf-10-10-10@2x.png b/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASInsetLayoutSpecSnapshotTests/testInsetsWithFixedSize_inf-10-10-10@2x.png deleted file mode 100644 index f9decf0282..0000000000 Binary files a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASInsetLayoutSpecSnapshotTests/testInsetsWithFixedSize_inf-10-10-10@2x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASInsetLayoutSpecSnapshotTests/testInsetsWithFixedSize_inf-10-10-inf@2x.png b/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASInsetLayoutSpecSnapshotTests/testInsetsWithFixedSize_inf-10-10-inf@2x.png deleted file mode 100644 index e3efdda0a1..0000000000 Binary files a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASInsetLayoutSpecSnapshotTests/testInsetsWithFixedSize_inf-10-10-inf@2x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASInsetLayoutSpecSnapshotTests/testInsetsWithFixedSize_inf-10-inf-10@2x.png b/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASInsetLayoutSpecSnapshotTests/testInsetsWithFixedSize_inf-10-inf-10@2x.png deleted file mode 100644 index f494863bc7..0000000000 Binary files a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASInsetLayoutSpecSnapshotTests/testInsetsWithFixedSize_inf-10-inf-10@2x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASInsetLayoutSpecSnapshotTests/testInsetsWithFixedSize_inf-10-inf-inf@2x.png b/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASInsetLayoutSpecSnapshotTests/testInsetsWithFixedSize_inf-10-inf-inf@2x.png deleted file mode 100644 index 5653f7f6fc..0000000000 Binary files a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASInsetLayoutSpecSnapshotTests/testInsetsWithFixedSize_inf-10-inf-inf@2x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASInsetLayoutSpecSnapshotTests/testInsetsWithFixedSize_inf-inf-10-10@2x.png b/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASInsetLayoutSpecSnapshotTests/testInsetsWithFixedSize_inf-inf-10-10@2x.png deleted file mode 100644 index 5fa79d8a92..0000000000 Binary files a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASInsetLayoutSpecSnapshotTests/testInsetsWithFixedSize_inf-inf-10-10@2x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASInsetLayoutSpecSnapshotTests/testInsetsWithFixedSize_inf-inf-10-inf@2x.png b/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASInsetLayoutSpecSnapshotTests/testInsetsWithFixedSize_inf-inf-10-inf@2x.png deleted file mode 100644 index bece9190a6..0000000000 Binary files a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASInsetLayoutSpecSnapshotTests/testInsetsWithFixedSize_inf-inf-10-inf@2x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASInsetLayoutSpecSnapshotTests/testInsetsWithFixedSize_inf-inf-inf-10@2x.png b/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASInsetLayoutSpecSnapshotTests/testInsetsWithFixedSize_inf-inf-inf-10@2x.png deleted file mode 100644 index e8132c50b9..0000000000 Binary files a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASInsetLayoutSpecSnapshotTests/testInsetsWithFixedSize_inf-inf-inf-10@2x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASInsetLayoutSpecSnapshotTests/testInsetsWithFixedSize_inf-inf-inf-inf@2x.png b/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASInsetLayoutSpecSnapshotTests/testInsetsWithFixedSize_inf-inf-inf-inf@2x.png deleted file mode 100644 index 6da1b998c0..0000000000 Binary files a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASInsetLayoutSpecSnapshotTests/testInsetsWithFixedSize_inf-inf-inf-inf@2x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASInsetLayoutSpecSnapshotTests/testInsetsWithInfinityAndZeroInsetValue_0-0-0-0@2x.png b/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASInsetLayoutSpecSnapshotTests/testInsetsWithInfinityAndZeroInsetValue_0-0-0-0@2x.png deleted file mode 100644 index 5104ab98be..0000000000 Binary files a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASInsetLayoutSpecSnapshotTests/testInsetsWithInfinityAndZeroInsetValue_0-0-0-0@2x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASInsetLayoutSpecSnapshotTests/testInsetsWithInfinityAndZeroInsetValue_0-0-0-inf@2x.png b/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASInsetLayoutSpecSnapshotTests/testInsetsWithInfinityAndZeroInsetValue_0-0-0-inf@2x.png deleted file mode 100644 index 8ac22fa361..0000000000 Binary files a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASInsetLayoutSpecSnapshotTests/testInsetsWithInfinityAndZeroInsetValue_0-0-0-inf@2x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASInsetLayoutSpecSnapshotTests/testInsetsWithInfinityAndZeroInsetValue_0-0-inf-0@2x.png b/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASInsetLayoutSpecSnapshotTests/testInsetsWithInfinityAndZeroInsetValue_0-0-inf-0@2x.png deleted file mode 100644 index 2054fac7ea..0000000000 Binary files a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASInsetLayoutSpecSnapshotTests/testInsetsWithInfinityAndZeroInsetValue_0-0-inf-0@2x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASInsetLayoutSpecSnapshotTests/testInsetsWithInfinityAndZeroInsetValue_0-0-inf-inf@2x.png b/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASInsetLayoutSpecSnapshotTests/testInsetsWithInfinityAndZeroInsetValue_0-0-inf-inf@2x.png deleted file mode 100644 index d09eb720c8..0000000000 Binary files a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASInsetLayoutSpecSnapshotTests/testInsetsWithInfinityAndZeroInsetValue_0-0-inf-inf@2x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASInsetLayoutSpecSnapshotTests/testInsetsWithInfinityAndZeroInsetValue_0-inf-0-0@2x.png b/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASInsetLayoutSpecSnapshotTests/testInsetsWithInfinityAndZeroInsetValue_0-inf-0-0@2x.png deleted file mode 100644 index 8fe02d548d..0000000000 Binary files a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASInsetLayoutSpecSnapshotTests/testInsetsWithInfinityAndZeroInsetValue_0-inf-0-0@2x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASInsetLayoutSpecSnapshotTests/testInsetsWithInfinityAndZeroInsetValue_0-inf-0-inf@2x.png b/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASInsetLayoutSpecSnapshotTests/testInsetsWithInfinityAndZeroInsetValue_0-inf-0-inf@2x.png deleted file mode 100644 index 21f8ad6169..0000000000 Binary files a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASInsetLayoutSpecSnapshotTests/testInsetsWithInfinityAndZeroInsetValue_0-inf-0-inf@2x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASInsetLayoutSpecSnapshotTests/testInsetsWithInfinityAndZeroInsetValue_0-inf-inf-0@2x.png b/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASInsetLayoutSpecSnapshotTests/testInsetsWithInfinityAndZeroInsetValue_0-inf-inf-0@2x.png deleted file mode 100644 index a77ce6a0c9..0000000000 Binary files a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASInsetLayoutSpecSnapshotTests/testInsetsWithInfinityAndZeroInsetValue_0-inf-inf-0@2x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASInsetLayoutSpecSnapshotTests/testInsetsWithInfinityAndZeroInsetValue_0-inf-inf-inf@2x.png b/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASInsetLayoutSpecSnapshotTests/testInsetsWithInfinityAndZeroInsetValue_0-inf-inf-inf@2x.png deleted file mode 100644 index c4e1791769..0000000000 Binary files a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASInsetLayoutSpecSnapshotTests/testInsetsWithInfinityAndZeroInsetValue_0-inf-inf-inf@2x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASInsetLayoutSpecSnapshotTests/testInsetsWithInfinityAndZeroInsetValue_inf-0-0-0@2x.png b/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASInsetLayoutSpecSnapshotTests/testInsetsWithInfinityAndZeroInsetValue_inf-0-0-0@2x.png deleted file mode 100644 index 19f457874e..0000000000 Binary files a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASInsetLayoutSpecSnapshotTests/testInsetsWithInfinityAndZeroInsetValue_inf-0-0-0@2x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASInsetLayoutSpecSnapshotTests/testInsetsWithInfinityAndZeroInsetValue_inf-0-0-inf@2x.png b/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASInsetLayoutSpecSnapshotTests/testInsetsWithInfinityAndZeroInsetValue_inf-0-0-inf@2x.png deleted file mode 100644 index 81a07b2570..0000000000 Binary files a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASInsetLayoutSpecSnapshotTests/testInsetsWithInfinityAndZeroInsetValue_inf-0-0-inf@2x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASInsetLayoutSpecSnapshotTests/testInsetsWithInfinityAndZeroInsetValue_inf-0-inf-0@2x.png b/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASInsetLayoutSpecSnapshotTests/testInsetsWithInfinityAndZeroInsetValue_inf-0-inf-0@2x.png deleted file mode 100644 index 31422ea5d7..0000000000 Binary files a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASInsetLayoutSpecSnapshotTests/testInsetsWithInfinityAndZeroInsetValue_inf-0-inf-0@2x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASInsetLayoutSpecSnapshotTests/testInsetsWithInfinityAndZeroInsetValue_inf-0-inf-inf@2x.png b/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASInsetLayoutSpecSnapshotTests/testInsetsWithInfinityAndZeroInsetValue_inf-0-inf-inf@2x.png deleted file mode 100644 index 63cff77a6f..0000000000 Binary files a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASInsetLayoutSpecSnapshotTests/testInsetsWithInfinityAndZeroInsetValue_inf-0-inf-inf@2x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASInsetLayoutSpecSnapshotTests/testInsetsWithInfinityAndZeroInsetValue_inf-inf-0-0@2x.png b/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASInsetLayoutSpecSnapshotTests/testInsetsWithInfinityAndZeroInsetValue_inf-inf-0-0@2x.png deleted file mode 100644 index 1c55fe57ed..0000000000 Binary files a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASInsetLayoutSpecSnapshotTests/testInsetsWithInfinityAndZeroInsetValue_inf-inf-0-0@2x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASInsetLayoutSpecSnapshotTests/testInsetsWithInfinityAndZeroInsetValue_inf-inf-0-inf@2x.png b/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASInsetLayoutSpecSnapshotTests/testInsetsWithInfinityAndZeroInsetValue_inf-inf-0-inf@2x.png deleted file mode 100644 index 5d0bfee89e..0000000000 Binary files a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASInsetLayoutSpecSnapshotTests/testInsetsWithInfinityAndZeroInsetValue_inf-inf-0-inf@2x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASInsetLayoutSpecSnapshotTests/testInsetsWithInfinityAndZeroInsetValue_inf-inf-inf-0@2x.png b/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASInsetLayoutSpecSnapshotTests/testInsetsWithInfinityAndZeroInsetValue_inf-inf-inf-0@2x.png deleted file mode 100644 index 2b6430c5b5..0000000000 Binary files a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASInsetLayoutSpecSnapshotTests/testInsetsWithInfinityAndZeroInsetValue_inf-inf-inf-0@2x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASInsetLayoutSpecSnapshotTests/testInsetsWithInfinityAndZeroInsetValue_inf-inf-inf-inf@2x.png b/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASInsetLayoutSpecSnapshotTests/testInsetsWithInfinityAndZeroInsetValue_inf-inf-inf-inf@2x.png deleted file mode 100644 index 6da1b998c0..0000000000 Binary files a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASInsetLayoutSpecSnapshotTests/testInsetsWithInfinityAndZeroInsetValue_inf-inf-inf-inf@2x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASInsetLayoutSpecSnapshotTests/testInsetsWithVariableSize_10-10-10-10@2x.png b/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASInsetLayoutSpecSnapshotTests/testInsetsWithVariableSize_10-10-10-10@2x.png deleted file mode 100644 index c9255d62e8..0000000000 Binary files a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASInsetLayoutSpecSnapshotTests/testInsetsWithVariableSize_10-10-10-10@2x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASInsetLayoutSpecSnapshotTests/testInsetsWithVariableSize_10-10-10-inf@2x.png b/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASInsetLayoutSpecSnapshotTests/testInsetsWithVariableSize_10-10-10-inf@2x.png deleted file mode 100644 index db62499472..0000000000 Binary files a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASInsetLayoutSpecSnapshotTests/testInsetsWithVariableSize_10-10-10-inf@2x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASInsetLayoutSpecSnapshotTests/testInsetsWithVariableSize_10-10-inf-10@2x.png b/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASInsetLayoutSpecSnapshotTests/testInsetsWithVariableSize_10-10-inf-10@2x.png deleted file mode 100644 index 2b052c4e38..0000000000 Binary files a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASInsetLayoutSpecSnapshotTests/testInsetsWithVariableSize_10-10-inf-10@2x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASInsetLayoutSpecSnapshotTests/testInsetsWithVariableSize_10-10-inf-inf@2x.png b/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASInsetLayoutSpecSnapshotTests/testInsetsWithVariableSize_10-10-inf-inf@2x.png deleted file mode 100644 index d0b2cbd912..0000000000 Binary files a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASInsetLayoutSpecSnapshotTests/testInsetsWithVariableSize_10-10-inf-inf@2x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASInsetLayoutSpecSnapshotTests/testInsetsWithVariableSize_10-inf-10-10@2x.png b/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASInsetLayoutSpecSnapshotTests/testInsetsWithVariableSize_10-inf-10-10@2x.png deleted file mode 100644 index 69368ee671..0000000000 Binary files a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASInsetLayoutSpecSnapshotTests/testInsetsWithVariableSize_10-inf-10-10@2x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASInsetLayoutSpecSnapshotTests/testInsetsWithVariableSize_10-inf-10-inf@2x.png b/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASInsetLayoutSpecSnapshotTests/testInsetsWithVariableSize_10-inf-10-inf@2x.png deleted file mode 100644 index 55efcf5dba..0000000000 Binary files a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASInsetLayoutSpecSnapshotTests/testInsetsWithVariableSize_10-inf-10-inf@2x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASInsetLayoutSpecSnapshotTests/testInsetsWithVariableSize_10-inf-inf-10@2x.png b/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASInsetLayoutSpecSnapshotTests/testInsetsWithVariableSize_10-inf-inf-10@2x.png deleted file mode 100644 index 797e7ac410..0000000000 Binary files a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASInsetLayoutSpecSnapshotTests/testInsetsWithVariableSize_10-inf-inf-10@2x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASInsetLayoutSpecSnapshotTests/testInsetsWithVariableSize_10-inf-inf-inf@2x.png b/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASInsetLayoutSpecSnapshotTests/testInsetsWithVariableSize_10-inf-inf-inf@2x.png deleted file mode 100644 index 8c88149380..0000000000 Binary files a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASInsetLayoutSpecSnapshotTests/testInsetsWithVariableSize_10-inf-inf-inf@2x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASInsetLayoutSpecSnapshotTests/testInsetsWithVariableSize_inf-10-10-10@2x.png b/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASInsetLayoutSpecSnapshotTests/testInsetsWithVariableSize_inf-10-10-10@2x.png deleted file mode 100644 index 01411e3f2c..0000000000 Binary files a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASInsetLayoutSpecSnapshotTests/testInsetsWithVariableSize_inf-10-10-10@2x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASInsetLayoutSpecSnapshotTests/testInsetsWithVariableSize_inf-10-10-inf@2x.png b/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASInsetLayoutSpecSnapshotTests/testInsetsWithVariableSize_inf-10-10-inf@2x.png deleted file mode 100644 index e3efdda0a1..0000000000 Binary files a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASInsetLayoutSpecSnapshotTests/testInsetsWithVariableSize_inf-10-10-inf@2x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASInsetLayoutSpecSnapshotTests/testInsetsWithVariableSize_inf-10-inf-10@2x.png b/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASInsetLayoutSpecSnapshotTests/testInsetsWithVariableSize_inf-10-inf-10@2x.png deleted file mode 100644 index f0cd235628..0000000000 Binary files a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASInsetLayoutSpecSnapshotTests/testInsetsWithVariableSize_inf-10-inf-10@2x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASInsetLayoutSpecSnapshotTests/testInsetsWithVariableSize_inf-10-inf-inf@2x.png b/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASInsetLayoutSpecSnapshotTests/testInsetsWithVariableSize_inf-10-inf-inf@2x.png deleted file mode 100644 index 5653f7f6fc..0000000000 Binary files a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASInsetLayoutSpecSnapshotTests/testInsetsWithVariableSize_inf-10-inf-inf@2x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASInsetLayoutSpecSnapshotTests/testInsetsWithVariableSize_inf-inf-10-10@2x.png b/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASInsetLayoutSpecSnapshotTests/testInsetsWithVariableSize_inf-inf-10-10@2x.png deleted file mode 100644 index 5fa79d8a92..0000000000 Binary files a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASInsetLayoutSpecSnapshotTests/testInsetsWithVariableSize_inf-inf-10-10@2x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASInsetLayoutSpecSnapshotTests/testInsetsWithVariableSize_inf-inf-10-inf@2x.png b/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASInsetLayoutSpecSnapshotTests/testInsetsWithVariableSize_inf-inf-10-inf@2x.png deleted file mode 100644 index bece9190a6..0000000000 Binary files a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASInsetLayoutSpecSnapshotTests/testInsetsWithVariableSize_inf-inf-10-inf@2x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASInsetLayoutSpecSnapshotTests/testInsetsWithVariableSize_inf-inf-inf-10@2x.png b/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASInsetLayoutSpecSnapshotTests/testInsetsWithVariableSize_inf-inf-inf-10@2x.png deleted file mode 100644 index e8132c50b9..0000000000 Binary files a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASInsetLayoutSpecSnapshotTests/testInsetsWithVariableSize_inf-inf-inf-10@2x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASInsetLayoutSpecSnapshotTests/testInsetsWithVariableSize_inf-inf-inf-inf@2x.png b/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASInsetLayoutSpecSnapshotTests/testInsetsWithVariableSize_inf-inf-inf-inf@2x.png deleted file mode 100644 index 6da1b998c0..0000000000 Binary files a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASInsetLayoutSpecSnapshotTests/testInsetsWithVariableSize_inf-inf-inf-inf@2x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASOverlayLayoutSpecSnapshotTests/testOverlay@2x.png b/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASOverlayLayoutSpecSnapshotTests/testOverlay@2x.png deleted file mode 100644 index 198e5394cc..0000000000 Binary files a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASOverlayLayoutSpecSnapshotTests/testOverlay@2x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASRatioLayoutSpecSnapshotTests/testRatioLayout_DoubleRatio@2x.png b/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASRatioLayoutSpecSnapshotTests/testRatioLayout_DoubleRatio@2x.png deleted file mode 100644 index a10ef96975..0000000000 Binary files a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASRatioLayoutSpecSnapshotTests/testRatioLayout_DoubleRatio@2x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASRatioLayoutSpecSnapshotTests/testRatioLayout_HalfRatio@2x.png b/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASRatioLayoutSpecSnapshotTests/testRatioLayout_HalfRatio@2x.png deleted file mode 100644 index 0cbc831393..0000000000 Binary files a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASRatioLayoutSpecSnapshotTests/testRatioLayout_HalfRatio@2x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASRatioLayoutSpecSnapshotTests/testRatioLayout_SevenTimesRatio@2x.png b/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASRatioLayoutSpecSnapshotTests/testRatioLayout_SevenTimesRatio@2x.png deleted file mode 100644 index 48be1e63a7..0000000000 Binary files a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASRatioLayoutSpecSnapshotTests/testRatioLayout_SevenTimesRatio@2x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASRatioLayoutSpecSnapshotTests/testRatioLayout_TenTimesRatioWithItemTooBig@2x.png b/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASRatioLayoutSpecSnapshotTests/testRatioLayout_TenTimesRatioWithItemTooBig@2x.png deleted file mode 100644 index ce593f7ad7..0000000000 Binary files a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASRatioLayoutSpecSnapshotTests/testRatioLayout_TenTimesRatioWithItemTooBig@2x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASRelativeLayoutSpecSnapshotTests/testMinimumSizeRangeIsGivenToChildWhenNotPositioning@2x.png b/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASRelativeLayoutSpecSnapshotTests/testMinimumSizeRangeIsGivenToChildWhenNotPositioning@2x.png deleted file mode 100644 index 02717f8fdb..0000000000 Binary files a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASRelativeLayoutSpecSnapshotTests/testMinimumSizeRangeIsGivenToChildWhenNotPositioning@2x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASRelativeLayoutSpecSnapshotTests/testWithOptions@2x.png b/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASRelativeLayoutSpecSnapshotTests/testWithOptions@2x.png deleted file mode 100644 index 1192d72e8d..0000000000 Binary files a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASRelativeLayoutSpecSnapshotTests/testWithOptions@2x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASRelativeLayoutSpecSnapshotTests/testWithOptions_CenterX@2x.png b/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASRelativeLayoutSpecSnapshotTests/testWithOptions_CenterX@2x.png deleted file mode 100644 index e2c7e8266b..0000000000 Binary files a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASRelativeLayoutSpecSnapshotTests/testWithOptions_CenterX@2x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASRelativeLayoutSpecSnapshotTests/testWithOptions_CenterXCenterY@2x.png b/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASRelativeLayoutSpecSnapshotTests/testWithOptions_CenterXCenterY@2x.png deleted file mode 100644 index 311ef9ed32..0000000000 Binary files a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASRelativeLayoutSpecSnapshotTests/testWithOptions_CenterXCenterY@2x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASRelativeLayoutSpecSnapshotTests/testWithOptions_CenterXEndY@2x.png b/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASRelativeLayoutSpecSnapshotTests/testWithOptions_CenterXEndY@2x.png deleted file mode 100644 index 385fc3e817..0000000000 Binary files a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASRelativeLayoutSpecSnapshotTests/testWithOptions_CenterXEndY@2x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASRelativeLayoutSpecSnapshotTests/testWithOptions_CenterY@2x.png b/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASRelativeLayoutSpecSnapshotTests/testWithOptions_CenterY@2x.png deleted file mode 100644 index 94db1b131f..0000000000 Binary files a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASRelativeLayoutSpecSnapshotTests/testWithOptions_CenterY@2x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASRelativeLayoutSpecSnapshotTests/testWithOptions_EndX@2x.png b/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASRelativeLayoutSpecSnapshotTests/testWithOptions_EndX@2x.png deleted file mode 100644 index e464619571..0000000000 Binary files a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASRelativeLayoutSpecSnapshotTests/testWithOptions_EndX@2x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASRelativeLayoutSpecSnapshotTests/testWithOptions_EndXCenterY@2x.png b/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASRelativeLayoutSpecSnapshotTests/testWithOptions_EndXCenterY@2x.png deleted file mode 100644 index 04ee2d6115..0000000000 Binary files a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASRelativeLayoutSpecSnapshotTests/testWithOptions_EndXCenterY@2x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASRelativeLayoutSpecSnapshotTests/testWithOptions_EndXEndY@2x.png b/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASRelativeLayoutSpecSnapshotTests/testWithOptions_EndXEndY@2x.png deleted file mode 100644 index 3d9d16b5d2..0000000000 Binary files a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASRelativeLayoutSpecSnapshotTests/testWithOptions_EndXEndY@2x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASRelativeLayoutSpecSnapshotTests/testWithOptions_EndY@2x.png b/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASRelativeLayoutSpecSnapshotTests/testWithOptions_EndY@2x.png deleted file mode 100644 index 8ba7270db2..0000000000 Binary files a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASRelativeLayoutSpecSnapshotTests/testWithOptions_EndY@2x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASRelativeLayoutSpecSnapshotTests/testWithSizingOptions@2x.png b/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASRelativeLayoutSpecSnapshotTests/testWithSizingOptions@2x.png deleted file mode 100644 index 1192d72e8d..0000000000 Binary files a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASRelativeLayoutSpecSnapshotTests/testWithSizingOptions@2x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASRelativeLayoutSpecSnapshotTests/testWithSizingOptions_SizingMinimumHeight@2x.png b/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASRelativeLayoutSpecSnapshotTests/testWithSizingOptions_SizingMinimumHeight@2x.png deleted file mode 100644 index 467bb6fa8c..0000000000 Binary files a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASRelativeLayoutSpecSnapshotTests/testWithSizingOptions_SizingMinimumHeight@2x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASRelativeLayoutSpecSnapshotTests/testWithSizingOptions_SizingMinimumWidth@2x.png b/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASRelativeLayoutSpecSnapshotTests/testWithSizingOptions_SizingMinimumWidth@2x.png deleted file mode 100644 index 8e9c66caa1..0000000000 Binary files a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASRelativeLayoutSpecSnapshotTests/testWithSizingOptions_SizingMinimumWidth@2x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASRelativeLayoutSpecSnapshotTests/testWithSizingOptions_SizingMinimumWidthSizingMinimumHeight@2x.png b/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASRelativeLayoutSpecSnapshotTests/testWithSizingOptions_SizingMinimumWidthSizingMinimumHeight@2x.png deleted file mode 100644 index ddafb41db7..0000000000 Binary files a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASRelativeLayoutSpecSnapshotTests/testWithSizingOptions_SizingMinimumWidthSizingMinimumHeight@2x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASStackLayoutSpecSnapshotTests/testAlignCenterWithFlexedMainDimension@2x.png b/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASStackLayoutSpecSnapshotTests/testAlignCenterWithFlexedMainDimension@2x.png deleted file mode 100644 index ea22b081a8..0000000000 Binary files a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASStackLayoutSpecSnapshotTests/testAlignCenterWithFlexedMainDimension@2x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASStackLayoutSpecSnapshotTests/testAlignCenterWithIndefiniteCrossDimension@2x.png b/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASStackLayoutSpecSnapshotTests/testAlignCenterWithIndefiniteCrossDimension@2x.png deleted file mode 100644 index 00b3bfb369..0000000000 Binary files a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASStackLayoutSpecSnapshotTests/testAlignCenterWithIndefiniteCrossDimension@2x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASStackLayoutSpecSnapshotTests/testAlignContentAndLineSpacingOverflow_alignContentCenter@2x.png b/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASStackLayoutSpecSnapshotTests/testAlignContentAndLineSpacingOverflow_alignContentCenter@2x.png deleted file mode 100644 index 188cd6007e..0000000000 Binary files a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASStackLayoutSpecSnapshotTests/testAlignContentAndLineSpacingOverflow_alignContentCenter@2x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASStackLayoutSpecSnapshotTests/testAlignContentAndLineSpacingOverflow_alignContentEnd@2x.png b/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASStackLayoutSpecSnapshotTests/testAlignContentAndLineSpacingOverflow_alignContentEnd@2x.png deleted file mode 100644 index 18f614cf47..0000000000 Binary files a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASStackLayoutSpecSnapshotTests/testAlignContentAndLineSpacingOverflow_alignContentEnd@2x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASStackLayoutSpecSnapshotTests/testAlignContentAndLineSpacingOverflow_alignContentSpaceAround@2x.png b/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASStackLayoutSpecSnapshotTests/testAlignContentAndLineSpacingOverflow_alignContentSpaceAround@2x.png deleted file mode 100644 index 188cd6007e..0000000000 Binary files a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASStackLayoutSpecSnapshotTests/testAlignContentAndLineSpacingOverflow_alignContentSpaceAround@2x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASStackLayoutSpecSnapshotTests/testAlignContentAndLineSpacingOverflow_alignContentSpaceBetween@2x.png b/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASStackLayoutSpecSnapshotTests/testAlignContentAndLineSpacingOverflow_alignContentSpaceBetween@2x.png deleted file mode 100644 index 20d303b586..0000000000 Binary files a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASStackLayoutSpecSnapshotTests/testAlignContentAndLineSpacingOverflow_alignContentSpaceBetween@2x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASStackLayoutSpecSnapshotTests/testAlignContentAndLineSpacingOverflow_alignContentStart@2x.png b/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASStackLayoutSpecSnapshotTests/testAlignContentAndLineSpacingOverflow_alignContentStart@2x.png deleted file mode 100644 index 20d303b586..0000000000 Binary files a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASStackLayoutSpecSnapshotTests/testAlignContentAndLineSpacingOverflow_alignContentStart@2x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASStackLayoutSpecSnapshotTests/testAlignContentAndLineSpacingUnderflow_alignContentCenter@2x.png b/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASStackLayoutSpecSnapshotTests/testAlignContentAndLineSpacingUnderflow_alignContentCenter@2x.png deleted file mode 100644 index 27b26426db..0000000000 Binary files a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASStackLayoutSpecSnapshotTests/testAlignContentAndLineSpacingUnderflow_alignContentCenter@2x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASStackLayoutSpecSnapshotTests/testAlignContentAndLineSpacingUnderflow_alignContentEnd@2x.png b/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASStackLayoutSpecSnapshotTests/testAlignContentAndLineSpacingUnderflow_alignContentEnd@2x.png deleted file mode 100644 index 740100fce2..0000000000 Binary files a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASStackLayoutSpecSnapshotTests/testAlignContentAndLineSpacingUnderflow_alignContentEnd@2x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASStackLayoutSpecSnapshotTests/testAlignContentAndLineSpacingUnderflow_alignContentSpaceAround@2x.png b/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASStackLayoutSpecSnapshotTests/testAlignContentAndLineSpacingUnderflow_alignContentSpaceAround@2x.png deleted file mode 100644 index 40bae9ef39..0000000000 Binary files a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASStackLayoutSpecSnapshotTests/testAlignContentAndLineSpacingUnderflow_alignContentSpaceAround@2x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASStackLayoutSpecSnapshotTests/testAlignContentAndLineSpacingUnderflow_alignContentSpaceBetween@2x.png b/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASStackLayoutSpecSnapshotTests/testAlignContentAndLineSpacingUnderflow_alignContentSpaceBetween@2x.png deleted file mode 100644 index a60f63f145..0000000000 Binary files a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASStackLayoutSpecSnapshotTests/testAlignContentAndLineSpacingUnderflow_alignContentSpaceBetween@2x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASStackLayoutSpecSnapshotTests/testAlignContentAndLineSpacingUnderflow_alignContentStart@2x.png b/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASStackLayoutSpecSnapshotTests/testAlignContentAndLineSpacingUnderflow_alignContentStart@2x.png deleted file mode 100644 index a89a941bf1..0000000000 Binary files a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASStackLayoutSpecSnapshotTests/testAlignContentAndLineSpacingUnderflow_alignContentStart@2x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASStackLayoutSpecSnapshotTests/testAlignContentAndLineSpacingUnderflow_alignContentStretch@2x.png b/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASStackLayoutSpecSnapshotTests/testAlignContentAndLineSpacingUnderflow_alignContentStretch@2x.png deleted file mode 100644 index 461c786922..0000000000 Binary files a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASStackLayoutSpecSnapshotTests/testAlignContentAndLineSpacingUnderflow_alignContentStretch@2x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASStackLayoutSpecSnapshotTests/testAlignContentOverflow_alignContentCenter@2x.png b/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASStackLayoutSpecSnapshotTests/testAlignContentOverflow_alignContentCenter@2x.png deleted file mode 100644 index 032e9fac3a..0000000000 Binary files a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASStackLayoutSpecSnapshotTests/testAlignContentOverflow_alignContentCenter@2x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASStackLayoutSpecSnapshotTests/testAlignContentOverflow_alignContentEnd@2x.png b/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASStackLayoutSpecSnapshotTests/testAlignContentOverflow_alignContentEnd@2x.png deleted file mode 100644 index 6d08d18e4a..0000000000 Binary files a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASStackLayoutSpecSnapshotTests/testAlignContentOverflow_alignContentEnd@2x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASStackLayoutSpecSnapshotTests/testAlignContentOverflow_alignContentSpaceAround@2x.png b/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASStackLayoutSpecSnapshotTests/testAlignContentOverflow_alignContentSpaceAround@2x.png deleted file mode 100644 index 032e9fac3a..0000000000 Binary files a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASStackLayoutSpecSnapshotTests/testAlignContentOverflow_alignContentSpaceAround@2x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASStackLayoutSpecSnapshotTests/testAlignContentOverflow_alignContentSpaceBetween@2x.png b/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASStackLayoutSpecSnapshotTests/testAlignContentOverflow_alignContentSpaceBetween@2x.png deleted file mode 100644 index 4df2a81184..0000000000 Binary files a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASStackLayoutSpecSnapshotTests/testAlignContentOverflow_alignContentSpaceBetween@2x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASStackLayoutSpecSnapshotTests/testAlignContentOverflow_alignContentStart@2x.png b/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASStackLayoutSpecSnapshotTests/testAlignContentOverflow_alignContentStart@2x.png deleted file mode 100644 index 4df2a81184..0000000000 Binary files a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASStackLayoutSpecSnapshotTests/testAlignContentOverflow_alignContentStart@2x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASStackLayoutSpecSnapshotTests/testAlignContentStretchAndOtherAlignments@2x.png b/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASStackLayoutSpecSnapshotTests/testAlignContentStretchAndOtherAlignments@2x.png deleted file mode 100644 index 51d060062c..0000000000 Binary files a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASStackLayoutSpecSnapshotTests/testAlignContentStretchAndOtherAlignments@2x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASStackLayoutSpecSnapshotTests/testAlignContentUnderflow_alignContentCenter@2x.png b/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASStackLayoutSpecSnapshotTests/testAlignContentUnderflow_alignContentCenter@2x.png deleted file mode 100644 index fea7203a26..0000000000 Binary files a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASStackLayoutSpecSnapshotTests/testAlignContentUnderflow_alignContentCenter@2x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASStackLayoutSpecSnapshotTests/testAlignContentUnderflow_alignContentEnd@2x.png b/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASStackLayoutSpecSnapshotTests/testAlignContentUnderflow_alignContentEnd@2x.png deleted file mode 100644 index 9e0bdad429..0000000000 Binary files a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASStackLayoutSpecSnapshotTests/testAlignContentUnderflow_alignContentEnd@2x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASStackLayoutSpecSnapshotTests/testAlignContentUnderflow_alignContentSpaceAround@2x.png b/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASStackLayoutSpecSnapshotTests/testAlignContentUnderflow_alignContentSpaceAround@2x.png deleted file mode 100644 index bb608622fd..0000000000 Binary files a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASStackLayoutSpecSnapshotTests/testAlignContentUnderflow_alignContentSpaceAround@2x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASStackLayoutSpecSnapshotTests/testAlignContentUnderflow_alignContentSpaceBetween@2x.png b/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASStackLayoutSpecSnapshotTests/testAlignContentUnderflow_alignContentSpaceBetween@2x.png deleted file mode 100644 index 17b8dbfbc4..0000000000 Binary files a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASStackLayoutSpecSnapshotTests/testAlignContentUnderflow_alignContentSpaceBetween@2x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASStackLayoutSpecSnapshotTests/testAlignContentUnderflow_alignContentStart@2x.png b/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASStackLayoutSpecSnapshotTests/testAlignContentUnderflow_alignContentStart@2x.png deleted file mode 100644 index ab969dd638..0000000000 Binary files a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASStackLayoutSpecSnapshotTests/testAlignContentUnderflow_alignContentStart@2x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASStackLayoutSpecSnapshotTests/testAlignContentUnderflow_alignContentStretch@2x.png b/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASStackLayoutSpecSnapshotTests/testAlignContentUnderflow_alignContentStretch@2x.png deleted file mode 100644 index 584aca77db..0000000000 Binary files a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASStackLayoutSpecSnapshotTests/testAlignContentUnderflow_alignContentStretch@2x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASStackLayoutSpecSnapshotTests/testAlignContentWithUnconstrainedCrossSize@2x.png b/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASStackLayoutSpecSnapshotTests/testAlignContentWithUnconstrainedCrossSize@2x.png deleted file mode 100644 index 12936781c0..0000000000 Binary files a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASStackLayoutSpecSnapshotTests/testAlignContentWithUnconstrainedCrossSize@2x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASStackLayoutSpecSnapshotTests/testAlignedCenter@2x.png b/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASStackLayoutSpecSnapshotTests/testAlignedCenter@2x.png deleted file mode 100644 index 46b73e6a6e..0000000000 Binary files a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASStackLayoutSpecSnapshotTests/testAlignedCenter@2x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASStackLayoutSpecSnapshotTests/testAlignedEnd@2x.png b/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASStackLayoutSpecSnapshotTests/testAlignedEnd@2x.png deleted file mode 100644 index d2131dd83f..0000000000 Binary files a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASStackLayoutSpecSnapshotTests/testAlignedEnd@2x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASStackLayoutSpecSnapshotTests/testAlignedStart@2x.png b/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASStackLayoutSpecSnapshotTests/testAlignedStart@2x.png deleted file mode 100644 index 5f9dc090e0..0000000000 Binary files a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASStackLayoutSpecSnapshotTests/testAlignedStart@2x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASStackLayoutSpecSnapshotTests/testAlignedStretchNoChildExceedsMin@2x.png b/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASStackLayoutSpecSnapshotTests/testAlignedStretchNoChildExceedsMin@2x.png deleted file mode 100644 index 537b1f6f13..0000000000 Binary files a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASStackLayoutSpecSnapshotTests/testAlignedStretchNoChildExceedsMin@2x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASStackLayoutSpecSnapshotTests/testAlignedStretchOneChildExceedsMin@2x.png b/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASStackLayoutSpecSnapshotTests/testAlignedStretchOneChildExceedsMin@2x.png deleted file mode 100644 index 8fbd29f3b5..0000000000 Binary files a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASStackLayoutSpecSnapshotTests/testAlignedStretchOneChildExceedsMin@2x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASStackLayoutSpecSnapshotTests/testBaselineAlignmentWithSpaceBetween@2x.png b/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASStackLayoutSpecSnapshotTests/testBaselineAlignmentWithSpaceBetween@2x.png deleted file mode 100644 index 5174b92e27..0000000000 Binary files a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASStackLayoutSpecSnapshotTests/testBaselineAlignmentWithSpaceBetween@2x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASStackLayoutSpecSnapshotTests/testBaselineAlignmentWithStretchedItem@2x.png b/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASStackLayoutSpecSnapshotTests/testBaselineAlignmentWithStretchedItem@2x.png deleted file mode 100644 index f3e20dbe00..0000000000 Binary files a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASStackLayoutSpecSnapshotTests/testBaselineAlignmentWithStretchedItem@2x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASStackLayoutSpecSnapshotTests/testBaselineAlignment_baselineFirst@2x.png b/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASStackLayoutSpecSnapshotTests/testBaselineAlignment_baselineFirst@2x.png deleted file mode 100644 index e45ab35c68..0000000000 Binary files a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASStackLayoutSpecSnapshotTests/testBaselineAlignment_baselineFirst@2x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASStackLayoutSpecSnapshotTests/testBaselineAlignment_baselineLast@2x.png b/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASStackLayoutSpecSnapshotTests/testBaselineAlignment_baselineLast@2x.png deleted file mode 100644 index 6cd4909902..0000000000 Binary files a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASStackLayoutSpecSnapshotTests/testBaselineAlignment_baselineLast@2x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASStackLayoutSpecSnapshotTests/testChildSpacing_spacingAfter@2x.png b/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASStackLayoutSpecSnapshotTests/testChildSpacing_spacingAfter@2x.png deleted file mode 100644 index f253af0a20..0000000000 Binary files a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASStackLayoutSpecSnapshotTests/testChildSpacing_spacingAfter@2x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASStackLayoutSpecSnapshotTests/testChildSpacing_spacingBalancedOut@2x.png b/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASStackLayoutSpecSnapshotTests/testChildSpacing_spacingBalancedOut@2x.png deleted file mode 100644 index 60ffcd81bc..0000000000 Binary files a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASStackLayoutSpecSnapshotTests/testChildSpacing_spacingBalancedOut@2x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASStackLayoutSpecSnapshotTests/testChildSpacing_spacingBefore@2x.png b/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASStackLayoutSpecSnapshotTests/testChildSpacing_spacingBefore@2x.png deleted file mode 100644 index e74a5b5a28..0000000000 Binary files a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASStackLayoutSpecSnapshotTests/testChildSpacing_spacingBefore@2x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASStackLayoutSpecSnapshotTests/testChildThatChangesCrossSizeWhenMainSizeIsFlexed@2x.png b/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASStackLayoutSpecSnapshotTests/testChildThatChangesCrossSizeWhenMainSizeIsFlexed@2x.png deleted file mode 100644 index fcb8d934c0..0000000000 Binary files a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASStackLayoutSpecSnapshotTests/testChildThatChangesCrossSizeWhenMainSizeIsFlexed@2x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASStackLayoutSpecSnapshotTests/testCrossAxisSizeBehaviors_fixedHeight@2x.png b/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASStackLayoutSpecSnapshotTests/testCrossAxisSizeBehaviors_fixedHeight@2x.png deleted file mode 100644 index 435a4cf60e..0000000000 Binary files a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASStackLayoutSpecSnapshotTests/testCrossAxisSizeBehaviors_fixedHeight@2x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASStackLayoutSpecSnapshotTests/testCrossAxisSizeBehaviors_variableHeight@2x.png b/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASStackLayoutSpecSnapshotTests/testCrossAxisSizeBehaviors_variableHeight@2x.png deleted file mode 100644 index 718b60304f..0000000000 Binary files a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASStackLayoutSpecSnapshotTests/testCrossAxisSizeBehaviors_variableHeight@2x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASStackLayoutSpecSnapshotTests/testCrossAxisStretchingOccursAfterStackAxisFlexing@2x.png b/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASStackLayoutSpecSnapshotTests/testCrossAxisStretchingOccursAfterStackAxisFlexing@2x.png deleted file mode 100644 index cd7489cb20..0000000000 Binary files a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASStackLayoutSpecSnapshotTests/testCrossAxisStretchingOccursAfterStackAxisFlexing@2x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASStackLayoutSpecSnapshotTests/testEmptyStack@2x.png b/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASStackLayoutSpecSnapshotTests/testEmptyStack@2x.png deleted file mode 100644 index 94dc9a5d2b..0000000000 Binary files a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASStackLayoutSpecSnapshotTests/testEmptyStack@2x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASStackLayoutSpecSnapshotTests/testFixedFlexBasisAppliedWhenFlexingItems_overflow@2x.png b/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASStackLayoutSpecSnapshotTests/testFixedFlexBasisAppliedWhenFlexingItems_overflow@2x.png deleted file mode 100644 index d224b220fd..0000000000 Binary files a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASStackLayoutSpecSnapshotTests/testFixedFlexBasisAppliedWhenFlexingItems_overflow@2x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASStackLayoutSpecSnapshotTests/testFixedFlexBasisAppliedWhenFlexingItems_underflow@2x.png b/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASStackLayoutSpecSnapshotTests/testFixedFlexBasisAppliedWhenFlexingItems_underflow@2x.png deleted file mode 100644 index df55d754f1..0000000000 Binary files a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASStackLayoutSpecSnapshotTests/testFixedFlexBasisAppliedWhenFlexingItems_underflow@2x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASStackLayoutSpecSnapshotTests/testFixedFlexBasisOverridesIntrinsicSizeForNonFlexingChildren@2x.png b/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASStackLayoutSpecSnapshotTests/testFixedFlexBasisOverridesIntrinsicSizeForNonFlexingChildren@2x.png deleted file mode 100644 index 64048bbd05..0000000000 Binary files a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASStackLayoutSpecSnapshotTests/testFixedFlexBasisOverridesIntrinsicSizeForNonFlexingChildren@2x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASStackLayoutSpecSnapshotTests/testFlexWithUnequalIntrinsicSizes_overflow@2x.png b/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASStackLayoutSpecSnapshotTests/testFlexWithUnequalIntrinsicSizes_overflow@2x.png deleted file mode 100644 index eebc4bb9e4..0000000000 Binary files a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASStackLayoutSpecSnapshotTests/testFlexWithUnequalIntrinsicSizes_overflow@2x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASStackLayoutSpecSnapshotTests/testFlexWithUnequalIntrinsicSizes_underflow@2x.png b/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASStackLayoutSpecSnapshotTests/testFlexWithUnequalIntrinsicSizes_underflow@2x.png deleted file mode 100644 index 54929c089c..0000000000 Binary files a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASStackLayoutSpecSnapshotTests/testFlexWithUnequalIntrinsicSizes_underflow@2x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASStackLayoutSpecSnapshotTests/testFlexWrapWithItemSpacings@2x.png b/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASStackLayoutSpecSnapshotTests/testFlexWrapWithItemSpacings@2x.png deleted file mode 100644 index 31df2f6199..0000000000 Binary files a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASStackLayoutSpecSnapshotTests/testFlexWrapWithItemSpacings@2x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASStackLayoutSpecSnapshotTests/testFlexWrapWithItemSpacingsBeingResetOnNewLines@2x.png b/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASStackLayoutSpecSnapshotTests/testFlexWrapWithItemSpacingsBeingResetOnNewLines@2x.png deleted file mode 100644 index 1824a25085..0000000000 Binary files a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASStackLayoutSpecSnapshotTests/testFlexWrapWithItemSpacingsBeingResetOnNewLines@2x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASStackLayoutSpecSnapshotTests/testFractionalFlexBasisResolvesAgainstParentSize@2x.png b/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASStackLayoutSpecSnapshotTests/testFractionalFlexBasisResolvesAgainstParentSize@2x.png deleted file mode 100644 index eba4df4df3..0000000000 Binary files a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASStackLayoutSpecSnapshotTests/testFractionalFlexBasisResolvesAgainstParentSize@2x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASStackLayoutSpecSnapshotTests/testHorizontalAndVerticalAlignments_horizontalBottomRight@2x.png b/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASStackLayoutSpecSnapshotTests/testHorizontalAndVerticalAlignments_horizontalBottomRight@2x.png deleted file mode 100644 index 489764fe6e..0000000000 Binary files a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASStackLayoutSpecSnapshotTests/testHorizontalAndVerticalAlignments_horizontalBottomRight@2x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASStackLayoutSpecSnapshotTests/testHorizontalAndVerticalAlignments_horizontalCenter@2x.png b/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASStackLayoutSpecSnapshotTests/testHorizontalAndVerticalAlignments_horizontalCenter@2x.png deleted file mode 100644 index eb0ea8c3da..0000000000 Binary files a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASStackLayoutSpecSnapshotTests/testHorizontalAndVerticalAlignments_horizontalCenter@2x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASStackLayoutSpecSnapshotTests/testHorizontalAndVerticalAlignments_horizontalTopLeft@2x.png b/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASStackLayoutSpecSnapshotTests/testHorizontalAndVerticalAlignments_horizontalTopLeft@2x.png deleted file mode 100644 index 8864402768..0000000000 Binary files a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASStackLayoutSpecSnapshotTests/testHorizontalAndVerticalAlignments_horizontalTopLeft@2x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASStackLayoutSpecSnapshotTests/testHorizontalAndVerticalAlignments_verticalBottomRight@2x.png b/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASStackLayoutSpecSnapshotTests/testHorizontalAndVerticalAlignments_verticalBottomRight@2x.png deleted file mode 100644 index 4e46d0f9dd..0000000000 Binary files a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASStackLayoutSpecSnapshotTests/testHorizontalAndVerticalAlignments_verticalBottomRight@2x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASStackLayoutSpecSnapshotTests/testHorizontalAndVerticalAlignments_verticalCenter@2x.png b/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASStackLayoutSpecSnapshotTests/testHorizontalAndVerticalAlignments_verticalCenter@2x.png deleted file mode 100644 index a0b412886f..0000000000 Binary files a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASStackLayoutSpecSnapshotTests/testHorizontalAndVerticalAlignments_verticalCenter@2x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASStackLayoutSpecSnapshotTests/testHorizontalAndVerticalAlignments_verticalTopLeft@2x.png b/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASStackLayoutSpecSnapshotTests/testHorizontalAndVerticalAlignments_verticalTopLeft@2x.png deleted file mode 100644 index 8277b97c00..0000000000 Binary files a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASStackLayoutSpecSnapshotTests/testHorizontalAndVerticalAlignments_verticalTopLeft@2x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASStackLayoutSpecSnapshotTests/testJustifiedCenterWithChildSpacing_variableHeight@2x.png b/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASStackLayoutSpecSnapshotTests/testJustifiedCenterWithChildSpacing_variableHeight@2x.png deleted file mode 100644 index 46dab172c1..0000000000 Binary files a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASStackLayoutSpecSnapshotTests/testJustifiedCenterWithChildSpacing_variableHeight@2x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASStackLayoutSpecSnapshotTests/testJustifiedSpaceAroundWithOneChild@2x.png b/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASStackLayoutSpecSnapshotTests/testJustifiedSpaceAroundWithOneChild@2x.png deleted file mode 100644 index da37b62262..0000000000 Binary files a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASStackLayoutSpecSnapshotTests/testJustifiedSpaceAroundWithOneChild@2x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASStackLayoutSpecSnapshotTests/testJustifiedSpaceAroundWithRemainingSpace@2x.png b/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASStackLayoutSpecSnapshotTests/testJustifiedSpaceAroundWithRemainingSpace@2x.png deleted file mode 100644 index 6de6f28efc..0000000000 Binary files a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASStackLayoutSpecSnapshotTests/testJustifiedSpaceAroundWithRemainingSpace@2x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASStackLayoutSpecSnapshotTests/testJustifiedSpaceBetweenWithOneChild@2x.png b/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASStackLayoutSpecSnapshotTests/testJustifiedSpaceBetweenWithOneChild@2x.png deleted file mode 100644 index 88d0aaf203..0000000000 Binary files a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASStackLayoutSpecSnapshotTests/testJustifiedSpaceBetweenWithOneChild@2x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASStackLayoutSpecSnapshotTests/testJustifiedSpaceBetweenWithRemainingSpace@2x.png b/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASStackLayoutSpecSnapshotTests/testJustifiedSpaceBetweenWithRemainingSpace@2x.png deleted file mode 100644 index 8ee77c8de5..0000000000 Binary files a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASStackLayoutSpecSnapshotTests/testJustifiedSpaceBetweenWithRemainingSpace@2x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASStackLayoutSpecSnapshotTests/testNegativeViolationAndFlexFactorIsNotRespected@2x.png b/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASStackLayoutSpecSnapshotTests/testNegativeViolationAndFlexFactorIsNotRespected@2x.png deleted file mode 100644 index d5cdcfb602..0000000000 Binary files a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASStackLayoutSpecSnapshotTests/testNegativeViolationAndFlexFactorIsNotRespected@2x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASStackLayoutSpecSnapshotTests/testNegativeViolationIsDistributedBasedOnSize@2x.png b/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASStackLayoutSpecSnapshotTests/testNegativeViolationIsDistributedBasedOnSize@2x.png deleted file mode 100644 index ebea9c1eaa..0000000000 Binary files a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASStackLayoutSpecSnapshotTests/testNegativeViolationIsDistributedBasedOnSize@2x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASStackLayoutSpecSnapshotTests/testNegativeViolationIsDistributedBasedOnSizeAmongMixedChildrenChildren@2x.png b/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASStackLayoutSpecSnapshotTests/testNegativeViolationIsDistributedBasedOnSizeAmongMixedChildrenChildren@2x.png deleted file mode 100644 index 5318559608..0000000000 Binary files a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASStackLayoutSpecSnapshotTests/testNegativeViolationIsDistributedBasedOnSizeAmongMixedChildrenChildren@2x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASStackLayoutSpecSnapshotTests/testNegativeViolationIsDistributedBasedOnSizeAmongMixedChildrenWithArbitraryFloats@2x.png b/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASStackLayoutSpecSnapshotTests/testNegativeViolationIsDistributedBasedOnSizeAmongMixedChildrenWithArbitraryFloats@2x.png deleted file mode 100644 index 5318559608..0000000000 Binary files a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASStackLayoutSpecSnapshotTests/testNegativeViolationIsDistributedBasedOnSizeAmongMixedChildrenWithArbitraryFloats@2x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASStackLayoutSpecSnapshotTests/testNegativeViolationIsDistributedBasedOnSizeAndFlexFactor@2x.png b/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASStackLayoutSpecSnapshotTests/testNegativeViolationIsDistributedBasedOnSizeAndFlexFactor@2x.png deleted file mode 100644 index 4dda03f985..0000000000 Binary files a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASStackLayoutSpecSnapshotTests/testNegativeViolationIsDistributedBasedOnSizeAndFlexFactor@2x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASStackLayoutSpecSnapshotTests/testNegativeViolationIsDistributedBasedOnSizeAndFlexFactorAmongMixedChildren@2x.png b/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASStackLayoutSpecSnapshotTests/testNegativeViolationIsDistributedBasedOnSizeAndFlexFactorAmongMixedChildren@2x.png deleted file mode 100644 index 8792b39b8f..0000000000 Binary files a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASStackLayoutSpecSnapshotTests/testNegativeViolationIsDistributedBasedOnSizeAndFlexFactorAmongMixedChildren@2x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASStackLayoutSpecSnapshotTests/testNegativeViolationIsDistributedBasedOnSizeAndFlexFactorAmongMixedChildrenArbitraryFloats@2x.png b/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASStackLayoutSpecSnapshotTests/testNegativeViolationIsDistributedBasedOnSizeAndFlexFactorAmongMixedChildrenArbitraryFloats@2x.png deleted file mode 100644 index 8792b39b8f..0000000000 Binary files a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASStackLayoutSpecSnapshotTests/testNegativeViolationIsDistributedBasedOnSizeAndFlexFactorAmongMixedChildrenArbitraryFloats@2x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASStackLayoutSpecSnapshotTests/testNegativeViolationIsDistributedBasedOnSizeAndFlexFactorDoesNotShrinkToZero@2x.png b/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASStackLayoutSpecSnapshotTests/testNegativeViolationIsDistributedBasedOnSizeAndFlexFactorDoesNotShrinkToZero@2x.png deleted file mode 100644 index 405fa880d3..0000000000 Binary files a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASStackLayoutSpecSnapshotTests/testNegativeViolationIsDistributedBasedOnSizeAndFlexFactorDoesNotShrinkToZero@2x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASStackLayoutSpecSnapshotTests/testNegativeViolationIsDistributedBasedOnSizeAndFlexFactorDoesNotShrinkToZeroWithArbitraryFloats@2x.png b/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASStackLayoutSpecSnapshotTests/testNegativeViolationIsDistributedBasedOnSizeAndFlexFactorDoesNotShrinkToZeroWithArbitraryFloats@2x.png deleted file mode 100644 index 405fa880d3..0000000000 Binary files a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASStackLayoutSpecSnapshotTests/testNegativeViolationIsDistributedBasedOnSizeAndFlexFactorDoesNotShrinkToZeroWithArbitraryFloats@2x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASStackLayoutSpecSnapshotTests/testNegativeViolationIsDistributedBasedOnSizeAndFlexFactorWithArbitraryFloats@2x.png b/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASStackLayoutSpecSnapshotTests/testNegativeViolationIsDistributedBasedOnSizeAndFlexFactorWithArbitraryFloats@2x.png deleted file mode 100644 index 4dda03f985..0000000000 Binary files a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASStackLayoutSpecSnapshotTests/testNegativeViolationIsDistributedBasedOnSizeAndFlexFactorWithArbitraryFloats@2x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASStackLayoutSpecSnapshotTests/testNegativeViolationIsDistributedBasedOnSizeWithArbitraryFloats@2x.png b/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASStackLayoutSpecSnapshotTests/testNegativeViolationIsDistributedBasedOnSizeWithArbitraryFloats@2x.png deleted file mode 100644 index ebea9c1eaa..0000000000 Binary files a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASStackLayoutSpecSnapshotTests/testNegativeViolationIsDistributedBasedOnSizeWithArbitraryFloats@2x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASStackLayoutSpecSnapshotTests/testNestedBaselineAlignments@2x.png b/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASStackLayoutSpecSnapshotTests/testNestedBaselineAlignments@2x.png deleted file mode 100644 index 67f32cb4df..0000000000 Binary files a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASStackLayoutSpecSnapshotTests/testNestedBaselineAlignments@2x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASStackLayoutSpecSnapshotTests/testNestedStackLayoutStretchDoesNotViolateWidth@2x.png b/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASStackLayoutSpecSnapshotTests/testNestedStackLayoutStretchDoesNotViolateWidth@2x.png deleted file mode 100644 index 2a5fd841b8..0000000000 Binary files a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASStackLayoutSpecSnapshotTests/testNestedStackLayoutStretchDoesNotViolateWidth@2x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASStackLayoutSpecSnapshotTests/testOverflowBehaviorsWhenAllFlexShrinkChildrenHaveBeenClampedToZeroButViolationStillExists@2x.png b/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASStackLayoutSpecSnapshotTests/testOverflowBehaviorsWhenAllFlexShrinkChildrenHaveBeenClampedToZeroButViolationStillExists@2x.png deleted file mode 100644 index 0471d0cc08..0000000000 Binary files a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASStackLayoutSpecSnapshotTests/testOverflowBehaviorsWhenAllFlexShrinkChildrenHaveBeenClampedToZeroButViolationStillExists@2x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASStackLayoutSpecSnapshotTests/testOverflowBehaviors_flex@2x.png b/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASStackLayoutSpecSnapshotTests/testOverflowBehaviors_flex@2x.png deleted file mode 100644 index 3c15de518f..0000000000 Binary files a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASStackLayoutSpecSnapshotTests/testOverflowBehaviors_flex@2x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASStackLayoutSpecSnapshotTests/testOverflowBehaviors_justifyCenter@2x.png b/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASStackLayoutSpecSnapshotTests/testOverflowBehaviors_justifyCenter@2x.png deleted file mode 100644 index 07bf66b685..0000000000 Binary files a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASStackLayoutSpecSnapshotTests/testOverflowBehaviors_justifyCenter@2x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASStackLayoutSpecSnapshotTests/testOverflowBehaviors_justifyEnd@2x.png b/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASStackLayoutSpecSnapshotTests/testOverflowBehaviors_justifyEnd@2x.png deleted file mode 100644 index a68c624868..0000000000 Binary files a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASStackLayoutSpecSnapshotTests/testOverflowBehaviors_justifyEnd@2x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASStackLayoutSpecSnapshotTests/testOverflowBehaviors_justifyStart@2x.png b/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASStackLayoutSpecSnapshotTests/testOverflowBehaviors_justifyStart@2x.png deleted file mode 100644 index e078398440..0000000000 Binary files a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASStackLayoutSpecSnapshotTests/testOverflowBehaviors_justifyStart@2x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASStackLayoutSpecSnapshotTests/testPositiveViolationIsDistributedEqually@2x.png b/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASStackLayoutSpecSnapshotTests/testPositiveViolationIsDistributedEqually@2x.png deleted file mode 100644 index 12a70c6a6d..0000000000 Binary files a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASStackLayoutSpecSnapshotTests/testPositiveViolationIsDistributedEqually@2x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASStackLayoutSpecSnapshotTests/testPositiveViolationIsDistributedEquallyAmongMixedChildren@2x.png b/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASStackLayoutSpecSnapshotTests/testPositiveViolationIsDistributedEquallyAmongMixedChildren@2x.png deleted file mode 100644 index 5ab4b9fd6c..0000000000 Binary files a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASStackLayoutSpecSnapshotTests/testPositiveViolationIsDistributedEquallyAmongMixedChildren@2x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASStackLayoutSpecSnapshotTests/testPositiveViolationIsDistributedEquallyAmongMixedChildrenWithArbitraryFloats@2x.png b/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASStackLayoutSpecSnapshotTests/testPositiveViolationIsDistributedEquallyAmongMixedChildrenWithArbitraryFloats@2x.png deleted file mode 100644 index 5ab4b9fd6c..0000000000 Binary files a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASStackLayoutSpecSnapshotTests/testPositiveViolationIsDistributedEquallyAmongMixedChildrenWithArbitraryFloats@2x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASStackLayoutSpecSnapshotTests/testPositiveViolationIsDistributedEquallyWithArbitraryFloats@2x.png b/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASStackLayoutSpecSnapshotTests/testPositiveViolationIsDistributedEquallyWithArbitraryFloats@2x.png deleted file mode 100644 index 12a70c6a6d..0000000000 Binary files a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASStackLayoutSpecSnapshotTests/testPositiveViolationIsDistributedEquallyWithArbitraryFloats@2x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASStackLayoutSpecSnapshotTests/testPositiveViolationIsDistributedProportionally@2x.png b/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASStackLayoutSpecSnapshotTests/testPositiveViolationIsDistributedProportionally@2x.png deleted file mode 100644 index 262cf4c26c..0000000000 Binary files a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASStackLayoutSpecSnapshotTests/testPositiveViolationIsDistributedProportionally@2x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASStackLayoutSpecSnapshotTests/testPositiveViolationIsDistributedProportionallyAmongMixedChildren@2x.png b/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASStackLayoutSpecSnapshotTests/testPositiveViolationIsDistributedProportionallyAmongMixedChildren@2x.png deleted file mode 100644 index 584294ebcb..0000000000 Binary files a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASStackLayoutSpecSnapshotTests/testPositiveViolationIsDistributedProportionallyAmongMixedChildren@2x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASStackLayoutSpecSnapshotTests/testPositiveViolationIsDistributedProportionallyAmongMixedChildrenWithArbitraryFloats@2x.png b/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASStackLayoutSpecSnapshotTests/testPositiveViolationIsDistributedProportionallyAmongMixedChildrenWithArbitraryFloats@2x.png deleted file mode 100644 index 584294ebcb..0000000000 Binary files a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASStackLayoutSpecSnapshotTests/testPositiveViolationIsDistributedProportionallyAmongMixedChildrenWithArbitraryFloats@2x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASStackLayoutSpecSnapshotTests/testPositiveViolationIsDistributedProportionallyWithArbitraryFloats@2x.png b/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASStackLayoutSpecSnapshotTests/testPositiveViolationIsDistributedProportionallyWithArbitraryFloats@2x.png deleted file mode 100644 index 262cf4c26c..0000000000 Binary files a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASStackLayoutSpecSnapshotTests/testPositiveViolationIsDistributedProportionallyWithArbitraryFloats@2x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASStackLayoutSpecSnapshotTests/testRemainingViolationIsAppliedProperlyToFirstFlexibleChild@2x.png b/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASStackLayoutSpecSnapshotTests/testRemainingViolationIsAppliedProperlyToFirstFlexibleChild@2x.png deleted file mode 100644 index c555157918..0000000000 Binary files a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASStackLayoutSpecSnapshotTests/testRemainingViolationIsAppliedProperlyToFirstFlexibleChild@2x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASStackLayoutSpecSnapshotTests/testRemainingViolationIsAppliedProperlyToFirstFlexibleChildWithArbitraryFloats@2x.png b/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASStackLayoutSpecSnapshotTests/testRemainingViolationIsAppliedProperlyToFirstFlexibleChildWithArbitraryFloats@2x.png deleted file mode 100644 index c555157918..0000000000 Binary files a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASStackLayoutSpecSnapshotTests/testRemainingViolationIsAppliedProperlyToFirstFlexibleChildWithArbitraryFloats@2x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASStackLayoutSpecSnapshotTests/testStackSpacingWithChildrenHavingNilObjects_variableHeight@2x.png b/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASStackLayoutSpecSnapshotTests/testStackSpacingWithChildrenHavingNilObjects_variableHeight@2x.png deleted file mode 100644 index ca249a5daa..0000000000 Binary files a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASStackLayoutSpecSnapshotTests/testStackSpacingWithChildrenHavingNilObjects_variableHeight@2x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASStackLayoutSpecSnapshotTests/testStackSpacing_variableHeight@2x.png b/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASStackLayoutSpecSnapshotTests/testStackSpacing_variableHeight@2x.png deleted file mode 100644 index 77d64be4cb..0000000000 Binary files a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASStackLayoutSpecSnapshotTests/testStackSpacing_variableHeight@2x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASStackLayoutSpecSnapshotTests/testUnderflowBehaviors_flex@2x.png b/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASStackLayoutSpecSnapshotTests/testUnderflowBehaviors_flex@2x.png deleted file mode 100644 index 89dac5e442..0000000000 Binary files a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASStackLayoutSpecSnapshotTests/testUnderflowBehaviors_flex@2x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASStackLayoutSpecSnapshotTests/testUnderflowBehaviors_justifyCenter@2x.png b/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASStackLayoutSpecSnapshotTests/testUnderflowBehaviors_justifyCenter@2x.png deleted file mode 100644 index 2dfbc80025..0000000000 Binary files a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASStackLayoutSpecSnapshotTests/testUnderflowBehaviors_justifyCenter@2x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASStackLayoutSpecSnapshotTests/testUnderflowBehaviors_justifyEnd@2x.png b/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASStackLayoutSpecSnapshotTests/testUnderflowBehaviors_justifyEnd@2x.png deleted file mode 100644 index 6fb41b79f8..0000000000 Binary files a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASStackLayoutSpecSnapshotTests/testUnderflowBehaviors_justifyEnd@2x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASStackLayoutSpecSnapshotTests/testUnderflowBehaviors_justifySpaceAround@2x.png b/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASStackLayoutSpecSnapshotTests/testUnderflowBehaviors_justifySpaceAround@2x.png deleted file mode 100644 index 1d71834f70..0000000000 Binary files a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASStackLayoutSpecSnapshotTests/testUnderflowBehaviors_justifySpaceAround@2x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASStackLayoutSpecSnapshotTests/testUnderflowBehaviors_justifySpaceBetween@2x.png b/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASStackLayoutSpecSnapshotTests/testUnderflowBehaviors_justifySpaceBetween@2x.png deleted file mode 100644 index 49943caaa8..0000000000 Binary files a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASStackLayoutSpecSnapshotTests/testUnderflowBehaviors_justifySpaceBetween@2x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASStackLayoutSpecSnapshotTests/testUnderflowBehaviors_justifyStart@2x.png b/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASStackLayoutSpecSnapshotTests/testUnderflowBehaviors_justifyStart@2x.png deleted file mode 100644 index 4be46ae87f..0000000000 Binary files a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASStackLayoutSpecSnapshotTests/testUnderflowBehaviors_justifyStart@2x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASTextNodeSnapshotTests/testFontPointSizeScaling@2x.png b/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASTextNodeSnapshotTests/testFontPointSizeScaling@2x.png deleted file mode 100644 index 111bd50048..0000000000 Binary files a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASTextNodeSnapshotTests/testFontPointSizeScaling@2x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASTextNodeSnapshotTests/testShadowing@2x.png b/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASTextNodeSnapshotTests/testShadowing@2x.png deleted file mode 100644 index edb68c14aa..0000000000 Binary files a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASTextNodeSnapshotTests/testShadowing@2x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASTextNodeSnapshotTests/testTextContainerInset@2x.png b/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASTextNodeSnapshotTests/testTextContainerInset@2x.png deleted file mode 100644 index 7e6cac14b8..0000000000 Binary files a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASTextNodeSnapshotTests/testTextContainerInset@2x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASTextNodeSnapshotTests/testTextContainerInsetHighlight@2x.png b/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASTextNodeSnapshotTests/testTextContainerInsetHighlight@2x.png deleted file mode 100644 index 4a2fa33448..0000000000 Binary files a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASTextNodeSnapshotTests/testTextContainerInsetHighlight@2x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASTextNodeSnapshotTests/testTextContainerInsetIsIncludedWithSmallerConstrainedSize@2x.png b/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASTextNodeSnapshotTests/testTextContainerInsetIsIncludedWithSmallerConstrainedSize@2x.png deleted file mode 100644 index 5e2062b8e7..0000000000 Binary files a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASTextNodeSnapshotTests/testTextContainerInsetIsIncludedWithSmallerConstrainedSize@2x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASTextNodeSnapshotTests/testThatFastPathTruncationWorks@2x.png b/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASTextNodeSnapshotTests/testThatFastPathTruncationWorks@2x.png deleted file mode 100644 index d9f01fce31..0000000000 Binary files a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASTextNodeSnapshotTests/testThatFastPathTruncationWorks@2x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASTextNodeSnapshotTests/testThatSlowPathTruncationWorks@2x.png b/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASTextNodeSnapshotTests/testThatSlowPathTruncationWorks@2x.png deleted file mode 100644 index 4d68f59813..0000000000 Binary files a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASTextNodeSnapshotTests/testThatSlowPathTruncationWorks@2x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASWrapperSpecSnapshotTests/testWrapperSpecWithMultipleElementsShouldSizeToLargestElement@2x.png b/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASWrapperSpecSnapshotTests/testWrapperSpecWithMultipleElementsShouldSizeToLargestElement@2x.png deleted file mode 100644 index e34eef76c7..0000000000 Binary files a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASWrapperSpecSnapshotTests/testWrapperSpecWithMultipleElementsShouldSizeToLargestElement@2x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASWrapperSpecSnapshotTests/testWrapperSpecWithOneElementShouldSizeToElement@2x.png b/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASWrapperSpecSnapshotTests/testWrapperSpecWithOneElementShouldSizeToElement@2x.png deleted file mode 100644 index d63856e6ec..0000000000 Binary files a/submodules/AsyncDisplayKit/Tests/ReferenceImages_64/ASWrapperSpecSnapshotTests/testWrapperSpecWithOneElementShouldSizeToElement@2x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/Tests/ReferenceImages_iOS_10/ASCornerLayoutSpecSnapshotTests/testCornerSpecForAllLocationsWithInnerOffset_bottomLeft_inner_childSize@2x.png b/submodules/AsyncDisplayKit/Tests/ReferenceImages_iOS_10/ASCornerLayoutSpecSnapshotTests/testCornerSpecForAllLocationsWithInnerOffset_bottomLeft_inner_childSize@2x.png deleted file mode 100644 index 3b78fb5e7d..0000000000 Binary files a/submodules/AsyncDisplayKit/Tests/ReferenceImages_iOS_10/ASCornerLayoutSpecSnapshotTests/testCornerSpecForAllLocationsWithInnerOffset_bottomLeft_inner_childSize@2x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/Tests/ReferenceImages_iOS_10/ASCornerLayoutSpecSnapshotTests/testCornerSpecForAllLocationsWithInnerOffset_bottomLeft_inner_fullSize@2x.png b/submodules/AsyncDisplayKit/Tests/ReferenceImages_iOS_10/ASCornerLayoutSpecSnapshotTests/testCornerSpecForAllLocationsWithInnerOffset_bottomLeft_inner_fullSize@2x.png deleted file mode 100644 index 3b78fb5e7d..0000000000 Binary files a/submodules/AsyncDisplayKit/Tests/ReferenceImages_iOS_10/ASCornerLayoutSpecSnapshotTests/testCornerSpecForAllLocationsWithInnerOffset_bottomLeft_inner_fullSize@2x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/Tests/ReferenceImages_iOS_10/ASCornerLayoutSpecSnapshotTests/testCornerSpecForAllLocationsWithInnerOffset_bottomRight_inner_childSize@2x.png b/submodules/AsyncDisplayKit/Tests/ReferenceImages_iOS_10/ASCornerLayoutSpecSnapshotTests/testCornerSpecForAllLocationsWithInnerOffset_bottomRight_inner_childSize@2x.png deleted file mode 100644 index 34851067b9..0000000000 Binary files a/submodules/AsyncDisplayKit/Tests/ReferenceImages_iOS_10/ASCornerLayoutSpecSnapshotTests/testCornerSpecForAllLocationsWithInnerOffset_bottomRight_inner_childSize@2x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/Tests/ReferenceImages_iOS_10/ASCornerLayoutSpecSnapshotTests/testCornerSpecForAllLocationsWithInnerOffset_bottomRight_inner_fullSize@2x.png b/submodules/AsyncDisplayKit/Tests/ReferenceImages_iOS_10/ASCornerLayoutSpecSnapshotTests/testCornerSpecForAllLocationsWithInnerOffset_bottomRight_inner_fullSize@2x.png deleted file mode 100644 index 34851067b9..0000000000 Binary files a/submodules/AsyncDisplayKit/Tests/ReferenceImages_iOS_10/ASCornerLayoutSpecSnapshotTests/testCornerSpecForAllLocationsWithInnerOffset_bottomRight_inner_fullSize@2x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/Tests/ReferenceImages_iOS_10/ASCornerLayoutSpecSnapshotTests/testCornerSpecForAllLocationsWithInnerOffset_topLeft_inner_childSize@2x.png b/submodules/AsyncDisplayKit/Tests/ReferenceImages_iOS_10/ASCornerLayoutSpecSnapshotTests/testCornerSpecForAllLocationsWithInnerOffset_topLeft_inner_childSize@2x.png deleted file mode 100644 index aa4c3ee8d8..0000000000 Binary files a/submodules/AsyncDisplayKit/Tests/ReferenceImages_iOS_10/ASCornerLayoutSpecSnapshotTests/testCornerSpecForAllLocationsWithInnerOffset_topLeft_inner_childSize@2x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/Tests/ReferenceImages_iOS_10/ASCornerLayoutSpecSnapshotTests/testCornerSpecForAllLocationsWithInnerOffset_topLeft_inner_fullSize@2x.png b/submodules/AsyncDisplayKit/Tests/ReferenceImages_iOS_10/ASCornerLayoutSpecSnapshotTests/testCornerSpecForAllLocationsWithInnerOffset_topLeft_inner_fullSize@2x.png deleted file mode 100644 index aa4c3ee8d8..0000000000 Binary files a/submodules/AsyncDisplayKit/Tests/ReferenceImages_iOS_10/ASCornerLayoutSpecSnapshotTests/testCornerSpecForAllLocationsWithInnerOffset_topLeft_inner_fullSize@2x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/Tests/ReferenceImages_iOS_10/ASCornerLayoutSpecSnapshotTests/testCornerSpecForAllLocationsWithInnerOffset_topRight_inner_childSize@2x.png b/submodules/AsyncDisplayKit/Tests/ReferenceImages_iOS_10/ASCornerLayoutSpecSnapshotTests/testCornerSpecForAllLocationsWithInnerOffset_topRight_inner_childSize@2x.png deleted file mode 100644 index 23082ede8c..0000000000 Binary files a/submodules/AsyncDisplayKit/Tests/ReferenceImages_iOS_10/ASCornerLayoutSpecSnapshotTests/testCornerSpecForAllLocationsWithInnerOffset_topRight_inner_childSize@2x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/Tests/ReferenceImages_iOS_10/ASCornerLayoutSpecSnapshotTests/testCornerSpecForAllLocationsWithInnerOffset_topRight_inner_fullSize@2x.png b/submodules/AsyncDisplayKit/Tests/ReferenceImages_iOS_10/ASCornerLayoutSpecSnapshotTests/testCornerSpecForAllLocationsWithInnerOffset_topRight_inner_fullSize@2x.png deleted file mode 100644 index 23082ede8c..0000000000 Binary files a/submodules/AsyncDisplayKit/Tests/ReferenceImages_iOS_10/ASCornerLayoutSpecSnapshotTests/testCornerSpecForAllLocationsWithInnerOffset_topRight_inner_fullSize@2x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/Tests/ReferenceImages_iOS_10/ASCornerLayoutSpecSnapshotTests/testCornerSpecForAllLocationsWithOuterOffset_bottomLeft_outer_childSize@2x.png b/submodules/AsyncDisplayKit/Tests/ReferenceImages_iOS_10/ASCornerLayoutSpecSnapshotTests/testCornerSpecForAllLocationsWithOuterOffset_bottomLeft_outer_childSize@2x.png deleted file mode 100644 index 18e211ae8e..0000000000 Binary files a/submodules/AsyncDisplayKit/Tests/ReferenceImages_iOS_10/ASCornerLayoutSpecSnapshotTests/testCornerSpecForAllLocationsWithOuterOffset_bottomLeft_outer_childSize@2x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/Tests/ReferenceImages_iOS_10/ASCornerLayoutSpecSnapshotTests/testCornerSpecForAllLocationsWithOuterOffset_bottomLeft_outer_fullSize@2x.png b/submodules/AsyncDisplayKit/Tests/ReferenceImages_iOS_10/ASCornerLayoutSpecSnapshotTests/testCornerSpecForAllLocationsWithOuterOffset_bottomLeft_outer_fullSize@2x.png deleted file mode 100644 index 393143a214..0000000000 Binary files a/submodules/AsyncDisplayKit/Tests/ReferenceImages_iOS_10/ASCornerLayoutSpecSnapshotTests/testCornerSpecForAllLocationsWithOuterOffset_bottomLeft_outer_fullSize@2x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/Tests/ReferenceImages_iOS_10/ASCornerLayoutSpecSnapshotTests/testCornerSpecForAllLocationsWithOuterOffset_bottomRight_outer_childSize@2x.png b/submodules/AsyncDisplayKit/Tests/ReferenceImages_iOS_10/ASCornerLayoutSpecSnapshotTests/testCornerSpecForAllLocationsWithOuterOffset_bottomRight_outer_childSize@2x.png deleted file mode 100644 index 18e211ae8e..0000000000 Binary files a/submodules/AsyncDisplayKit/Tests/ReferenceImages_iOS_10/ASCornerLayoutSpecSnapshotTests/testCornerSpecForAllLocationsWithOuterOffset_bottomRight_outer_childSize@2x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/Tests/ReferenceImages_iOS_10/ASCornerLayoutSpecSnapshotTests/testCornerSpecForAllLocationsWithOuterOffset_bottomRight_outer_fullSize@2x.png b/submodules/AsyncDisplayKit/Tests/ReferenceImages_iOS_10/ASCornerLayoutSpecSnapshotTests/testCornerSpecForAllLocationsWithOuterOffset_bottomRight_outer_fullSize@2x.png deleted file mode 100644 index 12498681e0..0000000000 Binary files a/submodules/AsyncDisplayKit/Tests/ReferenceImages_iOS_10/ASCornerLayoutSpecSnapshotTests/testCornerSpecForAllLocationsWithOuterOffset_bottomRight_outer_fullSize@2x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/Tests/ReferenceImages_iOS_10/ASCornerLayoutSpecSnapshotTests/testCornerSpecForAllLocationsWithOuterOffset_topLeft_outer_childSize@2x.png b/submodules/AsyncDisplayKit/Tests/ReferenceImages_iOS_10/ASCornerLayoutSpecSnapshotTests/testCornerSpecForAllLocationsWithOuterOffset_topLeft_outer_childSize@2x.png deleted file mode 100644 index 18e211ae8e..0000000000 Binary files a/submodules/AsyncDisplayKit/Tests/ReferenceImages_iOS_10/ASCornerLayoutSpecSnapshotTests/testCornerSpecForAllLocationsWithOuterOffset_topLeft_outer_childSize@2x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/Tests/ReferenceImages_iOS_10/ASCornerLayoutSpecSnapshotTests/testCornerSpecForAllLocationsWithOuterOffset_topLeft_outer_fullSize@2x.png b/submodules/AsyncDisplayKit/Tests/ReferenceImages_iOS_10/ASCornerLayoutSpecSnapshotTests/testCornerSpecForAllLocationsWithOuterOffset_topLeft_outer_fullSize@2x.png deleted file mode 100644 index dc4f1ab2b3..0000000000 Binary files a/submodules/AsyncDisplayKit/Tests/ReferenceImages_iOS_10/ASCornerLayoutSpecSnapshotTests/testCornerSpecForAllLocationsWithOuterOffset_topLeft_outer_fullSize@2x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/Tests/ReferenceImages_iOS_10/ASCornerLayoutSpecSnapshotTests/testCornerSpecForAllLocationsWithOuterOffset_topRight_outer_childSize@2x.png b/submodules/AsyncDisplayKit/Tests/ReferenceImages_iOS_10/ASCornerLayoutSpecSnapshotTests/testCornerSpecForAllLocationsWithOuterOffset_topRight_outer_childSize@2x.png deleted file mode 100644 index 18e211ae8e..0000000000 Binary files a/submodules/AsyncDisplayKit/Tests/ReferenceImages_iOS_10/ASCornerLayoutSpecSnapshotTests/testCornerSpecForAllLocationsWithOuterOffset_topRight_outer_childSize@2x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/Tests/ReferenceImages_iOS_10/ASCornerLayoutSpecSnapshotTests/testCornerSpecForAllLocationsWithOuterOffset_topRight_outer_fullSize@2x.png b/submodules/AsyncDisplayKit/Tests/ReferenceImages_iOS_10/ASCornerLayoutSpecSnapshotTests/testCornerSpecForAllLocationsWithOuterOffset_topRight_outer_fullSize@2x.png deleted file mode 100644 index fa7e15a554..0000000000 Binary files a/submodules/AsyncDisplayKit/Tests/ReferenceImages_iOS_10/ASCornerLayoutSpecSnapshotTests/testCornerSpecForAllLocationsWithOuterOffset_topRight_outer_fullSize@2x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/Tests/ReferenceImages_iOS_10/ASCornerLayoutSpecSnapshotTests/testCornerSpecForAllLocations_bottomLeft_center_childSize@2x.png b/submodules/AsyncDisplayKit/Tests/ReferenceImages_iOS_10/ASCornerLayoutSpecSnapshotTests/testCornerSpecForAllLocations_bottomLeft_center_childSize@2x.png deleted file mode 100644 index 90f411aff2..0000000000 Binary files a/submodules/AsyncDisplayKit/Tests/ReferenceImages_iOS_10/ASCornerLayoutSpecSnapshotTests/testCornerSpecForAllLocations_bottomLeft_center_childSize@2x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/Tests/ReferenceImages_iOS_10/ASCornerLayoutSpecSnapshotTests/testCornerSpecForAllLocations_bottomLeft_center_fullSize@2x.png b/submodules/AsyncDisplayKit/Tests/ReferenceImages_iOS_10/ASCornerLayoutSpecSnapshotTests/testCornerSpecForAllLocations_bottomLeft_center_fullSize@2x.png deleted file mode 100644 index 6d49323c17..0000000000 Binary files a/submodules/AsyncDisplayKit/Tests/ReferenceImages_iOS_10/ASCornerLayoutSpecSnapshotTests/testCornerSpecForAllLocations_bottomLeft_center_fullSize@2x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/Tests/ReferenceImages_iOS_10/ASCornerLayoutSpecSnapshotTests/testCornerSpecForAllLocations_bottomRight_center_childSize@2x.png b/submodules/AsyncDisplayKit/Tests/ReferenceImages_iOS_10/ASCornerLayoutSpecSnapshotTests/testCornerSpecForAllLocations_bottomRight_center_childSize@2x.png deleted file mode 100644 index 9d23e2b646..0000000000 Binary files a/submodules/AsyncDisplayKit/Tests/ReferenceImages_iOS_10/ASCornerLayoutSpecSnapshotTests/testCornerSpecForAllLocations_bottomRight_center_childSize@2x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/Tests/ReferenceImages_iOS_10/ASCornerLayoutSpecSnapshotTests/testCornerSpecForAllLocations_bottomRight_center_fullSize@2x.png b/submodules/AsyncDisplayKit/Tests/ReferenceImages_iOS_10/ASCornerLayoutSpecSnapshotTests/testCornerSpecForAllLocations_bottomRight_center_fullSize@2x.png deleted file mode 100644 index 58257ffef6..0000000000 Binary files a/submodules/AsyncDisplayKit/Tests/ReferenceImages_iOS_10/ASCornerLayoutSpecSnapshotTests/testCornerSpecForAllLocations_bottomRight_center_fullSize@2x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/Tests/ReferenceImages_iOS_10/ASCornerLayoutSpecSnapshotTests/testCornerSpecForAllLocations_topLeft_center_childSize@2x.png b/submodules/AsyncDisplayKit/Tests/ReferenceImages_iOS_10/ASCornerLayoutSpecSnapshotTests/testCornerSpecForAllLocations_topLeft_center_childSize@2x.png deleted file mode 100644 index 3503fd79dd..0000000000 Binary files a/submodules/AsyncDisplayKit/Tests/ReferenceImages_iOS_10/ASCornerLayoutSpecSnapshotTests/testCornerSpecForAllLocations_topLeft_center_childSize@2x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/Tests/ReferenceImages_iOS_10/ASCornerLayoutSpecSnapshotTests/testCornerSpecForAllLocations_topLeft_center_fullSize@2x.png b/submodules/AsyncDisplayKit/Tests/ReferenceImages_iOS_10/ASCornerLayoutSpecSnapshotTests/testCornerSpecForAllLocations_topLeft_center_fullSize@2x.png deleted file mode 100644 index 263f50d29c..0000000000 Binary files a/submodules/AsyncDisplayKit/Tests/ReferenceImages_iOS_10/ASCornerLayoutSpecSnapshotTests/testCornerSpecForAllLocations_topLeft_center_fullSize@2x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/Tests/ReferenceImages_iOS_10/ASCornerLayoutSpecSnapshotTests/testCornerSpecForAllLocations_topRight_center_childSize@2x.png b/submodules/AsyncDisplayKit/Tests/ReferenceImages_iOS_10/ASCornerLayoutSpecSnapshotTests/testCornerSpecForAllLocations_topRight_center_childSize@2x.png deleted file mode 100644 index 492fc049b8..0000000000 Binary files a/submodules/AsyncDisplayKit/Tests/ReferenceImages_iOS_10/ASCornerLayoutSpecSnapshotTests/testCornerSpecForAllLocations_topRight_center_childSize@2x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/Tests/ReferenceImages_iOS_10/ASCornerLayoutSpecSnapshotTests/testCornerSpecForAllLocations_topRight_center_fullSize@2x.png b/submodules/AsyncDisplayKit/Tests/ReferenceImages_iOS_10/ASCornerLayoutSpecSnapshotTests/testCornerSpecForAllLocations_topRight_center_fullSize@2x.png deleted file mode 100644 index 9e39a3c5c4..0000000000 Binary files a/submodules/AsyncDisplayKit/Tests/ReferenceImages_iOS_10/ASCornerLayoutSpecSnapshotTests/testCornerSpecForAllLocations_topRight_center_fullSize@2x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/Tests/ReferenceImages_iOS_10/ASStackLayoutSpecSnapshotTests/testBaselineAlignmentWithSpaceBetween@2x.png b/submodules/AsyncDisplayKit/Tests/ReferenceImages_iOS_10/ASStackLayoutSpecSnapshotTests/testBaselineAlignmentWithSpaceBetween@2x.png deleted file mode 100644 index 259778c672..0000000000 Binary files a/submodules/AsyncDisplayKit/Tests/ReferenceImages_iOS_10/ASStackLayoutSpecSnapshotTests/testBaselineAlignmentWithSpaceBetween@2x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/Tests/ReferenceImages_iOS_10/ASStackLayoutSpecSnapshotTests/testBaselineAlignmentWithStretchedItem@2x.png b/submodules/AsyncDisplayKit/Tests/ReferenceImages_iOS_10/ASStackLayoutSpecSnapshotTests/testBaselineAlignmentWithStretchedItem@2x.png deleted file mode 100644 index 9e8286a88c..0000000000 Binary files a/submodules/AsyncDisplayKit/Tests/ReferenceImages_iOS_10/ASStackLayoutSpecSnapshotTests/testBaselineAlignmentWithStretchedItem@2x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/Tests/ReferenceImages_iOS_10/ASStackLayoutSpecSnapshotTests/testBaselineAlignment_baselineFirst@2x.png b/submodules/AsyncDisplayKit/Tests/ReferenceImages_iOS_10/ASStackLayoutSpecSnapshotTests/testBaselineAlignment_baselineFirst@2x.png deleted file mode 100644 index 7f4045ee98..0000000000 Binary files a/submodules/AsyncDisplayKit/Tests/ReferenceImages_iOS_10/ASStackLayoutSpecSnapshotTests/testBaselineAlignment_baselineFirst@2x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/Tests/ReferenceImages_iOS_10/ASStackLayoutSpecSnapshotTests/testBaselineAlignment_baselineLast@2x.png b/submodules/AsyncDisplayKit/Tests/ReferenceImages_iOS_10/ASStackLayoutSpecSnapshotTests/testBaselineAlignment_baselineLast@2x.png deleted file mode 100644 index c81f3e9ca4..0000000000 Binary files a/submodules/AsyncDisplayKit/Tests/ReferenceImages_iOS_10/ASStackLayoutSpecSnapshotTests/testBaselineAlignment_baselineLast@2x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/Tests/ReferenceImages_iOS_10/ASStackLayoutSpecSnapshotTests/testNestedBaselineAlignments@2x.png b/submodules/AsyncDisplayKit/Tests/ReferenceImages_iOS_10/ASStackLayoutSpecSnapshotTests/testNestedBaselineAlignments@2x.png deleted file mode 100644 index 679b98a52c..0000000000 Binary files a/submodules/AsyncDisplayKit/Tests/ReferenceImages_iOS_10/ASStackLayoutSpecSnapshotTests/testNestedBaselineAlignments@2x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/Tests/ReferenceImages_iOS_10/ASTextNode2SnapshotTests/testShadowing_ASTextNode2@2x.png b/submodules/AsyncDisplayKit/Tests/ReferenceImages_iOS_10/ASTextNode2SnapshotTests/testShadowing_ASTextNode2@2x.png deleted file mode 100644 index 7a336db723..0000000000 Binary files a/submodules/AsyncDisplayKit/Tests/ReferenceImages_iOS_10/ASTextNode2SnapshotTests/testShadowing_ASTextNode2@2x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/Tests/ReferenceImages_iOS_10/ASTextNode2SnapshotTests/testTextContainerInsetHighlight_ASTextNode2@2x.png b/submodules/AsyncDisplayKit/Tests/ReferenceImages_iOS_10/ASTextNode2SnapshotTests/testTextContainerInsetHighlight_ASTextNode2@2x.png deleted file mode 100644 index 37dfc5986d..0000000000 Binary files a/submodules/AsyncDisplayKit/Tests/ReferenceImages_iOS_10/ASTextNode2SnapshotTests/testTextContainerInsetHighlight_ASTextNode2@2x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/Tests/ReferenceImages_iOS_10/ASTextNode2SnapshotTests/testTextContainerInsetIsIncludedWithSmallerConstrainedSize_ASTextNode2@2x.png b/submodules/AsyncDisplayKit/Tests/ReferenceImages_iOS_10/ASTextNode2SnapshotTests/testTextContainerInsetIsIncludedWithSmallerConstrainedSize_ASTextNode2@2x.png deleted file mode 100644 index dd3b0ccf4d..0000000000 Binary files a/submodules/AsyncDisplayKit/Tests/ReferenceImages_iOS_10/ASTextNode2SnapshotTests/testTextContainerInsetIsIncludedWithSmallerConstrainedSize_ASTextNode2@2x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/Tests/ReferenceImages_iOS_10/ASTextNode2SnapshotTests/testTextContainerInset_ASTextNode2@2x.png b/submodules/AsyncDisplayKit/Tests/ReferenceImages_iOS_10/ASTextNode2SnapshotTests/testTextContainerInset_ASTextNode2@2x.png deleted file mode 100644 index d66bb3bce9..0000000000 Binary files a/submodules/AsyncDisplayKit/Tests/ReferenceImages_iOS_10/ASTextNode2SnapshotTests/testTextContainerInset_ASTextNode2@2x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/Tests/ReferenceImages_iOS_10/ASTextNode2SnapshotTests/testTextTruncationModes_ASTextNode2_NSLineBreakByCharWrapping_0Lines@2x.png b/submodules/AsyncDisplayKit/Tests/ReferenceImages_iOS_10/ASTextNode2SnapshotTests/testTextTruncationModes_ASTextNode2_NSLineBreakByCharWrapping_0Lines@2x.png deleted file mode 100644 index e080782fa8..0000000000 Binary files a/submodules/AsyncDisplayKit/Tests/ReferenceImages_iOS_10/ASTextNode2SnapshotTests/testTextTruncationModes_ASTextNode2_NSLineBreakByCharWrapping_0Lines@2x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/Tests/ReferenceImages_iOS_10/ASTextNode2SnapshotTests/testTextTruncationModes_ASTextNode2_NSLineBreakByCharWrapping_1Lines@2x.png b/submodules/AsyncDisplayKit/Tests/ReferenceImages_iOS_10/ASTextNode2SnapshotTests/testTextTruncationModes_ASTextNode2_NSLineBreakByCharWrapping_1Lines@2x.png deleted file mode 100644 index 7139ae654a..0000000000 Binary files a/submodules/AsyncDisplayKit/Tests/ReferenceImages_iOS_10/ASTextNode2SnapshotTests/testTextTruncationModes_ASTextNode2_NSLineBreakByCharWrapping_1Lines@2x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/Tests/ReferenceImages_iOS_10/ASTextNode2SnapshotTests/testTextTruncationModes_ASTextNode2_NSLineBreakByCharWrapping_2Lines@2x.png b/submodules/AsyncDisplayKit/Tests/ReferenceImages_iOS_10/ASTextNode2SnapshotTests/testTextTruncationModes_ASTextNode2_NSLineBreakByCharWrapping_2Lines@2x.png deleted file mode 100644 index 7cab68aa7e..0000000000 Binary files a/submodules/AsyncDisplayKit/Tests/ReferenceImages_iOS_10/ASTextNode2SnapshotTests/testTextTruncationModes_ASTextNode2_NSLineBreakByCharWrapping_2Lines@2x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/Tests/ReferenceImages_iOS_10/ASTextNode2SnapshotTests/testTextTruncationModes_ASTextNode2_NSLineBreakByCharWrapping_3Lines@2x.png b/submodules/AsyncDisplayKit/Tests/ReferenceImages_iOS_10/ASTextNode2SnapshotTests/testTextTruncationModes_ASTextNode2_NSLineBreakByCharWrapping_3Lines@2x.png deleted file mode 100644 index 79c7db1ee7..0000000000 Binary files a/submodules/AsyncDisplayKit/Tests/ReferenceImages_iOS_10/ASTextNode2SnapshotTests/testTextTruncationModes_ASTextNode2_NSLineBreakByCharWrapping_3Lines@2x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/Tests/ReferenceImages_iOS_10/ASTextNode2SnapshotTests/testTextTruncationModes_ASTextNode2_NSLineBreakByTruncatingHead_0Lines@2x.png b/submodules/AsyncDisplayKit/Tests/ReferenceImages_iOS_10/ASTextNode2SnapshotTests/testTextTruncationModes_ASTextNode2_NSLineBreakByTruncatingHead_0Lines@2x.png deleted file mode 100644 index 4293eb9df1..0000000000 Binary files a/submodules/AsyncDisplayKit/Tests/ReferenceImages_iOS_10/ASTextNode2SnapshotTests/testTextTruncationModes_ASTextNode2_NSLineBreakByTruncatingHead_0Lines@2x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/Tests/ReferenceImages_iOS_10/ASTextNode2SnapshotTests/testTextTruncationModes_ASTextNode2_NSLineBreakByTruncatingHead_1Lines@2x.png b/submodules/AsyncDisplayKit/Tests/ReferenceImages_iOS_10/ASTextNode2SnapshotTests/testTextTruncationModes_ASTextNode2_NSLineBreakByTruncatingHead_1Lines@2x.png deleted file mode 100644 index 1422cb5b1b..0000000000 Binary files a/submodules/AsyncDisplayKit/Tests/ReferenceImages_iOS_10/ASTextNode2SnapshotTests/testTextTruncationModes_ASTextNode2_NSLineBreakByTruncatingHead_1Lines@2x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/Tests/ReferenceImages_iOS_10/ASTextNode2SnapshotTests/testTextTruncationModes_ASTextNode2_NSLineBreakByTruncatingHead_2Lines@2x.png b/submodules/AsyncDisplayKit/Tests/ReferenceImages_iOS_10/ASTextNode2SnapshotTests/testTextTruncationModes_ASTextNode2_NSLineBreakByTruncatingHead_2Lines@2x.png deleted file mode 100644 index e9472fc15b..0000000000 Binary files a/submodules/AsyncDisplayKit/Tests/ReferenceImages_iOS_10/ASTextNode2SnapshotTests/testTextTruncationModes_ASTextNode2_NSLineBreakByTruncatingHead_2Lines@2x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/Tests/ReferenceImages_iOS_10/ASTextNode2SnapshotTests/testTextTruncationModes_ASTextNode2_NSLineBreakByTruncatingHead_3Lines@2x.png b/submodules/AsyncDisplayKit/Tests/ReferenceImages_iOS_10/ASTextNode2SnapshotTests/testTextTruncationModes_ASTextNode2_NSLineBreakByTruncatingHead_3Lines@2x.png deleted file mode 100644 index 85f8b9688c..0000000000 Binary files a/submodules/AsyncDisplayKit/Tests/ReferenceImages_iOS_10/ASTextNode2SnapshotTests/testTextTruncationModes_ASTextNode2_NSLineBreakByTruncatingHead_3Lines@2x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/Tests/ReferenceImages_iOS_10/ASTextNode2SnapshotTests/testTextTruncationModes_ASTextNode2_NSLineBreakByTruncatingMiddle_0Lines@2x.png b/submodules/AsyncDisplayKit/Tests/ReferenceImages_iOS_10/ASTextNode2SnapshotTests/testTextTruncationModes_ASTextNode2_NSLineBreakByTruncatingMiddle_0Lines@2x.png deleted file mode 100644 index c1a4f2b499..0000000000 Binary files a/submodules/AsyncDisplayKit/Tests/ReferenceImages_iOS_10/ASTextNode2SnapshotTests/testTextTruncationModes_ASTextNode2_NSLineBreakByTruncatingMiddle_0Lines@2x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/Tests/ReferenceImages_iOS_10/ASTextNode2SnapshotTests/testTextTruncationModes_ASTextNode2_NSLineBreakByTruncatingMiddle_1Lines@2x.png b/submodules/AsyncDisplayKit/Tests/ReferenceImages_iOS_10/ASTextNode2SnapshotTests/testTextTruncationModes_ASTextNode2_NSLineBreakByTruncatingMiddle_1Lines@2x.png deleted file mode 100644 index d534022d55..0000000000 Binary files a/submodules/AsyncDisplayKit/Tests/ReferenceImages_iOS_10/ASTextNode2SnapshotTests/testTextTruncationModes_ASTextNode2_NSLineBreakByTruncatingMiddle_1Lines@2x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/Tests/ReferenceImages_iOS_10/ASTextNode2SnapshotTests/testTextTruncationModes_ASTextNode2_NSLineBreakByTruncatingMiddle_2Lines@2x.png b/submodules/AsyncDisplayKit/Tests/ReferenceImages_iOS_10/ASTextNode2SnapshotTests/testTextTruncationModes_ASTextNode2_NSLineBreakByTruncatingMiddle_2Lines@2x.png deleted file mode 100644 index c52a7e6dde..0000000000 Binary files a/submodules/AsyncDisplayKit/Tests/ReferenceImages_iOS_10/ASTextNode2SnapshotTests/testTextTruncationModes_ASTextNode2_NSLineBreakByTruncatingMiddle_2Lines@2x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/Tests/ReferenceImages_iOS_10/ASTextNode2SnapshotTests/testTextTruncationModes_ASTextNode2_NSLineBreakByTruncatingMiddle_3Lines@2x.png b/submodules/AsyncDisplayKit/Tests/ReferenceImages_iOS_10/ASTextNode2SnapshotTests/testTextTruncationModes_ASTextNode2_NSLineBreakByTruncatingMiddle_3Lines@2x.png deleted file mode 100644 index e5cde0ab00..0000000000 Binary files a/submodules/AsyncDisplayKit/Tests/ReferenceImages_iOS_10/ASTextNode2SnapshotTests/testTextTruncationModes_ASTextNode2_NSLineBreakByTruncatingMiddle_3Lines@2x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/Tests/ReferenceImages_iOS_10/ASTextNode2SnapshotTests/testTextTruncationModes_ASTextNode2_NSLineBreakByTruncatingTail_0Lines@2x.png b/submodules/AsyncDisplayKit/Tests/ReferenceImages_iOS_10/ASTextNode2SnapshotTests/testTextTruncationModes_ASTextNode2_NSLineBreakByTruncatingTail_0Lines@2x.png deleted file mode 100644 index 387d0b8d47..0000000000 Binary files a/submodules/AsyncDisplayKit/Tests/ReferenceImages_iOS_10/ASTextNode2SnapshotTests/testTextTruncationModes_ASTextNode2_NSLineBreakByTruncatingTail_0Lines@2x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/Tests/ReferenceImages_iOS_10/ASTextNode2SnapshotTests/testTextTruncationModes_ASTextNode2_NSLineBreakByTruncatingTail_1Lines@2x.png b/submodules/AsyncDisplayKit/Tests/ReferenceImages_iOS_10/ASTextNode2SnapshotTests/testTextTruncationModes_ASTextNode2_NSLineBreakByTruncatingTail_1Lines@2x.png deleted file mode 100644 index fd36b638c1..0000000000 Binary files a/submodules/AsyncDisplayKit/Tests/ReferenceImages_iOS_10/ASTextNode2SnapshotTests/testTextTruncationModes_ASTextNode2_NSLineBreakByTruncatingTail_1Lines@2x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/Tests/ReferenceImages_iOS_10/ASTextNode2SnapshotTests/testTextTruncationModes_ASTextNode2_NSLineBreakByTruncatingTail_2Lines@2x.png b/submodules/AsyncDisplayKit/Tests/ReferenceImages_iOS_10/ASTextNode2SnapshotTests/testTextTruncationModes_ASTextNode2_NSLineBreakByTruncatingTail_2Lines@2x.png deleted file mode 100644 index ebfd109103..0000000000 Binary files a/submodules/AsyncDisplayKit/Tests/ReferenceImages_iOS_10/ASTextNode2SnapshotTests/testTextTruncationModes_ASTextNode2_NSLineBreakByTruncatingTail_2Lines@2x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/Tests/ReferenceImages_iOS_10/ASTextNode2SnapshotTests/testTextTruncationModes_ASTextNode2_NSLineBreakByTruncatingTail_3Lines@2x.png b/submodules/AsyncDisplayKit/Tests/ReferenceImages_iOS_10/ASTextNode2SnapshotTests/testTextTruncationModes_ASTextNode2_NSLineBreakByTruncatingTail_3Lines@2x.png deleted file mode 100644 index 29e13b8d01..0000000000 Binary files a/submodules/AsyncDisplayKit/Tests/ReferenceImages_iOS_10/ASTextNode2SnapshotTests/testTextTruncationModes_ASTextNode2_NSLineBreakByTruncatingTail_3Lines@2x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/Tests/ReferenceImages_iOS_10/ASTextNode2SnapshotTests/testTextTruncationModes_ASTextNode2_NSLineBreakByWordWrapping_0Lines@2x.png b/submodules/AsyncDisplayKit/Tests/ReferenceImages_iOS_10/ASTextNode2SnapshotTests/testTextTruncationModes_ASTextNode2_NSLineBreakByWordWrapping_0Lines@2x.png deleted file mode 100644 index 6202ed9874..0000000000 Binary files a/submodules/AsyncDisplayKit/Tests/ReferenceImages_iOS_10/ASTextNode2SnapshotTests/testTextTruncationModes_ASTextNode2_NSLineBreakByWordWrapping_0Lines@2x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/Tests/ReferenceImages_iOS_10/ASTextNode2SnapshotTests/testTextTruncationModes_ASTextNode2_NSLineBreakByWordWrapping_1Lines@2x.png b/submodules/AsyncDisplayKit/Tests/ReferenceImages_iOS_10/ASTextNode2SnapshotTests/testTextTruncationModes_ASTextNode2_NSLineBreakByWordWrapping_1Lines@2x.png deleted file mode 100644 index 6316fb81f9..0000000000 Binary files a/submodules/AsyncDisplayKit/Tests/ReferenceImages_iOS_10/ASTextNode2SnapshotTests/testTextTruncationModes_ASTextNode2_NSLineBreakByWordWrapping_1Lines@2x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/Tests/ReferenceImages_iOS_10/ASTextNode2SnapshotTests/testTextTruncationModes_ASTextNode2_NSLineBreakByWordWrapping_2Lines@2x.png b/submodules/AsyncDisplayKit/Tests/ReferenceImages_iOS_10/ASTextNode2SnapshotTests/testTextTruncationModes_ASTextNode2_NSLineBreakByWordWrapping_2Lines@2x.png deleted file mode 100644 index ffe6f9c3a2..0000000000 Binary files a/submodules/AsyncDisplayKit/Tests/ReferenceImages_iOS_10/ASTextNode2SnapshotTests/testTextTruncationModes_ASTextNode2_NSLineBreakByWordWrapping_2Lines@2x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/Tests/ReferenceImages_iOS_10/ASTextNode2SnapshotTests/testTextTruncationModes_ASTextNode2_NSLineBreakByWordWrapping_3Lines@2x.png b/submodules/AsyncDisplayKit/Tests/ReferenceImages_iOS_10/ASTextNode2SnapshotTests/testTextTruncationModes_ASTextNode2_NSLineBreakByWordWrapping_3Lines@2x.png deleted file mode 100644 index f9248c2ecb..0000000000 Binary files a/submodules/AsyncDisplayKit/Tests/ReferenceImages_iOS_10/ASTextNode2SnapshotTests/testTextTruncationModes_ASTextNode2_NSLineBreakByWordWrapping_3Lines@2x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/Tests/ReferenceImages_iOS_10/ASTextNode2SnapshotTests/testThatSlowPathTruncationWorks_ASTextNode2@2x.png b/submodules/AsyncDisplayKit/Tests/ReferenceImages_iOS_10/ASTextNode2SnapshotTests/testThatSlowPathTruncationWorks_ASTextNode2@2x.png deleted file mode 100644 index b8123efd43..0000000000 Binary files a/submodules/AsyncDisplayKit/Tests/ReferenceImages_iOS_10/ASTextNode2SnapshotTests/testThatSlowPathTruncationWorks_ASTextNode2@2x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/Tests/ReferenceImages_iOS_10/ASTextNodeSnapshotTests/testFontPointSizeScaling@2x.png b/submodules/AsyncDisplayKit/Tests/ReferenceImages_iOS_10/ASTextNodeSnapshotTests/testFontPointSizeScaling@2x.png deleted file mode 100644 index 111bd50048..0000000000 Binary files a/submodules/AsyncDisplayKit/Tests/ReferenceImages_iOS_10/ASTextNodeSnapshotTests/testFontPointSizeScaling@2x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/Tests/ReferenceImages_iOS_10/ASTextNodeSnapshotTests/testShadowing@2x.png b/submodules/AsyncDisplayKit/Tests/ReferenceImages_iOS_10/ASTextNodeSnapshotTests/testShadowing@2x.png deleted file mode 100644 index edb68c14aa..0000000000 Binary files a/submodules/AsyncDisplayKit/Tests/ReferenceImages_iOS_10/ASTextNodeSnapshotTests/testShadowing@2x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/Tests/ReferenceImages_iOS_10/ASTextNodeSnapshotTests/testTextContainerInset2@2x.png b/submodules/AsyncDisplayKit/Tests/ReferenceImages_iOS_10/ASTextNodeSnapshotTests/testTextContainerInset2@2x.png deleted file mode 100644 index d66bb3bce9..0000000000 Binary files a/submodules/AsyncDisplayKit/Tests/ReferenceImages_iOS_10/ASTextNodeSnapshotTests/testTextContainerInset2@2x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/Tests/ReferenceImages_iOS_10/ASTextNodeSnapshotTests/testTextContainerInset@2x.png b/submodules/AsyncDisplayKit/Tests/ReferenceImages_iOS_10/ASTextNodeSnapshotTests/testTextContainerInset@2x.png deleted file mode 100644 index d66bb3bce9..0000000000 Binary files a/submodules/AsyncDisplayKit/Tests/ReferenceImages_iOS_10/ASTextNodeSnapshotTests/testTextContainerInset@2x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/Tests/ReferenceImages_iOS_10/ASTextNodeSnapshotTests/testTextContainerInsetHighlight@2x.png b/submodules/AsyncDisplayKit/Tests/ReferenceImages_iOS_10/ASTextNodeSnapshotTests/testTextContainerInsetHighlight@2x.png deleted file mode 100644 index 01234cff97..0000000000 Binary files a/submodules/AsyncDisplayKit/Tests/ReferenceImages_iOS_10/ASTextNodeSnapshotTests/testTextContainerInsetHighlight@2x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/Tests/ReferenceImages_iOS_10/ASTextNodeSnapshotTests/testTextContainerInsetIsIncludedWithSmallerConstrainedSize@2x.png b/submodules/AsyncDisplayKit/Tests/ReferenceImages_iOS_10/ASTextNodeSnapshotTests/testTextContainerInsetIsIncludedWithSmallerConstrainedSize@2x.png deleted file mode 100644 index 65c801d4df..0000000000 Binary files a/submodules/AsyncDisplayKit/Tests/ReferenceImages_iOS_10/ASTextNodeSnapshotTests/testTextContainerInsetIsIncludedWithSmallerConstrainedSize@2x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/Tests/ReferenceImages_iOS_10/ASTextNodeSnapshotTests/testThatFastPathTruncationWorks@2x.png b/submodules/AsyncDisplayKit/Tests/ReferenceImages_iOS_10/ASTextNodeSnapshotTests/testThatFastPathTruncationWorks@2x.png deleted file mode 100644 index 37b5444efa..0000000000 Binary files a/submodules/AsyncDisplayKit/Tests/ReferenceImages_iOS_10/ASTextNodeSnapshotTests/testThatFastPathTruncationWorks@2x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/Tests/ReferenceImages_iOS_10/ASTextNodeSnapshotTests/testThatSlowPathTruncationWorks@2x.png b/submodules/AsyncDisplayKit/Tests/ReferenceImages_iOS_10/ASTextNodeSnapshotTests/testThatSlowPathTruncationWorks@2x.png deleted file mode 100644 index 18de8b27fe..0000000000 Binary files a/submodules/AsyncDisplayKit/Tests/ReferenceImages_iOS_10/ASTextNodeSnapshotTests/testThatSlowPathTruncationWorks@2x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/Tests/ReferenceImages_iOS_10/ASTextNodeSnapshotTests/testThatTruncationTokenAttributesPrecedeThoseInheritedFromTextWhenTruncateTailMode@2x.png b/submodules/AsyncDisplayKit/Tests/ReferenceImages_iOS_10/ASTextNodeSnapshotTests/testThatTruncationTokenAttributesPrecedeThoseInheritedFromTextWhenTruncateTailMode@2x.png deleted file mode 100644 index 40351ad62b..0000000000 Binary files a/submodules/AsyncDisplayKit/Tests/ReferenceImages_iOS_10/ASTextNodeSnapshotTests/testThatTruncationTokenAttributesPrecedeThoseInheritedFromTextWhenTruncateTailMode@2x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/Tests/TestHost/AppDelegate.h b/submodules/AsyncDisplayKit/Tests/TestHost/AppDelegate.h deleted file mode 100644 index 1cdc488736..0000000000 --- a/submodules/AsyncDisplayKit/Tests/TestHost/AppDelegate.h +++ /dev/null @@ -1,14 +0,0 @@ -// -// AppDelegate.h -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -@interface AppDelegate : UIResponder - -@end diff --git a/submodules/AsyncDisplayKit/Tests/TestHost/AppDelegate.mm b/submodules/AsyncDisplayKit/Tests/TestHost/AppDelegate.mm deleted file mode 100644 index 91dc913326..0000000000 --- a/submodules/AsyncDisplayKit/Tests/TestHost/AppDelegate.mm +++ /dev/null @@ -1,14 +0,0 @@ -// -// AppDelegate.mm -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import "AppDelegate.h" - -@implementation AppDelegate - -@end diff --git a/submodules/AsyncDisplayKit/Tests/TestHost/Default-568h@2x.png b/submodules/AsyncDisplayKit/Tests/TestHost/Default-568h@2x.png deleted file mode 100644 index 1547a98454..0000000000 Binary files a/submodules/AsyncDisplayKit/Tests/TestHost/Default-568h@2x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/Tests/TestHost/Info.plist b/submodules/AsyncDisplayKit/Tests/TestHost/Info.plist deleted file mode 100644 index ed1c9acf9b..0000000000 --- a/submodules/AsyncDisplayKit/Tests/TestHost/Info.plist +++ /dev/null @@ -1,41 +0,0 @@ - - - - - CFBundleDevelopmentRegion - en - CFBundleExecutable - $(EXECUTABLE_NAME) - CFBundleIdentifier - $(PRODUCT_BUNDLE_IDENTIFIER) - CFBundleInfoDictionaryVersion - 6.0 - CFBundleName - $(PRODUCT_NAME) - CFBundlePackageType - APPL - CFBundleShortVersionString - 1.0 - CFBundleSignature - ???? - CFBundleVersion - 1 - LSRequiresIPhoneOS - - NSAppTransportSecurity - - NSAllowsArbitraryLoads - - - UIRequiredDeviceCapabilities - - armv7 - - UISupportedInterfaceOrientations - - UIInterfaceOrientationPortrait - UIInterfaceOrientationLandscapeLeft - UIInterfaceOrientationLandscapeRight - - - diff --git a/submodules/AsyncDisplayKit/Tests/TestHost/main.mm b/submodules/AsyncDisplayKit/Tests/TestHost/main.mm deleted file mode 100644 index 50a9e3ad6a..0000000000 --- a/submodules/AsyncDisplayKit/Tests/TestHost/main.mm +++ /dev/null @@ -1,17 +0,0 @@ -// -// main.mm -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import -#import "AppDelegate.h" - -int main(int argc, char * argv[]) { - @autoreleasepool { - return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); - } -} diff --git a/submodules/AsyncDisplayKit/Tests/TestResources/ASThrashTestRecordedCase b/submodules/AsyncDisplayKit/Tests/TestResources/ASThrashTestRecordedCase deleted file mode 100644 index e9dc1e9cc0..0000000000 --- a/submodules/AsyncDisplayKit/Tests/TestResources/ASThrashTestRecordedCase +++ /dev/null @@ -1 +0,0 @@ -YnBsaXN0MDDUAAEAAgADAAQABQAGAagBqVgkdmVyc2lvblgkb2JqZWN0c1kkYXJjaGl2ZXJUJHRvcBIAAYagrxBrAAcACAAPAC0ALgAvADAAMQAyADMANAA1ADYANwA4ADkAPABEAEoATwBWAFkAXABeAGEAaQBsAG8AcgB1AHgAgACGAI4AkgCWAJkAnACfAKIApgCqALIAtQC4ALsAvgDBAMUAzQDQANMA1gDZANwA4ADoAOsA7gDxAPQA9wD7AQMBBgEJAQwBDwESARQBGwEeAScBKgEuATYBOQE8AT8BQgFFAUgBUAFTAVwBXwFhAWkBawFtAW8BcQFzAXsBfQF/AYEBgwGFAYwBkAGTAZYBmgGcAaABpFUkbnVsbNMACQAKAAsADAANAA5VX2RpY3RYX3ZlcnNpb25WJGNsYXNzgAIQAYBq0wAQABEACwASAB8ALFdOUy5rZXlzWk5TLm9iamVjdHOsABMAFAAVABYAFwAYABkAGgAbABwAHQAegAOABIAFgAaAB4AIgAmACoALgAyADYAOrAAgACEAIgAjACQAJQAmACcAKAApACoAK4APgBGAE4AYgB6ARYBVgFaAXIBigGeAaIBpXxAQaW5zZXJ0ZWRTZWN0aW9uc18QFnJlcGxhY2VkU2VjdGlvbkluZGV4ZXNfEBNpbnNlcnRlZEl0ZW1JbmRleGVzXnJlcGxhY2luZ0l0ZW1zV29sZERhdGFUZGF0YV8QFmluc2VydGVkU2VjdGlvbkluZGV4ZXNfEBJkZWxldGVkSXRlbUluZGV4ZXNfEBNyZXBsYWNlZEl0ZW1JbmRleGVzXWluc2VydGVkSXRlbXNfEBVkZWxldGVkU2VjdGlvbkluZGV4ZXNfEBFyZXBsYWNpbmdTZWN0aW9uc9IAEQALADoAO6CAENIAPQA+AD8AQFokY2xhc3NuYW1lWCRjbGFzc2VzXk5TTXV0YWJsZUFycmF5owBBAEIAQ15OU011dGFibGVBcnJheVdOU0FycmF5WE5TT2JqZWN01ABFAAsARgBHAEgASQANAA1aTlNMb2NhdGlvblxOU1JhbmdlQ291bnRYTlNMZW5ndGgQAoAS0gA9AD4ASwBMXxARTlNNdXRhYmxlSW5kZXhTZXSjAE0ATgBDXxARTlNNdXRhYmxlSW5kZXhTZXRaTlNJbmRleFNldNIAEQALAFAAO6QAUQBSAFMAVIAUgBWAFoAXgBDUAEUACwBGAEcAVwBJAA0ADRADgBLSAEYACwBaAEkQAIAS0gBGAAsAWgBJgBLUAEUACwBGAEcAXwBJAA0ADRAEgBLSABEACwBiADulAGMAZABlAGYAZ4AZgBqAG4AcgB2AENIAEQALAGoAO6CAENIAEQALAG0AO6CAENIAEQALAHAAO6CAENIAEQALAHMAO6CAENIAEQALAHYAO6CAENIAEQALAHkAf6UAegB7AHwAfQB+gB+AKIAvgDaAPYBE0wCBAIIACwCDAIQAhVVpdGVtc1lzZWN0aW9uSUSAIBEBhYAn0gARAAsAhwA7pQCIAIkAigCLAIyAIYAjgCSAJYAmgBDSAI8ACwCQAJFWaXRlbUlEEQJogCLSAD0APgCTAJRfEBBBU1RocmFzaFRlc3RJdGVtogCVAENfEBBBU1RocmFzaFRlc3RJdGVt0gCPAAsAlwCREQJpgCLSAI8ACwCaAJERAmqAItIAjwALAJ0AkRECa4Ai0gCPAAsAoACREQJsgCLSAD0APgCjAKRfEBNBU1RocmFzaFRlc3RTZWN0aW9uogClAENfEBNBU1RocmFzaFRlc3RTZWN0aW9u0wCBAIIACwCnAKgAhYApEQGGgCfSABEACwCrADulAKwArQCuAK8AsIAqgCuALIAtgC6AENIAjwALALMAkRECbYAi0gCPAAsAtgCREQJugCLSAI8ACwC5AJERAm+AItIAjwALALwAkRECcIAi0gCPAAsAvwCREQJxgCLTAIEAggALAMIAwwCFgDARAYeAJ9IAEQALAMYAO6UAxwDIAMkAygDLgDGAMoAzgDSANYAQ0gCPAAsAzgCREQJygCLSAI8ACwDRAJERAnOAItIAjwALANQAkRECdIAi0gCPAAsA1wCREQJ1gCLSAI8ACwDaAJERAnaAItMAgQCCAAsA3QDeAIWANxEBiIAn0gARAAsA4QA7pQDiAOMA5ADlAOaAOIA5gDqAO4A8gBDSAI8ACwDpAJERAneAItIAjwALAOwAkRECeIAi0gCPAAsA7wCREQJ5gCLSAI8ACwDyAJERAnqAItIAjwALAPUAkRECe4Ai0wCBAIIACwD4APkAhYA+EQGJgCfSABEACwD8ADulAP0A/gD/AQABAYA/gECAQYBCgEOAENIAjwALAQQAkRECfIAi0gCPAAsBBwCREQJ9gCLSAI8ACwEKAJERAn6AItIAjwALAQ0AkRECf4Ai0gCPAAsBEACREQKAgCLSAD0APgBCAROiAEIAQ9IAEQALARUAO6QBFgEXARgBGYBGgEmAUIBSgBDTAIEAggALARwAqACFgEeAJ9IAEQALAR8AO6YArACtAK4BIwCvALCAKoArgCyASIAtgC6AENIAjwALASgAkREChoAi0wCBAIIACwErASwAhYBKEQGZgCfSABEACwEvADulATABMQEyATMBNIBLgEyATYBOgE+AENIAjwALATcAkRECgYAi0gCPAAsBOgCREQKCgCLSAI8ACwE9AJERAoOAItIAjwALAUAAkREChIAi0gCPAAsBQwCREQKFgCLTAIEAggALAUYA3gCFgFGAJ9IAEQALAUkAO6UA4gDjAOQA5QDmgDiAOYA6gDuAPIAQ0wCBAIIACwFRAPkAhYBTgCfSABEACwFUADumAP0A/gD/AQABWQEBgD+AQIBBgEKAVIBDgBDSAI8ACwFdAJERAoeAItIARgALAFoASYAS0gARAAsBYgA7pQFjAWQBZQFmAWeAV4BYgFmAWoBbgBDSAEYACwBaAEmAEtIARgALAFoASYAS0gBGAAsAWgBJgBLSAEYACwBaAEmAEtIARgALAFoASYAS0gARAAsBdAA7pQF1AXYBdwF4AXmAXYBegF+AYIBhgBDSAEYACwBaAEmAEtIARgALAFoASYAS0gBGAAsAWgBJgBLSAEYACwBaAEmAEtIARgALAFoASYAS0gARAAsBhgA7pAGHAYgBiQGKgGOAZIBlgGaAENIAEQALAY0AO6EBI4BIgBDSABEACwGRAH+ggETSABEACwGUADuggBDSABEACwGXADuhAVmAVIAQ1ABFAAsARgBHAFoASQANAA2AEtIAEQALAZ0AO6EBF4BJgBDSAD0APgGhAaJcTlNEaWN0aW9uYXJ5ogGjAENcTlNEaWN0aW9uYXJ50gA9AD4BpQGmXkFTVGhyYXNoVXBkYXRlogGnAENeQVNUaHJhc2hVcGRhdGVfEA9OU0tleWVkQXJjaGl2ZXLRAaoBq1Ryb290gAEACAAZACIAKwA1ADoAPwEYAR4BKwExAToBQQFDAUUBRwFUAVwBZwGAAYIBhAGGAYgBigGMAY4BkAGSAZQBlgGYAbEBswG1AbcBuQG7Ab0BvwHBAcMBxQHHAckBywHeAfcCDQIcAiQCKQJCAlcCbQJ7ApMCpwKwArECswK8AscC0ALfAuYC9QL9AwYDFwMiAy8DOAM6AzwDRQNZA2ADdAN/A4gDkQOTA5UDlwOZA5sDrAOuA7ADuQO7A70DxgPIA9kD2wPdA+YD8QPzA/UD9wP5A/sD/QQGBAcECQQSBBMEFQQeBB8EIQQqBCsELQQ2BDcEOQRCBE0ETwRRBFMEVQRXBFkEZgRsBHYEeAR7BH0EhgSRBJMElQSXBJkEmwSdBKYErQSwBLIEuwTOBNME5gTvBPIE9AT9BQAFAgULBQ4FEAUZBRwFHgUnBT0FQgVYBWUFZwVqBWwFdQWABYIFhAWGBYgFigWMBZUFmAWaBaMFpgWoBbEFtAW2Bb8FwgXEBc0F0AXSBd8F4QXkBeYF7wX6BfwF/gYABgIGBAYGBg8GEgYUBh0GIAYiBisGLgYwBjkGPAY+BkcGSgZMBlkGWwZeBmAGaQZ0BnYGeAZ6BnwGfgaABokGjAaOBpcGmgacBqUGqAaqBrMGtga4BsEGxAbGBtMG1QbYBtoG4wbuBvAG8gb0BvYG+Ab6BwMHBgcIBxEHFAcWBx8HIgckBy0HMAcyBzsHPgdAB0kHTgdXB2AHYgdkB2YHaAdqB3cHeQd7B4QHkQeTB5UHlweZB5sHnQefB6gHqwetB7oHvAe/B8EHygfVB9cH2QfbB90H3wfhB+oH7QfvB/gH+wf9CAYICQgLCBQIFwgZCCIIJQgnCDQINgg4CEEITAhOCFAIUghUCFYIWAhlCGcIaQhyCH8IgQiDCIUIhwiJCIsIjQiWCJkImwikCKYIrwi6CLwIvgjACMIIxAjGCM8I0QjaCNwI5QjnCPAI8gj7CP0JBgkRCRMJFQkXCRkJGwkdCSYJKAkxCTMJPAk+CUcJSQlSCVQJXQlmCWgJaglsCW4JcAl5CXwJfgmACYkJigmMCZUJlgmYCaEJpAmmCagJuQm7CcQJxwnJCcsJ1AnhCeYJ8wn8CgsKEAofCjEKNgo7AAAAAAAAAgIAAAAAAAABrAAAAAAAAAAAAAAAAAAACj0= \ No newline at end of file diff --git a/submodules/AsyncDisplayKit/Tests/TestResources/AttributedStringsFixture0.plist b/submodules/AsyncDisplayKit/Tests/TestResources/AttributedStringsFixture0.plist deleted file mode 100644 index 1d5554e472..0000000000 Binary files a/submodules/AsyncDisplayKit/Tests/TestResources/AttributedStringsFixture0.plist and /dev/null differ diff --git a/submodules/AsyncDisplayKit/Tests/TestResources/logo-square.png b/submodules/AsyncDisplayKit/Tests/TestResources/logo-square.png deleted file mode 100755 index 82ad66c69e..0000000000 Binary files a/submodules/AsyncDisplayKit/Tests/TestResources/logo-square.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/Tests/en.lproj/InfoPlist.strings b/submodules/AsyncDisplayKit/Tests/en.lproj/InfoPlist.strings deleted file mode 100644 index 477b28ff8f..0000000000 --- a/submodules/AsyncDisplayKit/Tests/en.lproj/InfoPlist.strings +++ /dev/null @@ -1,2 +0,0 @@ -/* Localized versions of Info.plist keys */ - diff --git a/submodules/AsyncDisplayKit/docs/.gitignore b/submodules/AsyncDisplayKit/docs/.gitignore deleted file mode 100755 index bd5d18888f..0000000000 --- a/submodules/AsyncDisplayKit/docs/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -_site/ - diff --git a/submodules/AsyncDisplayKit/docs/404.md b/submodules/AsyncDisplayKit/docs/404.md deleted file mode 100755 index 5c0791ac92..0000000000 --- a/submodules/AsyncDisplayKit/docs/404.md +++ /dev/null @@ -1,11 +0,0 @@ ---- -id: 4oh4 -title: Page Not Found -layout: default ---- - -# Page Not Found - -Crikey! There doesn't seem to be anything here. - -If you find a broken link, feel free to send a pull request. You can also let us know at [Github](https://github.com/texturegroup/texture/issues) so that we can fix it. diff --git a/submodules/AsyncDisplayKit/docs/CNAME b/submodules/AsyncDisplayKit/docs/CNAME deleted file mode 100755 index 80ea8a240d..0000000000 --- a/submodules/AsyncDisplayKit/docs/CNAME +++ /dev/null @@ -1 +0,0 @@ -texturegroup.org \ No newline at end of file diff --git a/submodules/AsyncDisplayKit/docs/Gemfile b/submodules/AsyncDisplayKit/docs/Gemfile deleted file mode 100755 index dec8af5008..0000000000 --- a/submodules/AsyncDisplayKit/docs/Gemfile +++ /dev/null @@ -1,5 +0,0 @@ -source 'https://rubygems.org' - -gem 'github-pages' -gem 'rouge', '~>1.7' -gem 'jekyll', '~>3.6.3' diff --git a/submodules/AsyncDisplayKit/docs/README.md b/submodules/AsyncDisplayKit/docs/README.md deleted file mode 100755 index 8c1c2ee544..0000000000 --- a/submodules/AsyncDisplayKit/docs/README.md +++ /dev/null @@ -1,31 +0,0 @@ -# Texture Documentation - -We use [Jekyll](http://jekyllrb.com/) to build the site using Markdown and host it on [Github Pages](https://pages.github.com/). - -### Dependencies - -Github Pages uses Jekyll to host a site and Jekyll has the following dependencies. - - - [Ruby](http://www.ruby-lang.org/) (version >= 2.0.0) - - [RubyGems](http://rubygems.org/) (version >= 1.3.7) - - [Bundler](http://gembundler.com/) - -Mac OS X comes pre-installed with Ruby, but you may need to update RubyGems (via `gem update --system`). -Once you have RubyGems, use it to install bundler. - -```sh -$ gem install bundler -$ cd gh-pages # Go to folder -$ bundle install # Might need sudo. -``` - -### Run Jekyll Locally - -Use Jekyll to serve the website locally (by default, at `http://localhost:4000`): - -```sh -$ bundle exec jekyll serve [--incremental] -$ open http://localhost:4000/ -``` - -For more, see https://help.github.com/articles/setting-up-your-github-pages-site-locally-with-jekyll/ diff --git a/submodules/AsyncDisplayKit/docs/_config.yml b/submodules/AsyncDisplayKit/docs/_config.yml deleted file mode 100755 index ab347c39b8..0000000000 --- a/submodules/AsyncDisplayKit/docs/_config.yml +++ /dev/null @@ -1,24 +0,0 @@ ---- -url: http://texturegroup.org -name: Texture -relative_permalinks: false -markdown: kramdown -timezone: America/Los_Angeles -google_analytics: UA-87502907-1 - -safe: true -lsi: false -highlighter: rouge - -defaults: - - - scope: - path: "" - type: "posts" - values: - layout: post - is_post: true - -collections: - docs: - output: true diff --git a/submodules/AsyncDisplayKit/docs/_data/nav_development.yml b/submodules/AsyncDisplayKit/docs/_data/nav_development.yml deleted file mode 100644 index 3a3a2597c8..0000000000 --- a/submodules/AsyncDisplayKit/docs/_data/nav_development.yml +++ /dev/null @@ -1,22 +0,0 @@ -- title: Introduction - items: - - overview - - structure - - components - - how-to-develop-and-debug -- title: Threading - items: - - threading -- title: Node Lifecycle - items: - - node-lifecycle -- title: Layout System - items: - - layout-specs - - automatic-subnode-layout - - layout-transitions -- title: Collections - items: - - collection-asynchronous-updates - - collection-animations - - cell-node-lifecycle diff --git a/submodules/AsyncDisplayKit/docs/_data/nav_docs.yml b/submodules/AsyncDisplayKit/docs/_data/nav_docs.yml deleted file mode 100755 index 6b4b7b8072..0000000000 --- a/submodules/AsyncDisplayKit/docs/_data/nav_docs.yml +++ /dev/null @@ -1,71 +0,0 @@ -- title: Quick Start - items: - - getting-started - - resources - - installation - - adoption-guide-2-0-beta1 -- title: Core Concepts - items: - - intelligent-preloading - - containers-overview - - node-overview - - subclassing - - node-lifecycle - - faq -- title: Layout - items: - - layout2-quickstart - - automatic-layout-examples-2 - - layout2-layoutspec-types - - layout2-layout-element-properties - - layout2-api-sizing - - layout-transition-api -- title: Conveniences - items: - - hit-test-slop - - batch-fetching-api - - automatic-subnode-mgmt - - inversion - - image-modification-block - - placeholder-fade-duration - - accessibility - - uicollectionviewinterop -- title: Optimizations - items: - - layer-backing - - subtree-rasterization - - synchronous-concurrency - - corner-rounding -- title: Tools - items: - - debug-tool-hit-test-visualization - - debug-tool-pixel-scaling - - debug-tool-ASRangeController -- title: Advanced Technologies - items: - - asvisibility - - asrunloopqueue -- title: Node Containers - items: - - containers-asviewcontroller - - containers-asnodecontroller - - containers-astablenode - - containers-ascollectionnode - - containers-aspagernode -- title: Nodes - items: - - display-node - - cell-node - - button-node - - text-node - - image-node - - network-image-node - - video-node - - map-node - - control-node - - scroll-node - - editable-text-node - - multiplex-image-node - - - diff --git a/submodules/AsyncDisplayKit/docs/_docs/accessibility.md b/submodules/AsyncDisplayKit/docs/_docs/accessibility.md deleted file mode 100755 index 45261003d9..0000000000 --- a/submodules/AsyncDisplayKit/docs/_docs/accessibility.md +++ /dev/null @@ -1,11 +0,0 @@ ---- -title: Accessibility -layout: docs -permalink: /docs/accessibility.html -prevPage: placeholder-fade-duration.html -nextPage: layer-backing.html ---- - -Accessibility works seamlessly in ways that even UIKit doesn’t provide. When using the powerful optimization features of Layer Backing (`.layerBacked`) and Subtree Rasterization (`.shouldRasterizeDescendants`), VoiceOver can access fine-grained metadata about each element. This is pretty amazing: `CALayer` doesn’t support accessibility, and rasterization reduces everything to a single flat image. - -The Texture team fundamentally believes in Accessibility, and invested the time to create an innovative system to make this possible with zero developer effort. As a bonus, this also allows Automated UI Testing greater access to the interface. \ No newline at end of file diff --git a/submodules/AsyncDisplayKit/docs/_docs/adoption-guide-2-0-beta1.md b/submodules/AsyncDisplayKit/docs/_docs/adoption-guide-2-0-beta1.md deleted file mode 100755 index f3c199fff3..0000000000 --- a/submodules/AsyncDisplayKit/docs/_docs/adoption-guide-2-0-beta1.md +++ /dev/null @@ -1,146 +0,0 @@ ---- -title: "Upgrading to 2.0" -layout: docs -permalink: /docs/adoption-guide-2-0-beta1.html -prevPage: adoption-guide-2-0-beta1.html ---- - -
    -
  1. GitHub Release Notes
  2. -
  3. Getting the 2.0 Release Candidate
  4. -
  5. Testing your app with 2.0
  6. -
  7. Migrating to 2.0
  8. -
  9. Migrating to 2.0 (Layout)
  10. -
- -## Release Notes - -Please read the official release notes on GitHub. - - -## Getting the Release Candidate - -Add the following to your podfile - -
-
-
-pod 'Texture', '>= 2.0'
-
-
-
- -then run - -
-
-
-pod repo update
-pod update Texture
-
-
-
- -in the terminal. - -## Testing 2.0 - -Once you have updated to 2.0, you will see many deprecation warnings. Don't worry! - -These warnings are quite safe, because we have bridged all of the old APIs for you, so that you can test out the 2.0, before migrating to the new API. - -If your app fails to build instead of just showing the warnings, you might have Warnings as Errors enabled for your project. You have a few options: - -1. Disable deprecation warnings in the Xcode project settings -2. Disable warnings as errors in the project's build settings. -3. Disable deprecation warnings in Texture. To do this, change `line 74` in `ASBaseDefines.h` to `# define ASDISPLAYNODE_WARN_DEPRECATED 0` - -Once your app builds and runs, test it to make sure everything is working normally. If you find any problems, try adopting the new API in that area and re-test. - -One key behavior change you may notice: - -- ASStackLayoutSpec's `.alignItems` property default changed to `ASStackLayoutAlignItemsStretch` instead of `ASStackLayoutAlignItemsStart`. This may cause distortion in your UI. - -If you still have issues, please file a GitHub issue and we'd be happy to help you out! - -## Migrating to 2.0 - -Once your app is working, it's time to start converting! - -A full API changelog from `1.9.92` to `2.0-beta.1` is available here. - -#### ASDisplayNode Changes - -- ASDisplayNode's `.usesImplicitHierarchyManagement` has been renamed to `.automaticallyManagesSubnodes`. The Automatic Subnode Management API has been moved out of Beta, but has a few documented [limitations](). - -- ASDisplayNode's `-cancelLayoutTransitionsInProgress` has been renamed to `-cancelLayoutTransition`. The Layout Transition API has been moved out of Beta. Significant new functionality is planed for future dot releases. - - -#### Updated Interface State Callback Methods - -The new method names are meant to unify the range update methods to show how they relate to each other and be a bit more self-explanatory: - -- `didEnterPreloadState / didExitPreloadState` -- `didEnterDisplayState / didExitDisplayState` -- `didEnterVisibleState / didExitVisibleState` - -These new methods replace the following: - -- `loadStateDidChange:(BOOL)inLoadState` -- `displayStateDidChange:(BOOL)inDisplayState` -- `visibleStateDidChange:(BOOL)isVisible` - -#### Collection / Table API Updates - -Texture's collection and table APIs have been moved from the view space (`collectionView`, `tableView`) to the node space (`collectionNode`, `tableNode`). - -- Search your project for `tableView` and `collectionView`. Most, if not all, of the data source / delegate methods have new node versions. - -It is important that developers using Texture understand that an ASCollectionNode is backed by an ASCollectionView (a subclass of UICollectionView). ASCollectionNode runs asynchronously, so calling -numberOfRowsInSection on the collectionNode is different than calling it on the collectionView. - -For example, let's say you have an empty table. You insert `100` rows and then immediately call -tableView:numberOfRowsInSection. This will return `0` rows. If you call -waitUntilAllUpdatesAreCommitted after insertion (waits until the collectionNode synchronizes with the collectionView), you will get 100, _but_ you might block the main thread. A good developer should rarely (or never) need to use -waitUntilAllUpdatesAreCommitted. If you update the collectionNode and then need to read back immediately, you should use the collectionNode API. You shouldn't need to talk to the collectionView. - -As a rule of thumb, use the collection / table node API for everything, unless the API is not available on the collectionNode. - -To summarize, any `indexPath` that is passed to the `collectionView` space references data that has been synced with `ASCollectionNode`'s underlying `UICollectionView`. Conversly, any `indexPath` that is passed to the `collectionNode` space references asynchronous data that *might not yet* have been synced with ASCollectionNode's underlying `UICollectionView`. The same concepts apply to `ASTableNode`. - -An exception to this is `ASTableNode`'s `-didSelectRowAtIndexPath:`, which is called in UIKit space to make sure that `indexPath` indicies reference the data in the onscreen (data that has been synced to the underlying `UICollectionView` `dataSource`). - -While previous versions of the framework required the developer to be aware of the asynchronous interplay between `ASCollectionNode` and its underlying `UICollectionView`, this new API should provide better safegaurds against developer-introduced data source inconsistencies. - -Other updates include: - -- Deprecate `ASTableView`'s -init method. Please use `ASTableNode` instead of `ASTableView`. While this makes adopting the framework marginally more difficult to, the benefits of using ASTableNode / ASCollectionNode over their ASTableView / ASCollectionView counterparts are signficant. - -- Deprecate `-beginUpdates` and `-endUpdatesAnimated:`. Please use the `-performBatchUpdates:` methods instead. - -- Deprecate `-reloadDataImmediately`. Please see the header file comments for the deprecation solution. - -- Moved range tuning to the `tableNode` / `collectionNode` (from the `tableView` / `collectionView`) - -- `constrainedSizeForNodeAtIndexPath:` moved from the `.dataSource` to the `.delegate` to be consistent with UIKit definitions of the roles. **Note:** Make sure that you provide a delegate for any `ASTableNode`, `ASCollectionNode` or `ASPagerNodes` that use this method. Your code will silently not call your delegate method, if you do not have a delegate assigned. - -- Renamed `pagerNode:constrainedSizeForNodeAtIndexPath:` to `pagerNode:constrainedSizeForNodeAtIndex:` - -- collection view update validation assertions are now enabled. If you see something like `"Invalid number of items in section 2. The number of items after the update (7) must be equal to the number of items before the update (4) plus or minus the number of items inserted or removed from the section (4 inserted, 0 removed)"`, please check the data source logic. If you have any questions, reach out to us on GitHub. - -Best Practices: - -- Use node blocks if possible. These are run in parallel on a background thread, resulting in 10x performance gains. -- Use nodes to store things about your rows. -- Make sure to batch updates that need to be batched. - -Resources: - -- [Video](https://youtu.be/yuDqvE5n_1g) of the ASCollectionNode Behind-the-Scenes talk at Pinterest. The diagrams seen in the talk. - -- PR [#2390](https://github.com/facebook/AsyncDisplayKit/pull/2390) and PR [#2381](https://github.com/facebook/AsyncDisplayKit/pull/2381) show how we converted AsyncDisplayKit's [example projects](https://github.com/texturegroup/texture/tree/master/examples) to conform to this new API. - - -#### Layout API Updates - -Please read the separate Layout 2.0 Conversion Guide for an overview of the upgrades and to see how to convert your existing layout code. - -#### Help us out - -If we're missing something from this list, please let us know or edit this doc for us (GitHub edit link at the top of page)! diff --git a/submodules/AsyncDisplayKit/docs/_docs/apidiff-1992-to-20beta1.md b/submodules/AsyncDisplayKit/docs/_docs/apidiff-1992-to-20beta1.md deleted file mode 100755 index bc681276fd..0000000000 --- a/submodules/AsyncDisplayKit/docs/_docs/apidiff-1992-to-20beta1.md +++ /dev/null @@ -1,7 +0,0 @@ ---- -title: API Diff -layout: apidiff -permalink: /docs/apidiff-1992-to-20beta1.html ---- - - diff --git a/submodules/AsyncDisplayKit/docs/_docs/appledocs.md b/submodules/AsyncDisplayKit/docs/_docs/appledocs.md deleted file mode 100755 index 4b466e9928..0000000000 --- a/submodules/AsyncDisplayKit/docs/_docs/appledocs.md +++ /dev/null @@ -1,9 +0,0 @@ - ---- -title: api -layout: docs -permalink: /docs/appledocs.html ---- - -

hi

- \ No newline at end of file diff --git a/submodules/AsyncDisplayKit/docs/_docs/asenvironment.md b/submodules/AsyncDisplayKit/docs/_docs/asenvironment.md deleted file mode 100755 index c749cd0802..0000000000 --- a/submodules/AsyncDisplayKit/docs/_docs/asenvironment.md +++ /dev/null @@ -1,19 +0,0 @@ ---- -title: ASEnvironment -layout: docs -permalink: /docs/asenvironment.html -prevPage: asvisibility.html -nextPage: asrunloopqueue.html ---- - -`ASEnvironment` is a performant and scalable way to enable upward and downward propagation of information throughout the node hierarchy. It stores a variety of critical “environmental” metadata, like the trait collection, interface state, hierarchy state, and more. - -Any object that conforms to the `` protocol can propagate specific states defined in an `ASEnvironmentState` up and/or down the ASEnvironment tree. To define how merges of States should happen, specific merge functions can be provided. - -Compared to UIKit, this system is very efficient and one of the reasons why nodes are much lighter weight than UIViews. This is achieved by using simple structures to store data rather than creating objects. For example, `UITraitCollection` is an object, but `ASEnvironmentTraitCollection` is just a struct. - -This means that whenever a node needs to query something about its environment, for example to check its [interface state](http://texturegroup.org/docs/intelligent-preloading.html#interface-state-ranges), instead of climbing the entire tree or checking all of its children, it can go to one spot and read the value that was propogated to it. - -A key operating principle of ASEnvironment is to update values when new subnodes are added or removed. - -ASEnvironment powers many of the most valuable features of Texture. **There is no public API available at this time.** diff --git a/submodules/AsyncDisplayKit/docs/_docs/asrunloopqueue.md b/submodules/AsyncDisplayKit/docs/_docs/asrunloopqueue.md deleted file mode 100755 index f40f532ed8..0000000000 --- a/submodules/AsyncDisplayKit/docs/_docs/asrunloopqueue.md +++ /dev/null @@ -1,14 +0,0 @@ ---- -title: ASRunLoopQueue -layout: docs -permalink: /docs/asrunloopqueue.html -prevPage: asvisibility.html ---- - -Even with main thread work, Texture is able to dramatically reduce its impact on the user experience by way of the rather amazing ASRunLoopQueue. - -`ASRunloopQueue` breaks up operations that must be performed on the main thread into far smaller chunks, easily 1/10th of the size that they otherwise would be, so that operation such as allocating UIViews or even destroying objects can be spread out and allow the run loops to more frequently turn. This more periodic turning allows the device to much more frequently check if a user touch has started or if an animation timer requires a new frame to be drawn, allowing far greater responsiveness even when the device is very busy and processing a large queue of main thread work. - -It's a longer discussion why this kind of technique is extremely challenging to implement with `UIKit`, but it has to do with the fact that `Texture` prepares content in advance, giving it a buffer of time where it can spread out the creation of these objects in tiny chunks. If it doesn't finish by the time it needs to be on screen, then it finishes the rest of what needs to be created in a single chunk. `UIKit` has no similar mechanisms to create things in advance, and there is always just one huge chunk as a view controller or cell needs to come on screen. - -**ASRunLoopQueue is enabled by default when running Texture.** A developer does not need to be aware of it's existence except to know that it helps reduce main thread blockage. diff --git a/submodules/AsyncDisplayKit/docs/_docs/asviewcontroller.md b/submodules/AsyncDisplayKit/docs/_docs/asviewcontroller.md deleted file mode 100755 index 9cba5be9e5..0000000000 --- a/submodules/AsyncDisplayKit/docs/_docs/asviewcontroller.md +++ /dev/null @@ -1,55 +0,0 @@ ---- -title: ASViewController -layout: docs -permalink: /docs/asviewcontroller.html -prevPage: -nextPage: aspagernode.html ---- - -`ASViewController` is a direct subclass of `UIViewController`. For the most part, it can be used in place of any `UIViewController` relatively easily. - -The main difference is that you construct and return the node you'd like managed as opposed to the way `UIViewController` provides a view of its own. - -Consider the following `ASViewController` subclass that would like to use a custom table node as its managed node. - -
-SwiftObjective-C -
-
-- (instancetype)initWithModel:(NSArray *)models
-{
-    ASTableNode *tableNode = [[ASTableNode alloc] initWithStyle:UITableViewStylePlain];
-
-    if (!(self = [super initWithNode:tableNode])) { return nil; }
-
-    self.models = models;
-    
-    self.tableNode = tableNode;
-    self.tableNode.dataSource = self;
-    
-    return self;
-}
-
- - -
-
- -The most important line is: - -`if (!(self = [super initWithNode:tableNode])) { return nil; }` - -As you can see, `ASViewController`'s are initialized with a node of your choosing. diff --git a/submodules/AsyncDisplayKit/docs/_docs/asvisibility.md b/submodules/AsyncDisplayKit/docs/_docs/asvisibility.md deleted file mode 100755 index 6ca8ef2de8..0000000000 --- a/submodules/AsyncDisplayKit/docs/_docs/asvisibility.md +++ /dev/null @@ -1,15 +0,0 @@ ---- -title: ASVisibility -layout: docs -permalink: /docs/asvisibility.html -prevPage: debug-tool-ASRangeController.html -nextPage: asenvironment.html ---- - -`ASNavigationController` and `ASTabBarController` both implement the `ASVisibility` protocol. These classes can be used even without `ASDisplayNodes`, making them suitable base classes for your inheritance hierarchy. For any child view controllers that are `ASViewControllers`, these classes know the exact number of user taps it would take to make the view controller visible (0 if currently visible). - -Knowing a view controller’s visibility depth allows view controllers to automatically take appropriate actions as a user approaches or leaves them. Non-default tabs in an app might preload some of their data; a controller 3 levels deep in a navigation stack might progressively free memory for images, text, and fetched data as it gets deeper. - -Any container view controller can implement a simple protocol to integrate with the system. For example, `ASNavigationController` will return a visibility depth of it's own `visibilityDepth` + 1 for a view controller that would be revealed by tapping the back button once. - -You can opt into some of this behavior automatically by enabling `automaticallyAdjustRangeModeBasedOnViewEvents` on `ASViewController`s. With this enabled, if either the view controller or its node conform to `ASRangeControllerUpdateRangeProtocol` (`ASCollectionNode` and `ASTableNode` do by default), the ranges will automatically be decreased as the visibility depth increases to save memory. diff --git a/submodules/AsyncDisplayKit/docs/_docs/automatic-layout-basics.md b/submodules/AsyncDisplayKit/docs/_docs/automatic-layout-basics.md deleted file mode 100755 index 128a1040d4..0000000000 --- a/submodules/AsyncDisplayKit/docs/_docs/automatic-layout-basics.md +++ /dev/null @@ -1,36 +0,0 @@ ---- -title: Layout Basics -layout: docs -permalink: /docs/automatic-layout-basics.html -prevPage: scroll-node.html -nextPage: automatic-layout-containers.html ---- - -## Box Model Layout - -ASLayout is an automatic, asynchronous, purely Objective-C box model layout feature. It is a simplified version of CSS flex box, loosely inspired by ComponentKit’s Layout. It is designed to make your layouts extensible and reusable. - -`UIView` instances store position and size in their `center` and `bounds` properties. As constraints change, Core Animation performs a layout pass to call `layoutSubviews`, asking views to update these properties on their subviews. - -`` instances (all ASDisplayNodes and subclasses) do not have any size or position information. Instead, Texture calls the `layoutSpecThatFits:` method with a given size constraint and the component must return a structure describing both its size, and the position and sizes of its children. - -## Terminology - -The terminology is a bit confusing, so here is a brief description of all of the Texture automatic layout players: - -Items that conform to the **\ protocol** declares a method for measuring the layout of an object. A layout is defined by an ASLayout return value, and must specify 1) the size (but not position) of the layoutable object, and 2) the size and position of all of its immediate child objects. The tree recursion is driven by parents requesting layouts from their children in order to determine their size, followed by the parents setting the position of the children once the size is known. - -This protocol also implements a "family" of layoutable protocols - the `AS{*}LayoutSpec` protocols. These protocols contain layout options that can be used for specific layout specs. For example, `ASStackLayoutSpec` has options defining how a layoutable should shrink or grow based upon available space. These layout options are all stored in an `ASLayoutOptions` class (that is defined in `ASLayoutablePrivate`). Generally you needn't worry about the layout options class, as the layoutable protocols allow all direct access to the options via convenience properties. If you are creating custom layout spec, then you can extend the backing layout options class to accommodate any new layout options. - -All ASDisplayNodes and subclasses as well as the `ASLayoutSpecs` conform to this protocol. - -An **`ASLayoutSpec`** is an immutable object that describes a layout. Creation of a layout spec should only happen by a user in layoutSpecThatFits:. During that method, a layout spec can be created and mutated. Once it is passed back to Texture, the isMutable flag will be set to NO and any further mutations will cause an assert. - -Every ASLayoutSpec must act on at least one child. The ASLayoutSpec has the responsibility of holding on to the spec children. Some layout specs, like ASInsetLayoutSpec, only require a single child. Others, have multiple. - -You don’t need to be aware of **`ASLayout`** except to know that it represents a computed immutable layout tree and is returned by objects conforming to the `` protocol. - -## Layout for UIKit Components: -- for UIViews that are added directly, you will still need to manually lay it out in `didLoad:` -- for UIViews that are added via `[ASDisplayNode initWithViewBlock:]` or its variants, you can then include it in `layoutSpecThatFits:` - diff --git a/submodules/AsyncDisplayKit/docs/_docs/automatic-layout-containers.md b/submodules/AsyncDisplayKit/docs/_docs/automatic-layout-containers.md deleted file mode 100755 index b612b37c78..0000000000 --- a/submodules/AsyncDisplayKit/docs/_docs/automatic-layout-containers.md +++ /dev/null @@ -1,192 +0,0 @@ ---- -title: LayoutSpecs -layout: docs -permalink: /docs/automatic-layout-containers.html -prevPage: scroll-node.html -nextPage: layout-api-debugging.html ---- - -Texture includes a library of `layoutSpec` components that can be composed to declaratively specify a layout. - -The **child(ren) of a layoutSpec may be a node, a layoutSpec or a combination of the two types.** In the below image, an `ASStackLayoutSpec` (vertical) containing a text node and an image node, is wrapped in another `ASStackLayoutSpec` (horizontal) with another text node. - - - -Both nodes and layoutSpecs conform to the `` protocol. Any `ASLayoutable` object may be the child of a layoutSpec. ASLayoutable properties may be applied to `ASLayoutable` objects to create complex UI designs. - -### Single Child layoutSpecs - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
LayoutSpecDescription
ASInsetLayoutSpec

Applies an inset margin around a component.

The object that is being inset must have an intrinsic size.

ASOverlayLayoutSpec

Lays out a component, stretching another component on top of it as an overlay.

The underlay object must have an intrinsic size. Additionally, the order in which subnodes are added matters for this layoutSpec; the overlay object must be added as a subnode to the parent node after the underlay object.

ASBackgroundLayoutSpec

Lays out a component, stretching another component behind it as a backdrop.

The foreground object must have an intrinsic size. The order in which subnodes are added matters for this layoutSpec; the background object must be added as a subnode to the parent node before the foreground object.

ASCenterLayoutSpec

Centers a component in the available space.

The ASCenterLayoutSpec must have an intrinisic size.

ASRatioLayoutSpec

Lays out a component at a fixed aspect ratio (which can be scaled).

This spec is great for objects that do not have an intrinisic size, such as ASNetworkImageNodes and ASVideoNodes.

ASRelativeLayoutSpec

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.

ASLayoutSpec

Can be used as a spacer in a stack spec with other children, when .flexGrow and/or .flexShrink is applied.

This class can also be subclassed to create custom layout specs - advanced Texture only!

- -### Multiple Child(ren) layoutSpecs - -The following layoutSpecs may contain one or more children. - - - - - - - - - - - - - - -
LayoutSpecDescription
ASStackLayoutSpec

Allows you to stack components vertically or horizontally and specify how they should be flexed and aligned to fit in the available space.

This is the most common layoutSpec.

ASStaticLayoutSpecAllows positioning children at fixed offsets using the .sizeRange and .layoutPosition ASLayoutable properties.
- -### ASLayoutable Properties - -The following properties can be applied to both nodes _and_ `layoutSpec`s; both conform to the `ASLayoutable` protocol. - -### ASStackLayoutable Properties - -The following properties may be set on any node or `layoutSpec`s, but will only apply to those who are a **child of a stack** `layoutSpec`. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
PropertyDescription
CGFloat .spacingBeforeAdditional space to place before this object in the stacking direction.
CGFloat .spacingAfterAdditional space to place after this object in the stacking direction.
BOOL .flexGrowIf the sum of childrens' stack dimensions is less than the minimum size, should this object grow? Used when attached to a stack layout.
BOOL .flexShrinkIf the sum of childrens' stack dimensions is greater than the maximum size, should this object shrink? Used when attached to a stack layout.
ASRelativeDimension .flexBasisSpecifies the initial size for this object, in the stack dimension (horizontal or vertical), before the flexGrow or flexShrink properties are applied and the remaining space is distributed.
ASStackLayoutAlignSelf alignSelfOrientation of the object along cross axis, overriding alignItems. Used when attached to a stack layout.
CGFloat .ascenderUsed for baseline alignment. The distance from the top of the object to its baseline.
CGFloat .descenderUsed for baseline alignment. The distance from the baseline of the object to its bottom.
- -### ASStaticLayoutable Properties - -The following properties may be set on any node or `layoutSpec`s, but will only apply to those who are a **child of a static** `layoutSpec`. - - - - - - - - - - - - - - -
PropertyDescription
.sizeRangeIf specified, the child's size is restricted according to this ASRelativeSizeRange. Percentages are resolved relative to the static layout spec.
.layoutPositionThe CGPoint position of this object within its parent spec.
- -### Providing Intrinsic Sizes for Leaf Nodes - -Texture's layout is recursive, starting at the layoutSpec returned from `layoutSpecThatFits:` and proceeding down until it reaches the leaf nodes included in any nested `layoutSpec`s. - -Some leaf nodes provide their own intrinsic size, such as `ASTextNode` or `ASImageNode`. An attributed string or an image have their own sizes. Other leaf nodes require an intrinsic size to be set. - -**Nodes that require the developer to provide an intrinsic size:** - - - `ASDisplayNode` custom subclasses may provide their intrinisc size by implementing `calculateSizeThatFits:`. - - `ASNetworkImageNode` or `ASMultiplexImageNode` have no intrinsic size until the image is downloaded. - - `ASVideoNode` or `ASVideoNodePlayer` have no intrinsic size until the video is downloaded. - - -To provide an intrinisc size for these nodes, you can set one of the following: - - 1. implement `calculateSizeThatFits:` for **custom ASDisplayNode subclasses** only. - 2. set `.preferredFrameSize` - 3. set `.sizeRange` for children of **static** nodes only. - - -Note that `.preferredFrameSize` is not considered by `ASTextNodes`. Also, setting .sizeRange on a node will override the node's intrinisic size provided by `calculateSizeThatFits:`. - -### Common Confusions - -There are two main confusions that developers have when using layoutSpecs - - 1. Certain ASLayoutable properties only apply to children of stack nodes, while other properties only apply to children of static nodes. All ASLayoutable properties can be applied to any node or layoutSpec, however certain properties will only take effect depending on the type of the parent layoutSpec they are wrapped in. These differences are highlighted above in the ASStackLayoutable Properties and ASStaticLayoutable Properties sections. - 2. Have I set an intrinsic size for all of my leaf nodes? - - -#### I set `.flexGrow` on my node, but it doesn't grow? - -Upward propogation of `ASLayoutable` properties is currently disabled. Thus, in certain situations, the `.flexGrow` property must be manually applied to the containers. Two common examples of this that we see include: - -- a node (with `flexGrow` enabled) is wrapped in a static layoutSpec, wrapped in a stack layoutSpec. **solution**: enable `flexGrow` on the static layoutSpec as well. -- a node (with `flexGrow` enabled) is wrapped in an inset spec. **solution**: enable `flexGrow` on the inset spec as well. - - -#### I want to provide a size for my image, but I don't want to hard code the size. - -#### Why won't my stack spec span the full width? - -#### Difference between `ASInsetLayoutSpec` and `ASOverlayLayoutSpec` - -An overlay spec requires the underlay object (object to which the overlay item will be applied) to have an intrinsic size. It will center the overlay object in the middle of this area. - -An inset spec requires its object to have an intrinsic size. It adds the inset padding to this size to calculate the final size of the inset spec. - - - -### Best Practices - - Texture layout is called on a background thread. Do not access the device screen bounds, or any other UIKit methods in `layoutSpecThatFits:`. - - don't wrap everything in a staticLayoutSpec? - - avoid using preferred frame size for everything - won't respond nicely to device rotation or device sizing differences? diff --git a/submodules/AsyncDisplayKit/docs/_docs/automatic-layout-examples-2.md b/submodules/AsyncDisplayKit/docs/_docs/automatic-layout-examples-2.md deleted file mode 100755 index 07da8df131..0000000000 --- a/submodules/AsyncDisplayKit/docs/_docs/automatic-layout-examples-2.md +++ /dev/null @@ -1,264 +0,0 @@ ---- -title: Layout Examples -layout: docs -permalink: /docs/automatic-layout-examples-2.html -prevPage: layout2-quickstart.html -nextPage: layout2-layoutspec-types.html ---- - -Check out the layout specs example project to play around with the code below. - -## Simple Header with Left and Right Justified Text - - - -To create this layout, we will use a: - -- a vertical `ASStackLayoutSpec` -- a horizontal `ASStackLayoutSpec` -- `ASInsetLayoutSpec` to inset the entire header - -The diagram below shows the composition of the layout elements (nodes + layout specs). - - - -
- - Swift - Objective-C - -
-
-- (ASLayoutSpec *)layoutSpecThatFits:(ASSizeRange)constrainedSize
-{
-  // when the username / location text is too long, 
-  // shrink the stack to fit onscreen rather than push content to the right, offscreen
-  ASStackLayoutSpec *nameLocationStack = [ASStackLayoutSpec verticalStackLayoutSpec];
-  nameLocationStack.style.flexShrink = 1.0;
-  nameLocationStack.style.flexGrow = 1.0;
-  
-  // if fetching post location data from server, 
-  // check if it is available yet and include it if so
-  if (_postLocationNode.attributedText) {
-    nameLocationStack.children = @[_usernameNode, _postLocationNode];
-  } else {
-    nameLocationStack.children = @[_usernameNode];
-  }
-  
-  // horizontal stack
-  ASStackLayoutSpec *headerStackSpec = [ASStackLayoutSpec stackLayoutSpecWithDirection:ASStackLayoutDirectionHorizontal
-                                                                               spacing:40
-                                                                        justifyContent:ASStackLayoutJustifyContentStart
-                                                                            alignItems:ASStackLayoutAlignItemsCenter
-                                                                              children:@[nameLocationStack, _postTimeNode]];
-  
-  // inset the horizontal stack
-  return [ASInsetLayoutSpec insetLayoutSpecWithInsets:UIEdgeInsetsMake(0, 10, 0, 10) child:headerStackSpec];
-}
-  
- -
-
- -Rotate the example project from portrait to landscape to see how the spacer grows and shrinks. - -## Photo with Inset Text Overlay - - - -To create this layout, we will use a: - -- `ASInsetLayoutSpec` to inset the text -- `ASOverlayLayoutSpec` to overlay the inset text spec on top of the photo - -
- - Swift - Objective-C - -
-
-- (ASLayoutSpec *)layoutSpecThatFits:(ASSizeRange)constrainedSize
-{
-  _photoNode.style.preferredSize = CGSizeMake(USER_IMAGE_HEIGHT*2, USER_IMAGE_HEIGHT*2);
-
-  // INIFINITY is used to make the inset unbounded
-  UIEdgeInsets insets = UIEdgeInsetsMake(INFINITY, 12, 12, 12);
-  ASInsetLayoutSpec *textInsetSpec = [ASInsetLayoutSpec insetLayoutSpecWithInsets:insets child:_titleNode];
-  
-  return [ASOverlayLayoutSpec overlayLayoutSpecWithChild:_photoNode overlay:textInsetSpec];
-}
-  
- -
-
- -## Photo with Outset Icon Overlay - - - -To create this layout, we will use a: - -- `ASAbsoluteLayoutSpec` to place the photo and icon which have been individually sized and positioned using their `ASLayoutable` properties - -
- - Swift - Objective-C - -
-
-- (ASLayoutSpec *)layoutSpecThatFits:(ASSizeRange)constrainedSize
-{
-  _iconNode.style.preferredSize = CGSizeMake(40, 40);
-  _iconNode.style.layoutPosition = CGPointMake(150, 0);
-  
-  _photoNode.style.preferredSize = CGSizeMake(150, 150);
-  _photoNode.style.layoutPosition = CGPointMake(40 / 2.0, 40 / 2.0);
-  
-  return [ASAbsoluteLayoutSpec absoluteLayoutSpecWithSizing:ASAbsoluteLayoutSpecSizingSizeToFit
-                                                   children:@[_photoNode, _iconNode]];
-}
-  
- -
-
- - - -## Simple Inset Text Cell - - - -To recreate the layout of a single cell as is used in Pinterest's search view above, we will use a: - -- `ASInsetLayoutSpec` to inset the text -- `ASCenterLayoutSpec` to center the text according to the specified properties - -
- - Swift - Objective-C - -
-
-- (ASLayoutSpec *)layoutSpecThatFits:(ASSizeRange)constrainedSize
-{
-    UIEdgeInsets insets = UIEdgeInsetsMake(0, 12, 4, 4);
-    ASInsetLayoutSpec *inset = [ASInsetLayoutSpec insetLayoutSpecWithInsets:insets
-                                                                      child:_titleNode];
-
-    return [ASCenterLayoutSpec centerLayoutSpecWithCenteringOptions:ASCenterLayoutSpecCenteringY
-                                                      sizingOptions:ASCenterLayoutSpecSizingOptionMinimumX
-                                                              child:inset];
-}
-  
- -
-
- -## Top and Bottom Separator Lines - - - -To create the layout above, we will use a: - -- a `ASInsetLayoutSpec` to inset the text -- a vertical `ASStackLayoutSpec` to stack the two separator lines on the top and bottom of the text - -The diagram below shows the composition of the layoutables (layout specs + nodes). - - - -The following code can also be found in the `ASLayoutSpecPlayground` [example project](). - -
- - Swift - Objective-C - -
-
-- (ASLayoutSpec *)layoutSpecThatFits:(ASSizeRange)constrainedSize
-{
-  _topSeparator.style.flexGrow = 1.0;
-  _bottomSeparator.style.flexGrow = 1.0;
-
-  ASInsetLayoutSpec *insetContentSpec = [ASInsetLayoutSpec insetLayoutSpecWithInsets:UIEdgeInsetsMake(20, 20, 20, 20) child:_textNode];
-
-  return [ASStackLayoutSpec stackLayoutSpecWithDirection:ASStackLayoutDirectionVertical
-                                                 spacing:0
-                                          justifyContent:ASStackLayoutJustifyContentCenter
-                                              alignItems:ASStackLayoutAlignItemsStretch
-                                                children:@[_topSeparator, insetContentSpec, _bottomSeparator]];
-}
-  
- -
-
diff --git a/submodules/AsyncDisplayKit/docs/_docs/automatic-layout-examples.md b/submodules/AsyncDisplayKit/docs/_docs/automatic-layout-examples.md deleted file mode 100755 index 1523720935..0000000000 --- a/submodules/AsyncDisplayKit/docs/_docs/automatic-layout-examples.md +++ /dev/null @@ -1,204 +0,0 @@ ---- -title: Layout Examples -layout: docs -permalink: /docs/automatic-layout-examples.html -prevPage: automatic-layout-containers.html -nextPage: automatic-layout-debugging.html ---- - -Three examples in increasing order of complexity. -#NSSpain Talk Example - - - -
-SwiftObjective-C - -
-
-- (ASLayoutSpec *)layoutSpecThatFits:(ASSizeRange)constraint
-{
-  ASStackLayoutSpec *vStack = [[ASStackLayoutSpec alloc] init];
-  
-  [vStack setChildren:@[titleNode, bodyNode];
-
-  ASStackLayoutSpec *hstack = [[ASStackLayoutSpec alloc] init];
-  hStack.direction          = ASStackLayoutDirectionHorizontal;
-  hStack.spacing            = 5.0;
-
-  [hStack setChildren:@[imageNode, vStack]];
-  
-  ASInsetLayoutSpec *insetSpec = [ASInsetLayoutSpec insetLayoutSpecWithInsets:UIEdgeInsetsMake(5,5,5,5) child:hStack];
-
-  return insetSpec;
-}
-
- -
-
- -###Discussion - -#Social App Layout - - - -
-SwiftObjective-C - -
-
-- (ASLayoutSpec *)layoutSpecThatFits:(ASSizeRange)constrainedSize
-{
-  // header stack
-  _userAvatarImageView.preferredFrameSize = CGSizeMake(USER_IMAGE_HEIGHT, USER_IMAGE_HEIGHT);  // constrain avatar image frame size
-  
-  ASLayoutSpec *spacer = [[ASLayoutSpec alloc] init];
-  spacer.flexGrow      = YES;
-
-  ASStackLayoutSpec *headerStack = [ASStackLayoutSpec horizontalStackLayoutSpec];
-  headerStack.alignItems         = ASStackLayoutAlignItemsCenter;       // center items vertically in horizontal stack
-  headerStack.justifyContent     = ASStackLayoutJustifyContentStart;    // justify content to left side of header stack
-  headerStack.spacing            = HORIZONTAL_BUFFER;
-
-  [headerStack setChildren:@[_userAvatarImageView, _userNameLabel, spacer, _photoTimeIntervalSincePostLabel]];
-  
-  // header inset stack
-  
-  UIEdgeInsets insets                = UIEdgeInsetsMake(0, HORIZONTAL_BUFFER, 0, HORIZONTAL_BUFFER);
-  ASInsetLayoutSpec *headerWithInset = [ASInsetLayoutSpec insetLayoutSpecWithInsets:insets child:headerStack];
-  headerWithInset.flexShrink = YES;
-  
-  // vertical stack
-  
-  CGFloat cellWidth                  = constrainedSize.max.width;
-  _photoImageView.preferredFrameSize = CGSizeMake(cellWidth, cellWidth);  // constrain photo frame size
-  
-  ASStackLayoutSpec *verticalStack   = [ASStackLayoutSpec verticalStackLayoutSpec];
-  verticalStack.alignItems           = ASStackLayoutAlignItemsStretch;    // stretch headerStack to fill horizontal space
-  
-  [verticalStack setChildren:@[headerWithInset, _photoImageView, footerWithInset]];
-
-  return verticalStack;
-}
-
- -
-
- -###Discussion - -Get the full Texture project at examples/ASDKgram. - -#Social App Layout 2 - - - -
-SwiftObjective-C - -
-
-- (ASLayoutSpec *)layoutSpecThatFits:(ASSizeRange)constrainedSize {
-
-  ASLayoutSpec *textSpec  = [self textSpec];
-  ASLayoutSpec *imageSpec = [self imageSpecWithSize:constrainedSize];
-  ASOverlayLayoutSpec *soldOutOverImage = [ASOverlayLayoutSpec overlayLayoutSpecWithChild:imageSpec 
-                                                                                  overlay:[self soldOutLabelSpec]];
-  
-  NSArray *stackChildren = @[soldOutOverImage, textSpec];
-  
-  ASStackLayoutSpec *mainStack = [ASStackLayoutSpec stackLayoutSpecWithDirection:ASStackLayoutDirectionVertical 
-                                                                         spacing:0.0
-                                                                  justifyContent:ASStackLayoutJustifyContentStart
-                                                                      alignItems:ASStackLayoutAlignItemsStretch          
-                                                                        children:stackChildren];
-  
-  ASOverlayLayoutSpec *soldOutOverlay = [ASOverlayLayoutSpec overlayLayoutSpecWithChild:mainStack 
-                                                                                overlay:self.soldOutOverlay];
-  
-  return soldOutOverlay;
-}
-
-- (ASLayoutSpec *)textSpec {
-  CGFloat kInsetHorizontal        = 16.0;
-  CGFloat kInsetTop               = 6.0;
-  CGFloat kInsetBottom            = 0.0;
-  UIEdgeInsets textInsets         = UIEdgeInsetsMake(kInsetTop, kInsetHorizontal, kInsetBottom, kInsetHorizontal);
-  
-  ASLayoutSpec *verticalSpacer    = [[ASLayoutSpec alloc] init];
-  verticalSpacer.flexGrow         = YES;
-  
-  ASLayoutSpec *horizontalSpacer1 = [[ASLayoutSpec alloc] init];
-  horizontalSpacer1.flexGrow      = YES;
-  
-  ASLayoutSpec *horizontalSpacer2 = [[ASLayoutSpec alloc] init];
-  horizontalSpacer2.flexGrow      = YES;
-  
-  NSArray *info1Children = @[self.firstInfoLabel, self.distanceLabel, horizontalSpacer1, self.originalPriceLabel];
-  NSArray *info2Children = @[self.secondInfoLabel, horizontalSpacer2, self.finalPriceLabel];
-  if ([ItemNode isRTL]) {
-    info1Children = [[info1Children reverseObjectEnumerator] allObjects];
-    info2Children = [[info2Children reverseObjectEnumerator] allObjects];
-  }
-  
-  ASStackLayoutSpec *info1Stack = [ASStackLayoutSpec stackLayoutSpecWithDirection:ASStackLayoutDirectionHorizontal 
-                                                                          spacing:1.0
-                                                                   justifyContent:ASStackLayoutJustifyContentStart 
-                                                                       alignItems:ASStackLayoutAlignItemsBaselineLast children:info1Children];
-  
-  ASStackLayoutSpec *info2Stack = [ASStackLayoutSpec stackLayoutSpecWithDirection:ASStackLayoutDirectionHorizontal 
-                                                                          spacing:0.0
-                                                                   justifyContent:ASStackLayoutJustifyContentCenter 
-                                                                       alignItems:ASStackLayoutAlignItemsBaselineLast children:info2Children];
-  
-  ASStackLayoutSpec *textStack = [ASStackLayoutSpec stackLayoutSpecWithDirection:ASStackLayoutDirectionVertical 
-                                                                         spacing:0.0
-                                                                  justifyContent:ASStackLayoutJustifyContentEnd
-                                                                      alignItems:ASStackLayoutAlignItemsStretch
-                                                                        children:@[self.titleLabel, verticalSpacer, info1Stack, info2Stack]];
-  
-  ASInsetLayoutSpec *textWrapper = [ASInsetLayoutSpec insetLayoutSpecWithInsets:textInsets 
-                                                                          child:textStack];
-  textWrapper.flexGrow = YES;
-  
-  return textWrapper;
-}
-
-- (ASLayoutSpec *)imageSpecWithSize:(ASSizeRange)constrainedSize {
-  CGFloat imageRatio = [self imageRatioFromSize:constrainedSize.max];
-  
-  ASRatioLayoutSpec *imagePlace = [ASRatioLayoutSpec ratioLayoutSpecWithRatio:imageRatio child:self.dealImageView];
-  
-  self.badge.layoutPosition = CGPointMake(0, constrainedSize.max.height - kFixedLabelsAreaHeight - kBadgeHeight);
-  self.badge.sizeRange = ASRelativeSizeRangeMake(ASRelativeSizeMake(ASRelativeDimensionMakeWithPercent(0), ASRelativeDimensionMakeWithPoints(kBadgeHeight)), ASRelativeSizeMake(ASRelativeDimensionMakeWithPercent(1), ASRelativeDimensionMakeWithPoints(kBadgeHeight)));
-  ASStaticLayoutSpec *badgePosition = [ASStaticLayoutSpec staticLayoutSpecWithChildren:@[self.badge]];
-  
-  ASOverlayLayoutSpec *badgeOverImage = [ASOverlayLayoutSpec overlayLayoutSpecWithChild:imagePlace overlay:badgePosition];
-  badgeOverImage.flexGrow = YES;
-  
-  return badgeOverImage;
-}
-
-- (ASLayoutSpec *)soldOutLabelSpec {
-  ASCenterLayoutSpec *centerSoldOutLabel = [ASCenterLayoutSpec centerLayoutSpecWithCenteringOptions:ASCenterLayoutSpecCenteringXY 
-  sizingOptions:ASCenterLayoutSpecSizingOptionMinimumXY child:self.soldOutLabelFlat];
-  ASStaticLayoutSpec *soldOutBG = [ASStaticLayoutSpec staticLayoutSpecWithChildren:@[self.soldOutLabelBackground]];
-  ASCenterLayoutSpec *centerSoldOut = [ASCenterLayoutSpec centerLayoutSpecWithCenteringOptions:ASCenterLayoutSpecCenteringXY   sizingOptions:ASCenterLayoutSpecSizingOptionDefault child:soldOutBG];
-  ASBackgroundLayoutSpec *soldOutLabelOverBackground = [ASBackgroundLayoutSpec backgroundLayoutSpecWithChild:centerSoldOutLabel background:centerSoldOut];
-  return soldOutLabelOverBackground;
-}
-
- -
-
- -###Discussion - -Get the full Texture project at examples/CatDealsCollectionView. diff --git a/submodules/AsyncDisplayKit/docs/_docs/automatic-subnode-mgmt.md b/submodules/AsyncDisplayKit/docs/_docs/automatic-subnode-mgmt.md deleted file mode 100755 index e4ff534206..0000000000 --- a/submodules/AsyncDisplayKit/docs/_docs/automatic-subnode-mgmt.md +++ /dev/null @@ -1,296 +0,0 @@ ---- -title: Automatic Subnode Management -layout: docs -permalink: /docs/automatic-subnode-mgmt.html -prevPage: batch-fetching-api.html -nextPage: inversion.html ---- - -Enabling Automatic Subnode Management (ASM) is required to use the Layout Transition API. However, apps that don't require animations can still benefit from the reduction in code size that this feature enables. - -When enabled, ASM means that your nodes no longer require `addSubnode:` or `removeFromSupernode` method calls. The presence or absence of the ASM node _and_ its subnodes is completely determined in its `layoutSpecThatFits:` method. - -### Example ### -
-Consider the following intialization method from the PhotoCellNode class in ASDKgram sample app. This ASCellNode subclass produces a simple social media photo feed cell. - -In the "Original Code" we see the familiar `addSubnode:` calls in bold. In the "Code with ASM" these have been removed and replaced with a single line that enables ASM. - -By setting `.automaticallyManagesSubnodes` to `YES` on the `ASCellNode`, we _no longer_ need to call `addSubnode:` for each of the `ASCellNode`'s subnodes. These `subNodes` will be present in the node hierarchy as long as this class' `layoutSpecThatFits:` method includes them. - - -Original code -
- - Objective-C - Swift - -
-
-- (instancetype)initWithPhotoObject:(PhotoModel *)photo;
-{
-  self = [super init];
-  
-  if (self) {
-    _photoModel = photo;
-    
-    _userAvatarImageNode = [[ASNetworkImageNode alloc] init];
-    _userAvatarImageNode.URL = photo.ownerUserProfile.userPicURL;
-    [self addSubnode:_userAvatarImageNode];
-
-    _photoImageNode = [[ASNetworkImageNode alloc] init];
-    _photoImageNode.URL = photo.URL;
-    [self addSubnode:_photoImageNode];
-
-    _userNameTextNode = [[ASTextNode alloc] init];
-    _userNameTextNode.attributedString = [photo.ownerUserProfile usernameAttributedStringWithFontSize:FONT_SIZE];
-    [self addSubnode:_userNameTextNode];
-    
-    _photoLocationTextNode = [[ASTextNode alloc] init];
-    [photo.location reverseGeocodedLocationWithCompletionBlock:^(LocationModel *locationModel) {
-      if (locationModel == _photoModel.location) {
-        _photoLocationTextNode.attributedString = [photo locationAttributedStringWithFontSize:FONT_SIZE];
-        [self setNeedsLayout];
-      }
-    }];
-    [self addSubnode:_photoLocationTextNode];
-  }
-  
-  return self;
-}
-
- -
-
- -Code with ASM -
- - Objective-C - Swift - -
-
-- (instancetype)initWithPhotoObject:(PhotoModel *)photo;
-{
-  self = [super init];
-  
-  if (self) {
-    self.automaticallyManagesSubnodes = YES;
-    
-    _photoModel = photo;
-    
-    _userAvatarImageNode = [[ASNetworkImageNode alloc] init];
-    _userAvatarImageNode.URL = photo.ownerUserProfile.userPicURL;
-
-    _photoImageNode = [[ASNetworkImageNode alloc] init];
-    _photoImageNode.URL = photo.URL;
-
-    _userNameTextNode = [[ASTextNode alloc] init];
-    _userNameTextNode.attributedString = [photo.ownerUserProfile usernameAttributedStringWithFontSize:FONT_SIZE];
-    
-    _photoLocationTextNode = [[ASTextNode alloc] init];
-    [photo.location reverseGeocodedLocationWithCompletionBlock:^(LocationModel *locationModel) {
-      if (locationModel == _photoModel.location) {
-        _photoLocationTextNode.attributedString = [photo locationAttributedStringWithFontSize:FONT_SIZE];
-        [self setNeedsLayout];
-      }
-    }];
-  }
-  
-  return self;
-}
-
- -
-
- -Several of the elements in this cell - `_userAvatarImageNode`, `_photoImageNode`, and `_photoLocationLabel` depend on seperate data fetches from the network that could return at any time. When should they be added to the UI? - -ASM knows whether or not to include these elements in the UI based on the information provided in the cell's `ASLayoutSpec`. - -
-An ASLayoutSpec completely describes the UI of a view in your app by specifying the hierarchy state of a node and its subnodes. An ASLayoutSpec is returned by a node from its layoutSpecThatFits: method. -
- -**It is your job to construct a `layoutSpecThatFits:` that handles how the UI should look with and without these elements.** - -Consider the abreviated `layoutSpecThatFits:` method for the `ASCellNode` subclass above. - -
- -Objective-C -Swift - - -
-
-- (ASLayoutSpec *)layoutSpecThatFits:(ASSizeRange)constrainedSize
-{  
-  ASStackLayoutSpec *headerSubStack = [ASStackLayoutSpec verticalStackLayoutSpec];
-  headerSubStack.flexShrink         = YES;
-  if (_photoLocationLabel.attributedString) {
-    [headerSubStack setChildren:@[_userNameLabel, _photoLocationLabel]];
-  } else {
-    [headerSubStack setChildren:@[_userNameLabel]];
-  }
-  
-  _userAvatarImageNode.preferredFrameSize = CGSizeMake(USER_IMAGE_HEIGHT, USER_IMAGE_HEIGHT);     // constrain avatar image frame size
-
-  ASLayoutSpec *spacer           = [[ASLayoutSpec alloc] init]; 
-  spacer.flexGrow                = YES;
-  
-  UIEdgeInsets avatarInsets      = UIEdgeInsetsMake(HORIZONTAL_BUFFER, 0, HORIZONTAL_BUFFER, HORIZONTAL_BUFFER);
-  ASInsetLayoutSpec *avatarInset = [ASInsetLayoutSpec insetLayoutSpecWithInsets:avatarInsets child:_userAvatarImageNode];
-
-  ASStackLayoutSpec *headerStack = [ASStackLayoutSpec horizontalStackLayoutSpec];
-  headerStack.alignItems         = ASStackLayoutAlignItemsCenter;                     // center items vertically in horizontal stack
-  headerStack.justifyContent     = ASStackLayoutJustifyContentStart;                  // justify content to the left side of the header stack
-  [headerStack setChildren:@[avatarInset, headerSubStack, spacer]];
-  
-  // header inset stack
-  UIEdgeInsets insets                = UIEdgeInsetsMake(0, HORIZONTAL_BUFFER, 0, HORIZONTAL_BUFFER);
-  ASInsetLayoutSpec *headerWithInset = [ASInsetLayoutSpec insetLayoutSpecWithInsets:insets child:headerStack];
-  
-  // footer inset stack
-  UIEdgeInsets footerInsets          = UIEdgeInsetsMake(VERTICAL_BUFFER, HORIZONTAL_BUFFER, VERTICAL_BUFFER, HORIZONTAL_BUFFER);
-  ASInsetLayoutSpec *footerWithInset = [ASInsetLayoutSpec insetLayoutSpecWithInsets:footerInsets child:_photoCommentsNode];
-  
-  // vertical stack
-  CGFloat cellWidth                  = constrainedSize.max.width;
-  _photoImageNode.preferredFrameSize = CGSizeMake(cellWidth, cellWidth);              // constrain photo frame size
-  
-  ASStackLayoutSpec *verticalStack   = [ASStackLayoutSpec verticalStackLayoutSpec];
-  verticalStack.alignItems           = ASStackLayoutAlignItemsStretch;                // stretch headerStack to fill horizontal space
-  [verticalStack setChildren:@[headerWithInset, _photoImageNode, footerWithInset]];
-
-  return verticalStack;
-}
-
- - -
-
- - -Here you can see that the children of the `headerSubStack` depend on whether or not the `_photoLocationLabel` attributed string has returned from the reverseGeocode process yet. - -The `_userAvatarImageNode`, `_photoImageNode`, and `_photoCommentsNode` are added into the ASLayoutSpec, but will not show up until their data fetches return. - -### Updating an ASLayoutSpec ### -
-**If something happens that you know will change your `ASLayoutSpec`, it is your job to call `setNeedsLayout`**. This is equivalent to `transitionLayout:duration:0` in the Transition Layout API. You can see this call in the completion block of the `photo.location reverseGeocodedLocationWithCompletionBlock:` call in the first code block. - -An appropriately constructed ASLayoutSpec will know which subnodes need to be added, removed or animated. - -Try out the ASDKgram sample app after looking at the code above, and you will see how simple it is to code an `ASCellNode` whose layout is responsive to numerous, individual data fetches and returns. While the `ASLayoutSpec` is coded in a way that leaves holes for the avatar and photo to populate, you can see how the cell's height will automatically adjust to accomodate the comments node at the bottom of the photo. - -This is just a simple example, but this feature has many more powerful uses. - -
-Warning: addSubnode: and removeFromSupernode should never be called on a node that has ASM enabled. Doing so could cause the following exception - "A flattened layout must consist exclusively of node sublayouts". -
diff --git a/submodules/AsyncDisplayKit/docs/_docs/batch-fetching-api.md b/submodules/AsyncDisplayKit/docs/_docs/batch-fetching-api.md deleted file mode 100755 index 5fd9044697..0000000000 --- a/submodules/AsyncDisplayKit/docs/_docs/batch-fetching-api.md +++ /dev/null @@ -1,151 +0,0 @@ ---- -title: Batch Fetching API -layout: docs -permalink: /docs/batch-fetching-api.html -prevPage: hit-test-slop.html -nextPage: automatic-subnode-mgmt.html ---- - -Texture's Batch Fetching API makes it easy to add fetching chunks of new data. Usually this would be done in a `-scrollViewDidScroll:` method, but Texture provides a more structured mechanism. - -By default, as a user is scrolling, when they approach the point in the table or collection where they are 2 "screens" away from the end of the current content, the table will try to fetch more data. - -If you'd like to configure how far away from the end you should be, just change the `leadingScreensForBatching` property on an `ASTableView` or `ASCollectionView` to something else. - -
-SwiftObjective-C - -
-
-tableNode.view.leadingScreensForBatching = 3.0;  // overriding default of 2.0
-
- -
-
- -### Batch Fetching Delegate Methods - -The first thing you have to do in order to support batch fetching, is implement a method that decides if it's an appropriate time to load new content or not. - -For tables it would look something like: - -
-SwiftObjective-C - -
-
-- (BOOL)shouldBatchFetchForTableNode:(ASTableNode *)tableNode
-{
-  if (_weNeedMoreContent) {
-    return YES;
-  }
-
-  return NO;
-}
-
- -
-
- -and for collections: - -
-SwiftObjective-C - -
-
-
-- (BOOL)shouldBatchFetchForCollectionNode:(ASCollectionNode *)collectionNode
-{
-  if (_weNeedMoreContent) {
-    return YES;
-  }
-
-  return NO;
-}
-
- -
-
- -These methods will be called when the user has scrolled into the batch fetching range, and their answer will determine if another request actually needs to be made or not. Usually this decision is based on if there is still data to fetch. - -If you return NO, then no new batch fetching process will happen. If you return YES, the batch fetching mechanism will start and the following method will be called next. - -`-tableNode:willBeginBatchFetchWithContext:` - -or - -`-collectionNode:willBeginBatchFetchWithContext:` - -This is where you should actually fetch data, be it from a web API or some local database. - -
-Note: This method will always be called on a background thread. This means, if you need to do any work on the main thread, you should dispatch it to the main thread and then proceed with the work needed in order to finish the batch fetch operation. -
- -
-SwiftObjective-C - -
-
-- (void)tableNode:(ASTableNode *)tableNode willBeginBatchFetchWithContext:(ASBatchContext *)context 
-{
-  // Fetch data most of the time asynchronoulsy from an API or local database
-  NSArray *newPhotos = [SomeSource getNewPhotos];
-
-  // Insert data into table or collection node
-  [self insertNewRowsInTableNode:newPhotos];
-
-  // Decide if it's still necessary to trigger more batch fetches in the future
-  _stillDataToFetch = ...;
-
-  // Properly finish the batch fetch
-  [context completeBatchFetching:YES];
-}
-
- -
-
- -Once you've finished fetching your data, it is very important to let Texture know that you have finished the process. To do that, you need to call `-completeBatchFetching:` on the `context` object that was passed in with a parameter value of `YES`. This assures that the whole batch fetching mechanism stays in sync and the next batch fetching cycle can happen. Only by passing `YES` will the context know to attempt another batch update when necessary. - -Check out the following sample apps to see the batch fetching API in action: - diff --git a/submodules/AsyncDisplayKit/docs/_docs/button-node.md b/submodules/AsyncDisplayKit/docs/_docs/button-node.md deleted file mode 100755 index 11eb6ca955..0000000000 --- a/submodules/AsyncDisplayKit/docs/_docs/button-node.md +++ /dev/null @@ -1,98 +0,0 @@ ---- -title: ASButtonNode -layout: docs -permalink: /docs/button-node.html -prevPage: cell-node.html -nextPage: text-node.html ---- - -### Basic Usage - -`ASButtonNode` subclasses `ASControlNode` in the same way `UIButton` subclasses `UIControl`. In contrast, being able to layer back the subnodes of every button can significantly lighten main thread impact relative to `UIButton`. - -### Control State - -If you've used `-setTitle:forControlState:` then you already know how to set up an ASButtonNode. The `ASButtonNode` version adds in a few parameters for conveniently setting attributes. - -
-SwiftObjective-C - -
-
-[buttonNode setTitle:@"Button Title Normal" withFont:nil withColor:[UIColor blueColor] forState:ASControlStateNormal];
-
- -
-
- -If you need even more control, you can also opt to use the attributed string version directly: - -
-SwiftObjective-C - -
-
-[self.buttonNode setAttributedTitle:attributedTitle forState:ASControlStateNormal];
-
- -
-
- -### Target-Action Pairs - -Again, analagous to UIKit, you can add sets of target-action pairs to respond to various events. - -
-SwiftObjective-C - -
-
-[buttonNode addTarget:self action:@selector(buttonPressed:) forControlEvents:ASControlNodeEventTouchUpInside];
-
- -
-
- -### Content Alignment - -`ASButtonNode` offers both `contentVerticalAlignment` and `contentHorizontalAlignment` properties. This allows you to easily set the alignment of the titleLabel or image you're using for your button. - -
-SwiftObjective-C - -
-
-self.buttonNode.contentVerticalAlignment = ASVerticalAlignmentTop;
-self.buttonNode.contentHorizontalAlignment = ASHorizontalAlignmentMiddle;
-
- -
-
- -
Note: At the moment, this property will not work if you aren't using -layoutSpecThatFits:. -
- -### Gotchas - -There are a few things that might trip up someone new to the framework. - -##### View Hierarchies -Let's say you want to add an `ASButtonNode` to the view of one of your existing view controllers. The first thing you'll notice is that setting a title for a control state doesn't seem to make your title appear. You can fix this by calling `-measure:` on the button which will cause its title label to be measured and laid out. - -The next thing you'll notice is that, if you set titles of various lengths for different control states, the button will dynamically grow and shrink as the title changes. This is because changing the title causes `-setNeedsLayout` to be called on the button. Within a node hierarchy, this makes sense, and will work as expected. - -Long story short, use an `ASViewController`. - -##### Selected State - -If you want your button to change to a "selected" state after being tapped, you'll need to do that manually. - diff --git a/submodules/AsyncDisplayKit/docs/_docs/cell-node.md b/submodules/AsyncDisplayKit/docs/_docs/cell-node.md deleted file mode 100755 index 60b1cfad3f..0000000000 --- a/submodules/AsyncDisplayKit/docs/_docs/cell-node.md +++ /dev/null @@ -1,142 +0,0 @@ ---- -title: ASCellNode -layout: docs -permalink: /docs/cell-node.html -prevPage: display-node.html -nextPage: button-node.html ---- - -`ASCellNode`, as you may have guessed, is the cell class of Texture. Unlike the various cells in UIKit, `ASCellNode` can be used with `ASTableNodes`, `ASCollectionNodes` and `ASPagerNodes`, making it incredibly flexible. - -### 3 Ways to Party - -There are three ways in which you can implement the cells you'll use in your Texture app: subclassing `ASCellNode`, initializing with an existing `ASViewController` or using an existing UIView or `CALayer`. - -#### Subclassing - -Subclassing an `ASCellNode` is pretty much the same as subclassing a regular `ASDisplayNode`. - -Most likely, you'll write a few of the following: - -- `-init` -- Thread safe initialization. -- `-layoutSpecThatFits:` -- Return a layout spec that defines the layout of your cell. -- `-didLoad` -- Called on the main thread. Good place to add gesture recognizers, etc. -- `-layout` -- Also called on the main thread. Layout is complete after the call to super which means you can do any extra tweaking you need to do. - - -#### Initializing with an `ASViewController` - -Say you already have some type of view controller written to display a view in your app. If you want to take that view controller and drop its view in as a cell in one of the scrolling nodes or a pager node its no problem. - -For example, say you already have a view controller written that manages an `ASTableNode`. To use that table as a page in an `ASPagerNode` you can use `-initWithViewControllerBlock`. - -
-SwiftObjective-C -
-
-- (ASCellNode *)pagerNode:(ASPagerNode *)pagerNode nodeAtIndex:(NSInteger)index
-{
-    NSArray *animals = self.allAnimals[index];
-    
-    ASCellNode *node = [[ASCellNode alloc] initWithViewControllerBlock:^UIViewController * _Nonnull{
-        return [[AnimalTableNodeController alloc] initWithAnimals:animals];
-    } didLoadBlock:nil];
-    
-    node.style.preferredSize = pagerNode.bounds.size;
-    
-    return node;
-}
-
- -
-
- -And this works for any combo of scrolling container node and `UIViewController` subclass. You want to embed random view controllers in your collection node? Go for it. - -
-Notice that you need to set the .style.preferredSize of a node created this way. Normally your nodes will implement -layoutSpecThatFits: but since these don't you'll need give the cell a size. -
- - -#### Initializing with a `UIView` or `CALayer` - -Alternatively, if you already have a `UIView` or `CALayer` subclass that you'd like to drop in as cell you can do that instead. - -
-SwiftObjective-C -
-
-- (ASCellNode *)pagerNode:(ASPagerNode *)pagerNode nodeAtIndex:(NSInteger)index
-{
-    NSArray *animal = self.animals[index];
-    
-    ASCellNode *node = [[ASCellNode alloc] initWithViewBlock:^UIView * _Nonnull{
-        return [[SomeAnimalView alloc] initWithAnimal:animal];
-    }];
-
-    node.style.preferredSize = pagerNode.bounds.size;
-    
-    return node;
-}
-
- -
-
- -As you can see, its roughly the same idea. That being said, if you're doing this, you may consider converting the existing `UIView` subclass to be an `ASCellNode` subclass in order to gain the advantage of asynchronous display. - -### Never Show Placeholders - -Usually, if a cell hasn't finished its display pass before it has reached the screen it will show placeholders until it has completed drawing its content. - -If placeholders are unacceptable, you can set an `ASCellNode`'s `neverShowPlaceholders` property to `YES`. - -
-SwiftObjective-C -
-
-node.neverShowPlaceholders = YES;
-
- -
-
- -With this property set to `YES`, the main thread will be blocked until display has completed for the cell. This is more similar to UIKit, and in fact makes Texture scrolling visually indistinguishable from UIKit's, except being faster. - -
-Using this option does not eliminate all of the performance advantages of Texture. Normally, a cell has been preloading and is almost done when it reaches the screen, so the blocking time is very short. Even if the rangeTuningParameters are set to 0 this option outperforms UIKit. While the main thread is waiting, subnode display executes concurrently. -
- -### `UITableViewCell` specific propertys - -UITableViewCell has properties like selectionStyle, accessoryType and seperatorInset that many of us use sometimes to give the Cell more detail. For this case ASCellNode has the same (passthrough) properties that can be used. - -
-UIKits UITableViewCell contains ASCellNode as a subview. Depending how your ASLayoutSpec is defined it may occur that your Layout overlays the UITableViewCell.accessoryView and therefore is not visible. Make sure that your Layout doesn't overlay any of UITableViewCell's specific properties. -
diff --git a/submodules/AsyncDisplayKit/docs/_docs/containers-ascollectionnode.md b/submodules/AsyncDisplayKit/docs/_docs/containers-ascollectionnode.md deleted file mode 100755 index 780e5c3ad9..0000000000 --- a/submodules/AsyncDisplayKit/docs/_docs/containers-ascollectionnode.md +++ /dev/null @@ -1,228 +0,0 @@ ---- -title: ASCollectionNode -layout: docs -permalink: /docs/containers-ascollectionnode.html -prevPage: containers-astablenode.html -nextPage: containers-aspagernode.html ---- - -`ASCollectionNode` is equivalent to UIKit's `UICollectionView` and can be used in place of any `UICollectionView`. - -`ASCollectionNode` replaces `UICollectionView`'s required method - -
- - Swift - Objective-C - - -
-
-- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath;
-  
- - -
-
- -with your choice of **_one_** of the following methods - -
-SwiftObjective-C - -
-
-- (ASCellNode *)collectionNode:(ASCollectionNode *)collectionNode nodeForItemAtIndexPath:(NSIndexPath *)indexPath
-
- -
-
- -

-or -

- -
-SwiftObjective-C - -
-
-- (ASCellNodeBlock)collectionNode:(ASCollectionNode *)collectionNode nodeBlockForItemAtIndexPath:(NSIndexPath *)indexPath
-
- -
-
- -It is recommended that you use the node block version of the method so that your collection node will be able to prepare and display all of its cells concurrently. - -As noted in the previous section: - -
    -
  • ASCollectionNodes do not utilize cell reuse.
  • -
  • Using the "nodeBlock" method is preferred.
  • -
  • It is very important that the returned node blocks are thread-safe.
  • -
  • ASCellNodes can be used by ASTableNode, ASCollectionNode and ASPagerNode.
  • -
- -### Node Block Thread Safety Warning - -It is very important that node blocks be thread-safe. One aspect of that is ensuring that the data model is accessed _outside_ of the node block. Therefore, it is unlikely that you should need to use the index inside of the block. - -Consider the following `-collectionNode:nodeBlockForItemAtIndexPath:` method. - -
-SwiftObjective-C -
-
-- (ASCellNodeBlock)collectionNode:(ASCollectionNode *)collectionNode nodeBlockForItemAtIndexPath:(NSIndexPath *)indexPath
-{
-    PhotoModel *photoModel = [_photoFeed objectAtIndex:indexPath.row];
-    
-    // this may be executed on a background thread - it is important to make sure it is thread safe
-    ASCellNode *(^cellNodeBlock)() = ^ASCellNode *() {
-        PhotoCellNode *cellNode = [[PhotoCellNode alloc] initWithPhoto:photoModel];
-        cellNode.delegate = self;
-        return cellNode;
-    };
-    
-    return cellNodeBlock;
-}
-  
- - -
-
- -In the example above, you can see how the index is used to access the photo model before creating the node block. - -### Replacing a UICollectionViewController with an ASViewController - -Texture does not offer an equivalent to UICollectionViewController. Instead, you can use the flexibility of ASViewController to recreate any type of UI...ViewController. - -Consider, the following ASViewController subclass. - -An ASCollectionNode is assigned to be managed by an `ASViewController` in its `-initWithNode:` designated initializer method, thus making it a sort of ASCollectionNodeController. - -
-SwiftObjective-C -
-
-- (instancetype)init
-{
-  _flowLayout = [[UICollectionViewFlowLayout alloc] init];
-  _collectionNode = [[ASCollectionNode alloc] initWithCollectionViewLayout:_flowLayout];
-  
-  self = [super initWithNode:_collectionNode];
-  if (self) {
-    _flowLayout.minimumInteritemSpacing = 1;
-    _flowLayout.minimumLineSpacing = 1;
-  }
-  
-  return self;
-}
-
- - -
-
- -This works just as well with any node including as an ASTableNode, ASPagerNode, etc. - -### Accessing the ASCollectionView -If you've used previous versions of Texture, you'll notice that `ASCollectionView` has been removed in favor of `ASCollectionNode`. - -
-`ASCollectionView`, an actual `UICollectionView` subclass, is still used internally by `ASCollectionNode`. While it should not be created directly, it can still be used directly by accessing the `.view` property of an `ASCollectionNode`. -

-Don't forget that a node's `view` or `layer` property should only be accessed after viewDidLoad or didLoad, respectively, have been called. -
- -The `LocationCollectionNodeController` above accesses the `ASCollectionView` directly in `-viewDidLoad`. - -
-SwiftObjective-C -
-
-- (void)viewDidLoad
-{
-  [super viewDidLoad];
-  
-  _collectionNode.delegate = self;
-  _collectionNode.dataSource = self;
-  _collectionNode.view.allowsSelection = NO;
-  _collectionNode.view.backgroundColor = [UIColor whiteColor];
-}
-
- - -
-
- -### Cell Sizing and Layout - -As discussed in the previous section, `ASCollectionNode` and `ASTableNode` do not need to keep track of the height of their `ASCellNode`s. - -Right now, cells will grow to fit their constrained size and will be laid out by whatever `UICollectionViewLayout` you provide. - -You can also constrain cells used in a collection node using `ASCollectionNode`'s `-constrainedSizeForItemAtIndexPath:`. - -### Examples - -The most detailed example of laying out the cells of an `ASCollectionNode` is the CustomCollectionView app. It includes a Pinterest style cell layout using an `ASCollectionNode` and a custom `UICollectionViewLayout`. - -#### More Sample Apps with ASCollectionNodes - - - -### Interoperability with UICollectionViewCells - -`ASCollectionNode` supports using UICollectionViewCells alongside native ASCellNodes. - -Note that these UIKit cells will **not** have the performance benefits of `ASCellNodes` (like preloading, async layout, and async drawing), even when mixed within the same `ASCollectionNode`. - -However, this interoperability allows developers the flexibility to test out the framework without needing to convert all of their cells at once. Read more here. diff --git a/submodules/AsyncDisplayKit/docs/_docs/containers-asnodecontroller.md b/submodules/AsyncDisplayKit/docs/_docs/containers-asnodecontroller.md deleted file mode 100755 index 09b644440f..0000000000 --- a/submodules/AsyncDisplayKit/docs/_docs/containers-asnodecontroller.md +++ /dev/null @@ -1,238 +0,0 @@ ---- -title: "ASNodeController (Beta)" -layout: docs -permalink: /docs/containers-asnodecontroller.html -prevPage: containers-asviewcontroller.html -nextPage: containers-astablenode.html ---- - -
-To use this feature, you will need to import "ASNodeController+Beta.h" -
- -The Texture team has many exciting ideas for expanding `ASNodeController`. Follow along [here](https://github.com/facebook/AsyncDisplayKit/issues/2964) if you'd like to participate in shaping the future of node controllers. - -For now, `ASNodeController` remains a simple, but powerful class. - -### Example - -The [example project](https://github.com/texturegroup/texture/pull/2945) attached in the initial PR modifies the normal [ASDKgram](https://github.com/texturegroup/texture/tree/master/examples/ASDKgram) project to use an `ASNodeController`. -This `PhotoCellNodeController` is used to manage the fetching of the comments data for a photo in a photo feed, once the photo enters the preload range. This node controller allows us to separate the preloading logic from where it previously existed in the `PhotoCellNode` "view" class. - -To convert ASDKgram to use an `ASNodeController`, we first create a `PhotoCellNodeController` class. - -This node controller overrides `ASNodeController`'s' `-loadNode` method to create a `PhotoCellNode` once required. It is not neccessary to call super in this method. - -This node controller also observes its node's interface state in order to intelligently preload the photo's comment feed model data when the `PhotoCellNode` enters the preload state (which indicates that the photo cell is likely to scroll onscreen soon). - -All of this logic can be removed from where it previously existed in the "view" (our `PhotoCellNode` class), leading to a more concise and MVC-friendly view class. - -
- - Swift - Objective-C - - -
-
-@implementation PhotoCellNodeController
-
-- (void)loadNode
-{
-  self.node = [[PhotoCellNode alloc] initWithPhotoObject:self.photoModel];
-}
-
-- (void)didEnterPreloadState
-{
-  [super didEnterPreloadState];
-  
-  CommentFeedModel *commentFeedModel = _photoModel.commentFeed;
-  [commentFeedModel refreshFeedWithCompletionBlock:^(NSArray *newComments) {
-    // load comments for photo
-    if (commentFeedModel.numberOfItemsInFeed > 0) {
-      [self.node.photoCommentsNode updateWithCommentFeedModel:commentFeedModel];
-      [self.node setNeedsLayout];
-    }
-  }];
-}
-
-@end
-  
- - -
-
- -Next, we add a mutable array to the `PhotoFeedNodeController` to store our node controllers and instantiate it in the init method. - -
- - Swift - Objective-C - - -
-
-@implementation PhotoFeedNodeController
-{
-  PhotoFeedModel          *_photoFeed;
-  ASTableNode             *_tableNode;
-  NSMutableArray *_photoCellNodeControllers;
-}
-
-- (instancetype)init
-{
-  _tableNode = [[ASTableNode alloc] init];
-  self = [super initWithNode:_tableNode];
-  
-  if (self) {
-    self.navigationItem.title = @"Texture";
-    [self.navigationController setNavigationBarHidden:YES];
-    
-    _tableNode.dataSource = self;
-    _tableNode.delegate = self;
-    
-    _photoCellNodeControllers = [NSMutableArray array];
-  }
-  
-  return self;
-}
-  
- - -
-
- -To use this node controller, we modify our table row insertion logic to create a `PhotoCellNodeController` rather than a `PhotoCellNode` directly and add it to our node controller array. - -
- - Swift - Objective-C - - -
-
-- (void)insertNewRowsInTableNode:(NSArray *)newPhotos
-{
-  NSInteger section = 0;
-  NSMutableArray *indexPaths = [NSMutableArray array];
-  
-  NSUInteger newTotalNumberOfPhotos = [_photoFeed numberOfItemsInFeed];
-  for (NSUInteger row = newTotalNumberOfPhotos - newPhotos.count; row < newTotalNumberOfPhotos; row++) {
-  
-    // create photoCellNodeControllers for the new photos
-    PhotoCellNodeController *cellController = [[PhotoCellNodeController alloc] init];
-    cellController.photoModel = [_photoFeed objectAtIndex:row];
-    [_photoCellNodeControllers addObject:cellController];
-    
-    // include this index path in the insert rows call for the table
-    NSIndexPath *path = [NSIndexPath indexPathForRow:row inSection:section];
-    [indexPaths addObject:path];
-  }
-  
-  [_tableNode insertRowsAtIndexPaths:indexPaths withRowAnimation:UITableViewRowAnimationNone];
-}
-  
- - -
-
- -Don't forget to modify the table data source method to return the node controller rather than the cell node. - -
- - Swift - Objective-C - - -
-
-- (ASCellNodeBlock)tableNode:(ASTableNode *)tableNode nodeBlockForRowAtIndexPath:(NSIndexPath *)indexPath
-{
-  PhotoCellNodeController *cellController = [_photoCellNodeControllers objectAtIndex:indexPath.row];
-  // this will be executed on a background thread - important to make sure it's thread safe
-  ASCellNode *(^ASCellNodeBlock)() = ^ASCellNode *() {
-    PhotoCellNode *cellNode = [cellController node];
-    return cellNode;
-  };
-  
-  return ASCellNodeBlock;
-}
-  
- - -
-
- - - diff --git a/submodules/AsyncDisplayKit/docs/_docs/containers-aspagernode.md b/submodules/AsyncDisplayKit/docs/_docs/containers-aspagernode.md deleted file mode 100755 index f538983ee0..0000000000 --- a/submodules/AsyncDisplayKit/docs/_docs/containers-aspagernode.md +++ /dev/null @@ -1,166 +0,0 @@ ---- -title: ASPagerNode -layout: docs -permalink: /docs/containers-aspagernode.html -prevPage: containers-ascollectionnode.html -nextPage: display-node.html ---- - -`ASPagerNode` is a subclass of `ASCollectionNode` with a specific `UICollectionViewLayout` used under the hood. - -Using it allows you to produce a page style UI similar to what you'd create with UIKit's `UIPageViewController`. `ASPagerNode` currently supports staying on the correct page during rotation. It does _not_ currently support circular scrolling. - -The main dataSource methods are: - -
-SwiftObjective-C -
-
-- (NSInteger)numberOfPagesInPagerNode:(ASPagerNode *)pagerNode
-
- - -
-
- -and - -
-SwiftObjective-C -
-
-- (ASCellNode *)pagerNode:(ASPagerNode *)pagerNode nodeAtIndex:(NSInteger)index
-
- - -
-
- -or - -
-SwiftObjective-C -
-
-- (ASCellNodeBlock)pagerNode:(ASPagerNode *)pagerNode nodeBlockAtIndex:(NSInteger)index`
-
- - -
-
- -These two methods, just as with `ASCollectionNode` and `ASTableNode` need to return either an `ASCellNode` or an `ASCellNodeBlock` - a block that creates an `ASCellNode` and can be run on a background thread. - -Note that neither methods should rely on cell reuse (they will be called once per row). Also, unlike UIKit, these methods are not called when the row is just about to display. - -While `-pagerNode:nodeAtIndex:` will be called on the main thread, `-pagerNode:nodeBlockAtIndex:` is preferred because it concurrently allocates cell nodes, meaning that the `-init:` method of each of your subnodes will be run in the background. **It is very important that node blocks be thread-safe** as they can be called on the main thread or a background queue. - -### Node Block Thread Safety Warning - -It is imperative that the data model be accessed outside of the node block. This means that it is highly unlikely that you should need to use the index inside of the block. - -In the example below, you can see how the index is used to access the photo model before creating the node block. - -
-SwiftObjective-C -
-
-- (ASCellNodeBlock)pagerNode:(ASPagerNode *)pagerNode nodeBlockAtIndex:(NSInteger)index
-{
-  PhotoModel *photoModel = _photoFeed[index];
-  
-  // this part can be executed on a background thread - it is important to make sure it is thread safe!
-  ASCellNode *(^cellNodeBlock)() = ^ASCellNode *() {
-    PhotoCellNode *cellNode = [[PhotoCellNode alloc] initWithPhoto:photoModel];
-    return cellNode;
-  };
-  
-  return cellNodeBlock;
-}
-
- - -
-
- -### Using an ASViewController For Optimal Performance - -One especially useful pattern is to return an `ASCellNode` that is initialized with an existing `UIViewController` or `ASViewController`. For optimal performance, use an `ASViewController`. - -
-SwiftObjective-C -
-
-- (ASCellNode *)pagerNode:(ASPagerNode *)pagerNode nodeAtIndex:(NSInteger)index
-{
-    NSArray *animals = self.animals[index];
-    
-    ASCellNode *node = [[ASCellNode alloc] initWithViewControllerBlock:^{
-        return [[AnimalTableNodeController alloc] initWithAnimals:animals];;
-    } didLoadBlock:nil];
-    
-    node.style.preferredSize = pagerNode.bounds.size;
-    
-    return node;
-}
-
- - -
-
- -In this example, you can see that the node is constructed using the `-initWithViewControllerBlock:` method. It is usually necessary to provide a cell created this way with a `style.preferredSize` so that it can be laid out correctly. - -### Use ASPagerNode as root node of an ASViewController - -#### Log message while popping back in the view controller hierarchy -If you use an `ASPagerNode` embedded in an `ASViewController` in full screen. If you pop back from the view controller hierarchy you will see some error message in the console. - -To resolve the error message set `self.automaticallyAdjustsScrollViewInsets = NO;` in `viewDidLoad` in your `ASViewController` subclass. - -#### `navigationBar.translucent` is set to YES -If you have an `ASPagerNode` embedded in an `ASViewController` in full screen and set the `navigationBar.translucent` to `YES`, you will see an error message while pushing the view controller on the view controller stack. - -To resolve the error message add `[self.pagerNode waitUntilAllUpdatesAreCommitted];` within `- (void)viewWillAppear:(BOOL)animated` in your `ASViewController` subclass. -Unfortunately the disadvantage of this is that the first measurement pass will block the main thread until it finishes. - -#### Some more details about the error messages above -The reason for this error message is that due to the asynchronous nature of Texture, measurement of nodes will happen on a background thread as UIKit will resize the view of the `ASViewController` on on the main thread. The new layout pass has to wait until the old layout pass finishes with an old layout constrained size. Unfortunately while the measurement pass with the old constrained size is still in progress the `ASPagerFlowLayout` that is backing a `ASPagerNode` will print some errors in the console as it expects sizes for nodes already measured with the new constrained size. - -### Sample Apps - -Check out the following sample apps to see an `ASPagerNode` in action: - diff --git a/submodules/AsyncDisplayKit/docs/_docs/containers-astablenode.md b/submodules/AsyncDisplayKit/docs/_docs/containers-astablenode.md deleted file mode 100755 index 7742e23c3b..0000000000 --- a/submodules/AsyncDisplayKit/docs/_docs/containers-astablenode.md +++ /dev/null @@ -1,228 +0,0 @@ ---- -title: ASTableNode -layout: docs -permalink: /docs/containers-astablenode.html -prevPage: containers-asnodecontroller.html -nextPage: containers-ascollectionnode.html ---- - -`ASTableNode` is equivalent to UIKit's `UITableView` and can be used in place of any `UITableView`. - -`ASTableNode` replaces `UITableView`'s required method - -
- - Swift - Objective-C - - -
-
-- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
-  
- - -
-
- -with your choice of **_one_** of the following methods - -
- - Swift - Objective-C - - -
-
-- (ASCellNode *)tableNode:(ASTableNode *)tableNode nodeForRowAtIndexPath:(NSIndexPath *)indexPath
-  
- - -
-
- -or - -
- - Swift - Objective-C - - -
-
-- (ASCellNodeBlock)tableNode:(ASTableNode *)tableNode nodeBlockForRowAtIndexPath:(NSIndexPath *)indexPath
-  
- - -
-
- -
-
-It is recommended that you use the node block version of these methods so that your table node will be able to prepare and display all of its cells concurrently. This means that all subnode initialization methods can be run in the background. Make sure to keep 'em thread safe. -
- -These two methods, need to return either an `ASCellNode` or an `ASCellNodeBlock`. An `ASCellNodeBlock` is a block that creates a `ASCellNode` which can be run on a background thread. Note that `ASCellNodes` are used by `ASTableNode`, `ASCollectionNode` and `ASPagerNode`. - -Note that neither of these methods require a reuse mechanism. - -### Replacing UITableViewController with ASViewController - -Texture does not offer an equivalent to `UITableViewController`. Instead, use an `ASViewController` initialized with an `ASTableNode`. - -Consider, again, the `ASViewController` subclass - PhotoFeedNodeController - from the `ASDKgram sample app` that uses a table node as its managed node. - -An `ASTableNode` is assigned to be managed by an `ASViewController` in its `-initWithNode:` designated initializer method. - -
-SwiftObjective-C -
-
-- (instancetype)init
-{
-    _tableNode = [[ASTableNode alloc] initWithStyle:UITableViewStylePlain];
-    self = [super initWithNode:_tableNode];
-    
-    if (self) {
-      _tableNode.dataSource = self;
-      _tableNode.delegate = self;
-    }
-    
-    return self;
-}
-  
- - -
-
- -### Node Block Thread Safety Warning - -It is very important that node blocks be thread-safe. One aspect of that is ensuring that the data model is accessed _outside_ of the node block. Therefore, it is unlikely that you should need to use the index inside of the block. - -Consider the following `-tableNode:nodeBlockForRowAtIndexPath:` method from the `PhotoFeedNodeController.m` file in the ASDKgram sample app. - -
-SwiftObjective-C -
-
-- (ASCellNodeBlock)tableNode:(ASTableNode *)tableNode nodeBlockForRowAtIndexPath:(NSIndexPath *)indexPath
-{
-    PhotoModel *photoModel = [_photoFeed objectAtIndex:indexPath.row];
-    
-    // this may be executed on a background thread - it is important to make sure it is thread safe
-    ASCellNode *(^cellNodeBlock)() = ^ASCellNode *() {
-        PhotoCellNode *cellNode = [[PhotoCellNode alloc] initWithPhoto:photoModel];
-        cellNode.delegate = self;
-        return cellNode;
-    };
-    
-    return cellNodeBlock;
-}
-  
- - -
-
- -In the example above, you can see how the index is used to access the photo model before creating the node block. - -### Accessing the ASTableView - -If you've used previous versions of Texture, you'll notice that `ASTableView` has been removed in favor of `ASTableNode`. - -
-ASTableView, an actual UITableView subclass, is still used internally by ASTableNode. While it should not be created directly, it can still be used directly by accessing the .view property of an ASTableNode. - -Don't forget that a node's view or layer property should only be accessed after -viewDidLoad or -didLoad, respectively, have been called. -
- -For example, you may want to set a table's separator style property. This can be done by accessing the table node's view in the `-viewDidLoad:` method as seen in the example below. - -
-SwiftObjective-C -
-
-- (void)viewDidLoad
-{
-  [super viewDidLoad];
-  
-  _tableNode.view.allowsSelection = NO;
-  _tableNode.view.separatorStyle = UITableViewCellSeparatorStyleNone;
-  _tableNode.view.leadingScreensForBatching = 3.0;  // default is 2.0
-}
-
- - -
-
- -### Table Row Height - -An important thing to notice is that `ASTableNode` does not provide an equivalent to `UITableView`'s `-tableView:heightForRowAtIndexPath:`. - -This is because nodes are responsible for determining their own height based on the provided constraints. This means you no longer have to write code to determine this detail at the view controller level. - -A node defines its height by way of the layoutSpec returned in the `-layoutSpecThatFits:` method. All nodes given a constrained size are able to calculate their desired size. - -
-By default, a ASTableNode provides its cells with a size range constraint where the minimum width is the tableNode's width and a minimum height is 0. The maximum width is also the tableNode's width but the maximum height is FLT_MAX. -

-This is all to say, a `tableNode`'s cells will always fill the full width of the `tableNode`, but their height is flexible making self-sizing cells something that happens automatically. -
- -If you call `-setNeedsLayout` on an `ASCellNode`, it will automatically perform another layout pass and if its overall desired size has changed, the table will be informed and will update itself. - -This is different from `UIKit` where normally you would have to call reload row / item. This saves tons of code, check out the ASDKgram sample app to see side by side implementations of an `UITableView` and `ASTableNode` implemented social media feed. - -### Sample Apps using ASTableNode - diff --git a/submodules/AsyncDisplayKit/docs/_docs/containers-asviewcontroller.md b/submodules/AsyncDisplayKit/docs/_docs/containers-asviewcontroller.md deleted file mode 100755 index 8b4fd3648d..0000000000 --- a/submodules/AsyncDisplayKit/docs/_docs/containers-asviewcontroller.md +++ /dev/null @@ -1,67 +0,0 @@ ---- -title: ASViewController -layout: docs -permalink: /docs/containers-asviewcontroller.html -prevPage: faq.html -nextPage: containers-asnodecontroller.html ---- - -`ASViewController` is a subclass of `UIViewController` that adds several useful features for hosting `ASDisplayNode` hierarchies. - -An `ASViewController` can be used in place of any `UIViewController` - including within a `UINavigationController`, `UITabBarController` and `UISplitViewController` or as a modal view controller. - -Benefits of using an `ASViewController`: -
    -
  1. Save Memory. An ASViewController that goes off screen will automatically reduce the size of the fetch data and display ranges of any of its children. This is key for memory management in large applications.
  2. -
  3. ASVisibility Feature. When used in an ASNavigationController or ASTabBarController, these classes know the exact number of user taps it would take to make the view controller visible.
  4. -
- -More features will be added over time, so it is a good idea to base your view controllers off of this class. - -## Usage - -A `UIViewController` provides a view of its own. An `ASViewController` is assigned a node to manage in its designated initializer `-initWithNode:`. - -Consider the following `ASViewController` subclass, `PhotoFeedNodeController`, from the ASDKgram example project that would like to use a table node as its managed node. - -This table node is assigned to the `ASViewController` in its `-initWithNode:` designated initializer method. - -
-SwiftObjective-C -
-
-- (instancetype)init
-{
-  _tableNode = [[ASTableNode alloc] initWithStyle:UITableViewStylePlain];
-  self = [super initWithNode:_tableNode];
-  
-  if (self) {
-    _tableNode.dataSource = self;
-    _tableNode.delegate = self;
-  }
-  
-  return self;
-}
-  
- - -
-
- -
-
-Conversion Tip: If your app already has a complex view controller hierarchy, it is perfectly fine to have all of them subclass ASViewController. That is to say, even if you don't use ASViewController's designated initializer -initWithNode:, and only use the ASViewController in the manner of a traditional UIViewController, this will give you the additional node support if you choose to adopt it in different areas your application. -
- diff --git a/submodules/AsyncDisplayKit/docs/_docs/containers-overview.md b/submodules/AsyncDisplayKit/docs/_docs/containers-overview.md deleted file mode 100755 index cde2fb7f8d..0000000000 --- a/submodules/AsyncDisplayKit/docs/_docs/containers-overview.md +++ /dev/null @@ -1,52 +0,0 @@ ---- -title: Node Containers -layout: docs -permalink: /docs/containers-overview.html -prevPage: intelligent-preloading.html -nextPage: node-overview.html ---- - -### Use Nodes in Node Containers -It is highly recommended that you use Texture's nodes within a node container. Texture offers the following node containers. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Texture Node ContainerUIKit Equivalent
ASCollectionNodein place of UIKit's UICollectionView
ASPagerNodein place of UIKit's UIPageViewController
ASTableNodein place of UIKit's UITableView
ASViewControllerin place of UIKit's UIViewController
ASNavigationControllerin place of UIKit's UINavigationController. Implements the ASVisibility protocol.
ASTabBarControllerin place of UIKit's UITabBarController. Implements the ASVisibility protocol.
- -
-Example code and specific sample projects are highlighted in the documentation for each node container. - - - -### What do I Gain by Using a Node Container? - -A node container automatically manages the intelligent preloading of its nodes. This means that all of the node's layout measurement, data fetching, decoding and rendering will be done asynchronously. Among other conveniences, this is why it is recommended to use nodes within a container node. - -Note that while it _is_ possible to use nodes directly (without a Texture node container), unless you add additional calls, they will only start displaying once they come onscreen (as UIKit does). This can lead to performance degradation and flashing of content. diff --git a/submodules/AsyncDisplayKit/docs/_docs/control-node.md b/submodules/AsyncDisplayKit/docs/_docs/control-node.md deleted file mode 100755 index 30aef32914..0000000000 --- a/submodules/AsyncDisplayKit/docs/_docs/control-node.md +++ /dev/null @@ -1,122 +0,0 @@ ---- -title: ASControlNode -layout: docs -permalink: /docs/control-node.html -prevPage: map-node.html -nextPage: scroll-node.html ---- - -`ASControlNode` is the Texture equivalent to `UIControl`. You don't create instances of `ASControlNode` directly. Instead, you can use it as a subclassing point when creating controls of your own. In fact, ASTextNode, ASImageNode, ASVideoNode and ASMapNode are all subclasses of `ASControlNode`. - -This fact is especially useful when it comes to image and text nodes. Having the ability to add target-action pairs means that you can use any text or image node as a button without having to rely on creating gesture recognizers, as you would with text in UIKit, or creating extraneous views as you might when using `UIButton`. - -### Control State - -Like `UIControl`, `ASControlNode` has a state which defines its appearance and ability to support user interactions. Its state can be one of any state defined by `ASControlState`. - -
-SwiftObjective-C -
-
-typedef NS_OPTIONS(NSUInteger, ASControlState) {
-    ASControlStateNormal       = 0,
-    ASControlStateHighlighted  = 1 << 0,  // used when isHighlighted is set
-    ASControlStateDisabled     = 1 << 1,
-    ASControlStateSelected     = 1 << 2,  // used when isSelected is set
-    ...
-};
-
- -
-
- -### Target-Action Mechanism - -Also similarly to `UIControl`, `ASControlNode`'s have a set of events defined which you can react to by assigning a target-action pair. - -The available actions are: -
-SwiftObjective-C -
-
-typedef NS_OPTIONS(NSUInteger, ASControlNodeEvent)
-{
-  /** A touch-down event in the control node. */
-  ASControlNodeEventTouchDown         = 1 << 0,
-  /** A repeated touch-down event in the control node; for this event the value of the UITouch tapCount method is greater than one. */
-  ASControlNodeEventTouchDownRepeat   = 1 << 1,
-  /** An event where a finger is dragged inside the bounds of the control node. */
-  ASControlNodeEventTouchDragInside   = 1 << 2,
-  /** An event where a finger is dragged just outside the bounds of the control. */
-  ASControlNodeEventTouchDragOutside  = 1 << 3,
-  /** A touch-up event in the control node where the finger is inside the bounds of the node. */
-  ASControlNodeEventTouchUpInside     = 1 << 4,
-  /** A touch-up event in the control node where the finger is outside the bounds of the node. */
-  ASControlNodeEventTouchUpOutside    = 1 << 5,
-  /** A system event canceling the current touches for the control node. */
-  ASControlNodeEventTouchCancel       = 1 << 6,
-  /** All events, including system events. */
-  ASControlNodeEventAllEvents         = 0xFFFFFFFF
-};
-
- -
-
- -Assigning a target and action for these events is done with the same methods as a `UIControl`, namely using `–addTarget:action:forControlEvents:`. - -### Hit Test Slop - -While all node's have a `hitTestSlop` property, this is usually most useful when dealing with controls. Instead of needing to make your control bigger, or needing to override `-hitTest:withEvent:` you can just assign a `UIEdgeInsets` to your control and its boundaries will be expanded accordingly. - -
-SwiftObjective-C -
-
-CGFloat horizontalDiff = (bounds.size.width - _playButton.bounds.size.width)/2;
-CGFloat verticalDiff = (bounds.size.height - _playButton.bounds.size.height)/2;
-
-_playButton.hitTestSlop = UIEdgeInsetsMake(-verticalDiff, -horizontalDiff, -verticalDiff, -horizontalDiff);
-
- -
-
- -Remember that, since the property is an inset, you'll need to use negative values in order to expand the size of your tappable region. - -### Hit Test Visualization - -The hit test visualization tool is an option to enable highlighting of the tappable areas of your nodes. To enable it, include `[ASControlNode setEnableHitTestDebug:YES]` in your app delegate in `-application:didFinishLaunchingWithOptions:`. diff --git a/submodules/AsyncDisplayKit/docs/_docs/corner-rounding.md b/submodules/AsyncDisplayKit/docs/_docs/corner-rounding.md deleted file mode 100755 index d8eca56c87..0000000000 --- a/submodules/AsyncDisplayKit/docs/_docs/corner-rounding.md +++ /dev/null @@ -1,226 +0,0 @@ ---- -title: Corner Rounding -layout: docs -permalink: /docs/corner-rounding.html -prevPage: synchronous-concurrency.html -nextPage: debug-tool-hit-test-visualization.html ---- - -When it comes to corner rounding, many developers stick with CALayer's `.cornerRadius` property. Unfortunately, this convenient property greatly taxes performance and should only be used when there is _no_ alternative. This post will cover: - - - -## CALayer's .cornerRadius is Expensive - -Why is `.cornerRadius` so expensive? Use of CALayer's `.cornerRadius` property triggers offscreen rendering to perform the clipping operation on every frame - 60 FPS during scrolling - even if the content in that area isn't changing! This means that the GPU has to switch contexts on every frame, between compositing the overall frame + additional passes for each use of `.cornerRadius`. - -Importantly, these costs don't show up in the Time Profiler, because they affect work done by the CoreAnimation Render Server on your app's behalf. This intensive thrash annihilates performance for a lot of devices. On the iPhone 4, 4S, and 5 / 5C (along with comparable iPads / iPods), expect to see notably degraded performance. On the iPhone 5S and newer, even if you can't see the impact directly, it will reduce headroom so that it takes less to cause a frame drop. - -## Performant Corner Rounding Strategies - -There are only three things to consider when picking a corner rounding strategy: - -
    -
  1. Is there movement underneath the corner?
  2. -
  3. Is there movement through the corner?
  4. -
  5. Are all 4 corners the same node *and* no other nodes intersect in the corner area?
  6. -
- -Movement **underneath the corner** is any movement behind the corner. For example, as a rounded-corner collection cell scrolls over a background, the background will move underneath and out from under the corners. - -To describe movement **through the corner,** imagine a small rounded-corner scroll view containing a much larger photo. As you zoom and pan the photo inside of the scroll view, the photo will move through the corners of the scroll view. - - - -The above image shows movement underneath the corner highlighted in blue and movement through the corner highlighted in orange. - -
-Note: There can be movement inside of the rounded-corner object, without moving through the corner. The following image shows content, highlighted in green, inset from the edge with a margin equal to the size of the corner radius. When the content scrolls, it will not move through the corners. -
- - - -Using the above method to adjust your design to eliminate one source of corner movement can make the difference between being able to use a fast rounding technique, or resorting to `.cornerRadius.`. - -The final consideration is to determine if all four corners cover the same node or if any subnodes interesect the corner area. - - - -### Precomposited Corners - -Precomposited corners refer to corners drawn using bezier paths to clip the content in a CGContext / UIGraphicsContext (`[path clip]`). In this scenario, the corners become part of the image itself — and are "baked in" to the single CALayer. There are two types of precomposited corners. - -The absolute best method is to use **precomposited opaque corners**. This is the most efficient method available, resulting in zero alpha blending (although this is much less critical than avoiding offscreen rendering). Unfortunately, this method is also the least flexible; the background behind the corners will need to be a solid color if the rounded image needs to move around on top of it. It's possible, but tricky to make precomposited corners with a textured or photo background - usually it's best to use precomposited alpha corners instead'.' - -The second method involves using bezier paths with **precomposited alpha corners**. This method is pretty flexible and should be one of the most frequently used. It does incur the cost of alpha blending across the full size of the content, and including an alpha channel increases memory impact by 25% over opaque precompositing - but these costs are tiny on modern devices, and a different order of magnitude than `.cornerRadius` offscreen rendering. - -A key limitation of precomposited corners is that the corners must only touch one node and not intersect with any subnodes. If either of these conditions exist, clip corners must be used. - -Note that Texture nodes have a special optimization of `.cornerRadius` that automatically implements precomposited corners **only when using** `.shouldRasterizeDescendants`. It's important to think carefully before you enable rasterization, so don't use this option without first reading all about the concept. - -
-If you're looking for a simple, flat-color rounded rectangle or circle, Texture offers a variety of conveniences to provide this. See `UIImage+ASConveniences.h` for methods to create flat-colored, rounded-corner resizable images using precomposited corners (both alpha and opaque are supported). These are great for use as placeholders for image nodes or backgrounds for ASButtonNode. -
- -### Clip Corner - -This strategy involves placing **4 seperate opaque corners that sit on top of the content** that needs corner rounding. This method is flexible and has quite good performance. It has minor CPU overhead of 4 seperate layers, one layer for each corner. - - - -Clip corners applies to two main types of corner rounding situations: - -
    -
  • Rounded corners in situations in which the corners touch more than one node or intersect with any subnodes.
  • -
  • Rounded corners on top of a stationary texture or photo background. The photo clip corner method is tricky, but useful!
  • -
- -## Is it ever okay to use CALayer's .cornerRadius property? - -There are a few, quite rare cases in which it is appropriate to use `.cornerRadius.` These include when there is dynamic content moving _both_ through the inside and underneath the corner. For certain animations, this is impossible to avoid. However, in many cases, it is easy to adjust your design to eliminate one of the sources of movement. One such case was discussed in the section on corner movement. - -It is much less bad, and okay as a shortcut, to use `.cornerRadius.` for screens in which nothing moves. However, *any* motion on the screen, even movement that doesn't involve the corners, will cause the `.cornerRadius.` performance tax. For example, having a rounded element in the navigation bar with a scrolling view beneath it will cause the impact even if they don't overlap. Animating anything onscreen, even if the user doesn't interact, will as well.' Additionally, any type of screen refresh will incur the cost of corner rounding. - -### Rasterization and Layerbacking - -Some people have suggested that using CALayer's `.shouldRasterize` can improve the performance of the `.cornerRadius` property. This is not well understood option that is generally perilous. As long as nothing causes it to re-rasterize (no movement, no tap to change color, not on a table view that moves, etc), it is okay to use. Generally we don't encourage this because it is very easy to cause much worse performance. For people who have not great app architecture and insist on using CALayer's `.cornerRadius` (e.g. their app is not very performant), this _can_ make a meaningful difference. However, if you are building your app from the ground up, we highly reccommend that you choose one of the better corner rounding strategies above. - -CALayer's `.shouldRasterize` is unrelated to Texture `node.shouldRasterizeDescendents`. When enabled, `.shouldRasterizeDescendents` will prevent the actual view and layer of the subnode children from being created. - -## Corner Rounding Strategy Flowchart - -Use this flowchart to select the most performant strategy to round a set of corners. - -corner rounding strategy flowchart - -## Texture Support - -The following code exemplifies different ways how to archive corner rounding within Texture: - -### Use `.cornerRadius` - -
-SwiftObjective-C -
-
-CGFloat cornerRadius = 20.0;
-    
-_photoImageNode.cornerRoundingType = ASCornerRoundingTypeDefaultSlowCALayer;
-_photoImageNode.cornerRadius = cornerRadius;
-
- -
-
- - -### Use precomposition for rounding corners - -
-SwiftObjective-C -
-
-CGFloat cornerRadius = 20.0;
-    
-_photoImageNode.cornerRoundingType = ASCornerRoundingTypePrecomposited;
-_photoImageNode.cornerRadius = cornerRadius;
-
- -
-
- - -### Use clipping for rounding corners - -
-SwiftObjective-C -
-
-CGFloat cornerRadius = 20.0;
-
-_photoImageNode.cornerRoundingType = ASCornerRoundingTypeClipping;
-_photoImageNode.backgroundColor = [UIColor whiteColor];
-_photoImageNode.cornerRadius = cornerRadius;
-
- -
-
- - -### Use `willDisplayNodeContentWithRenderingContext` to set a clipping path for the content for rounding corners - -
-SwiftObjective-C -
-
-CGFloat cornerRadius = 20.0;
-    
-// Use the screen scale for corner radius to respect content scale
-CGFloat screenScale = UIScreen.mainScreen.scale;
-_photoImageNode.willDisplayNodeContentWithRenderingContext = ^(CGContextRef context, id drawParameters) {
-    CGRect bounds = CGContextGetClipBoundingBox(context);
-    CGFloat radius = cornerRadius * screenScale; 
-    UIImage *overlay = [UIImage as_resizableRoundedImageWithCornerRadius:radius
-                                                             cornerColor:[UIColor clearColor]
-                                                               fillColor:[UIColor clearColor]];
-    [overlay drawInRect:bounds];
-    [[UIBezierPath bezierPathWithRoundedRect:bounds cornerRadius:radius] addClip];
-};
-
-
- -
-
- -### Use `ASImageNode` extras to round the image and add a border. - -This is great for example to round avatar images. - -
-SwiftObjective-C -
-
-CGFloat cornerRadius = 20.0;
-
-_photoImageNode.imageModificationBlock = ASImageNodeRoundBorderModificationBlock(5.0, [UIColor orangeColor]);
-
- -
-
diff --git a/submodules/AsyncDisplayKit/docs/_docs/debug-tool-ASRangeController.md b/submodules/AsyncDisplayKit/docs/_docs/debug-tool-ASRangeController.md deleted file mode 100755 index b1bbc33a80..0000000000 --- a/submodules/AsyncDisplayKit/docs/_docs/debug-tool-ASRangeController.md +++ /dev/null @@ -1,42 +0,0 @@ ---- -title: Range Visualization -layout: docs -permalink: /docs/debug-tool-ASRangeController.html -prevPage: debug-tool-pixel-scaling.html -nextPage: asvisibility.html ---- - -## Visualize ASRangeController tuning parameters (PR #1390) -
-This debug feature adds a semi-transparent subview in the bottom right hand corner of the sharedApplication keyWindow that visualizes the ASRangeTuningParameters per each ASLayoutRangeType for each visible (on-screen) instance of ASRangeController. - -- The instances of ASRangeController are represented as bars -- As you scroll around within ASTable/CollectionViews you can see the parameters (green = Visible, yellow = Display, and red = FetchData) move relative to each other. -- White arrows on the L and R sides of the individual RangeController bar views indicate the scrolling direction so that you can determine the leading / trailing tuning parameters (especially useful for vertically-oriented rangeControllers whose leading edge might be unclear within the horizontally-oriented bar view). -- The white debug label above the RangeController bar displays the RangeController dataSource’s class name to differentiate between nested views. -- The overlay can be moved with a panning gesture in order to see content under it. - -This debug feature is useful for highly optimized Texture apps that require tuning of any ASRangeController. Or for anyone who is curious about how ASRangeControllers work. - -The VerticalWithinHorizontal example app contains an ASPagerNode with embedded ASTableViews. In the screenshot with this feature enabled, you can see the two range controllers - ASTableView and ASCollectionView (ASPagerNode) - in the overlay. - -- The white arrows to the right of the rangeController bars indicate that the user is currently scrolling down through the table and right through the ASCollectionView/PagerNode. -- The ASTableView rangeController bar indicates that the range parameters are tuned to both fetch and decode more data in the downward table direction rather than in the reverse direction (which makes sense as the user is scrolling down). -- Since it’s less obvious whether or not the user will page to the right or left next, the ASCollectionView is tuned to fetch and decode equal amounts of data in each direction. -- In the video demo, you can see as the user scrolls between pages, that new ASTableView rangeControllers are created and removed in the overlay view. -![bc0b98f0-ebb8-11e5-8f50-421cb0f320c2](https://cloud.githubusercontent.com/assets/3419380/14057072/ef7f63a0-f2b2-11e5-92a5-f65b2d207e63.png) - -## Limitations -
    -
  • only shows onscreen ASRangeControllers
  • -
  • currently the ratio of red (fetch data), yellow (display) and green (visible) are relative to each other, but not between each bar view. So you cannot compare individual bars to eachother
  • -
- -## Usage -In your `AppDelegate.m` file, -
    -
  • import AsyncDisplayKit+Debug.h
  • -
  • add [ASDisplayNode setShouldShowRangeDebugOverlay:YES] at the top of your AppDelegate's didFinishLaunchingWithOptions: method
  • -
- -**Make sure to call this method before initializing any component that uses an ASRangeControllers (ASTableView, ASCollectionView).** diff --git a/submodules/AsyncDisplayKit/docs/_docs/debug-tool-hit-test-visualization.md b/submodules/AsyncDisplayKit/docs/_docs/debug-tool-hit-test-visualization.md deleted file mode 100755 index 2b2f5f2a50..0000000000 --- a/submodules/AsyncDisplayKit/docs/_docs/debug-tool-hit-test-visualization.md +++ /dev/null @@ -1,34 +0,0 @@ ---- -title: Hit Test Visualization -layout: docs -permalink: /docs/debug-tool-hit-test-visualization.html -prevPage: corner-rounding.html -nextPage: debug-tool-pixel-scaling.html ---- - -## Visualize ASControlNode Tappable Areas -
-This debug feature adds a semi-transparent highlight overlay on any ASControlNodes containing a `target:action:` pair or gesture recognizer. The tappable range is defined as the ASControlNode’s frame + its `.hitTestSlop` `UIEdgeInsets`. Hit test slop is a unique feature of `ASControlNode` that allows it to extend its tappable range. - -In the screenshot below, you can quickly see that -
    -
  • The tappable area for the avatar image overlaps the username’s tappable area. In this case, the user avatar image is on top in the view hierarchy and is capturing some touches that should go to the username.
  • -
  • It would probably make sense to expand the `.hitTestSlop` for the username to allow the user to more easily hit it.
  • -
  • I’ve accidentally set the hitTestSlop’s UIEdgeInsets to be positive instead of negative for the photo likes count label. It’s going to be hard for a user to tap the smaller target.
  • -
- -![screen shot 2016-03-25 at 4 39 23 pm](https://cloud.githubusercontent.com/assets/3419380/14057034/e1e71450-f2b1-11e5-8091-3e6f22862994.png) - -## Restrictions -
-A _green_ border on the edge(s) of the highlight overlay indicates that that edge of the tapable area is restricted by one of it's superview's tapable areas. An _orange_ border on the edge(s) of the highlight overlay indicates that that edge of the tapable area is clipped by .clipsToBounds of a parent in its hierarchy. - -## Usage -
-In your `AppDelegate.m` file, -
    -
  • import AsyncDisplayKit+Debug.h
  • -
  • add [ASControlNode setEnableHitTestDebug:YES] at the top of your AppDelegate's didFinishLaunchingWithOptions: method
  • -
- -**Make sure to call this method before initializing any ASControlNodes - including ASButtonNodes, ASImageNodes, and ASTextNodes.** diff --git a/submodules/AsyncDisplayKit/docs/_docs/debug-tool-pixel-scaling.md b/submodules/AsyncDisplayKit/docs/_docs/debug-tool-pixel-scaling.md deleted file mode 100755 index 2ff4e5e37b..0000000000 --- a/submodules/AsyncDisplayKit/docs/_docs/debug-tool-pixel-scaling.md +++ /dev/null @@ -1,60 +0,0 @@ ---- -title: Image Scaling -layout: docs -permalink: /docs/debug-tool-pixel-scaling.html -prevPage: debug-tool-hit-test-visualization.html -nextPage: debug-tool-ASRangeController.html ---- - -## Visualize ASImageNode.image’s pixel scaling -
-This debug feature adds a red text overlay on the bottom right hand corner of an ASImageNode if (and only if) the image’s size in pixels does not match it’s bounds size in pixels, e.g. - -
-SwiftObjective-C - -
-
-CGFloat imageSizeInPixels = image.size.width * image.size.height;
-CGFloat boundsSizeInPixels = imageView.bounds.size.width * imageView.bounds.size.height;
-CGFloat scaleFactor = imageSizeInPixels / boundsSizeInPixels;
-
-if (scaleFactor != 1.0) {
-      NSString *scaleString = [NSString stringWithFormat:@"%.2fx", scaleFactor];
-      _debugLabelNode.hidden = NO;
-}
-
- -
-
- - -This debug feature is useful for quickly determining if you are - -
    -
  • downloading and rendering excessive amounts of image data
  • -
  • upscaling a low quality image
  • -
- -In the screenshot below of an app with this debug feature enabled, you can see that the avatar image is unnecessarily large (9x too large) for it’s bounds size and that the center picture is more optimized, but not perfectly so. If you control your own endpoint, make sure to return an optimally sized image. - -![screen shot 2016-03-25 at 4 04 59 pm](https://cloud.githubusercontent.com/assets/3419380/14056994/15561daa-f2b1-11e5-9606-59d54d2b5354.png) - -## Usage -
-In your `AppDelegate.m` file, -
    -
  • import AsyncDisplayKit+Debug.h
  • -
  • add [ASImageNode setShouldShowImageScalingOverlay:YES] at the top of your AppDelegate's didFinishLaunchingWithOptions: method
  • -
- -**Make sure to call this method before initializing any ASImageNodes.** diff --git a/submodules/AsyncDisplayKit/docs/_docs/development/automatic-subnode-layout.md b/submodules/AsyncDisplayKit/docs/_docs/development/automatic-subnode-layout.md deleted file mode 100644 index 705411d113..0000000000 --- a/submodules/AsyncDisplayKit/docs/_docs/development/automatic-subnode-layout.md +++ /dev/null @@ -1,7 +0,0 @@ ---- -title: Automatic subnode layout -layout: docs -permalink: /development/automatic-subnode-layout.html ---- - -

👷👷‍♀️Under construction…

\ No newline at end of file diff --git a/submodules/AsyncDisplayKit/docs/_docs/development/cell-node-lifecycle.md b/submodules/AsyncDisplayKit/docs/_docs/development/cell-node-lifecycle.md deleted file mode 100644 index 9ae549f915..0000000000 --- a/submodules/AsyncDisplayKit/docs/_docs/development/cell-node-lifecycle.md +++ /dev/null @@ -1,7 +0,0 @@ ---- -title: Cell node lifecycle -layout: docs -permalink: /development/cell-node-lifecycle.html ---- - -

👷👷‍♀️Under construction…

\ No newline at end of file diff --git a/submodules/AsyncDisplayKit/docs/_docs/development/collection-animations.md b/submodules/AsyncDisplayKit/docs/_docs/development/collection-animations.md deleted file mode 100644 index e97a4d540c..0000000000 --- a/submodules/AsyncDisplayKit/docs/_docs/development/collection-animations.md +++ /dev/null @@ -1,7 +0,0 @@ ---- -title: Collection animations -layout: docs -permalink: /development/collection-animations.html ---- - -

👷👷‍♀️Under construction…

\ No newline at end of file diff --git a/submodules/AsyncDisplayKit/docs/_docs/development/collection-asynchronous-updates.md b/submodules/AsyncDisplayKit/docs/_docs/development/collection-asynchronous-updates.md deleted file mode 100644 index aacb9bc35a..0000000000 --- a/submodules/AsyncDisplayKit/docs/_docs/development/collection-asynchronous-updates.md +++ /dev/null @@ -1,7 +0,0 @@ ---- -title: Collections and asynchronous updates -layout: docs -permalink: /development/collection-asynchronous-updates.html ---- - -

👷👷‍♀️Under construction…

\ No newline at end of file diff --git a/submodules/AsyncDisplayKit/docs/_docs/development/components.md b/submodules/AsyncDisplayKit/docs/_docs/development/components.md deleted file mode 100644 index 52f5e35b93..0000000000 --- a/submodules/AsyncDisplayKit/docs/_docs/development/components.md +++ /dev/null @@ -1,7 +0,0 @@ ---- -title: How components work together -layout: docs -permalink: /development/components.html ---- - -

👷👷‍♀️Under construction…

\ No newline at end of file diff --git a/submodules/AsyncDisplayKit/docs/_docs/development/how-to-develop-and-debug.md b/submodules/AsyncDisplayKit/docs/_docs/development/how-to-develop-and-debug.md deleted file mode 100644 index d22ddbc879..0000000000 --- a/submodules/AsyncDisplayKit/docs/_docs/development/how-to-develop-and-debug.md +++ /dev/null @@ -1,7 +0,0 @@ ---- -title: Develop and debug -layout: docs -permalink: /development/how-to-develop-and-debug.html ---- - -

👷👷‍♀️Under construction…

\ No newline at end of file diff --git a/submodules/AsyncDisplayKit/docs/_docs/development/layout-specs.md b/submodules/AsyncDisplayKit/docs/_docs/development/layout-specs.md deleted file mode 100644 index c7089b81f8..0000000000 --- a/submodules/AsyncDisplayKit/docs/_docs/development/layout-specs.md +++ /dev/null @@ -1,7 +0,0 @@ ---- -title: Layout specs -layout: docs -permalink: /development/layout-specs.html ---- - -

👷👷‍♀️Under construction…

\ No newline at end of file diff --git a/submodules/AsyncDisplayKit/docs/_docs/development/layout-transitions.md b/submodules/AsyncDisplayKit/docs/_docs/development/layout-transitions.md deleted file mode 100644 index 8ba604966f..0000000000 --- a/submodules/AsyncDisplayKit/docs/_docs/development/layout-transitions.md +++ /dev/null @@ -1,7 +0,0 @@ ---- -title: Layout transitions and animations -layout: docs -permalink: /development/layout-transitions.html ---- - -

👷👷‍♀️Under construction…

\ No newline at end of file diff --git a/submodules/AsyncDisplayKit/docs/_docs/development/node-lifecycle.md b/submodules/AsyncDisplayKit/docs/_docs/development/node-lifecycle.md deleted file mode 100644 index b8695b8923..0000000000 --- a/submodules/AsyncDisplayKit/docs/_docs/development/node-lifecycle.md +++ /dev/null @@ -1,7 +0,0 @@ ---- -title: Node lifecycle -layout: docs -permalink: /development/node-lifecycle.html ---- - -

👷👷‍♀️Under construction…

\ No newline at end of file diff --git a/submodules/AsyncDisplayKit/docs/_docs/development/overview.md b/submodules/AsyncDisplayKit/docs/_docs/development/overview.md deleted file mode 100644 index 531fefe951..0000000000 --- a/submodules/AsyncDisplayKit/docs/_docs/development/overview.md +++ /dev/null @@ -1,7 +0,0 @@ ---- -title: Overview -layout: docs -permalink: /development/overview.html ---- - -

👷👷‍♀️Under construction…

\ No newline at end of file diff --git a/submodules/AsyncDisplayKit/docs/_docs/development/structure.md b/submodules/AsyncDisplayKit/docs/_docs/development/structure.md deleted file mode 100644 index ec05b3f043..0000000000 --- a/submodules/AsyncDisplayKit/docs/_docs/development/structure.md +++ /dev/null @@ -1,7 +0,0 @@ ---- -title: Structure -layout: docs -permalink: /development/structure.html ---- - -

👷👷‍♀️Under construction…

\ No newline at end of file diff --git a/submodules/AsyncDisplayKit/docs/_docs/development/threading.md b/submodules/AsyncDisplayKit/docs/_docs/development/threading.md deleted file mode 100644 index 33499aeb29..0000000000 --- a/submodules/AsyncDisplayKit/docs/_docs/development/threading.md +++ /dev/null @@ -1,7 +0,0 @@ ---- -title: Threading -layout: docs -permalink: /development/threading.html ---- - -

👷👷‍♀️Under construction…

\ No newline at end of file diff --git a/submodules/AsyncDisplayKit/docs/_docs/display-node.md b/submodules/AsyncDisplayKit/docs/_docs/display-node.md deleted file mode 100755 index 896c969dad..0000000000 --- a/submodules/AsyncDisplayKit/docs/_docs/display-node.md +++ /dev/null @@ -1,93 +0,0 @@ ---- -title: ASDisplayNode -layout: docs -permalink: /docs/display-node.html -prevPage: containers-aspagernode.html -nextPage: cell-node.html ---- - -### Node Basics - -`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`. - -
-SwiftObjective-C - -
-
-ASDisplayNode *node = [[ASDisplayNode alloc] init];
-node.backgroundColor = [UIColor orangeColor];
-node.bounds = CGRectMake(0, 0, 100, 100);
-
-NSLog(@"Underlying view: %@", node.view);
-	
- - -
-
- -A node has all the same properties as a `UIView`, so using them should feel very familiar to anyone familiar with UIKit. - -Properties of both views and layers are forwarded to nodes and can be easily accessed. - -
-SwiftObjective-C - -
-
-ASDisplayNode *node = [[ASDisplayNode alloc] init];
-node.clipsToBounds = YES;				  // not .masksToBounds
-node.borderColor = [UIColor blueColor];  //layer name when there is no UIView equivalent
-
-NSLog(@"Backing layer: %@", node.layer);
-	
- - -
-
- -As you can see, naming defaults to the `UIView` conventions*** unless there is no `UIView` equivalent. You also have access to your underlying `CALayer` just as you would when dealing with a plain `UIView`. - -When used with one of the node containers, a node’s properties will be set on a background thread, and its backing view/layer will be lazily constructed with the cached properties collected by the node. You rarely need to worry about jumping to a background thread as this will be taken care of by the framework, but it's important to know that this is happening under the hood. - -### View Wrapping - -In some cases, it is desirable to initialize a node and provide a view to be used as the backing view. These views are provided via a block that will return a view so that the actual construction of the view can be saved until later. These nodes’ display step happens synchronously. This is because a node can only be asynchronously displayed when it wraps an `_ASDisplayView` (the internal view subclass), not when it wraps a plain `UIView`. - -
-SwiftObjective-C - -
-
-ASDisplayNode *node = [ASDisplayNode alloc] initWithViewBlock:^{
-	SomeView *view  = [[SomeView alloc] init];
-	return view;
-}];
-	
- - -
-
- -Doing this allows you to wrap existing views if that is preferable to converting the `UIView` subclass to an `ASDisplayNode` subclass. - -
- *** The only exception is that nodes use `position` instead of `center` for reasons beyond this intro. -
diff --git a/submodules/AsyncDisplayKit/docs/_docs/editable-text-node.md b/submodules/AsyncDisplayKit/docs/_docs/editable-text-node.md deleted file mode 100755 index 9eccfd0321..0000000000 --- a/submodules/AsyncDisplayKit/docs/_docs/editable-text-node.md +++ /dev/null @@ -1,153 +0,0 @@ ---- -title: ASEditableTextNode -layout: docs -permalink: /docs/editable-text-node.html -prevPage: scroll-node.html -nextPage: multiplex-image-node.html ---- - -`ASEditableTextNode` is available to be used anywhere you'd normally use a `UITextView` or `UITextField`. Under the hood, it uses a specialized `UITextView` as its backing view. You can access and configure this view directly any time after the node has loaded, as long as you do it on the main thread. - -It's also important to note that this node does not support layer backing due to the fact that it supports user interaction. - -### Basic Usage - -Using an editable text node as a text input is easy. If you want it to have text by default, you can assign an attributed string to the `attributedText` property. - -
-SwiftObjective-C - -
-
-ASEditableTextNode *editableTextNode = [[ASEditableTextNode alloc] init];
-
-editableTextNode.attributedText = [[NSAttributedString alloc] initWithString:@"Lorem ipsum dolor sit amet."];
-editableTextNode.textContainerInset = UIEdgeInsetsMake(8, 8, 8, 8);
-
- - -
-
- -### Placeholder Text - -If you want to display a text box with a placeholder that disappears after a user starts typing, just assign an attributed string to the `attributedPlaceholderText` property. - -
-SwiftObjective-C - -
-
-editableTextNode.attributedPlaceholderText = [[NSAttributedString alloc] initWithString:@"Type something here..."];
-
- - -
-
- -The property `isDisplayingPlaceholder` will initially return `YES`, but will toggle to `NO` any time the `attributedText` property is set to a non-empty string. - -### Typing Attributes - -To set up the style of the text your user will type into this text field, you can set the `typingAttributes`. - - -
-SwiftObjective-C - -
-
-editableTextNode.typingAttributes = @{NSForegroundColorAttributeName: [UIColor blueColor], 
-                                      NSBackgroundColorAttributeName: [UIColor redColor]};
-
- - -
-
- - -### ASEditableTextNode Delegate - -In order to respond to events associated with an editable text node, you can use any of the following delegate methods: - - --- Indicates to the delegate that the text node began editing. - -
-SwiftObjective-C -
-
-- (void)editableTextNodeDidBeginEditing:(ASEditableTextNode *)editableTextNode;
-
- -
-
- --- Asks the delegate whether the specified text should be replaced in the editable text node. - -
-SwiftObjective-C -
-
-- (BOOL)editableTextNode:(ASEditableTextNode *)editableTextNode shouldChangeTextInRange:(NSRange)range replacementText:(NSString *)text;
-
- -
-
- --- Indicates to the delegate that the text node's selection has changed. - -
-SwiftObjective-C -
-
-- (void)editableTextNodeDidChangeSelection:(ASEditableTextNode *)editableTextNode fromSelectedRange:(NSRange)fromSelectedRange toSelectedRange:(NSRange)toSelectedRange dueToEditing:(BOOL)dueToEditing;
-
- -
-
- --- Indicates to the delegate that the text node's text was updated. - -
-SwiftObjective-C -
-
-- (void)editableTextNodeDidUpdateText:(ASEditableTextNode *)editableTextNode;
-
- -
-
- ---  Indicates to the delegate that the text node has finished editing. - -
-SwiftObjective-C -
-
-- (void)editableTextNodeDidFinishEditing:(ASEditableTextNode *)editableTextNode;
-
- -
-
- diff --git a/submodules/AsyncDisplayKit/docs/_docs/faq.md b/submodules/AsyncDisplayKit/docs/_docs/faq.md deleted file mode 100755 index fa7d3b2be7..0000000000 --- a/submodules/AsyncDisplayKit/docs/_docs/faq.md +++ /dev/null @@ -1,125 +0,0 @@ ---- -title: FAQ -layout: docs -permalink: /docs/faq.html -prevPage: subclassing.html -nextPage: containers-asviewcontroller.html ---- - -### Common Developer Mistakes - - - -### Common Conceptual Misunderstandings - - - -### Common Questions - - - -### Accessing the node's view before it is loaded -
-Node `-init` methods are often called off the main thread, therefore it is imperative that no UIKit objects are accessed. Examples of common errors include accessing the node's view or creating a gesture recognizer. Instead, these operations are ideal to perform in `-didLoad`. - -Interacting with UIKit in `-init` can cause crashes and performance problems. -
- -### Make sure you access your data source outside the node block -
-The `indexPath` parameter is only valid _outside_ the node block returned in `nodeBlockForItemAtIndexPath:` or `nodeBlockForRowAtIndexPath:`. Because these blocks are executed on a background thread, the `indexPath` may be invalid by execution time, due to additional changes in the data source. - -See an example of how to correctly code a node block in the ASTableNode page. Just as with UIKit, it will cause an exception if Nil is returned from the block for any `ASCellNode`. -
- -### Take steps to avoid a retain cycle in viewBlocks -
-When using `initWithViewBlock:` it is important to prevent a retain cycle by capturing a strong reference to self. The two ways that a cycle can be created are by using any instance variable inside the block or directly referencing self without using a weak pointer. - -You can use properties instead of instance variables as long as they are accessed on a weak pointer to self. - -Because viewBlocks are always executed on the main thread, it is safe to preform UIKit operations (including gesture recognizer creation and addition). - -Although the block is destroyed after the view is created, in the event that the block is never run and the view is never created, then a cycle can persist preventing memory from being released. -
- -### ASCellNode Reusability -
-Texture does not use cell reuse, for a number of specific reasons, one side effect of this is that it eliminates the large class of bugs associated with cell reuse. -
- -### LayoutSpecs Are Regenerated -
-A node's layoutSpec gets regenerated every time its `layoutThatFits:` method is called. -
- -### Layout API Sizing -
-If you're confused by `ASRelativeDimension`, `ASRelativeSize`, `ASRelativeSizeRange` and `ASSizeRange`, check out our Layout API Sizing guide. -
- -### CALayer's .cornerRadius Property Kills Performance -
-CALayer's' .cornerRadius property is a disastrously expensive property that should only be used when there is no alternative. It is one of the least efficient, most render-intensive properties on CALayer (alongside shadowPath, masking, borders, etc). These properties trigger offscreen rendering to perform the clipping operation on every frame — 60FPS during scrolling! — even if the content in that area isn't changing. - -Using `.cornerRadius` will visually degraded performance on iPhone 4, 4S, and 5 / 5C (along with comparable iPads / iPods) and reduce head room and make frame drops more likely on 5S and newer devices. - -For a longer discussion and easy alternative corner rounding solutions, please read our comprehensive corner rounding guide. -
- -### Texture does not support UIKit Auto Layout or InterfaceBuilder -
-UIKit Auto Layout and InterfaceBuilder are not supported by Texture. - -However, Texture's Layout API provides a variety of ASLayoutSpec objects that allow implementing automatic layout which is more efficient (multithreaded, off the main thread), often easier to debug (can step into the code and see where all values come from, as it is open source), and reusable (you can build composable layouts that can be shared with different parts of the UI). -
- -### ASDisplayNode keep alive reference - -
-
-
-ASTextNode *title=[[ASTextNode alloc]init];
-title.attributedString=Text;
-[self addSubnode:title];
-
-retain cycles
-(
-"-> _keepalive_node -> ASTextNode ",
-"-> _view -> _ASDisplayView "
-)
-
-
-
- -
-This retain cycle is intentionally created because the node is in a "live" view hierarchy (it is inside the UIWindow that is onscreen). - -To see why this is necessary, consider that Apple also creates this retain cycle between UIView and CALayer. If you create a UIView and add its layer to a super layer, and then release the UIView, it will stay alive even though the CALayer delegate pointing to it is weak. - -For the same reason, if the node's view is a descendant of a window, but there is no reference to the node, we keep the node alive with a strong reference from the view. - -Good application design should not rely on this behavior, because a strong reference to the node should be maintained by the subnodes array or by an instance variable. However, this condition occasionally occurs, for example when using a UIView animation API. This cycle should never create a leak or even extend the lifecycle of a node any longer than it is absolutely necessary. -
- -### UICollectionViewCell Compatibility - -Texture supports using UICollectionViewCells alongside native ASCellNodes. - -Note that these UIKit cells will **not** have the performance benefits of `ASCellNodes` (like preloading, async layout, and async drawing), even when mixed within the same `ASCollectionNode`. - -However, this interoperability allows developers the flexibility to test out the framework without needing to convert all of their cells at once. Read more here. diff --git a/submodules/AsyncDisplayKit/docs/_docs/getting-started.md b/submodules/AsyncDisplayKit/docs/_docs/getting-started.md deleted file mode 100755 index ae96e6cfb2..0000000000 --- a/submodules/AsyncDisplayKit/docs/_docs/getting-started.md +++ /dev/null @@ -1,53 +0,0 @@ ---- -title: Getting Started -layout: docs -permalink: /docs/getting-started.html -nextPage: resources.html ---- - -Texture's basic unit is the `node`. `ASDisplayNode` is an abstraction -over `UIView`, which in turn is an abstraction over `CALayer`. Unlike views, which -can only be used on the main thread, nodes are thread-safe: you can -instantiate and configure entire hierarchies of them in parallel on background -threads. - -To keep its user interface smooth and responsive, your app should render at 60 -frames per second — the gold standard on iOS. This means the main thread -has one-sixtieth of a second to push each frame. That's 16 milliseconds to -execute all layout and drawing code! And because of system overhead, your code -usually has less than ten milliseconds to run before it causes a frame drop. - -Texture lets you move image decoding, text sizing and rendering, and -other expensive UI operations off the main thread, to keep the main thread available to -respond to user interaction. Texture has other tricks up its -sleeve too... but we'll get to that later. - -

Nodes

- -If you're used to working with views, you already know how to use nodes. Most methods have a node equivalent and most `UIView` and `CALayer` properties are available as well. In any case where there is a naming discrepancy (such as `.clipsToBounds` vs `.masksToBounds`), nodes will default to the `UIView` name. The only exception is that nodes use position instead of center. - -Of course, you can always access the underlying view or layer directly via `node.view` or `node.layer`, just make sure to do it on the main thread! - -Texture offers a variety of nodes to replace the majority of the UIKit components that you are used to. Large scale apps have been able to completely write their UI using just Texture nodes. - -

Node Containers

- -When converting an app to use Texture, a common mistake is to add nodes directly to an existing view hierarchy. Doing this will virtually guarantee that your nodes will flash as they are rendered. - -Instead, you should add nodes as subnodes of one of the many node container classes. These containers are in charge of telling contained nodes what state they're currently in so that data can be loaded and nodes can be rendered as efficiently as possible. You should think of these classes as the integration point between UIKit and Texture. - -

Layout Engine

- -Texture's layout engine is both one of its most powerful and one of its most unique features. Based on the CSS FlexBox model, it provides a declarative way of specifying a custom node's size and layout of its subnodes. While all nodes are concurrently rendered by default, asynchronous measurement and layout are performed by providing an `ASLayoutSpec` for each node. - -

Advanced Developer Features

- -Texture offers a variety of advanced developer features that cannot be found in UIKit or Foundation. Our developers have found that Texture allows simplifications in their architecture and improves developer velocity. - -(Full list coming soon!) - -

Adding Texture to your App

- -If you are new to Texture, we recommend that you check out our ASDKgram example app. We've created a handy guide (coming soon!) with step-by-step directions and a follow along example on how to add Texture to an app. - -If you run into any problems along the way, reach out to us GitHub or the Texture Slack community for help. diff --git a/submodules/AsyncDisplayKit/docs/_docs/hit-test-slop.md b/submodules/AsyncDisplayKit/docs/_docs/hit-test-slop.md deleted file mode 100755 index fa126ce880..0000000000 --- a/submodules/AsyncDisplayKit/docs/_docs/hit-test-slop.md +++ /dev/null @@ -1,44 +0,0 @@ ---- -title: Hit Test Slop -layout: docs -permalink: /docs/hit-test-slop.html -prevPage: layout-transition-api.html -nextPage: batch-fetching-api.html ---- - -`ASDisplayNode` has a `hitTestSlop` property of type `UIEdgeInsets` that when set to a non-zero inset, increase the bounds for hit testing to make it easier to tap or perform gestures on this node. - -ASDisplayNode is the base class for all nodes, so this property is available on any of Texture's nodes. - -
-Note: This affects the default implementation of -hitTest and -pointInside, so subclasses should call super if you override it and want hitTestSlop applied. -
- -A node's ability to capture touch events is restricted by its parent's bounds + parent hitTestSlop UIEdgeInsets. Should you want to extend the hitTestSlop of a child outside its parent's bounds, simply extend the parent node's hitTestSlop to include the child's hitTestSlop needs. - -### Usage - -A common need for hit test slop, is when you have a text node (aka label) you'd like to use as a button. Often, the text node's height won't meet the 44 point minimum recommended for tappable areas. In that case, you can calculate the difference, and apply a negative inset to your label to increase the tappable area. - -
-SwiftObjective-C - -
-
-ASTextNode *textNode = [[ASTextNode alloc] init];
-
-CGFloat padding = (44.0 - button.bounds.size.height)/2.0;
-textNode.hitTestSlop = UIEdgeInsetsMake(-padding, 0, -padding, 0);
-
- -
-
- -
-To visualize hitTestSlop, check out the debug tool. -
diff --git a/submodules/AsyncDisplayKit/docs/_docs/image-modification-block.md b/submodules/AsyncDisplayKit/docs/_docs/image-modification-block.md deleted file mode 100755 index 1e2e2716aa..0000000000 --- a/submodules/AsyncDisplayKit/docs/_docs/image-modification-block.md +++ /dev/null @@ -1,152 +0,0 @@ ---- -title: Image Modification Blocks -layout: docs -permalink: /docs/image-modification-block.html -prevPage: inversion.html -nextPage: placeholder-fade-duration.html ---- - -Many times, operations that would affect the appearance of an image you're displaying are big sources of main thread work. Naturally, you want to move these to a background thread. - -By assigning an `imageModificationBlock` to your imageNode, you can define a set of transformations that need to happen asynchronously to any image that gets set on the imageNode. - -
-SwiftObjective-C - -
-
-_backgroundImageNode.imageModificationBlock = ^(UIImage *image) {
-	UIImage *newImage = [image applyBlurWithRadius:30
-		tintColor:[UIColor colorWithWhite:0.5 alpha:0.3]
-		saturationDeltaFactor:1.8
-		maskImage:nil];
-	return newImage ?: image;
-};
-
-//some time later...
-
-_backgroundImageNode.image = someImage;
-
- - -
-
- -The image named "someImage" will now be blurred asynchronously before being assigned to the imageNode to be displayed. - -### Adding image effects - -The most efficient way to add image effects is by leveraging the `imageModificationBlock` block. If a block is provided it can perform drawing operations on the image during the display phase. As display is happening on a background thread it will not block the main thread. - -In the following example we assume we have an avatar node that will be setup in `init` of a supernode and the image of the node should be rounded. We provide the `imageModificationBlock` and in there we call a convenience method that transforms the image passed in into a circular image and return it. - -
-SwiftObjective-C - -
-
-- (instancetype)init
-{
-// ...
-  _userAvatarImageNode.imageModificationBlock = ^UIImage *(UIImage *image) {
-    CGSize profileImageSize = CGSizeMake(USER_IMAGE_HEIGHT, USER_IMAGE_HEIGHT);
-    return [image makeCircularImageWithSize:profileImageSize];
-  };
-  // ...
-}
-
- - -
- -
- -The actual drawing code is nicely abstracted away in an UIImage category and looks like the following: - -
-SwiftObjective-C - -
-
-@implementation UIImage (Additions)
-- (UIImage *)makeCircularImageWithSize:(CGSize)size
-{
-  // make a CGRect with the image's size
-  CGRect circleRect = (CGRect) {CGPointZero, size};
-
-  // begin the image context since we're not in a drawRect:
-  UIGraphicsBeginImageContextWithOptions(circleRect.size, NO, 0);
-
-  // create a UIBezierPath circle
-  UIBezierPath *circle = [UIBezierPath bezierPathWithRoundedRect:circleRect cornerRadius:circleRect.size.width/2];
-
-  // clip to the circle
-  [circle addClip];
-
-  // draw the image in the circleRect *AFTER* the context is clipped
-  [self drawInRect:circleRect];
-
-  // get an image from the image context
-  UIImage *roundedImage = UIGraphicsGetImageFromCurrentImageContext();
-
-  // end the image context since we're not in a drawRect:
-  UIGraphicsEndImageContext();
-
-  return roundedImage;
-}
-@end
-
- - -
-
- -The imageModificationBlock is very handy and can be used to add all kind of image effects, such as rounding, adding borders, or other pattern overlays, without extraneous display calls. diff --git a/submodules/AsyncDisplayKit/docs/_docs/image-node.md b/submodules/AsyncDisplayKit/docs/_docs/image-node.md deleted file mode 100755 index 4fcc2da69b..0000000000 --- a/submodules/AsyncDisplayKit/docs/_docs/image-node.md +++ /dev/null @@ -1,90 +0,0 @@ ---- -title: ASImageNode -layout: docs -permalink: /docs/image-node.html -prevPage: text-node.html -nextPage: network-image-node.html ---- - -`ASImageNode` is the Texture equivalent to `UIImageView`. The most basic difference is that images are decoded asynchronously by default. Of course, there are more advanced improvements as well such as GIF support and `imageModificationBlock`s. - -### Basic Usage - -Using an image node works exactly like using an image view. - -
-SwiftObjective-C - -
-
-ASImageNode *imageNode = [[ASImageNode alloc] init];
-
-imageNode.image = [UIImage imageNamed:@"someImage"];
-imageNode.contentMode = UIViewContentModeScaleAspectFill;
-
- - -
-
- - -### Image transformations and effects - -Many times, operations that would affect the appearance of an image you're displaying are big sources of main thread work. Naturally, you want to move these to a background thread. - -By assigning an `imageModificationBlock` to your `imageNode`, you can define a set of transformations that need to happen asynchronously to any image that gets set on the `imageNode`, including image effects such as rounding, adding borders, or other pattern overlays, without extraneous display calls. - -You can read more about it at Image Modification Blocks. - -### Image Cropping - -When an `imageNode`'s `contentMode` property is set to `UIViewContentModeScaleAspectFill`, it will automatically expand the image to fill the entire area of the imageNode, and crop any areas that go past the bounds due to scaling the image. - -By default, the expanded image will be centered within the bounds of the view. Take the following cat image. His face gets cut off by default. - - - -That's messed up. To fix it, you can set the `cropRect` property to move the image over. By default it is set to `CGRectMake(0.5, 0.5, 0.0, 0.0)`. - -The rectangle is specified as a "unit rectangle," using percentages of the source image's width and height. To show the image starting at the left side, you can set the `cropRect`'s `x` value to be `0.0`, meaning the image's origin should start at `{0, 0}` as opposed to the default. - -
-SwiftObjective-C - -
-
-self.animalImageNode.cropRect = CGRectMake(0, 0, 0.0, 0.0);
-
- - -
-
- -Leaving the width and height values at `0.0` means the image won't be stretched. - - - -Alternatively, you can set the `x` value of the origin to `1.0` to right align the image. - - - -### Forced Upscaling - -By default, an image won't be upscaled on the CPU when it is too small to fit into the bounds of the `imageNode` it has been set on. - -You can set `forceUpscaling` to `YES` if you'd like to change this fact. Doing so means your app will take up more memory any time you use an image that is smaller than its destination. - -### Detecting Image Scaling - -By using the pixel scaling tool, you can easily check each image in your app to see how much it has been scaled up or down. - -If images are too big, you risk rendering excessive amounts of image data, and when they're too small you spend time upscaling a low quality image. - -If you control your API, consider returning correctly scaled images so that this work can be avoided. diff --git a/submodules/AsyncDisplayKit/docs/_docs/index.html b/submodules/AsyncDisplayKit/docs/_docs/index.html deleted file mode 100755 index 930d84ddd9..0000000000 --- a/submodules/AsyncDisplayKit/docs/_docs/index.html +++ /dev/null @@ -1,4 +0,0 @@ ---- -layout: redirect -destination: /docs/getting-started.html ---- diff --git a/submodules/AsyncDisplayKit/docs/_docs/inset-layout-spec.md b/submodules/AsyncDisplayKit/docs/_docs/inset-layout-spec.md deleted file mode 100755 index ad3bd3e5b1..0000000000 --- a/submodules/AsyncDisplayKit/docs/_docs/inset-layout-spec.md +++ /dev/null @@ -1,7 +0,0 @@ ---- -title: ASInsetLayoutSpec -layout: docs -permalink: /docs/inset-layout-spec.html ---- - -
😑 This page is coming soon...
\ No newline at end of file diff --git a/submodules/AsyncDisplayKit/docs/_docs/installation.md b/submodules/AsyncDisplayKit/docs/_docs/installation.md deleted file mode 100755 index 81e6573a32..0000000000 --- a/submodules/AsyncDisplayKit/docs/_docs/installation.md +++ /dev/null @@ -1,114 +0,0 @@ ---- -title: Installation -layout: docs -permalink: /docs/installation.html -prevPage: resources.html -nextPage: adoption-guide-2-0-beta1.html ---- - -Texture may be added to your project via CocoaPods or Carthage. Do not forget to import the framework header: - -
-
-
-#import 
-
-
-
- -or create a Objective-C bridging header (Swift). If you have any problems installing Texture, please contact us on Github or Slack! - -## CocoaPods - -Texture is available on CocoaPods. Add the following to your Podfile: - -
-
-
-target 'MyApp' do
-	pod "Texture"
-end
-
-
-
- -Quit Xcode completely before running - -
-
-
-> pod install
-
-
-
- -in the project directory in Terminal. - -To update your version of Texture, run - -
-
-
-> pod update Texture
-
-
-
- -in the project directory in Terminal. - -Don't forget to use the workspace `.xcworkspace` file, _not_ the project `.xcodeproj` file. - -## Carthage (standard build) - -
-The standard way to use Carthage is to have a Cartfile list the dependencies, and then run `carthage update` to download the dependenices into the `Cathage/Checkouts` folder and build each of those into frameworks located in the `Carthage/Build` folder, and finally the developer has to manually integrate in the project. -
- -Texture is also available through Carthage. - -Add the following to your Cartfile to get the **latest release** branch: - -
-
-
-github "texturegroup/texture"
-
-
-
- -
-Or, to get the **master** branch: - -
-
-
-github "texturegroup/texture" "master"
-
-
-
- -
-Texture has its own Cartfile which lists its dependencies, so this is the only line you will need to include in your Cartfile. - -Run - -
-
-
-> carthage update
-
-
-
- -
-in Terminal. This will fetch dependencies into a `Carthage/Checkouts` folder, then build each one. - -Look for terminal output confirming `Texture`, `PINRemoteImage (3.0.0-beta.2)` and `PINCache` are all fetched and built. The Texture framework Cartfile should handle the dependencies correctly. - -In Xcode, on your application targets’ **“General”** settings tab, in the **“Linked Frameworks and Libraries”** section, drag and drop each framework you want to use from the `Carthage/Build` folder on disk. - -## Carthage (light) - -Texture does not yet support the lighter way of using Carthage, in which you manually add the project files. This is because one of its dependencies, `PINCache` (a nested dependency of `PINRemoteImage`) does not yet have a project file. - -Without including `PINRemoteImage` and `PINCache`, you will not get Texture's full image feature set. diff --git a/submodules/AsyncDisplayKit/docs/_docs/intelligent-preloading.md b/submodules/AsyncDisplayKit/docs/_docs/intelligent-preloading.md deleted file mode 100755 index 24440f1acd..0000000000 --- a/submodules/AsyncDisplayKit/docs/_docs/intelligent-preloading.md +++ /dev/null @@ -1,95 +0,0 @@ ---- -title: Intelligent Preloading -layout: docs -permalink: /docs/intelligent-preloading.html -prevPage: upgrading.html -nextPage: containers-overview.html ---- - -While a node's ability to be rendered and measured asynchronously and concurrently makes it quite powerful, another crucially important layer to Texture is the idea of intelligent preloading. - -As was pointed out in Getting Started, it is rarely advantageous to use a node outside of the context of one of the node containers. This is due to the fact that all nodes have a notion of their current interface state. - -This `interfaceState` property is constantly updated by an `ASRangeController` which all containers create and maintain internally. - -A node used outside of a container won't have its state updated by any range controller. This sometimes results in a flash as nodes are rendered after realizing they're already onscreen without any warning. - -## Interface State Ranges - -When nodes are added to a scrolling or paging interface they are typically in one of the following ranges. This means that as the scrolling view is scrolled, their interface states will be updated as they move through them. - - - -A node will be in one of following ranges: - - - - - - - - - - - - - - - - - - -
Interface StateDescription
PreloadThe furthest range out from being visible. This is where content is gathered from an external source, whether that’s some API or a local disk.
DisplayHere, display tasks such as text rasterization and image decoding take place.
VisibleThe node is onscreen by at least one pixel.
- -## ASRangeTuningParameters - -The size of each of these ranges is measured in "screenfuls". While the default sizes will work well for many use cases, they can be tweaked quite easily by setting the tuning parameters for range type on your scrolling node. - - - -In the above visualization of a scrolling collection, the user is scrolling down. As you can see, the sizes of the ranges in the leading direction are quite a bit larger than the content the user is moving away from (the trailing direction). If the user were to change directions, the leading and trailing sides would dynamically swap in order to keep memory usage optimal. This allows you to worry about defining the leading and trailing sizes without having to worry about reacting to the changing scroll directions of your user. - -Intelligent preloading also works in multiple dimensions. - -## Interface State Callbacks - -As a user scrolls, nodes move through the ranges and react appropriately by loading data, rendering, etc. Your own node subclasses can easily tap into this mechanism by implementing the corresponding callback methods. - -#### Visible Range - -
- -
-
--didEnterVisibleState
--didExitVisibleState
-
-
-
- -#### Display Range - -
- -
-
--didEnterDisplayState
--didExitDisplayState
-
-
-
- -#### Preload Range - -
- -
-
--didEnterPreloadState
--didExitPreloadState
-
-
-
- -
-Just remember to call super ok? 😉 diff --git a/submodules/AsyncDisplayKit/docs/_docs/inversion.md b/submodules/AsyncDisplayKit/docs/_docs/inversion.md deleted file mode 100755 index 5dd18140dd..0000000000 --- a/submodules/AsyncDisplayKit/docs/_docs/inversion.md +++ /dev/null @@ -1,34 +0,0 @@ ---- -title: Inversion -layout: docs -permalink: /docs/inversion.html -prevPage: automatic-subnode-mgmt.html -nextPage: image-modification-block.html ---- - -`ASTableNode` and `ASCollectionNode` have a `inverted` property of type `BOOL` that when set to `YES`, will automatically invert the content so that it's layed out bottom to top, that is the 'first' (indexPath 0, 0) node is at the bottom rather than the top as usual. This is extremely covenient for chat/messaging apps, and with Texture it only takes one property. - -When this is enabled, developers only have to take one more step to have full inversion support and that is to adjust the `contentInset` of their `ASTableNode` or `ASCollectionNode` like so: - -
- - Swift - Objective-C - - -
-
- CGFloat inset = [self topBarsHeight];
- self.tableNode.view.contentInset = UIEdgeInsetsMake(0, 0, inset, 0);
- self.tableNode.view.scrollIndicatorInsets = UIEdgeInsetsMake(0, 0, inset, 0);
-  
- -
-  let inset = self.topBarsHeight
-  self.tableNode.view.contentInset = UIEdgeInsets(top: 0.0, left: 0.0, bottom: inset, right: 0.0)
-  self.tableNode.view.scrollIndicatorInsets = UIEdgeInsets(top: 0.0, left: 0.0, bottom: inset, right: 0.0)
-  
-
-
- -See the SocialAppLayout-Inverted example project for more details. diff --git a/submodules/AsyncDisplayKit/docs/_docs/layer-backing.md b/submodules/AsyncDisplayKit/docs/_docs/layer-backing.md deleted file mode 100755 index 17f4e70fb3..0000000000 --- a/submodules/AsyncDisplayKit/docs/_docs/layer-backing.md +++ /dev/null @@ -1,29 +0,0 @@ ---- -title: Layer Backing -layout: docs -permalink: /docs/layer-backing.html -prevPage: accessibility.html -nextPage: subtree-rasterization.html ---- - -In some cases, you can substantially improve your app's performance by using layers instead of views. **We recommend enabling layer-backing in any custom node that doesn't need touch handling**. - -With UIKit, manually converting view-based code to layers is laborious due to the difference in APIs. Worse, if at some point you need to enable touch handling or other view-specific functionality, you have to manually convert everything back (and risk regressions!). - -With all Texture nodes, converting an entire subtree from views to layers is as simple as: - -
-SwiftObjective-C -
-
-rootNode.isLayerBacked = YES;
-
- -
-
- -...and if you need to go back, it's as simple as deleting one line. - - diff --git a/submodules/AsyncDisplayKit/docs/_docs/layout-api-debugging.md b/submodules/AsyncDisplayKit/docs/_docs/layout-api-debugging.md deleted file mode 100755 index 5b86012570..0000000000 --- a/submodules/AsyncDisplayKit/docs/_docs/layout-api-debugging.md +++ /dev/null @@ -1,69 +0,0 @@ ---- -title: Layout Debugging -layout: docs -permalink: /docs/layout-api-debugging.html -prevPage: automatic-layout-containers.html -nextPage: layout-api-sizing.html ---- - -Here are some helpful questions to ask yourself when you encounter any issues composing layoutSpecs. - -## Am I the child of an `ASStackLayoutSpec` or an `ASStaticLayoutSpec`? -
-Certain `ASLayoutable` properties will _only_ apply when the layoutable is a child of a _stack_ spec (the child is called an ASStackLayoutable), while other properties _only_ apply when the layoutable is a child of a _static_ spec (the child is called an ASStaticLayoutable). - -- table of [`ASStackLayoutables` properties](http://texturegroup.org/docs/automatic-layout-containers.html#asstacklayoutable-properties) -- table of [`ASStaticLayoutable` properties](http://texturegroup.org/docs/automatic-layout-containers.html#asstaticlayoutable-properties) - -All ASLayoutable properties can be applied to _any_ layoutable (e.g. any node or layout spec), however certain properties will only take effect depending on the type of the parent layout spec they are wrapped in. - -## Have I considered where to set `ASLayoutable` properties? -
-Let's say you have a node (`n1`) and you wrap it in a layout spec (`s1`). If you want to wrap the layout spec (`s1`) in a stack or static spec (`s2`), you will need to set all of the properties on the spec (`s1`) and not the node (`n1`). - -A common examples of this confusion involves flex grow and flex shrink. E.g. a node with `.flexGrow` enabled is wrapped in an inset spec. The inset spec will not grow as we expect. **Solution:** enable `.flexGrow` on the inset spec as well. - -## Have I provided sizes for any node that lacks an intrinsic size? -
-Texture's layout pass is recursive, starting at the layout spec returned from `-layoutSpecThatFits:` and proceeding down until it reaches the leaf nodes included in any nested layout specs. - -Some leaf nodes have a concept of their own intrinsic size, such as ASTextNode or ASImageNode. A text node knows the length of its formatted string and an ASImageNode knows the size of its static image. Other leaf nodes require an intrinsic size to be set. - -Nodes that require the developer to provide an intrinsic size: - -- `ASNetworkImageNode` or `ASMultiplexImageNode` have no intrinsic size until the image is downloaded. **A size must be provided for either node.** -- `ASVideoNode` or `ASVideoNodePlayer` have no intrinsic size until the video is downloaded. **A size must be provided for either node.** -- `ASDisplayNode` custom subclasses may provide their intrinisc size by implementing `-calculateSizeThatFits:`. - -To provide an intrinisc size for these nodes that lack intrinsic sizes (even if only momentarily), you can set one of the following: - -- set `.preferredFrameSize` on any node. -- set `.sizeRange` for children of **static** specs only. -- implement `-calculateSizeThatFits:` for **custom ASDisplayNode subclasses only**. - -*_Note that .preferredFrameSize is not considered by ASTextNodes. Also, setting .sizeRange on a node will override the node's intrinisic size provided by -calculateSizeThatFits:_ - -## When do I use `.preferredFrameSize` vs `.sizeRange`? -
-Set `.preferredFrameSize` to set a size for any node. Note that setting .preferredFrameSize on an `ASTextNode` will silently fail. We are working on fixing this, but in the meantime, you can wrap the ASTextNode in a static spec and provide it a .sizeRange. - -Set `.sizeRange` to set a size range for any node or layout spec that is the child of a *static* spec consisting. `.sizeRange` is the *only* way to set a size on a layout spec. Again, when using `.sizeRange`, you *must wrap the layoutable in a static layout spec for it to take effect.* - -A `.sizeRange` consists of a minimum and maximum constrained size (these sizes can be a specific point value or a relative value, like 70%). For details on the `.sizeRange` property's custom value type, check out our [Layout API Sizing guide](http://texturegroup.org/docs/layout-api-sizing.html). - -## `ASRelativeDimension` vs `ASRelativeSize` vs `ASRelativeSizeRange` vs `ASSizeRange` -
-Texture's Layout API supports configuring node and layout spec sizes with specific point values as well as relative values. Read the [Layout API Sizing guide](http://texturegroup.org/docs/layout-api-sizing.html) for a helpful chart and documentation on our custom layout value types. - -## Debugging layout specs with ASCII art -
-Calling `-asciiArtString` on any `ASDisplayNode` or `ASLayoutSpec` returns an ascii-art representation of the object and its children. An example of a simple layoutSpec ascii-art console output can be seen below. - -``` ------------------------ASStackLayoutSpec---------------------- -| -----ASStackLayoutSpec----- -----ASStackLayoutSpec----- | -| | ASImageNode | | ASImageNode | | -| | ASImageNode | | ASImageNode | | -| --------------------------- --------------------------- | --------------------------------------------------------------- - ``` diff --git a/submodules/AsyncDisplayKit/docs/_docs/layout-api-sizing.md b/submodules/AsyncDisplayKit/docs/_docs/layout-api-sizing.md deleted file mode 100755 index 7937793c61..0000000000 --- a/submodules/AsyncDisplayKit/docs/_docs/layout-api-sizing.md +++ /dev/null @@ -1,171 +0,0 @@ ---- -title: Layout API Sizing -layout: docs -permalink: /docs/layout-api-sizing.html -prevPage: layout-api-debugging.html -nextPage: layout-transition-api.html ---- - -The easiest way to understand the compound dimension types in the Layout API is to see all the units in relation to one another. - - - -## Values (CGFloat, ASRelativeDimension) -
-`ASRelativeDimension` is essentially a normal **CGFloat with support for representing either a point value, or a % value**. It allows the same API to take in both fixed values, as well as relative ones. - -ASRelativeDimension is used to set the `flexBasis` property on a child of an `ASStackLayoutSpec`. The flexBasis property specifies the initial size in the stack dimension for this object, where the stack dimension is whether it is a horizontal or vertical stack. - -When a relative (%) value is used, it is resolved against the size of the parent. For example, an item with 50% flexBasis will ultimately have a point value set on it at the time that the stack achieves a concrete size. - -
-Note that .flexBasis can be set on any <ASLayoutable> (a node, or a layout spec), but will only take effect if that element is added as a child of a stack layout spec. This container-dependence of layoutable properties is a key area we’re working on clarifying. -
- -#### Constructing ASRelativeDimensions -
-`ASDimension.h` contains 3 convenience functions to construct an `ASRelativeDimension`. It is easiest to use function that corresponds to the type (top 2 functions). - -
-SwiftObjective-C - -
-
-ASRelativeDimensionMakeWithPoints(CGFloat points);
-ASRelativeDimensionMakeWithPercent(CGFloat percent);
-ASRelativeDimensionMake(ASRelativeDimensionType type, CGFloat value);
-
- -
-
- -#### ASRelativeDimension Example -
-`PIPlaceSingleDetailNode` uses flexBasis to set 2 child nodes of a horizontal stack to share the width 40 / 60: - -
-SwiftObjective-C - -
-
-leftSideStack.flexBasis = ASRelativeDimensionMakeWithPercent(0.4f);
-self.detailLabel.flexBasis  = ASRelativeDimensionMakeWithPercent(0.6f);
-[horizontalStack setChildren:@[leftSideStack, self.detailLabel]];
-
- -
-
- - - -## Sizes (CGSize, ASRelativeSize) -
-`ASRelativeSize` is **similar to a CGSize, but its width and height may represent either a point or percent value.**  In fact, their unit type may even be different from one another. `ASRelativeSize` doesn't have a direct use in the Layout API, except to construct an `ASRelativeSizeRange`. - -- an `ASRelativeSize` consists of a `.width` and `.height` that are each `ASRelativeDimensions`. - -- the type of the width and height are independent; either one individually, or both, may be a point or percent value. (e.g. you could specify that an ASRelativeSize that has a height in points, but a variable % width) - -#### Constructing ASRelativeSizes -
-`ASRelativeSize.h` contains 2 convenience functions to construct an `ASRelativeSize`. **If you don't need to support relative (%) values, you can construct an `ASRelativeSize` with just a CGSize.** - -
-SwiftObjective-C - -
-
-ASRelativeSizeMake(ASRelativeDimension width, ASRelativeDimension height);
-ASRelativeSizeMakeWithCGSize(CGSize size);
-
- -
-
- -## Size Ranges (ASSizeRange, ASRelativeSizeRange) - -Because the layout spec system allows flexibility with elements growing and shrinking, we sometimes need to provide limits / boundaries to its flexibility. - -There are two size range types, but in essence, both contain a minimum and maximum size and that are used to influence the result of layout measurements. - -In the Pinterest code base, the **minimum size seems to be only necessary for stack specs in order to determine how much space to fill in between the children.** For example, with buttons in a nav bar, we don’t want them to stack as closely together as they can fit — rather a minimum width, as wide as the screen, is specified and causes the stack to add spacing to satisfy that constraint. - -**It’s much more common that the “max” constraint is what matters, though.** This is the case when text is wrapping or truncating - it’s encountering the maximum allowed width. Setting a minimum width for text doesn’t actually do anything—the text can’t be made longer—unless it’s in a stack, and spacing is added around it. - -#### ASSizeRange -
-UIKit doesn't provide a structure to bundle a minimum and maximum CGSize. So `ASSizeRange` was created to support **a minimum and maximum CGSize pair**. - -The `constrainedSize` that is passed as an input to `layoutSpecThatFits:` is an `ASSizeRange`. - -
-SwiftObjective-C - -
-
-- (ASLayoutSpec *)layoutSpecThatFits:(ASSizeRange)constrainedSize;
-
- -
-
- -#### ASRelativeSizeRange -
-`ASRelativeSizeRange` is essentially **a minimum and maximum size pair, that are used to constrain the size of a layout object.** The minimum and maximum sizes must **support both point and relative sizes**, which is where our friend the ASRelativeSize comes in. Hence, an ASRelativeSizeRange consists of a minimum and maximum `ASRelativeSize`. - -ASRelativeSizeRange is used to set the `sizeRange` property on a child of an `ASStaticLayoutSpec`. If specified, the child's size is restricted according to this size. - -
-Note that .sizeRange can be set on any <ASLayoutable> (a node, or a layout spec), but will only take effect if that element is added as a child of a static layout spec. This container-dependence of layoutable properties is a key area we’re working on clarifying. -
- -#### ASSizeRange vs. ASRelativeSizeRange -
-Why do we pass a `ASSizeRange *constrainedSize` to a node's `layoutSpecThatFits:` function, but a `ASRelativeSizeRange` for the `.sizeRange` property on an element provided as a child of a layout spec? - - It’s pretty rare that you need the percent feature for a .sizeRange feature, but it’s there to make the API as flexible as possible. The input value of the constrainedSize that comes into the argument, has already been resolved by the parent’s size. It may have been influenced by a percent type, but has always be converted by that point into points. - -#### Constructing ASRelativeSizeRange -
-`ASRelativeSize.h` contains 4 convenience functions to construct an `ASRelativeSizeRange` from the various smaller units. - -- Percentage and point values can be combined. E.g. you could specify that an object is a certain height in points, but a variable percentage width. - -- If you only care to constrain the min / max or width / height, you can pass in `CGFLOAT_MIN`, `CGFLOAT_MAX`, `constrainedSize.max.width`, etc - -Most of the time, relative values are not needed for a size range _and_ the design requires an object to be forced to a particular size (min size = max size = no range). In this common case, you can use: - -
-SwiftObjective-C - -
-
-ASRelativeSizeRangeMakeWithExactCGSize(CGSize exact);
-
- -
-
- -### Sizing Conclusion -
-Here we have our original table, which has been annotated to show the uses of the various units in the Layout API. - - - -It’s worth noting that that there’s a certain flexibility to be able to use so many powerful options with a single API - flexBasis and sizeRange can be used to set points and percentages in different directions. However, since the majority of do not use the full set of options, we should adjust the API so that the powerful capabilities are a slightly more hidden. - diff --git a/submodules/AsyncDisplayKit/docs/_docs/layout-engine.md b/submodules/AsyncDisplayKit/docs/_docs/layout-engine.md deleted file mode 100755 index f73bed3225..0000000000 --- a/submodules/AsyncDisplayKit/docs/_docs/layout-engine.md +++ /dev/null @@ -1,87 +0,0 @@ ---- -title: Layout Engine -layout: docs -permalink: /docs/layout-engine.html -prevPage: subclassing.html -nextPage: containers-overview.html ---- - -Texture's layout engine is based on the CSS Box Model. While it is the feature of the framework that bears the weakest resemblance to the UIKit equivalent (AutoLayout), it is also among the most useful features once you've gotten used to it. With enough practice, you may just come to prefer creating declarative layouts to the constraint based approach. ;] - -The main way you participate in this system is by implementing `-layoutSpecThatFits:` in a node subclass. Here, you declaratively build up layout specs from the inside out, returning the final spec which will contain the rest. - -
-SwiftObjective-C -
-
-- (ASLayoutSpec *)layoutSpecThatFits:(ASSizeRange)constrainedSize
-{
-  ASStackLayoutSpec *verticalStack = [ASStackLayoutSpec verticalStackLayoutSpec];
-  verticalStack.direction          = ASStackLayoutDirectionVertical;
-  verticalStack.spacing            = 4.0;
-  [verticalStack setChildren:_commentNodes];
-
-  return verticalStack;
-}
-  
- - -
-
- -Whle this example is extremely simple, it gives you an idea of how to use a layout spec. A stack layout spec, for instance, defines a layout of nodes in which the chlidren will be laid out adjacently, in the direction specified, with the spacing specified. It is very similar to `UIStackView` but with the added benefit of backwards compatibility. - -### ASLayoutable - -Layout spec's children can be any object whose class conforms to the `` protocol. All nodes, as well as all layout specs conform to the `` protocol. This means that your layout can be built up in composable chunks until you have what you want. - -Say you wanted to add 8 pts of padding to the stack you've already set up: - -
-SwiftObjective-C -
- -
-- (ASLayoutSpec *)layoutSpecThatFits:(ASSizeRange)constrainedSize
-{
-  ASStackLayoutSpec *verticalStack = [ASStackLayoutSpec verticalStackLayoutSpec];
-  verticalStack.direction          = ASStackLayoutDirectionVertical;
-  verticalStack.spacing            = 4.0;
-  [verticalStack setChildren:_commentNodes];
-  
-  UIEdgeInsets insets = UIEdgeInsetsMake(8, 8, 8, 8);
-  ASInsetLayoutSpec *insetSpec = [ASInsetLayoutSpec insetLayoutSpecWithInsets:insets 
-                                      child:verticalStack];
-  
-  return insetSpec;
-}
-  
- - -
-
- -You can easily do that by making that stack the child of an inset layout spec. - -Naturally, using layout specs takes a bit of practice so to learn more, check out the layout section. diff --git a/submodules/AsyncDisplayKit/docs/_docs/layout-options.md b/submodules/AsyncDisplayKit/docs/_docs/layout-options.md deleted file mode 100755 index 709a7f8be3..0000000000 --- a/submodules/AsyncDisplayKit/docs/_docs/layout-options.md +++ /dev/null @@ -1,52 +0,0 @@ ---- -title: Layout Options -layout: docs -permalink: /docs/layout-options.html -prevPage: automatic-layout-debugging.html -nextPage: layer-backing.html ---- - -When using Texture, you have three options for layout. Note that UIKit Autolayout is **not** supported by Texture. -#Manual Sizing & Layout - -This original layout method shipped with Texture 1.0 and is analogous to UIKit's layout methods. Use this method for ASViewControllers (unless you subclass the node). - -`[ASDisplayNode calculateSizeThatFits:]` **vs.** `[UIView sizeThatFits:]` - -`[ASDisplayNode layout]` **vs.** `[UIView layoutSubviews]` - -###Advantages (over UIKit) -- Eliminates all main thread layout cost -- Results are cached - -###Shortcomings (same as UIKit): -- Code duplication between methods -- Logic is not reusable - -#Unified Sizing & Layout - -This layout method does not have a UIKit analog. It is implemented by calling - -`- (ASLayout *)calculateLayoutThatFits: (ASSizeRange)constraint` - -###Advantages -- zero duplication -- still async, still cached - -###Shortcomings -- logic is not reusable, and is still manual - -# Automatic, Extensible Layout - -This is the reccomended layout method. It does not have a UIKit analog and is implemented by calling - -`- (ASLayoutSpec *)layoutSpecThatFits:(ASSizeRange)constraint` -###Advantages -- can reuse even complex, custom layouts -- built-in specs provide automatic layout -- combine to compose new layouts easily -- still async, cached, and zero duplication - -The diagram below shows how options #2 and #3 above both result in an ASLayout, except that in option #3, the ASLayout is produced automatically by the ASLayoutSpec. - - diff --git a/submodules/AsyncDisplayKit/docs/_docs/layout-transition-api.md b/submodules/AsyncDisplayKit/docs/_docs/layout-transition-api.md deleted file mode 100755 index e1f7afc702..0000000000 --- a/submodules/AsyncDisplayKit/docs/_docs/layout-transition-api.md +++ /dev/null @@ -1,259 +0,0 @@ ---- -title: Layout Transition API -layout: docs -permalink: /docs/layout-transition-api.html -prevPage: layout2-api-sizing.html -nextPage: hit-test-slop.html ---- - -The Layout Transition API was designed to make all animations with Texture easy - even transforming an entire set of views into a completely different set of views! - -With this system, you simply specify the desired layout and Texture will do the work to figure out differences from the current layout. It will automatically add new elements, remove unneeded elements after the transition, and update the position of any existing elements. - -There are also easy to use APIs that allow you to fully customize the starting position of newly introduced elements, as well as the ending position of removed elements. - -
-Use of Automatic Subnode Management is required to use the Layout Transition API. -
- -## Animating between Layouts -
-The layout Transition API makes it easy to animate between a node's generated layouts in response to some internal state change in a node. - -Imagine you wanted to implement this sign up form and animate in the new field when tapping the next button: - -![Imgur](http://i.imgur.com/Dsf1R72.gif) - -A standard way to implement this would be to create a container node called `SignupNode` that includes two editable text field nodes and a button node as subnodes. We'll include a property on the SignupNode called `fieldState` that will be used to select which editable text field node to show when the node calculates its layout. - -The internal layout spec of the `SignupNode` container would look something like this: - -
- - Swift - Objective-C - -
-
-- (ASLayoutSpec *)layoutSpecThatFits:(ASSizeRange)constrainedSize
-{
-  FieldNode *field;
-  if (self.fieldState == SignupNodeName) {
-    field = self.nameField;
-  } else {
-    field = self.ageField;
-  }
-
-  ASStackLayoutSpec *stack = [[ASStackLayoutSpec alloc] init];
-  [stack setChildren:@[field, self.buttonNode]];
-
-  UIEdgeInsets insets = UIEdgeInsetsMake(15.0, 15.0, 15.0, 15.0);
-  return [ASInsetLayoutSpec insetLayoutSpecWithInsets:insets child:stack];
-}
-
- -
-
- -To trigger a transition from the `nameField` to the `ageField` in this example, we'll update the SignupNode's `.fieldState` property and begin the transition with `transitionLayoutWithAnimation:`. - -This method will invalidate the current calculated layout and recompute a new layout with the `ageField` now in the stack. - -
- - Swift - Objective-C - -
-
-self.signupNode.fieldState = SignupNodeAge;
-
-[self.signupNode transitionLayoutWithAnimation:YES];
-
- -
-
- -In the default implementation of this API, the layout will recalculate the new layout and use its sublayouts to size and position the SignupNode's subnodes without animation. Future versions of this API will likely include a default animation between layouts and we're open to feedback on what you'd like to see here. However, we'll need to implement a custom animation block to handle the signup form case. - -The example below represents an override of `animateLayoutTransition:` in the SignupNode. - -This method is called after the new layout has been calculated via `transitionLayoutWithAnimation:` and in the implementation we'll perform a specific animation based upon the fieldState property that was set before the animation was triggered. - -
- - Swift - Objective-C - -
-
-- (void)animateLayoutTransition:(id<ASContextTransitioning>)context
-{
-  if (self.fieldState == SignupNodeName) {
-    CGRect initialNameFrame = [context initialFrameForNode:self.ageField];
-    initialNameFrame.origin.x += initialNameFrame.size.width;
-    self.nameField.frame = initialNameFrame;
-    self.nameField.alpha = 0.0;
-    CGRect finalAgeFrame = [context finalFrameForNode:self.nameField];
-    finalAgeFrame.origin.x -= finalAgeFrame.size.width;
-    [UIView animateWithDuration:0.4 animations:^{
-      self.nameField.frame = [context finalFrameForNode:self.nameField];
-      self.nameField.alpha = 1.0;
-      self.ageField.frame = finalAgeFrame;
-      self.ageField.alpha = 0.0;
-    } completion:^(BOOL finished) {
-      [context completeTransition:finished];
-    }];
-  } else {
-    CGRect initialAgeFrame = [context initialFrameForNode:self.nameField];
-    initialAgeFrame.origin.x += initialAgeFrame.size.width;
-    self.ageField.frame = initialAgeFrame;
-    self.ageField.alpha = 0.0;
-    CGRect finalNameFrame = [context finalFrameForNode:self.ageField];
-    finalNameFrame.origin.x -= finalNameFrame.size.width;
-    [UIView animateWithDuration:0.4 animations:^{
-      self.ageField.frame = [context finalFrameForNode:self.ageField];
-      self.ageField.alpha = 1.0;
-      self.nameField.frame = finalNameFrame;
-      self.nameField.alpha = 0.0;
-    } completion:^(BOOL finished) {
-      [context completeTransition:finished];
-    }];
-  }
-}
-
- -
-
- -The passed `ASContextTransitioning` context object in this method contains relevant information to help you determine the state of the nodes before and after the transition. It includes getters into old and new constrained sizes, inserted and removed nodes, and even the raw old and new `ASLayout` objects. In the `SignupNode` example, we're using it to determine the frame for each of the fields and animate them in an out of place. - -It is imperative to call `completeTransition:` on the context object once your animation has finished, as it will perform the necessary internal steps for the newly calculated layout to become the current `calculatedLayout`. - -Note that there hasn't been a use of `addSubnode:` or `removeFromSupernode` during the transition. Texture's layout transition API analyzes the differences in the node hierarchy between the old and new layout, implicitly performing node insertions and removals via Automatic Subnode Management. - -Nodes are inserted before your implementation of `animateLayoutTransition:` is called and this is a good place to manually manage the hierarchy before you begin the animation. Removals are performed in `didCompleteLayoutTransition:` after you call `completeTransition:` on the context object. If you need to manually perform deletions, override `didCompleteLayoutTransition:` and perform your custom operations. Note that this will override the default behavior and it is recommended to either call `super` or walk through the `removedSubnodes` getter in the context object to perform the cleanup. - -Passing `NO` to `transitionLayoutWithAnimation:` will still run through your `animateLayoutTransition:` and `didCompleteLayoutTransition:` implementations with the `[context isAnimated]` property set to `NO`. It is your choice on how to handle this case — if at all. An easy way to provide a default implementation this is to call super: - -
- - Swift - Objective-C - -
-
-- (void)animateLayoutTransition:(id<ASContextTransitioning>)context
-{
-  if ([context isAnimated]) {
-    // perform animation
-  } else {
-    [super animateLayoutTransition:context];
-  }
-}
-
- -
-
- -## Animating constrainedSize Changes -
-There will be times you'll simply want to respond to bounds changes to your node and animate the recalculation of its layout. To handle this case, call `transitionLayoutWithSizeRange:animated:` on your node. - -This method is similar to `transitionLayoutWithAnimation:`, but will not trigger an animation if the passed `ASSizeRange` is equal to the current `constrainedSizeForCalculatedLayout` value. This is great for responding to rotation events and view controller size changes: - -
- - Swift - Objective-C - -
-
-- (void)viewWillTransitionToSize:(CGSize)size withTransitionCoordinator:(id<UIViewControllerTransitionCoordinator>)coordinator
-{
-  [super viewWillTransitionToSize:size withTransitionCoordinator:coordinator];
-  [coordinator animateAlongsideTransition:^(id<UIViewControllerTransitionCoordinatorContext>  _Nonnull context) {
-    [self.node transitionLayoutWithSizeRange:ASSizeRangeMake(size, size) animated:YES];
-  } completion:nil];
-}
-
- -
-
- -## Examples that use the Layout Transition API - -- [ASDKLayoutTransition](https://github.com/texturegroup/texture/tree/master/examples/ASDKLayoutTransition) diff --git a/submodules/AsyncDisplayKit/docs/_docs/layout2-api-sizing.md b/submodules/AsyncDisplayKit/docs/_docs/layout2-api-sizing.md deleted file mode 100755 index 6459eadcf1..0000000000 --- a/submodules/AsyncDisplayKit/docs/_docs/layout2-api-sizing.md +++ /dev/null @@ -1,194 +0,0 @@ ---- -title: Layout API Sizing -layout: docs -permalink: /docs/layout2-api-sizing.html -nextPage: layout-transition-api.html ---- - -The easiest way to understand the compound dimension types in the Layout API is to see all the units in relation to one another. - - - -## Values (`CGFloat`, `ASDimension`) - -`ASDimension` is essentially a **normal CGFloat with support for representing either a point value, a relative percentage value, or an auto value**. - -This unit allows the same API to take in both fixed values, as well as relative ones. - -
- - Swift - Objective-C - -
-
-// dimension returned is relative (%)
-ASDimensionMake(@"50%");  
-ASDimensionMakeWithFraction(0.5);
-
-// dimension returned in points
-ASDimensionMake(@"70pt");
-ASDimensionMake(70);      
-ASDimensionMakeWithPoints(70);
-
- -
-
- -### Example using `ASDimension` - -`ASDimension` is used to set the `flexBasis` property on a child of an `ASStackLayoutSpec`. The `flexBasis` property specifies an object's initial size in the stack dimension, where the stack dimension is whether it is a horizontal or vertical stack. - -In the following view, we want the left stack to occupy `40%` of the horizontal width and the right stack to occupy `60%` of the width. - - - -We do this by setting the `.flexBasis` property on the two childen of the horizontal stack: - -
- - Swift - Objective-C - -
-
-self.leftStack.style.flexBasis = ASDimensionMake(@"40%");
-self.rightStack.style.flexBasis = ASDimensionMake(@"60%");
-
-[horizontalStack setChildren:@[self.leftStack, self.rightStack]];
-
- -
-
- -## Sizes (`CGSize`, `ASLayoutSize`) - -`ASLayoutSize` is similar to a `CGSize`, but its **width and height values may represent either a point or percent value**. The type of the width and height are independent; either one may be a point or percent value. - -
- - Swift - Objective-C - -
-
-ASLayoutSizeMake(ASDimension width, ASDimension height);
-
- -
-
- -
-`ASLayoutSize` is used for setting a layout element's `.preferredLayoutSize`, `.minLayoutSize` and `.maxLayoutSize` properties. It allows the same API to take in both fixed sizes, as well as relative ones. - -
- - Swift - Objective-C - -
-
-// Dimension type "Auto" indicates that the layout element may 
-// be resolved in whatever way makes most sense given the circumstances
-ASDimension width = ASDimensionMake(ASDimensionUnitAuto, 0);  
-ASDimension height = ASDimensionMake(@"50%");
-
-layoutElement.style.preferredLayoutSize = ASLayoutSizeMake(width, height);
-
- -
-
- -
-If you do not need relative values, you can set the layout element's `.preferredSize`, `.minSize` and `.maxSize` properties. The properties take regular `CGSize` values. - -
- - Swift - Objective-C - -
-
-layoutElement.style.preferredSize = CGSizeMake(30, 160);
-
- -
-
- -
-Most of the time, you won't want to constrain both width and height. In these cases, you can individually set a layout element's size properties using `ASDimension` values. - -
- - Swift - Objective-C - -
-
-layoutElement.style.width     = ASDimensionMake(@"50%");
-layoutElement.style.minWidth  = ASDimensionMake(@"50%");
-layoutElement.style.maxWidth  = ASDimensionMake(@"50%");
-
-layoutElement.style.height    = ASDimensionMake(@"50%");
-layoutElement.style.minHeight = ASDimensionMake(@"50%");
-layoutElement.style.maxHeight = ASDimensionMake(@"50%");
-
- -
-
- -## Size Range (`ASSizeRange`) - -`UIKit` doesn't provide a structure to bundle a minimum and maximum `CGSize`. So, `ASSizeRange` was created to support **a minimum and maximum CGSize pair**. - -`ASSizeRange` is used mostly in the internals of the layout API. However, the `constrainedSize` value passed as an input to `layoutSpecThatFits:` is an `ASSizeRange`. - -
- - Swift - Objective-C - -
-
-- (ASLayoutSpec *)layoutSpecThatFits:(ASSizeRange)constrainedSize;
-
- -
-
- -The `constrainedSize` passed to an `ASDisplayNode` subclass' `layoutSpecThatFits:` method is the minimum and maximum sizes that the node should fit in. The minimum and maximum `CGSize`s contained in `constrainedSize` can be used to size the node's layout elements. diff --git a/submodules/AsyncDisplayKit/docs/_docs/layout2-conversion-guide.md b/submodules/AsyncDisplayKit/docs/_docs/layout2-conversion-guide.md deleted file mode 100755 index 6283cf1ec0..0000000000 --- a/submodules/AsyncDisplayKit/docs/_docs/layout2-conversion-guide.md +++ /dev/null @@ -1,519 +0,0 @@ ---- -title: Upgrading to Layout 2.0 (Beta) -layout: docs -permalink: /docs/layout2-conversion-guide.html ---- - -A list of the changes: - -- Introduction of true flex factors -- `ASStackLayoutSpec` `.alignItems` property default changed to `ASStackLayoutAlignItemsStretch` -- Rename `ASStaticLayoutSpec` to `ASAbsoluteLayoutSpec` -- Rename `ASLayoutable` to `ASLayoutElement` -- Set `ASLayoutElement` properties via `style` property -- Easier way to size of an `ASLayoutElement` -- Deprecation of `-[ASDisplayNode preferredFrameSize]` -- Deprecation of `-[ASLayoutElement measureWithSizeRange:]` -- Deprecation of `-[ASDisplayNode measure:]` -- Removal of `-[ASAbsoluteLayoutElement sizeRange]` -- Rename `ASRelativeDimension` to `ASDimension` -- Introduction of `ASDimensionUnitAuto` - -In addition to the inline examples comparing **1.x** layout code vs **2.0** layout code, the [example projects](https://github.com/texturegroup/texture/tree/master/examples) and layout documentation have been updated to use the new API. - -All other **2.0** changes not related to the Layout API are documented here. - -## Introduction of true flex factors - -With **1.x** the `flexGrow` and `flexShrink` properties were of type `BOOL`. - -With **2.0**, these properties are now type `CGFloat` with default values of `0.0`. - -This behavior is consistent with the Flexbox implementation for web. See [`flexGrow`](https://developer.mozilla.org/en-US/docs/Web/CSS/flex-grow) and [`flexShrink`](https://developer.mozilla.org/en-US/docs/Web/CSS/flex-shrink) for further information. - -
-SwiftObjective-C - -
-
-id<ASLayoutElement> layoutElement = ...;
-
-// 1.x:
-layoutElement.flexGrow = YES;
-layoutElement.flexShrink = YES;
-
-// 2.0:
-layoutElement.style.flexGrow = 1.0;
-layoutElement.style.flexShrink = 1.0;
-
- - -
-
- -## `ASStackLayoutSpec`'s `.alignItems` property default changed - -`ASStackLayoutSpec`'s `.alignItems` property default changed to `ASStackLayoutAlignItemsStretch` instead of `ASStackLayoutAlignItemsStart` to align with the CSS align-items property. - -## Rename `ASStaticLayoutSpec` to `ASAbsoluteLayoutSpec` & behavior change - -`ASStaticLayoutSpec` has been renamed to `ASAbsoluteLayoutSpec`, to be consistent with web terminology and better represent the intended behavior. - -
-SwiftObjective-C - -
-
-// 1.x:
-ASStaticLayoutSpec *layoutSpec = [ASStaticLayoutSpec staticLayoutSpecWithChildren:@[...]];
-
-// 2.0:
-ASAbsoluteLayoutSpec *layoutSpec = [ASAbsoluteLayoutSpec absoluteLayoutSpecWithChildren:@[...]];
-
- -
-
- -
-**Please note** that there has also been a behavior change introduced. The following text overlay layout was previously created using a `ASStaticLayoutSpec`, `ASInsetLayoutSpec` and `ASOverlayLayoutSpec` as seen in the code below. - - - -
-Using `INFINITY` for the `top` value in the `UIEdgeInsets` property of the `ASInsetLayoutSpec` allowed the text inset to start at the bottom. This was possible because it would adopt the size of the static layout spec's `_photoNode`. - -
- - Swift - Objective-C - -
-
-- (ASLayoutSpec *)layoutSpecThatFits:(ASSizeRange)constrainedSize
-{
-  _photoNode.preferredFrameSize = CGSizeMake(USER_IMAGE_HEIGHT*2, USER_IMAGE_HEIGHT*2);
-  ASStaticLayoutSpec *backgroundImageStaticSpec = [ASStaticLayoutSpec staticLayoutSpecWithChildren:@[_photoNode]];
-
-  UIEdgeInsets insets = UIEdgeInsetsMake(INFINITY, 12, 12, 12);
-  ASInsetLayoutSpec *textInsetSpec = [ASInsetLayoutSpec insetLayoutSpecWithInsets:insets child:_titleNode];
-
-  ASOverlayLayoutSpec *textOverlaySpec = [ASOverlayLayoutSpec overlayLayoutSpecWithChild:backgroundImageStaticSpec
-                                                                                 overlay:textInsetSpec];
-  
-  return textOverlaySpec;
-}
-  
- -
-
- -
-With the new `ASAbsoluteLayoutSpec` and same code above, the layout would now look like the picture below. The text is still there, but at ~900 pts (offscreen). - - - -## Rename `ASLayoutable` to `ASLayoutElement` - -Remember that an `ASLayoutSpec` contains children that conform to the `ASLayoutElement` protocol. Both `ASDisplayNodes` and `ASLayoutSpecs` conform to this protocol. - -The protocol has remained the same as **1.x**, but the name has been changed to be more descriptive. - -## Set `ASLayoutElement` properties via `ASLayoutElementStyle` - -An `ASLayoutElement`'s properties are are now set via it's `ASLayoutElementStyle` object. - -
-SwiftObjective-C - -
-
-id<ASLayoutElement> *layoutElement = ...;
-
-// 1.x:
-layoutElement.spacingBefore = 1.0;
-
-// 2.0:
-layoutElement.style.spacingBefore = 1.0;
-
- -
-
- -However, the properties specific to an `ASLayoutSpec` are still set directly on the layout spec. - -
-SwiftObjective-C - -
-
-// 1.x and 2.0
-ASStackLayoutSpec *stackLayoutSpec = ...;
-stackLayoutSpec.direction = ASStackLayoutDirectionVertical;
-stackLayoutSpec.justifyContent = ASStackLayoutJustifyContentStart;
-
- -
-
- -## Setting the size of an `ASLayoutElement` - -With **2.0** we introduce a new, easier, way to set the size of an `ASLayoutElement`. These methods replace the deprecated `-preferredFrameSize` and `-sizeRange` **1.x** methods. - -The following **optional** properties are provided via the layout element's `style` property: - -- `-[ASLayoutElementStyle width]`: specifies the width of an ASLayoutElement. The `minWidth` and `maxWidth` properties will override `width`. The height will be set to Auto unless provided. - -- `-[ASLayoutElementStyle minWidth]`: specifies the minimum width of an ASLayoutElement. This prevents the used value of the `width` property from becoming smaller than the specified for `minWidth`. - -- `-[ASLayoutElementStyle maxWidth]`: specifies the maximum width of an ASLayoutElement. It prevents the used value of the `width` property from becoming larger than the specified for `maxWidth`. - -- `-[ASLayoutElementStyle height]`: specifies the height of an ASLayoutElement. The `minHeight` and `maxHeight` properties will override `height`. The width will be set to Auto unless provided. - -- `-[ASLayoutElementStyle minHeight]`: specifies the minimum height of an ASLayoutElement. It prevents the used value of the `height` property from becoming smaller than the specified for `minHeight`. - -- `-[ASLayoutElementStyle maxHeight]`: specifies the maximum height of an ASLayoutElement. It prevents the used value of the `height` property from becoming larger than the specified for `maxHeight`. - -To set both the width and height with a `CGSize` value: - -- `-[ASLayoutElementStyle preferredSize]`: Provides a suggested size for a layout element. If the optional minSize or maxSize are provided, and the preferredSize exceeds these, the minSize or maxSize will be enforced. If this optional value is not provided, the layout element’s size will default to it’s intrinsic content size provided calculateSizeThatFits: - -- `-[ASLayoutElementStyle minSize]`: An optional property that provides a minimum size bound for a layout element. If provided, this restriction will always be enforced. If a parent layout element’s minimum size is smaller than its child’s minimum size, the child’s minimum size will be enforced and its size will extend out of the layout spec’s. - -- `-[ASLayoutElementStyle maxSize]`: An optional property that provides a maximum size bound for a layout element. If provided, this restriction will always be enforced. If a child layout element’s maximum size is smaller than its parent, the child’s maximum size will be enforced and its size will extend out of the layout spec’s. - -To set both the width and height with a relative (%) value (an `ASRelativeSize`): - -- `-[ASLayoutElementStyle preferredRelativeSize]`: Provides a suggested RELATIVE size for a layout element. An ASRelativeSize uses percentages rather than points to specify layout. E.g. width should be 50% of the parent’s width. If the optional minRelativeSize or maxRelativeSize are provided, and the preferredRelativeSize exceeds these, the minRelativeSize or maxRelativeSize will be enforced. If this optional value is not provided, the layout element’s size will default to its intrinsic content size provided calculateSizeThatFits: - -- `-[ASLayoutElementStyle minRelativeSize]`: An optional property that provides a minimum RELATIVE size bound for a layout element. If provided, this restriction will always be enforced. If a parent layout element’s minimum relative size is smaller than its child’s minimum relative size, the child’s minimum relative size will be enforced and its size will extend out of the layout spec’s. - -- `-[ASLayoutElementStyle maxRelativeSize]`: An optional property that provides a maximum RELATIVE size bound for a layout element. If provided, this restriction will always be enforced. If a parent layout element’s maximum relative size is smaller than its child’s maximum relative size, the child’s maximum relative size will be enforced and its size will extend out of the layout spec’s. - -For example, if you want to set a `width` of an `ASDisplayNode`: - -
-SwiftObjective-C - -
-
-// 1.x:
-// no good way to set an intrinsic size
-
-// 2.0:
-ASDisplayNode *ASDisplayNode = ...;
-
-// width 100 points, height: auto
-displayNode.style.width = ASDimensionMakeWithPoints(100);
-
-// width 50%, height: auto
-displayNode.style.width = ASDimensionMakeWithFraction(0.5);
-
-ASLayoutSpec *layoutSpec = ...;
-
-// width 100 points, height 100 points
-layoutSpec.style.preferredSize = CGSizeMake(100, 100);
-
- -
-
- -If you previously wrapped an `ASLayoutElement` with an `ASStaticLayoutSpec` just to give it a specific size (without setting the `layoutPosition` property on the element too), you don't have to do that anymore. - -
-SwiftObjective-C - -
-
-ASStackLayoutSpec *stackLayoutSpec = ...;
-id<ASLayoutElement> *layoutElement = ...;
-
-// 1.x:
-layoutElement.sizeRange = ASRelativeSizeRangeMakeWithExactCGSize(CGSizeMake(50, 50));
-ASStaticLayoutSpec *staticLayoutSpec = [ASStaticLayoutSpec staticLayoutSpecWithChildren:@[layoutElement]];
-stackLayoutSpec.children = @[staticLayoutSpec];
-
-// 2.0:
-layoutElement.style.preferredSizeRange = ASRelativeSizeRangeMakeWithExactCGSize(CGSizeMake(50, 50));
-stackLayoutSpec.children = @[layoutElement];
-
- -
-
- -If you previously wrapped a `ASLayoutElement` within a `ASStaticLayoutSpec` just to return any layout spec from within `layoutSpecThatFits:` there is a new layout spec now that is called `ASWrapperLayoutSpec`. `ASWrapperLayoutSpec` is an `ASLayoutSpec` subclass that can wrap a `ASLayoutElement` and calculates the layout of the child based on the size given to the `ASLayoutElement`: - -
-SwiftObjective-C - -
-
-// 1.x - ASStaticLayoutSpec used as a "wrapper" to return subnode from layoutSpecThatFits: 
-- (ASLayoutSpec *)layoutSpecThatFits:(ASSizeRange)constrainedSize
-{
-  return [ASStaticLayoutSpec staticLayoutSpecWithChildren:@[subnode]];
-}
-
-// 2.0
-- (ASLayoutSpec *)layoutSpecThatFits:(ASSizeRange)constrainedSize
-{
-  return [ASWrapperLayoutSpec wrapperWithLayoutElement:subnode];
-}
-
-// 1.x - ASStaticLayoutSpec used to set size (but not position) of subnode
-- (ASLayoutSpec *)layoutSpecThatFits:(ASSizeRange)constrainedSize
-{
-  ASDisplayNode *subnode = ...;
-  subnode.preferredSize = ...;
-  return [ASStaticLayoutSpec staticLayoutSpecWithChildren:@[subnode]];
-}
-
-// 2.0
-- (ASLayoutSpec *)layoutSpecThatFits:(ASSizeRange)constrainedSize
-{
-  ASDisplayNode *subnode = ...;
-  subnode.style.preferredSize = CGSizeMake(constrainedSize.max.width, constrainedSize.max.height / 2.0);
-  return [ASWrapperLayoutSpec wrapperWithLayoutElement:subnode];
-}
-
- -
-
- -## Deprecation of `-[ASDisplayNode preferredFrameSize]` - -With the introduction of new sizing properties there is no need anymore for the `-[ASDisplayNode preferredFrameSize]` property. Therefore it is deprecated in **2.0**. Instead, use the size values on the `style` object of an `ASDisplayNode`: - -
-SwiftObjective-C - -
-
 
-ASDisplayNode *ASDisplayNode = ...;
-
-// 1.x:
-displayNode.preferredFrameSize = CGSize(100, 100);
-
-// 2.0
-displayNode.style.preferredSize = CGSize(100, 100);
-
- -
-
- -`-[ASDisplayNode preferredFrameSize]` was not supported properly and was often more confusing than helpful. The new sizing methods should be easier and more clear to implment. - -## Deprecation of `-[ASLayoutElement measureWithSizeRange:]` - -`-[ASLayoutElement measureWithSizeRange:]` is deprecated in **2.0**. - -#### Calling `measureWithSizeRange:` - -If you previously called `-[ASLayoutElement measureWithSizeRange:]` to receive an `ASLayout`, call `-[ASLayoutElement layoutThatFits:]` now instead. - -
-SwiftObjective-C - -
-
-// 1.x:
-ASLayout *layout = [layoutElement measureWithSizeRange:someSizeRange];
-
-// 2.0:
-ASLayout *layout = [layoutElement layoutThatFits:someSizeRange];
-
- -
-
- -#### Implementing `measureWithSizeRange:` - -If you are implementing a custom `class` that conforms to `ASLayoutElement` (e.g. creating a custom `ASLayoutSpec`) , replace `-measureWithSizeRange:` with `-calculateLayoutThatFits:` - -
-SwiftObjective-C - -
-
-// 1.x:
-- (ASLayout *)measureWithSizeRange:(ASSizeRange)constrainedSize {}
-
-// 2.0:
-- (ASLayout *)calculateLayoutThatFits:(ASSizeRange)constrainedSize {}
-
- -
-
- -`-calculateLayoutThatFits:` takes an `ASSizeRange` that specifies a min size and a max size of type `CGSize`. Choose any size in the given range, to calculate the children's size and position and return a `ASLayout` structure with the layout of child components. - -Besides `-calculateLayoutThatFits:` there are two additional methods on `ASLayoutElement` that you should know about if you are implementing classes that conform to `ASLayoutElement`: - -
-SwiftObjective-C - -
-
-- (ASLayout *)calculateLayoutThatFits:(ASSizeRange)constrainedSize
-                     restrictedToSize:(ASLayoutElementSize)size
-                 relativeToParentSize:(CGSize)parentSize;
-
- -
-
- -In certain advanced cases, you may want to override this method. Overriding this method allows you to receive the `layoutElement`'s size, parent size, and constrained size. With these values you could calculate the final constrained size and call `-calculateLayoutThatFits:` with the result. - -
-SwiftObjective-C - -
-
-- (ASLayout *)layoutThatFits:(ASSizeRange)constrainedSize
-                  parentSize:(CGSize)parentSize;
-
- -
-
- -Call this on children`layoutElements` to compute their layouts within your implementation of `-calculateLayoutThatFits:`. - -For sample implementations of layout specs and the usage of the `calculateLayoutThatFits:` family of methods, check out the layout specs in Texture itself! - -## Deprecation of `-[ASDisplayNode measure:]` - -Use `-[ASDisplayNode layoutThatFits:]` instead to get an `ASLayout` and call `size` on the returned `ASLayout`: - -
-SwiftObjective-C - -
-
-// 1.x:
-CGSize size = [displayNode measure:CGSizeMake(100, 100)];
-
-// 2.0:
-// Creates an ASSizeRange with min and max sizes.
-ASLayout *layout = [displayNode layoutThatFits:ASSizeRangeMake(CGSizeZero, CGSizeMake(100, 100))];
-// Or an exact size
-// ASLayout *layout = [displayNode layoutThatFits:ASSizeRangeMake(CGSizeMake(100, 100))];
-CGSize size = layout.size;
-
- -
-
- -## Remove of `-[ASAbsoluteLayoutElement sizeRange]` - -The `sizeRange` property was removed from the `ASAbsoluteLayoutElement` protocol. Instead set the one of the following: - -- `-[ASLayoutElement width]` -- `-[ASLayoutElement height]` -- `-[ASLayoutElement minWidth]` -- `-[ASLayoutElement minHeight]` -- `-[ASLayoutElement maxWidth]` -- `-[ASLayoutElement maxHeight]` - -
-SwiftObjective-C - -
-
-id<ASLayoutElement> layoutElement = ...;
-
-// 1.x:
-layoutElement.sizeRange = ASRelativeSizeRangeMakeWithExactCGSize(CGSizeMake(50, 50));
-
-// 2.0:
-layoutElement.style.preferredSizeRange = ASRelativeSizeRangeMakeWithExactCGSize(CGSizeMake(50, 50));
-
- -
-
- -Due to the removal of `-[ASAbsoluteLayoutElement sizeRange]`, we also removed the `ASRelativeSizeRange`, as the type was no longer needed. - -## Rename `ASRelativeDimension` to `ASDimension` - -To simplify the naming and support the fact that dimensions are widely used in Texture now, `ASRelativeDimension` was renamed to `ASDimension`. Having a shorter name and handy functions to create it was an important goal for us. - -`ASRelativeDimensionTypePercent` and associated functions were renamed to use `Fraction` to be consistent with Apple terminology. - -
-SwiftObjective-C - -
-
-// 2.0:
-// Handy functions to create ASDimensions
-ASDimension dimensionInPoints;
-dimensionInPoints = ASDimensionMake(ASDimensionTypePoints, 5.0)
-dimensionInPoints = ASDimensionMake(5.0)
-dimensionInPoints = ASDimensionMakeWithPoints(5.0)
-dimensionInPoints = ASDimensionMake("5.0pt");
-
-ASDimension dimensionInFractions;
-dimensionInFractions = ASDimensionMake(ASDimensionTypeFraction, 0.5)
-dimensionInFractions = ASDimensionMakeWithFraction(0.5)
-dimensionInFractions = ASDimensionMake("50%");
-
- -
-
- -## Introduction of `ASDimensionUnitAuto` - -Previously `ASDimensionUnitPoints` and `ASDimensionUnitFraction` were the only two `ASDimensionUnit` enum values available. A new dimension type called `ASDimensionUnitAuto` now exists. All of the ``ASLayoutElementStyle` sizing properties are set to `ASDimensionAuto` by default. - -`ASDimensionUnitAuto` means more or less: *"I have no opinion" and may be resolved in whatever way makes most sense given the circumstances.* - -Most of the time this is the intrinsic content size of the `ASLayoutElement`. - -For example, if an `ASImageNode` has a `width` set to `ASDimensionUnitAuto`, the width of the linked image file will be used. For an `ASTextNode` the intrinsic content size will be calculated based on the text content. If an `ASLayoutElement` cannot provide any intrinsic content size like `ASVideoNode` for example the size needs to set explicitly. - -
-SwiftObjective-C - -
-
-// 2.0:
-// No specific size needs to be set as the imageNode's size 
-// will be calculated from the content (the image in this case)
-ASImageNode *imageNode = [ASImageNode new];
-imageNode.image = ...;
-
-// Specific size must be set for ASLayoutElement objects that
-// do not have an intrinsic content size (ASVideoNode does not
-// have a size until it's video downloads)
-ASVideoNode *videoNode = [ASVideoNode new];
-videoNode.style.preferredSize = CGSizeMake(200, 100);
-
- -
-
- diff --git a/submodules/AsyncDisplayKit/docs/_docs/layout2-layout-element-properties.md b/submodules/AsyncDisplayKit/docs/_docs/layout2-layout-element-properties.md deleted file mode 100755 index 18735a8cdf..0000000000 --- a/submodules/AsyncDisplayKit/docs/_docs/layout2-layout-element-properties.md +++ /dev/null @@ -1,146 +0,0 @@ ---- -title: Layout Element Properties -layout: docs -permalink: /docs/layout2-layout-element-properties.html -prevPage: layout2-layoutspec-types.html -nextPage: layout2-api-sizing.html ---- - -- ASStackLayoutElement Properties - will only take effect on a node or layout spec that is the child of a stack spec -- ASAbsoluteLayoutElement Properties - will only take effect on a node or layout spec that is the child of a absolute spec -- ASLayoutElement Properties - applies to all nodes & layout specs - -## ASStackLayoutElement Properties - -
-Please note that the following properties will only take effect if set on the child of an STACK layout spec. -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
PropertyDescription
CGFloat .style.spacingBeforeAdditional space to place before this object in the stacking direction.
CGFloat .style.spacingAfterAdditional space to place after this object in the stacking direction.
CGFloat .style.flexGrowIf the sum of childrens' stack dimensions is less than the minimum size, should this object grow?
CGFloat .style.flexShrinkIf the sum of childrens' stack dimensions is greater than the maximum size, should this object shrink?
ASDimension .style.flexBasisSpecifies the initial size for this object, in the stack dimension (horizontal or vertical), before the flexGrow / flexShrink properties are applied and the remaining space is distributed.
ASStackLayoutAlignSelf .style.alignSelfOrientation of the object along cross axis, overriding alignItems. Options include: -
    -
  • ASStackLayoutAlignSelfAuto
  • -
  • ASStackLayoutAlignSelfStart
  • -
  • ASStackLayoutAlignSelfEnd
  • -
  • ASStackLayoutAlignSelfCenter
  • -
  • ASStackLayoutAlignSelfStretch
  • -
CGFloat .style.ascenderUsed for baseline alignment. The distance from the top of the object to its baseline.
CGFloat .style.descenderUsed for baseline alignment. The distance from the baseline of the object to its bottom.
- - -## ASAbsoluteLayoutElement Properties - -
-Please note that the following properties will only take effect if set on the child of an ABSOLUTE layout spec. -
- - - - - - - - - - -
PropertyDescription
CGPoint .style.layoutPositionThe CGPoint position of this object within its ASAbsoluteLayoutSpec parent spec.
- -## ASLayoutElement Properties - -
-Please note that the following properties apply to ALL layout elements. -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
PropertyDescription
ASDimension .style.widthThe width property specifies the width of the content area of an ASLayoutElement. The minWidth and maxWidth properties override width. Defaults to ASDimensionAuto.
ASDimension .style.heightThe height property specifies the height of the content area of an ASLayoutElement. The minHeight and maxHeight properties override height. Defaults to ASDimensionAuto.
ASDimension .style.minWidthThe minWidth property is used to set the minimum width of a given element. It prevents the used value of the width property from becoming smaller than the value specified for minWidth. The value of minWidth overrides both maxWidth and width. Defaults to ASDimensionAuto.
ASDimension .style.maxWidthThe maxWidth property is used to set the maximum width of a given element. It prevents the used value of the width property from becoming larger than the value specified for maxWidth. The value of maxWidth overrides width, but minWidth overrides maxWidth. Defaults to ASDimensionAuto.
ASDimension .style.minHeightThe minHeight property is used to set the minimum height of a given element. It prevents the used value of the height property from becoming smaller than the value specified for minHeight. The value of minHeight overrides both maxHeight and height. Defaults to ASDimensionAuto.
ASDimension .style.maxHeightThe maxHeight property is used to set the maximum height of a given element. It prevents the used value of the height property from becoming larger than the value specified for maxHeight. The value of maxHeight overrides height, but minHeight overrides maxHeight. Defaults to ASDimensionAuto
CGSize .style.preferredSize

Provides a suggested size for a layout element. If the optional minSize or maxSize are provided, and the preferredSize exceeds these, the minSize or maxSize will be enforced. If this optional value is not provided, the layout element’s size will default to it’s intrinsic content size provided calculateSizeThatFits:

-

This method is optional, but one of either preferredSize or preferredLayoutSize is required for nodes that either have no intrinsic content size or should be laid out at a different size than its intrinsic content size. For example, this property could be set on an ASImageNode to display at a size different from the underlying image size.

-

Warning: calling the getter when the size's width or height are relative will cause an assert.

CGSize .style.minSize

An optional property that provides a minimum size bound for a layout element. If provided, this restriction will always be enforced. If a parent layout element’s minimum size is smaller than its child’s minimum size, the child’s minimum size will be enforced and its size will extend out of the layout spec’s.

-

For example, if you set a preferred relative width of 50% and a minimum width of 200 points on an element in a full screen container, this would result in a width of 160 points on an iPhone screen. However, since 160 pts is lower than the minimum width of 200 pts, the minimum width would be used.

CGSize .style.maxSize

An optional property that provides a maximum size bound for a layout element. If provided, this restriction will always be enforced. If a child layout element’s maximum size is smaller than its parent, the child’s maximum size will be enforced and its size will extend out of the layout spec’s.

-

For example, if you set a preferred relative width of 50% and a maximum width of 120 points on an element in a full screen container, this would result in a width of 160 points on an iPhone screen. However, since 160 pts is higher than the maximum width of 120 pts, the maximum width would be used.

ASLayoutSize .style.preferredLayoutSizeProvides a suggested RELATIVE size for a layout element. An ASLayoutSize uses percentages rather than points to specify layout. E.g. width should be 50% of the parent’s width. If the optional minLayoutSize or maxLayoutSize are provided, and the preferredLayoutSize exceeds these, the minLayoutSize or maxLayoutSize will be enforced. If this optional value is not provided, the layout element’s size will default to its intrinsic content size provided calculateSizeThatFits:
ASLayoutSize .style.minLayoutSizeAn optional property that provides a minimum RELATIVE size bound for a layout element. If provided, this restriction will always be enforced. If a parent layout element’s minimum relative size is smaller than its child’s minimum relative size, the child’s minimum relative size will be enforced and its size will extend out of the layout spec’s.
ASLayoutSize .style.maxLayoutSizeAn optional property that provides a maximum RELATIVE size bound for a layout element. If provided, this restriction will always be enforced. If a parent layout element’s maximum relative size is smaller than its child’s maximum relative size, the child’s maximum relative size will be enforced and its size will extend out of the layout spec’s.
diff --git a/submodules/AsyncDisplayKit/docs/_docs/layout2-layoutSpecThatFits.md b/submodules/AsyncDisplayKit/docs/_docs/layout2-layoutSpecThatFits.md deleted file mode 100755 index cd3e3097cc..0000000000 --- a/submodules/AsyncDisplayKit/docs/_docs/layout2-layoutSpecThatFits.md +++ /dev/null @@ -1,120 +0,0 @@ ---- -title: Composing Layout Specs -layout: docs -permalink: /docs/layout2-layoutSpecThatFits.html ---- - -The composing of layout specs and layoutables are happening within the `layoutSpecThatFits:` method. This is where you will put the majority of your layout code. It defines the layout and does the heavy calculation on a background thread. - -Every `ASDisplayNode` that would like to layout it's subnodes should should do this by implementing the `layoutSpecThatFits:` method. This method is where you build out a layout spec object that will produce the size of the node, as well as the size and position of all subnodes. - -The following `layoutSpecThatFits:` implementation is from the Kittens example and will implement an easy stack layout with an image with a constrained size on the left and a text to the right. The great thing is, by using a `ASStackLayoutSpec` the height is dynamically calculated based on the image height and the height of the text. - -
- - Swift - Objective-C - - -
-
-- (ASLayoutSpec *)layoutSpecThatFits:(ASSizeRange)constrainedSize
-{
-  // Set an intrinsic size for the image node
-  CGSize imageSize = _isImageEnlarged ? CGSizeMake(2.0 * kImageSize, 2.0 * kImageSize)
-                                      : CGSizeMake(kImageSize, kImageSize);
-  [_imageNode setSizeFromCGSize:imageSize];
-
-  // Shrink the text node in case the image + text gonna be too wide
-  _textNode.flexShrink = YES;
-
-  // Configure stack
-  ASStackLayoutSpec *stackLayoutSpec =
-  [ASStackLayoutSpec
-   stackLayoutSpecWithDirection:ASStackLayoutDirectionHorizontal
-   spacing:kInnerPadding
-   justifyContent:ASStackLayoutJustifyContentStart
-   alignItems:ASStackLayoutAlignItemsStart
-   children:_swappedTextAndImage ? @[_textNode, _imageNode] : @[_imageNode, _textNode]];
-
-  // Add inset
-  return [ASInsetLayoutSpec
-          insetLayoutSpecWithInsets:UIEdgeInsetsMake(kOuterPadding, kOuterPadding, kOuterPadding, kOuterPadding)
-          child:stackLayoutSpec];
-}
-  
- - -
-
- - -The result looks like the following: -![Kittens Node](https://d3vv6lp55qjaqc.cloudfront.net/items/2l133Y2B3r1F231a310q/Screen%20Shot%202016-08-23%20at%202.29.12%20PM.png) - -Let's look at some more advanced composition of layout spec and layoutable implementation from the `ASDKGram` example that should give you a feel how layout specs and layoutables can be combined to compose a difficult layout. You can also find this code in the `examples/ASDKGram` folder. - -
- - Swift - Objective-C - - -
-
-  
- - -
-
- -After the layout pass happened the result will look like the following: -![ASDKGram](https://d3vv6lp55qjaqc.cloudfront.net/items/1l0t352p441K3k0C3y1l/layout-example-2.png) - -The layout spec object that you create in `layoutSpecThatFits:` is mutable up until the point that it is return in this method. After this point, it will be immutable. It's important to remember not to cache layout specs for use later but instead to recreate them when necessary. - -Note: Because it is run on a background thread, you should not set any node.view or node.layer properties here. Also, unless you know what you are doing, do not create any nodes in this method. Additionally, it is not necessary to begin this method with a call to super, unlike other method overrides. \ No newline at end of file diff --git a/submodules/AsyncDisplayKit/docs/_docs/layout2-layoutspec-types-examples.md b/submodules/AsyncDisplayKit/docs/_docs/layout2-layoutspec-types-examples.md deleted file mode 100755 index 6b851879ff..0000000000 --- a/submodules/AsyncDisplayKit/docs/_docs/layout2-layoutspec-types-examples.md +++ /dev/null @@ -1,26 +0,0 @@ ---- -title: Layout Spec Composition Examples -layout: docs -permalink: /docs/layout2-layoutspec-types-examples.html ---- - -## Text Overlaid on an Image - - -
-SwiftObjective-C - -
-
-- (ASLayoutSpec *)layoutSpecThatFits:(ASSizeRange)constrainedSize
-{
-  ...
-  UIEdgeInsets *insets = UIEdgeInsetsMake(0, HORIZONTAL_BUFFER, 0, HORIZONTAL_BUFFER);
-  ASInsetLayoutSpec *headerWithInset = [ASInsetLayoutSpec alloc] initWithInsets:insets child:textNode];
-  ...
-}
-
- -
-
\ No newline at end of file diff --git a/submodules/AsyncDisplayKit/docs/_docs/layout2-layoutspec-types.md b/submodules/AsyncDisplayKit/docs/_docs/layout2-layoutspec-types.md deleted file mode 100755 index a5ab39b14f..0000000000 --- a/submodules/AsyncDisplayKit/docs/_docs/layout2-layoutspec-types.md +++ /dev/null @@ -1,517 +0,0 @@ ---- -title: Layout Specs -layout: docs -permalink: /docs/layout2-layoutspec-types.html -prevPage: automatic-layout-examples-2.html -nextPage: layout2-layout-element-properties.html ---- - -The following `ASLayoutSpec` subclasses can be used to compose simple or very complex layouts. - - -
  • ASCornerLayoutSpec
  • - -You may also subclass `ASLayoutSpec` in order to make your own, custom layout specs. - -## ASWrapperLayoutSpec - -`ASWrapperLayoutSpec` is a simple `ASLayoutSpec` subclass that can wrap a `ASLayoutElement` and calculate the layout of the child based on the size set on the layout element. - -`ASWrapperLayoutSpec` is ideal for easily returning a single subnode from `-layoutSpecThatFits:`. Optionally, this subnode can have sizing information set on it. However, if you need to set a position in addition to a size, use `ASAbsoluteLayoutSpec` instead. - -
    - - Swift - Objective-C - - -
    -
    -// return a single subnode from layoutSpecThatFits: 
    -- (ASLayoutSpec *)layoutSpecThatFits:(ASSizeRange)constrainedSize
    -{
    -  return [ASWrapperLayoutSpec wrapperWithLayoutElement:_subnode];
    -}
    -
    -// set a size (but not position)
    -- (ASLayoutSpec *)layoutSpecThatFits:(ASSizeRange)constrainedSize
    -{
    -  _subnode.style.preferredSize = CGSizeMake(constrainedSize.max.width,
    -                                            constrainedSize.max.height / 2.0);
    -  return [ASWrapperLayoutSpec wrapperWithLayoutElement:subnode];
    -}
    -
    - - -
    -
    - -## ASStackLayoutSpec (Flexbox Container) -Of all the layoutSpecs in Texture, `ASStackLayoutSpec` is the most useful and powerful. `ASStackLayoutSpec` uses the flexbox algorithm to determine the position and size of its children. Flexbox is designed to provide a consistent layout on different screen sizes. In a stack layout you align items in either a vertical or horizontal stack. A stack layout can be a child of another stack layout, which makes it possible to create almost any layout using a stack layout spec. - -`ASStackLayoutSpec` has 7 properties in addition to its `` properties: - -- `direction`. Specifies the direction children are stacked in. If horizontalAlignment and verticalAlignment were set, -they will be resolved again, causing justifyContent and alignItems to be updated accordingly. -- `spacing`. The amount of space between each child. -- `horizontalAlignment`. Specifies how children are aligned horizontally. Depends on the stack direction, setting the alignment causes either - justifyContent or alignItems to be updated. The alignment will remain valid after future direction changes. - Thus, it is preferred to those properties. -- `verticalAlignment`. Specifies how children are aligned vertically. Depends on the stack direction, setting the alignment causes either - justifyContent or alignItems to be updated. The alignment will remain valid after future direction changes. - Thus, it is preferred to those properties. -- `justifyContent`. It defines the alignment along the main axis. -- `alignItems`. Orientation of children along cross axis. -- `flexWrap`. Whether children are stacked into a single or multiple lines. Defaults to single line. -- `alignContent`. Orientation of lines along cross axis if there are multiple lines. - -
    - - Swift - Objective-C - - -
    -
    -- (ASLayoutSpec *)layoutSpecThatFits:(ASSizeRange)constrainedSize
    -{
    -  ASStackLayoutSpec *mainStack = [ASStackLayoutSpec stackLayoutSpecWithDirection:ASStackLayoutDirectionHorizontal
    -                       spacing:6.0
    -                justifyContent:ASStackLayoutJustifyContentStart
    -                    alignItems:ASStackLayoutAlignItemsCenter
    -                      children:@[_iconNode, _countNode]];
    -
    -  // Set some constrained size to the stack
    -  mainStack.style.minWidth = ASDimensionMakeWithPoints(60.0);
    -  mainStack.style.maxHeight = ASDimensionMakeWithPoints(40.0);
    -
    -  return mainStack;
    -}
    -
    - - -
    -
    - -Flexbox works the same way in Texture as it does in CSS on the web, with a few exceptions. For example, the defaults are different and there is no `flex` parameter. See Web Flexbox Differences for more information. - -
    - -## ASInsetLayoutSpec -During the layout pass, the `ASInsetLayoutSpec` passes its `constrainedSize.max` `CGSize` to its child, after subtracting its insets. Once the child determines it's final size, the inset spec passes its final size up as the size of its child plus its inset margin. Since the inset layout spec is sized based on the size of it's child, the child **must** have an instrinsic size or explicitly set its size. - - - -If you set `INFINITY` as a value in the `UIEdgeInsets`, the inset spec will just use the intrinisic size of the child. See an example of this. - -
    - - Swift - Objective-C - - -
    -
    -- (ASLayoutSpec *)layoutSpecThatFits:(ASSizeRange)constrainedSize
    -{
    -  ...
    -  UIEdgeInsets *insets = UIEdgeInsetsMake(10, 10, 10, 10);
    -  ASInsetLayoutSpec *headerWithInset = [ASInsetLayoutSpec insetLayoutSpecWithInsets:insets child:textNode];
    -  ...
    -}
    -
    - - -
    -
    - -## ASOverlayLayoutSpec -`ASOverlayLayoutSpec` lays out its child (blue), stretching another component on top of it as an overlay (red). - - - -The overlay spec's size is calculated from the child's size. In the diagram below, the child is the blue layer. The child's size is then passed as the `constrainedSize` to the overlay layout element (red layer). Thus, it is important that the child (blue layer) **must** have an intrinsic size or a size set on it. - -
    -When using Automatic Subnode Management with the ASOverlayLayoutSpec, the nodes may sometimes appear in the wrong order. This is a known issue that will be fixed soon. The current workaround is to add the nodes manually, with the overlay layout element (red) must added as a subnode to the parent node after the child layout element (blue). -
    - -
    - - Swift - Objective-C - - -
    -
    -- (ASLayoutSpec *)layoutSpecThatFits:(ASSizeRange)constrainedSize
    -{
    -  ASDisplayNode *backgroundNode = ASDisplayNodeWithBackgroundColor([UIColor blueColor]);
    -  ASDisplayNode *foregroundNode = ASDisplayNodeWithBackgroundColor([UIColor redColor]);
    -  return [ASOverlayLayoutSpec overlayLayoutSpecWithChild:backgroundNode overlay:foregroundNode];
    -}
    -
    - - -
    -
    - -## ASBackgroundLayoutSpec -`ASBackgroundLayoutSpec` lays out a component (blue), stretching another component behind it as a backdrop (red). - - - -The background spec's size is calculated from the child's size. In the diagram below, the child is the blue layer. The child's size is then passed as the `constrainedSize` to the background layout element (red layer). Thus, it is important that the child (blue layer) **must** have an intrinsic size or a size set on it. - -
    -When using Automatic Subnode Management with the ASOverlayLayoutSpec, the nodes may sometimes appear in the wrong order. This is a known issue that will be fixed soon. The current workaround is to add the nodes manually, with the child layout element (blue) must added as a subnode to the parent node after the child background element (red). -
    - -
    - - Swift - Objective-C - - -
    -
    -- (ASLayoutSpec *)layoutSpecThatFits:(ASSizeRange)constrainedSize
    -{
    -  ASDisplayNode *backgroundNode = ASDisplayNodeWithBackgroundColor([UIColor redColor]);
    -  ASDisplayNode *foregroundNode = ASDisplayNodeWithBackgroundColor([UIColor blueColor]);
    -
    -  return [ASBackgroundLayoutSpec backgroundLayoutSpecWithChild:foregroundNode background:backgroundNode];
    -}
    -
    - - -
    -
    - -Note: The order in which subnodes are added matters for this layout spec; the background object must be added as a subnode to the parent node before the foreground object. Using ASM does not currently guarantee this order! - -## ASCenterLayoutSpec -`ASCenterLayoutSpec` centers its child within its max `constrainedSize`. - - - -If the center spec's width or height is unconstrained, it shrinks to the size of the child. - -`ASCenterLayoutSpec` has two properties: - -- `centeringOptions`. Determines how the child is centered within the center spec. Options include: None, X, Y, XY. -- `sizingOptions`. Determines how much space the center spec will take up. Options include: Default, minimum X, minimum Y, minimum XY. - -
    - - Swift - Objective-C - - -
    -
    -- (ASLayoutSpec *)layoutSpecThatFits:(ASSizeRange)constrainedSize
    -{
    -  ASStaticSizeDisplayNode *subnode = ASDisplayNodeWithBackgroundColor([UIColor greenColor], CGSizeMake(70, 100));
    -  return [ASCenterLayoutSpec centerLayoutSpecWithCenteringOptions:ASCenterLayoutSpecCenteringXY
    -                                                    sizingOptions:ASCenterLayoutSpecSizingOptionDefault
    -                                                            child:subnode]
    -}
    -
    - - -
    -
    - -## ASRatioLayoutSpec -`ASRatioLayoutSpec` lays out a component at a fixed aspect ratio which can scale. This spec **must** have a width or a height passed to it as a constrainedSize as it uses this value to scale itself. - - - -It is very common to use a ratio spec to provide an intrinsic size for `ASNetworkImageNode` or `ASVideoNode`, as both do not have an intrinsic size until the content returns from the server. - -
    - - Swift - Objective-C - - -
    -
    -- (ASLayoutSpec *)layoutSpecThatFits:(ASSizeRange)constrainedSize
    -{
    -  // Half Ratio
    -  ASStaticSizeDisplayNode *subnode = ASDisplayNodeWithBackgroundColor([UIColor greenColor], CGSizeMake(100, 100));
    -  return [ASRatioLayoutSpec ratioLayoutSpecWithRatio:0.5 child:subnode];
    -}
    -
    - - -
    -
    - -## ASRelativeLayoutSpec -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. - -This is a very powerful class, but too complex to cover in this overview. For more information, look into `ASRelativeLayoutSpec`'s `-calculateLayoutThatFits:` method + properties. - -
    - - Swift - Objective-C - - -
    -
    -- (ASLayoutSpec *)layoutSpecThatFits:(ASSizeRange)constrainedSize
    -{
    -  ...
    -  ASDisplayNode *backgroundNode = ASDisplayNodeWithBackgroundColor([UIColor redColor]);
    -  ASStaticSizeDisplayNode *foregroundNode = ASDisplayNodeWithBackgroundColor([UIColor greenColor], CGSizeMake(70, 100));
    -
    -  ASRelativeLayoutSpec *relativeSpec = [ASRelativeLayoutSpec relativePositionLayoutSpecWithHorizontalPosition:ASRelativeLayoutSpecPositionStart
    -                                  verticalPosition:ASRelativeLayoutSpecPositionStart
    -                                      sizingOption:ASRelativeLayoutSpecSizingOptionDefault
    -                                             child:foregroundNode]
    -
    -  ASBackgroundLayoutSpec *backgroundSpec = [ASBackgroundLayoutSpec backgroundLayoutSpecWithChild:relativeSpec background:backgroundNode];
    -  ...
    -}
    -
    - - -
    -
    - -## ASAbsoluteLayoutSpec -Within `ASAbsoluteLayoutSpec` you can specify exact locations (x/y coordinates) of its children by setting their `layoutPosition` property. Absolute layouts are less flexible and harder to maintain than other types of layouts. - -`ASAbsoluteLayoutSpec` has one property: - -- `sizing`. Determines how much space the absolute spec will take up. Options include: Default, and Size to Fit. *Note* that the Size to Fit option will replicate the behavior of the old `ASStaticLayoutSpec`. - -
    - - Swift - Objective-C - - -
    -
    -- (ASLayoutSpec *)layoutSpecThatFits:(ASSizeRange)constrainedSize
    -{
    -  CGSize maxConstrainedSize = constrainedSize.max;
    -
    -  // Layout all nodes absolute in a static layout spec
    -  guitarVideoNode.style.layoutPosition = CGPointMake(0, 0);
    -  guitarVideoNode.style.preferredSize = CGSizeMake(maxConstrainedSize.width, maxConstrainedSize.height / 3.0);
    -
    -  nicCageVideoNode.style.layoutPosition = CGPointMake(maxConstrainedSize.width / 2.0, maxConstrainedSize.height / 3.0);
    -  nicCageVideoNode.style.preferredSize = CGSizeMake(maxConstrainedSize.width / 2.0, maxConstrainedSize.height / 3.0);
    -
    -  simonVideoNode.style.layoutPosition = CGPointMake(0.0, maxConstrainedSize.height - (maxConstrainedSize.height / 3.0));
    -  simonVideoNode.style.preferredSize = CGSizeMake(maxConstrainedSize.width/2, maxConstrainedSize.height / 3.0);
    -
    -  hlsVideoNode.style.layoutPosition = CGPointMake(0.0, maxConstrainedSize.height / 3.0);
    -  hlsVideoNode.style.preferredSize = CGSizeMake(maxConstrainedSize.width / 2.0, maxConstrainedSize.height / 3.0);
    -
    -  return [ASAbsoluteLayoutSpec absoluteLayoutSpecWithChildren:@[guitarVideoNode, nicCageVideoNode, simonVideoNode, hlsVideoNode]];
    -}
    -
    - - -
    -
    - -## ASCornerLayoutSpec -`ASCornerLayoutSpec` is a new convenient layout spec for fast corner element layout. The easy way to position an element in corner is to use declarative code expression rather than manual coordinate calculation, and ASCornerLayoutSpec can achieve this goal. - - - -`ASCornerLayoutSpec` takes good care of its own size calculation. The best scenario to explain this would be the case that adding a small badge view at the corner of user's avatar image and there is no need to worry about the fact that little-exceeded badge frame (which out of avatar image frame) may affect the whole layout size. By default, the size of corner element will not be added to layout size, only if you manually turn on the `wrapsCorner` property. - -`ASCornerLayoutSpec` is introduced from version 2.7 and above. - -
    - - Swift - Objective-C - - -
    -
    -- (ASLayoutSpec *)layoutSpecThatFits:(ASSizeRange)constrainedSize
    -{
    -  ...
    -  // Layout the center of badge to the top right corner of avatar.
    -  ASCornerLayoutSpec *cornerSpec = [ASCornerLayoutSpec cornerLayoutSpecWithChild:self.avatarNode corner:self.badgeNode location:ASCornerLayoutLocationTopRight];
    -  // Slightly shift center of badge inside of avatar.
    -  cornerSpec.offset = CGPointMake(-3, 3);
    -  ...
    -}
    -
    - - -
    -
    - -## ASLayoutSpec -`ASLayoutSpec` is the main class from that all layout spec's are subclassed. It's main job is to handle all the children management, but it also can be used to create custom layout specs. Only the super advanced should want / need to create a custom subclasses of `ASLayoutSpec` though. Instead try to use provided layout specs and compose them together to create more advanced layouts. - -Another use of `ASLayoutSpec` is to be used as a spacer in a `ASStackLayoutSpec` with other children, when `.flexGrow` and/or `.flexShrink` is applied. - -
    - - Swift - Objective-C - - -
    -
    -- (ASLayoutSpec *)layoutSpecThatFits:(ASSizeRange)constrainedSize
    -{
    -  ...
    -  // ASLayoutSpec as spacer
    -  ASLayoutSpec *spacer = [[ASLayoutSpec alloc] init];
    -  spacer.style.flexGrow = 1.0;
    -
    -  stack.children = @[imageNode, spacer, textNode];
    -  ...
    -}
    -
    - - -
    -
    diff --git a/submodules/AsyncDisplayKit/docs/_docs/layout2-manual-layout.md b/submodules/AsyncDisplayKit/docs/_docs/layout2-manual-layout.md deleted file mode 100755 index fef0ccf505..0000000000 --- a/submodules/AsyncDisplayKit/docs/_docs/layout2-manual-layout.md +++ /dev/null @@ -1,174 +0,0 @@ ---- -title: Manual Layout -layout: docs -permalink: /docs/layout2-manual-layout.html ---- - -## Manual Layout -After diving in to the automatic way for layout in Texture there is still the _old_ way to layout manually available. For the sake of completness here is a short description how to accomplish that within Texture. - -### Manual Layout UIKit - -Sizing and layout of custom view hierarchies are typically done all at once on the main thread. For example, a custom UIView that minimally encloses a text view and an image view might look like this: - -
    - - Swift - Objective-C - - -
    -
    -- (CGSize)sizeThatFits:(CGSize)size
    -{
    -  // size the image
    -  CGSize imageSize = [_imageView sizeThatFits:size];
    -
    -  // size the text view
    -  CGSize maxTextSize = CGSizeMake(size.width - imageSize.width, size.height);
    -  CGSize textSize = [_textView sizeThatFits:maxTextSize];
    -
    -  // make sure everything fits
    -  CGFloat minHeight = MAX(imageSize.height, textSize.height);
    -  return CGSizeMake(size.width, minHeight);
    -}
    -
    -- (void)layoutSubviews
    -{
    -  CGSize size = self.bounds.size; // convenience
    -
    -  // size and layout the image
    -  CGSize imageSize = [_imageView sizeThatFits:size];
    -  _imageView.frame = CGRectMake(size.width - imageSize.width, 0.0f,
    -                                imageSize.width, imageSize.height);
    -
    -  // size and layout the text view
    -  CGSize maxTextSize = CGSizeMake(size.width - imageSize.width, size.height);
    -  CGSize textSize = [_textView sizeThatFits:maxTextSize];
    -  _textView.frame = (CGRect){ CGPointZero, textSize };
    -}
    -  
    - - -
    -
    - -This isn't ideal. We're sizing our subviews twice — once to figure out how big our view needs to be and once when laying it out — and while our layout arithmetic is cheap and quick, we're also blocking the main thread on expensive text sizing. - -We could improve the situation by manually cacheing our subviews' sizes, but that solution comes with its own set of problems. Just adding `_imageSize` and `_textSize` ivars wouldn't be enough: for example, if the text were to change, we'd need to recompute its size. The boilerplate would quickly become untenable. - -Further, even with a cache, we'll still be blocking the main thread on sizing *sometimes*. We could try to shift sizing to a background thread with `dispatch_async()`, but even if our own code is thread-safe, UIView methods are documented to [only work on the main thread](https://developer.apple.com/library/ios/documentation/UIKit/Reference/UIView_Class/index.html): - -> Manipulations to your application’s user interface must occur on the main -> thread. Thus, you should always call the methods of the UIView class from -> code running in the main thread of your application. The only time this may -> not be strictly necessary is when creating the view object itself but all -> other manipulations should occur on the main thread. - -This is a pretty deep rabbit hole. We could attempt to work around the fact that UILabels and UITextViews cannot safely be sized on background threads by manually creating a TextKit stack and sizing the text ourselves... but that's a laborious duplication of work. Further, if UITextView's layout behaviour changes in an iOS update, our sizing code will break. (And did we mention that TextKit isn't thread-safe either?) - -### Manual Layout Texture - -Manual layout within Texture are realized within two methods: - -#### `calculateSizeThatFits` and `layout` - -Within `calculateSizeThatFits:` you should provide a intrinsic content size for the node based on the given `constrainedSize`. This method is called on a background thread so perform expensive sizing operations within it. - -
    - - Swift - Objective-C - - -
    -
    -- [ASDisplayNode calculateSizeThatFits:]
    -  
    - - -
    -
    - -After measurement and layout pass happens further layout can be done in `layout`. This method is called on the main thread. In there, layout operations can be done for nodes that are not playing within the automatic layout system and are referenced within `layoutSpecThatFits:`. - -
    - - Swift - Objective-C - - -
    -
    -- [ASDisplayNode layout]
    -  
    - - -
    -
    - -#### Example -Our custom node looks like this: - -
    - - Swift - Objective-C - - -
    -
    -#import 
    -
    -...
    -
    -// perform expensive sizing operations on a background thread
    -- (CGSize)calculateSizeThatFits:(CGSize)constrainedSize
    -{
    -  // size the image
    -  CGSize imageSize = [_imageNode layoutThatFits:ASSizeRangeMake(CGSizeZero, constrainedSize)].size;
    -
    -  // size the text node
    -  CGSize maxTextSize = CGSizeMake(constrainedSize.width - imageSize.width,
    -                                  constrainedSize.height);
    -
    -  CGSize textSize = [_textNode layoutThatFits:ASSizeRangeMake(CGSizeZero, maxTextSize)].size;
    -
    -  // make sure everything fits
    -  CGFloat minHeight = MAX(imageSize.height, textSize.height);
    -  return CGSizeMake(constrainedSize.width, minHeight);
    -}
    -
    -// do as little work as possible in main-thread layout
    -- (void)layout
    -{
    -  // layout the image using its cached size
    -  CGSize imageSize = _imageNode.calculatedSize;
    -  _imageNode.frame = CGRectMake(self.bounds.size.width - imageSize.width, 0.0f,
    -                                imageSize.width, imageSize.height);
    -
    -  // layout the text view using its cached size
    -  CGSize textSize = _textNode.calculatedSize;
    -  _textNode.frame = (CGRect){ CGPointZero, textSize };
    -}
    -  
    - - -
    -
    - -`ASImageNode` and `ASTextNode`, like the rest of Texture, are thread-safe, so we can size them on background threads. The `-layoutThatFits:` method is like `-sizeThatFits:`, but with side effects: it caches the (`calculatedSize`) for quick access later on — like in our now-snappy `-layout` implementation. - -As you can see, node hierarchies are sized and laid out in much the same way as their view counterparts. Manually layed out nodes do need to be written with a few things in mind: - -* Nodes must recursively measure all of their subnodes in their `-calculateSizeThatFits:` implementations. Note that the `-layoutThatFits:` machinery will only call `-calculateSizeThatFits:` if a new measurement pass is needed (e.g., if the constrained size has changed) and `layoutSpecThatFits:` is *not* implemented. - -* Nodes should perform any other expensive pre-layout calculations in `-calculateSizeThatFits:`, caching useful intermediate results in ivars as appropriate. - -* Nodes should call `[self invalidateCalculatedSize]` when necessary. For example, `ASTextNode` invalidates its calculated size when its `attributedString` property is changed. - -As already mentioned, automatic layout is preferred over manual layout and should be the way to go in most cases. \ No newline at end of file diff --git a/submodules/AsyncDisplayKit/docs/_docs/layout2-quickstart.md b/submodules/AsyncDisplayKit/docs/_docs/layout2-quickstart.md deleted file mode 100755 index 798e0a2ec4..0000000000 --- a/submodules/AsyncDisplayKit/docs/_docs/layout2-quickstart.md +++ /dev/null @@ -1,100 +0,0 @@ ---- -title: Quickstart -layout: docs -permalink: /docs/layout2-quickstart.html -prevPage: multiplex-image-node.html -nextPage: automatic-layout-examples-2.html ---- - -## Motivation & Benefits - -The Layout API was created as a performant alternative to UIKit's Auto Layout, which becomes exponentially expensive for complicated view hierarchies. Texture's Layout API has many benefits over using UIKit's Auto Layout: - -- **Fast**: As fast as manual layout code and significantly faster than Auto Layout -- **Asynchronous & Concurrent:** Layouts can be computed on background threads so user interactions are not interrupted. -- **Declarative**: Layouts are declared with immutable data structures. This makes layout code easier to develop, document, code review, test, debug, profile, and maintain. -- **Cacheable**: Layout results are immutable data structures so they can be precomputed in the background and cached to increase user perceived performance. -- **Extensible**: Easy to share code between classes. - -## Inspired by CSS Flexbox - -Those who are familiar with Flexbox will notice many similarities in the two systems. However, Texture's Layout API does not re-implement all of CSS. - -## Basic Concepts - -Texture's layout system is centered around two basic concepts: - -1. Layout Specs -2. Layout Elements - - -### Layout Specs - -A layout spec, short for "layout specification", has no physical presence. Instead, layout specs act as containers for other layout elements by understanding how these children layout elements relate to each other. - -Texture provides several subclasses of `ASLayoutSpec`, from a simple layout specification that insets a single child, to a more complex layout specification that arranges multiple children in varying stack configurations. - -### Layout Elements - -Layout specs contain and arrange layout elements. - -All `ASDisplayNode`s and `ASLayoutSpec`s conform to the `` protocol. This means that you can compose layout specs from both nodes and other layout specs. Cool! - -The `ASLayoutElement` protocol has several properties that can be used to create very complex layouts. In addition, layout specs have their own set of properties that can be used to adjust the arrangment of the layout elements. - -### Combine Layout Specs & Layout Elements to Make Complex UI - -Here you can see how `ASTextNode`s (highlighted in yellow), an `ASVideoNode` (top image) and an `ASStackLayoutSpec` ("stack layout spec") can be combined to create a complex layout. - - - -The play button on top of the `ASVideoNode` (top image) is placed using an `ASCenterLayoutSpec` ("center layout spec") and an `ASOverlayLayoutSpec` ("overlay layout spec"). - - - -### Some nodes need Sizes Set - - - -Some elements have an "intrinsic size" based on their immediately available content. For example, ASTextNode can calculate its size based on its attributed string. Other nodes that have an intrinsic size include - -- `ASImageNode` -- `ASTextNode` -- `ASButtonNode` - -All other nodes either do not have an intrinsic size or lack an intrinsic size until their external resource is loaded. For example, an `ASNetworkImageNode` does not know its size until the image has been downloaded from the URL. These sorts of elements include - -- `ASVideoNode` -- `ASVideoPlayerNode` -- `ASNetworkImageNode` -- `ASEditableTextNode` - -These nodes that lack an initial intrinsic size must have an initial size set for them using an `ASRatioLayoutSpec`, an `ASAbsoluteLayoutSpec` or the size properties on the style object. - -### Layout Debugging - -Calling `-asciiArtString` on any `ASDisplayNode` or `ASLayoutSpec` returns an ascii-art representation of the object and its children. Optionally, if you set the `.debugName` on any node or layout spec, that will also be included in the ascii art. An example is seen below. - -
    -
    -
    ------------------------ASStackLayoutSpec----------------------
    -|  -----ASStackLayoutSpec-----  -----ASStackLayoutSpec-----  |
    -|  |       ASImageNode       |  |       ASImageNode       |  |
    -|  |       ASImageNode       |  |       ASImageNode       |  |
    -|  ---------------------------  ---------------------------  |
    ---------------------------------------------------------------
    -
    -
    -
    - -You can also print out the style object on any `ASLayoutElement` (node or layout spec). This is especially useful when debugging the sizing properties. - -
    -
    -
    -(lldb) po _photoImageNode.style
    -Layout Size = min {414pt, 414pt} <= preferred {20%, 50%} <= max {414pt, 414pt}
    -
    -
    -
    diff --git a/submodules/AsyncDisplayKit/docs/_docs/layout2-web-flexbox-differences.md b/submodules/AsyncDisplayKit/docs/_docs/layout2-web-flexbox-differences.md deleted file mode 100755 index 73dac79fe7..0000000000 --- a/submodules/AsyncDisplayKit/docs/_docs/layout2-web-flexbox-differences.md +++ /dev/null @@ -1,21 +0,0 @@ ---- -title: Web Flexbox Differences -layout: docs -permalink: /docs/layout2-web-flexbox-differences.html ---- - -The goal of Texture's Layout API is *not* to re-implement all of CSS. It only targets a subset of CSS and Flexbox container, and there are no plans to implement support for tables, floats, or any other CSS concepts. The Texture Layout API also does not plan to support styling properties which do not affect layout such as color or background properties. - -The layout system tries to stay as close as possible to CSS. There are, however, certain cases where it differs from the web, these include: - -### Naming properties - -Certain properties have a different naming as on the web. For example `min-height` equivalent is the `minHeight` property. The full list of properties that control layout is documented in the Layout Properties section. - -### No margin / padding properties - -Layoutables don't have a padding or margin property. Instead wrapping a layoutable within an `ASInsetLayoutSpec` to apply padding or margin to the layoutable is the recommended way. See `ASInsetLayout` section for more information. - -### Missing features - -Certain features are not supported currently. See Layout Properties for the full list of properties that are supported. diff --git a/submodules/AsyncDisplayKit/docs/_docs/map-node.md b/submodules/AsyncDisplayKit/docs/_docs/map-node.md deleted file mode 100755 index 6245306193..0000000000 --- a/submodules/AsyncDisplayKit/docs/_docs/map-node.md +++ /dev/null @@ -1,146 +0,0 @@ ---- -title: ASMapNode -layout: docs -permalink: /docs/map-node.html -prevPage: video-node.html -nextPage: control-node.html ---- - -`ASMapNode` allows you to easily specify a geographic region to show to your users. - -### Basic Usage - -Let's say you'd like to show a snapshot of San Francisco. All you need are the coordinates. - -
    -SwiftObjective-C - -
    -
    -ASMapNode *mapNode = [[ASMapNode alloc] init];
    -mapNode.style.preferredSize = CGSizeMake(300.0, 300.0);
    -
    -// San Francisco
    -CLLocationCoordinate2D coord = CLLocationCoordinate2DMake(37.7749, -122.4194);
    -
    -// show 20,000 square meters
    -mapNode.region = MKCoordinateRegionMakeWithDistance(coord, 20000, 20000);
    -
    - - -
    -
    - - - -The region value is actually just one piece of a property called `options` of type `MKMapSnapshotOptions`. - - -### MKMapSnapshotOptions - -A map node's main components can be defined directly through its `options` property. The snapshot options object contains the following: - -
      -
    • An MKMapCamera: used to configure altitude and pitch of the camera
    • -
    • An MKMapRect: basically a CGRect
    • -
    • An MKMapRegion: Controls the coordinate of focus, and the size around that focus to show
    • -
    • An MKMapType: Can be set to Standard, Satellite, etc.
    • -
    - -To do something like changing your map to a satellite map, you just need to create an options object and set its properties accordingly. - -
    -SwiftObjective-C - -
    -
    -MKMapSnapshotOptions *options = [[MKMapSnapshotOptions alloc] init];
    -options.mapType = MKMapTypeSatellite;
    -options.region = MKCoordinateRegionMakeWithDistance(coord, 20000, 20000);
    -
    -mapNode.options = options;
    -
    - -
    -
    - -Results in: - - - -One thing to note is that setting the options value will overwrite a previously set region. - -### Annotations - -To set annotations, all you need to do is assign an array of annotations to your `ASMapNode`. - -Say you want to show a pin directly in the middle of your map of San Francisco. - -
    -SwiftObjective-C - -
    -
    -MKPointAnnotation *annotation = [[MKPointAnnotation alloc] init];
    -annotation.coordinate = CLLocationCoordinate2DMake(37.7749, -122.4194);
    -
    -mapNode.annotations = @[annotation];
    -
    - -
    -
    - - - -No problem. - -### Live Map Mode - -Chaning your map node from a static view of some region, into a fully interactable cartographic playground is as easy as: - -
    -SwiftObjective-C - -
    -
    -mapNode.liveMap = YES;
    -
    - -
    -
    - -This enables "live map mode" in which the node will use an MKMapView to render an interactive version of your map. - - - -As with UIKit views, the `MKMapView` used in live map mode is not thread-safe. - -### MKMapView Delegate - -If live map mode has been enabled and you need to react to any events associated with the map node, you can set the `mapDelegate` property. This delegate should conform to the MKMapViewDelegate protocol. - - - - diff --git a/submodules/AsyncDisplayKit/docs/_docs/multiplex-image-node.md b/submodules/AsyncDisplayKit/docs/_docs/multiplex-image-node.md deleted file mode 100755 index d219becb80..0000000000 --- a/submodules/AsyncDisplayKit/docs/_docs/multiplex-image-node.md +++ /dev/null @@ -1,109 +0,0 @@ ---- -title: ASMultiplexImageNode -layout: docs -permalink: /docs/multiplex-image-node.html -prevPage: editable-text-node.html ---- - -Let's say your API is out of your control and the images in your app can't be progressive jpegs but you can retrieve a few different sizes of the image asset you want to display. This is where you would use an `ASMultiplexImageNode` instead of an ASNetworkImageNode. - -In the following example, you're using a multiplex image node in an `ASCellNode` subclass. After initialization, you typically need to do two things. First, make sure to set `downloadsIntermediateImages` to `YES` so that the lesser quality images will be downloaded. - -Then, assign an array of keys to the property `imageIdentifiers`. This list should be in descending order of image quality and will be used by the node to determine what URL to call for each image it will try to load. - -
    -SwiftObjective-C - -
    -
    -- (instancetype)initWithURLs:(NSDictionary *)urls
    -{
    -    ...
    -     _imageURLs = urls;          // something like @{@"thumb": "/smallImageUrl", @"medium": ...}
    -
    -    _multiplexImageNode = [[ASMultiplexImageNode alloc] initWithCache:nil 
    -                                                           downloader:[ASBasicImageDownloader sharedImageDownloader]];
    -    _multiplexImageNode.downloadsIntermediateImages = YES;
    -    _multiplexImageNode.imageIdentifiers = @[ @"original", @"medium", @"thumb" ];
    -
    -    _multiplexImageNode.dataSource = self;
    -    _multiplexImageNode.delegate   = self;
    -    ...
    -}
    -    
    - - -
    -
    - - -Then, if you've set up a simple dictionary that holds the keys you provided earlier pointing to URLs of the various versions of your image, you can simply return the URL for the given key in: - -
    -SwiftObjective-C - -
    -
    -#pragma mark Multiplex Image Node Datasource
    -
    -- (NSURL *)multiplexImageNode:(ASMultiplexImageNode *)imageNode 
    -        URLForImageIdentifier:(id)imageIdentifier
    -{
    -    return _imageURLs[imageIdentifier];
    -}
    -
    - - -
    -
    - -There are also delegate methods provided to update you on things such as the progress of an image's download, when it has finished displaying etc. They're all optional so feel free to use them as necessary. - -For example, in the case that you want to react to the fact that a new image arrived, you can use the following delegate callback. - -
    -SwiftObjective-C - -
    -
    -#pragma mark Multiplex Image Node Delegate
    -
    -- (void)multiplexImageNode:(ASMultiplexImageNode *)imageNode 
    -            didUpdateImage:(UIImage *)image 
    -            withIdentifier:(id)imageIdentifier 
    -                 fromImage:(UIImage *)previousImage 
    -            withIdentifier:(id)previousImageIdentifier;
    -{    
    -        // this is optional, in case you want to react to the fact that a new image came in
    -}
    -
    - - -
    -
    - diff --git a/submodules/AsyncDisplayKit/docs/_docs/network-image-node.md b/submodules/AsyncDisplayKit/docs/_docs/network-image-node.md deleted file mode 100755 index 2753afe3ed..0000000000 --- a/submodules/AsyncDisplayKit/docs/_docs/network-image-node.md +++ /dev/null @@ -1,119 +0,0 @@ ---- -title: ASNetworkImageNode -layout: docs -permalink: /docs/network-image-node.html -prevPage: image-node.html -nextPage: video-node.html ---- - -`ASNetworkImageNode` can be used any time you need to display an image that is being hosted remotely. All you have to do is set the `.URL` property with the appropriate `NSURL` instance and the image will be asynchonously loaded and concurrently rendered for you. - -
    -SwiftObjective-C - -
    -
    -ASNetworkImageNode *imageNode = [[ASNetworkImageNode alloc] init];
    -imageNode.URL = [NSURL URLWithString:@"https://someurl.com/image_uri"];
    -	
    - - -
    -
    - -### Laying Out a Network Image Node - -Since an `ASNetworkImageNode` has no intrinsic content size when it is created, it is necessary for you to explicitly specify how they should be laid out. - -

    Option 1: .style.preferredSize

    - -If you have a standard size you want the image node's frame size to be you can use the `.style.preferredSize` property. - -
    -SwiftObjective-C - -
    -
    -- (ASLayoutSpec *)layoutSpecThatFits:(ASSizeRange)constraint
    -{
    -	imageNode.style.preferredSize = CGSizeMake(100, 200);
    -	...
    -	return finalLayoutSpec;
    -}
    -
    - - -
    -
    - -

    Option 2: ASRatioLayoutSpec

    - -This is also a perfect place to use `ASRatioLayoutSpec`. Instead of assigning a static size for the image, you can assign a ratio and the image will maintain that ratio when it has finished loading and is displayed. - -
    -SwiftObjective-C - -
    -
    -- (ASLayoutSpec *)layoutSpecThatFits:(ASSizeRange)constraint
    -{
    -	CGFloat ratio = 3.0/1.0;
    -	ASRatioLayoutSpec *imageRatioSpec = [ASRatioLayoutSpec ratioLayoutSpecWithRatio:ratio child:self.imageNode];
    -	...
    -	return finalLayoutSpec;
    -}
    -
    - - -
    -
    - -### Under the Hood - -
    If you choose not to include the PINRemoteImage and PINCache dependencies you will lose progressive jpeg support and be required to include your own custom cache that conforms to ASImageCacheProtocol.
    - -#### Progressive JPEG Support - -Thanks to the inclusion of PINRemoteImage, network image nodes now offer full support for loading progressive JPEGs. This means that if your server provides them, your images will display quickly at a lower quality that will scale up as more data is loaded. - -To enable progressive loading, just set `shouldRenderProgressImages` to `YES` like so: - -
    -SwiftObjective-C - -
    -
    -networkImageNode.shouldRenderProgressImages = YES;
    -
    - - -
    -
    - -It's important to remember that this is using one image that is progressively loaded. If your server is constrained to using regular JPEGs, but provides you with multiple versions of increasing quality, you should check out ASMultiplexImageNode instead. - -#### Automatic Caching - -`ASNetworkImageNode` now uses PINCache under the hood by default to cache network images automatically. - -#### GIF Support - -`ASNetworkImageNode` provides GIF support through `PINRemoteImage`'s beta `PINAnimatedImage`. Of note! This support will not work for local files unless `shouldCacheImage` is set to `NO`. diff --git a/submodules/AsyncDisplayKit/docs/_docs/node-overview.md b/submodules/AsyncDisplayKit/docs/_docs/node-overview.md deleted file mode 100755 index 0b699e2daf..0000000000 --- a/submodules/AsyncDisplayKit/docs/_docs/node-overview.md +++ /dev/null @@ -1,81 +0,0 @@ ---- -title: Node Subclasses -layout: docs -permalink: /docs/node-overview.html -prevPage: containers-overview.html -nextPage: subclassing.html ---- - -Texture offers the following nodes. - -A key advantage of using nodes over UIKit components is that **all nodes perform layout and display off of the main thread**, so that the main thread is available to immediately respond to user interaction events. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    Texture NodeUIKit Equivalent
    ASDisplayNodein place of UIKit's UIView
    - The root Texture node, from which all other nodes inherit.
    ASCellNodein place of UIKit's UITableViewCell & UICollectionViewCell
    - ASCellNodes are used in ASTableNode, ASCollectionNode and ASPagerNode.
    ASScrollNodein place of UIKit's UIScrollView -

    This node is useful for creating a customized scrollable region that contains other nodes.

    ASEditableTextNode
    - ASTextNode
    in place of UIKit's UITextView
    - in place of UIKit's UILabel
    ASImageNode
    - ASNetworkImageNode
    - ASMultiplexImageNode
    in place of UIKit's UIImageView
    ASVideoNode
    - ASVideoPlayerNode
    in place of UIKit's AVPlayerLayer
    - in place of UIKit's UIMoviePlayer
    ASControlNodein place of UIKit's UIControl
    ASButtonNodein place of UIKit's UIButton
    ASMapNodein place of UIKit's MKMapView
    - -
    -Despite having rough equivalencies to UIKit components, in general, Texture nodes offer more advanced features and conveniences. For example, an `ASNetworkImageNode` does automatic loading and cache management, and even supports progressive jpeg and animated gifs. - -The `AsyncDisplayKitOverview` example app gives basic implementations of each of the nodes listed above. - - -# Node Inheritance Hierarchy - -All Texture nodes inherit from `ASDisplayNode`. - -node inheritance flowchart - -The nodes highlighted in blue are synchronous wrappers of UIKit elements. For example, `ASScrollNode` wraps a `UIScrollView`, and `ASCollectionNode` wraps a `UICollectionView`. An `ASMapNode` in `liveMapMode` is a synchronous wrapper of `UIMapView`. - - - - diff --git a/submodules/AsyncDisplayKit/docs/_docs/overlay-layout-spec.md b/submodules/AsyncDisplayKit/docs/_docs/overlay-layout-spec.md deleted file mode 100755 index 3ddbe8231c..0000000000 --- a/submodules/AsyncDisplayKit/docs/_docs/overlay-layout-spec.md +++ /dev/null @@ -1,7 +0,0 @@ ---- -title: ASOverlayLayoutSpec -layout: docs -permalink: /docs/overlay-layout-spec.html ---- - -
    😑 This page is coming soon...
    \ No newline at end of file diff --git a/submodules/AsyncDisplayKit/docs/_docs/philosophy.md b/submodules/AsyncDisplayKit/docs/_docs/philosophy.md deleted file mode 100755 index 48481180af..0000000000 --- a/submodules/AsyncDisplayKit/docs/_docs/philosophy.md +++ /dev/null @@ -1,47 +0,0 @@ ---- -title: Philosophy -layout: docs -permalink: /docs/philosophy.html -prevPage: getting-started.html -nextPage: installation.html ---- - -#Asynchronous Performance Gains - -Texture is a UI framework that was originally born from Facebook’s Paper app. It came as an answer to one of the core questions the Paper team faced. **How can you keep the main thread as clear as possible?** - -Nowadays, many apps have a user experience that relies heavily upon continuous gestures and physics based animations. At the very least, your UI is probably dependent on some form of scroll view. These types of user interfaces depend entirely on the main thread and are extremely sensitive to main thread stalls. **A clogged main thread means dropped frames and an unpleasant user experience.** - -Texture Nodes are a thread-safe abstraction layer over UIViews and CALayers: - -logo - -You can access most view and layer properties when using nodes, the difference is that nodes are rendered concurrently by default, and measured and laid out asynchronously when used correctly! - -Too see asynchronous performance gains in action, check out the `examples/ASDKgram` app which compares a UIKit-implemented social media feed with an Texture-implemented social media feed! - -On an iPhone 6+, the performance may not be radically different, but on a 4S, the difference is dramatic! Which leads us to Texture's next priority... - -#A Great App Experience for All Users - -Texture's performance gains allow you to easily design a great experience for every app user - across all devices, on all network connections. - -##A Great Developer Experience - -Texture also strives to make the developer experience great -- platform compatability: iOS & tvOS -- language compatability: Objective-C & Swift -- requires fewer lines of code to build advanced apps (see `examples/ASDKgram` for a direct comparison of a UIKit implemention of an app vs. an equivalent Texture implementation) -- cleaner architecture patterns -- robust code (some really brilliant minds have worked on this for 3+ years). - -#Advanced Developer Tools - -As Texture has grown, some of the brightest iOS engineers have contributed advanced technologies that will save you, as a developer using Texture, development time. - -###Advanced Technology -- ASRunLoopQueue -- ASRangeController with Intelligent Preloading - -###Network Code Savings -- automatic batch fetching (e.g. JSON payloads) diff --git a/submodules/AsyncDisplayKit/docs/_docs/placeholder-fade-duration.md b/submodules/AsyncDisplayKit/docs/_docs/placeholder-fade-duration.md deleted file mode 100755 index 0b5ca8b131..0000000000 --- a/submodules/AsyncDisplayKit/docs/_docs/placeholder-fade-duration.md +++ /dev/null @@ -1,32 +0,0 @@ ---- -title: Placeholders -layout: docs -permalink: /docs/placeholder-fade-duration.html -prevPage: image-modification-block.html -nextPage: accessibility.html ---- - -## ASDisplayNodes may Implement Placeholders - -Any `ASDisplayNode` subclass may implement the `-placeholderImage` method to provide a placeholder that covers content until a node's contents are finished displaying. To use placeholders, set `.placeholderEnabled = YES` and optionally set a `.placeholderFadeDuration`; - -For image drawing, use the node's `.calculatedSize` property. - -
    -The `-placeholderImage` function may be called on a background thread, so it is important that this function is thread safe. Note that `-[UIImage imageNamed:]` is not thread safe when using image assets. Instead use `-[UIImage imageWithContentsOfFile:]`. -
    - - -An ideal resource for creating placeholder images, including rounded rect solid colored ones or simple square corner ones is the `UIImage+ASConvenience` category methods in Texture. - -See our ancient Placeholders sample app to see this concept, first invented by the Facebook Paper team, in action. - -## `.neverShowPlaceholders` - -Hear Scott Goodson explain placeholders, `.neverShowPlaceholders` and why UIKit doesn't have them. - -## ASNetworkImageNode also have Default Images - -In _addition_ to placeholders, `ASNetworkImageNode`s also have a `.defaultImage` property. While placeholders are meant to be transient, default images will persist if the image node's `.URL` property is `nil` or if the URL fails to load. - -We suggest using default images for avatars, while using placeholder images for photos. diff --git a/submodules/AsyncDisplayKit/docs/_docs/principles.md b/submodules/AsyncDisplayKit/docs/_docs/principles.md deleted file mode 100755 index aec7fb2dfd..0000000000 --- a/submodules/AsyncDisplayKit/docs/_docs/principles.md +++ /dev/null @@ -1,33 +0,0 @@ ---- -title: Principles -layout: docs -permalink: /docs/principles.html ---- - -The following principles guide the design and development of the Texture framework. - -## 1. Reliable - -- **What:** Behavior should match the documentation. The framework shouldn't crash in production, even when used incorrectly. -- **Why:** If the framework is not reliable, then it cannot be used in production apps. More importantly, it will drain the morale of the engineers working on it. -- **How:** Meaningful, stable unit tests. We will devote a significant chunk of our resources to build unit tests. - -## 2. Familiar - -- **What:** Interfaces should match industry standards such as UIKit and CSS when possible. When we diverge from these standards, the interfaces should as be intuitive and direct as possible. -- **Why:** If the framework is not familiar, then companies will be wary about adopting it. Engineers trained in UIKit, especially junior ones, will be frustrated and unproductive. -- **How:** Compare API to other mature frameworks, reach out to users when developing new API to get feedback. Be generous with abstraction layers – as long as we don't sacrifice Reliable. - -## 3. Lean - -- **What:** Speed and memory conservation should be industry-leading, the API should be concise, and implementation code should be short and organized. -- **Why:** Performance is at the heart of Texture. It's what we do and we do it better than anyone else. In addition, a concise codebase and API are easier to maintain and learn. Plus it's just the right thing to do. -- **How:** Look for opportunities to improve performance. Think about the performance implications of each line of code. Dedicate resources to refactoring. Build tools to gather and expose performance metrics. - -## 4. Bold - -- **What:** Ambitious features, such as animated layout transitioning or our visibility-depth system, should be added from time to time. -- **Why:** Cutting-edge, never-before-seen tech gets people excited about the framework, and can raise the bar for the entire industry. They really move the needle on the user experience in subtle ways. Plus it's fun! -- **How:** Propose crazy ideas. See them through – ensure they get into the workflow and get resources allocated for them. - - \ No newline at end of file diff --git a/submodules/AsyncDisplayKit/docs/_docs/relative-layout-spec.md b/submodules/AsyncDisplayKit/docs/_docs/relative-layout-spec.md deleted file mode 100755 index a9e6a157b8..0000000000 --- a/submodules/AsyncDisplayKit/docs/_docs/relative-layout-spec.md +++ /dev/null @@ -1,7 +0,0 @@ ---- -title: ASRelativeLayoutSpec -layout: docs -permalink: /docs/relative-layout-spec.html ---- - -
    😑 This page is coming soon...
    \ No newline at end of file diff --git a/submodules/AsyncDisplayKit/docs/_docs/resources.md b/submodules/AsyncDisplayKit/docs/_docs/resources.md deleted file mode 100755 index 51a388a7d6..0000000000 --- a/submodules/AsyncDisplayKit/docs/_docs/resources.md +++ /dev/null @@ -1,50 +0,0 @@ ---- -title: Resources -layout: docs -permalink: /docs/resources.html -prevPage: getting-started.html -nextPage: installation.html ---- - -### Slack - -Join 700+ Texture developers and the Texture core team on Slack for real-time debugging, the latest updates, and asynchronous banter. Signup here. - -### Examples -Browse through our many example projects. - -If you are new to Texture, we recommend that you start with the ASDKgram example app which compares a photo feed implemented with UIKit to an identical feed implemented with Texture. The app features: -
      -
    1. An infinitely scrolling home feed that demonstrates Texture's smoother scrolling performance.
    2. -
    3. A significantly sized code base to demonstrate how much less code it takes to design apps using Texture.
    4. -
    - -### Videos - - -### Tutorials / Articles - - - -### Layout Resources -Texture's powerful layout system is based on the CSS FlexBox model. These sites are useful for learning the basics of this system. - diff --git a/submodules/AsyncDisplayKit/docs/_docs/roadmap.md b/submodules/AsyncDisplayKit/docs/_docs/roadmap.md deleted file mode 100755 index 2ef0873623..0000000000 --- a/submodules/AsyncDisplayKit/docs/_docs/roadmap.md +++ /dev/null @@ -1,49 +0,0 @@ ---- -title: Roadmap -layout: docs -permalink: /docs/roadmap.html ---- - -This document outlines some of the upcoming plans for Texture. Since Texture is a fast-moving project with a small core team, this roadmap will change over time. - -The Texture roadmap is driven by the framework's four key qualities. You can read read more about the principles here. - -## 2.1 Release - -#### Familiar - -- Increase investment in Swift over time. -- Adopt a more regular release cadence. -- Reversible 0-100% transitions for our Layout Transition API. - -#### Bold - -- Declarative collection node API. [Try it out]() and give us feedback! - -## 2.5+ Release - -#### Reliable - -- Audit typography features. - -#### Familiar - -- Better supplementary node support. - -#### Lean - -- True asynchronous layout. - -#### Bold - -- First class transitions with the Layout Transition API. -- Extreme debuggability. -- AsyncKit? - -## Ways to Get Involved - -- Connect on GitHub, Slack and Twitter. -- Vet our documentation. Submit or suggest ways to improve. -- Share your experience using Texture. Thanks Buffer! -- Contribute layout examples. -- Contribute code. Try to implement one of our "Needs Volunteer" issues. diff --git a/submodules/AsyncDisplayKit/docs/_docs/scroll-node.md b/submodules/AsyncDisplayKit/docs/_docs/scroll-node.md deleted file mode 100755 index 465ac00e62..0000000000 --- a/submodules/AsyncDisplayKit/docs/_docs/scroll-node.md +++ /dev/null @@ -1,78 +0,0 @@ ---- -title: ASScrollNode -layout: docs -permalink: /docs/scroll-node.html -prevPage: control-node.html -nextPage: editable-text-node.html ---- - -`ASScrollNode` is an `ASDisplayNode` whose underlying view is an `UIScrollView`. This class offers the ability to automatically adopt its `ASLayoutSpec`'s size as the scrollable `contentSize`. - -### automaticallyManagesContentSize - -When enabled, the size calculated by the `ASScrolNode`'s layout spec defines the `.contentSize` of the scroll view. This is in contrast to most nodes, where the `layoutSpec` size is applied to the bounds (and in turn, frame). In this mode, the bounds of the scroll view always fills the parent's size. - -`automaticallyManagesContentSize` is useful both for subclasses of `ASScrollNode` implementing `layoutSpecThatFits:` or may also be used as the base class with `.layoutSpecBlock` set. In both cases, it is common use `.automaticallyManagesSubnodes` so that the nodes in the layout spec are added to the scrollable area automatically. - -With this approach there is no need to capture the layout size, use an absolute layout spec as a wrapper, or set `contentSize` anywhere in the code and it will update as the layout changes! Instead, it is very common and useful to simply return an `ASStackLayoutSpec` and the scrollable area will allow you to see all of it. - -### scrollableDirections - -This option is useful when using `automaticallyManagesContentSize`, especially if you want horizontal content (because the default is vertical). - -This property controls how the `constrainedSize` is interpreted when sizing the content. Options include: - - - - - - - - - - - - - - -
    VerticalThe `constrainedSize` is interpreted as having unbounded `.height` (`CGFLOAT_MAX`), allowing stacks and other content in the layout spec to expand and result in scrollable content.
    HorizontalThe `constrainedSize` is interpreted as having unbounded `.width` (`CGFLOAT_MAX`).
    Vertical & HorizontalThe `constrainedSize` is interpreted as unbounded in both directions.
    - -### Example - -In case you're not familiar with scroll views, they are basically windows into content that would take up more space than can fit in that area. - -Say you have a giant image, but you only want to take up 200x200 pts on the screen. - -
    -SwiftObjective-C - -
    -
    -// NOTE: If you are using a horizontal stack, set scrollNode.scrollableDirections.
    -ASScrollNode *scrollNode = [[ASScrollNode alloc] init];
    -scrollNode.automaticallyManagesSubnodes = YES;
    -scrollNode.automaticallyManagesContentSize = YES;
    -
    -scrollNode.layoutSpecBlock = ^(ASDisplayNode *node, ASSizeRange constrainedSize){
    -  ASStackLayoutSpec *stack = [ASStackLayoutSpec verticalStackLayoutSpec];
    -  // Add children to the stack.
    -  return stack;
    -};
    -
    -
    - -
    -
    diff --git a/submodules/AsyncDisplayKit/docs/_docs/static-layout-spec.md b/submodules/AsyncDisplayKit/docs/_docs/static-layout-spec.md deleted file mode 100755 index 01318bf4ac..0000000000 --- a/submodules/AsyncDisplayKit/docs/_docs/static-layout-spec.md +++ /dev/null @@ -1,7 +0,0 @@ ---- -title: ASStaticLayoutSpec -layout: docs -permalink: /docs/static-layout-spec.html ---- - -
    😑 This page is coming soon...
    \ No newline at end of file diff --git a/submodules/AsyncDisplayKit/docs/_docs/subclassing.md b/submodules/AsyncDisplayKit/docs/_docs/subclassing.md deleted file mode 100755 index 8052e20937..0000000000 --- a/submodules/AsyncDisplayKit/docs/_docs/subclassing.md +++ /dev/null @@ -1,110 +0,0 @@ ---- -title: Subclassing -layout: docs -permalink: /docs/subclassing.html -prevPage: containers-overview.html -nextPage: faq.html ---- -The most important distinction when creating a subclass is whether you writing an ASViewController or an ASDisplayNode. This sounds obvious, but because some of these differences are subtle, it is important to keep this top of mind. - -## ASDisplayNode -
    -While subclassing nodes is similar to writing a UIView subclass, there are a few guidelines to follow to ensure that both that you're utilizing the framework to its full potential and that your nodes behave as expected. - -### `-init` - -This method is called on a **background thread** when using nodeBlocks. However, because no other method can run until -init is finished, it should never be necessary to have a lock in this method. - -The most important thing to remember is that your init method must be capable of being called on any queue. Most notably, this means you should never initialize any UIKit objects, touch the view or layer of a node (e.g. `node.layer.X` or `node.view.X`) or add any gesture recognizers in your initializer. Instead, do these things in `-didLoad`. - -### `-didLoad` - -This method is conceptually similar to UIViewController's `-viewDidLoad` method; it’s called once and is the point where the backing view has been loaded. It is guaranteed to be called on the **main thread** and is the appropriate place to do any UIKit things (such as adding gesture recognizers, touching the view / layer, initializing UIKit objects). - -### `-layoutSpecThatFits:` - -This method defines the layout and does the heavy calculation on a **background thread**. This method is where you build out a layout spec object that will produce the size of the node, as well as the size and position of all subnodes. This is where you will put the majority of your layout code. - -The layout spec object that you create is malleable up until the point that it is return in this method. After this point, it will be immutable. It's important to remember not to cache layout specs for use later but instead to recreate them when necessary. - -Because it is run on a background thread, you should not set any `node.view` or `node.layer` properties here. Also, unless you know what you are doing, do not create any nodes in this method. Additionally, it is not necessary to begin this method with a call to super, unlike other method overrides. - -### `-layout` - -The call to super in this method is where the results of the layoutSpec are applied; Right after the call to super in this method, the layout spec will have been calculated and all subnodes will have been measured and positioned. - -`-layout` is conceptually similar to UIViewController's `-viewWillLayoutSubviews`. This is a good spot to change the hidden property, set view based properties if needed (not layoutable properties) or set background colors. You could put background color setting in -layoutSpecThatFits:, but there may be timing problems. If you happen to be using any UIViews, you can set their frames here. However, you can always create a node wrapper with `-initWithViewBlock:` and then size this on the background thread elsewhere. - -This method is called on the **main thread**. However, if you are using layout Specs, you shouldn't rely on this method too much, as it is much preferable to do layout off the main thread. Less than 1 in 10 subclasses will need this. - -One great use of `-layout` is for the specific case in which you want a subnode to be your exact size. E.g. when you want a collectionNode to take up the full screen. This case is not supported well by layout specs and it is often easiest to set the frame manually with a single line in this method: - -``` -subnode.frame = self.bounds; -``` - -If you desire the same effect in a ASViewController, you can do the same thing in -viewWillLayoutSubviews, unless your node is the node in initWithNode: and in that case it will do this automatically. - -## ASViewController -
    -An `ASViewController` is a regular `UIViewController` subclass that has special features to manage nodes. Since it is a UIViewController subclass, all methods are called on the **main thread** (and you should always create an ASViewController on the main thread). - -### `-init` - -This method is called once, at the very beginning of an ASViewController's lifecycle. As with UIViewController initialization, it is best practice to **never access** `self.view` or `self.node.view` in this method as it will force the view to be created early. Instead, do any view access in -viewDidLoad. - -ASViewController's designated initializer is `initWithNode:`. A typical initializer will look something like the code below. Note how the ASViewController's node is created _before_ calling super. An ASViewController manages a node similarly to how a UIViewController manages a view, but the initialization is slightly different. - - -
    -SwiftObjective-C - -
    -
    -- (instancetype)init
    -{
    -  _pagerNode = [[ASPagerNode alloc] init];
    -  self = [super initWithNode:_pagerNode];
    -  
    -  // setup any instance variables or properties here
    -  if (self) {
    -    _pagerNode.dataSource = self;
    -    _pagerNode.delegate = self;
    -  }
    -  
    -  return self;
    -}
    -
    - -
    -
    - -### `-loadView` - -We recommend that you do not use this method because it is has no particular advantages over `-viewDidLoad` and has some disadvantages. However, it is safe to use as long as you do not set the `self.view` property to a different value. The call to [super loadView] will set it to the `node.view` for you. - -### `-viewDidLoad` - -This method is called once in a ASViewController's lifecycle, immediately after `-loadView`. This is the earliest time at which you should access the node's view. It is a great spot to put any **setup code that should only be run once and requires access to the view/layer**, such as adding a gesture recognizer. - -Layout code should never be put in this method, because it will not be called again when geometry changes. Note this is equally true for UIViewController; it is bad practice to put layout code in this method even if you don't currently expect geometry changes. - -### `-viewWillLayoutSubviews` - -This method is called at the exact same time as a node's `-layout` method and it may be called multiple times in a ASViewController's lifecycle; it will be called whenever the bounds of the ASViewController's node are changed (including rotation, split screen, keyboard presentation) as well as when there are changes to the hierarchy (children being added, removed, or changed in size). - -For consistency, it is best practice to put all layout code in this method. Because it is not called very frequently, even code that does not directly depend on the size belongs here. - -### `-viewWillAppear:` / `-viewDidDisappear:` - -These methods are called just before the ASViewController's node appears on screen (the earliest time that it is visible) and just after it is removed from the view hierarchy (the earliest time that it is no longer visible). These methods provide a good opportunity to start or stop animations related to the presentation or dismissal of your controller. This is also a good place to make a log of a user action. - -Although these methods may be called multiple times and geometry information is available, they are not called for all geometry changes and so should not be used for core layout code (beyond setup required for specific animations). diff --git a/submodules/AsyncDisplayKit/docs/_docs/subtree-rasterization.md b/submodules/AsyncDisplayKit/docs/_docs/subtree-rasterization.md deleted file mode 100755 index 20aa0761bd..0000000000 --- a/submodules/AsyncDisplayKit/docs/_docs/subtree-rasterization.md +++ /dev/null @@ -1,26 +0,0 @@ ---- -title: Subtree Rasterization -layout: docs -permalink: /docs/subtree-rasterization.html -prevPage: layer-backing.html -nextPage: synchronous-concurrency.html ---- - -Flattening an entire view hierarchy into a single layer improves performance, but with UIKit, comes with a hit to maintainability and hierarchy-based reasoning. - -With all Texture nodes, enabling precompositing is as simple as: - -
    -SwiftObjective-C -
    -
    -[rootNode enableSubtreeRasterization];
    -
    - -
    -
    -
    - -This line will cause the entire node hierarchy from that point on to be rendered into one layer. diff --git a/submodules/AsyncDisplayKit/docs/_docs/synchronous-concurrency.md b/submodules/AsyncDisplayKit/docs/_docs/synchronous-concurrency.md deleted file mode 100755 index d4430b7516..0000000000 --- a/submodules/AsyncDisplayKit/docs/_docs/synchronous-concurrency.md +++ /dev/null @@ -1,32 +0,0 @@ ---- -title: Synchronous Concurrency -layout: docs -permalink: /docs/synchronous-concurrency.html -prevPage: subtree-rasterization.html -nextPage: corner-rounding.html ---- - -Both `ASViewController` and `ASCellNode` have a property called `neverShowPlaceholders`. - -By setting this property to YES, the main thread will be blocked until display has completed for the cell or view controller's view. - -Using this option does not eliminate all of the performance advantages of Texture. Normally, a given node has been preloading and is almost done when it reaches the screen, so the blocking time is very short. Even if the rangeTuningParameters are set to 0 this option outperforms UIKit. While the main thread is waiting, all subnode display executes concurrently, thus synchronous concurrency. - -See the NSSpain 2015 talk video for a visual walkthrough of this behavior. - -
    -SwiftObjective-C -
    -
    -node.neverShowPlaceholders = YES;
    -
    - -
    -
    -
    - -Usually, if a cell hasn't finished its display pass before it has reached the screen it will show placeholders until it has drawing its content. Setting this option to YES makes your scrolling node or ASViewController act more like UIKit, and in fact makes Texture scrolling visually indistinguishable from UIKit's, except that it's faster. - - diff --git a/submodules/AsyncDisplayKit/docs/_docs/team.md b/submodules/AsyncDisplayKit/docs/_docs/team.md deleted file mode 100755 index e3a9643912..0000000000 --- a/submodules/AsyncDisplayKit/docs/_docs/team.md +++ /dev/null @@ -1,44 +0,0 @@ ---- -title: Pinterest Team -layout: docs -permalink: /docs/team.html ---- - - - - - - - - - - - - - - - - - - - - - - -

    Scott Goodson (@appleguy) is an original author of Texture and, most recently, a driving force behind making Pinterest's design vision a reality with the recent rewrite of the iOS app.

    -

    Previously, Scott managed the Facebook Paper and Instagram iOS engineering teams, and helped lead the native code rewrite of the core Facebook iOS app. He also spent four years at Apple where he was one of the first ten engineers to work on iPhone OS 1.0, and developed apps like Stocks and Calculator.

    -

    Scott is deeply passionate about building Texture into a framework that allows effortless development of polished and performant apps that serve all users, regardless of device age, internet connection, or language.

    Michael Schneider (@maicki) is especially passionate about API design and recently led the re-architecture of the layout API for the 2.0 release. As our resident layout expert, Michael volunteers much of his own time to help developers on Texture's public slack channel. Before he joined Pinterest, Michael worked on Pocket for iOS, Mac and Chrome and Read Later an Instapaper and Pocket Mac app.

    Huy Nguyen (@nguyenhuy ) joined the Pinterest team after authoring Texture's automatic layout feature, which has become the foundation for the Texture's 2.0 release. To date, the Layout API has been the largest contribution to the framework by a community member!

    Garrett Moon (@garrettmoon ) is the fearless leader of Pinterest's framework team. He also authored PINRemoteImage - a threadsafe, performant, feature rich image fetcher, and PINCache, a non-deadlocking fork of TMCache. Both are used as the backing store for ASNetworkImageNode.

    Adlai ("Ad-lee") Holler (@adlai-holler) joined the Pinterest team after making major contributions to the framework while writing Tripstr in Swift with Texture.

    -
    - -# Join us! - -We are looking for senior developers familiar with Texture to join our team! - -We have an exciting roadmap that we believe will continue to push the boundaries of what is possible on the iOS platform, while making the framework easier to use than ever before. - -As part of the team, you would work on Texture, [PINRemoteImage](https://github.com/pinterest/PINRemoteImage), and [PINCache](https://github.com/pinterest/PINCache) (the backing store for ASNetworkImageNode), while using all three in Pinterest's [app](https://itunes.apple.com/us/app/pinterest/id429047995). - -One interesting thing to note is that Pinterest does not have an internal fork of Texture. Everything is developed on master, with release branches cut from master only a few weeks before our public application launches. This allows us to move exceptionally quickly in developing and launching improvements to millions of users. - -Sound interesting? -Send us an email at textureframework@gmail.com. diff --git a/submodules/AsyncDisplayKit/docs/_docs/text-cell-node.md b/submodules/AsyncDisplayKit/docs/_docs/text-cell-node.md deleted file mode 100755 index e9d0438b53..0000000000 --- a/submodules/AsyncDisplayKit/docs/_docs/text-cell-node.md +++ /dev/null @@ -1,45 +0,0 @@ ---- -title: ASTextCellNode -layout: docs -permalink: /docs/text-cell-node.html -prevPage: cell-node.html -nextPage: control-node.html ---- - -ASTextCellNode is a simple ASCellNode subclass you can use when all you need is a cell with styled text. - -
    -SwiftObjective-C -
    -
    -ASTextCellNode *textCell = [[ASTextCellNode alloc]
    -            initWithAttributes:@{NSFontAttributeName: [UIFont fontWithName:@"SomeFont" size:16.0]} 												  insets:UIEdgeInsetsMake(8, 16, 8, 16)];
    -  
    - -
    -
    - -The text can be configured on initialization or after the fact. - -
    -SwiftObjective-C -
    -
    -ASTextCellNode *textCell = [[ASTextCellNode alloc] init];
    -
    -textCellNode.text         = @"Some dang ol' text";
    -textCellNode.attributes   = @{NSFontAttributeName: [UIFont fontWithName:@"SomeFont" size:16.0]};
    -textCellNode.insets       = UIEdgeInsetsMake(8, 16, 8, 16);
    -  
    - -
    -
    \ No newline at end of file diff --git a/submodules/AsyncDisplayKit/docs/_docs/text-node.md b/submodules/AsyncDisplayKit/docs/_docs/text-node.md deleted file mode 100755 index 176a721999..0000000000 --- a/submodules/AsyncDisplayKit/docs/_docs/text-node.md +++ /dev/null @@ -1,228 +0,0 @@ ---- -title: ASTextNode -layout: docs -permalink: /docs/text-node.html -prevPage: button-node.html -nextPage: image-node.html ---- - -`ASTextNode` is Texture's main text node and can be used any time you would normally use a `UILabel`. It includes full rich text support and is a subclass of `ASControlNode` meaning it can be used any time you would normally create a UIButton with just its titleLabel set. - -### Basic Usage -`ASTextNode`'s interface should be familiar to anyone who's used a `UILabel`. The first difference you may notice, is that text node's only use attributed strings instead of having the option of using a plain string. - -
    -SwiftObjective-C - -
    -
    -NSDictionary *attrs = @{ NSFontAttributeName: [UIFont fontWithName:@"HelveticaNeue" size:12.0f] };
    -NSAttributedString *string = [[NSAttributedString alloc] initWithString:@"Hey, here's some text." attributes:attrs];
    -
    -_node = [[ASTextNode alloc] init];
    -_node.attributedText = string;
    -
    - - -
    -
    - -As you can see, to create a basic text node, all you need to do is use a standard alloc-init and then set up the attributed string for the text you wish to display. - -### Truncation - -In any case where you need your text node to fit into a space that is smaller than what would be necessary to display all the text it contains, as much as possible will be shown, and whatever is cut off will be replaced with a truncation string. - - -
    -SwiftObjective-C - -
    -
    -_textNode = [[ASTextNode alloc] init];
    -_textNode.attributedText = string;
    -_textNode.truncationAttributedText = [[NSAttributedString alloc]
    -												initWithString:@"¶¶¶"];
    -
    - - -
    -
    - -This results in something like: - - - -By default, the truncation string will be "…" so you don't need to set it if that's all you need. - - -### Link Attributes - -In order to designate chunks of your text as a link, you first need to set the `linkAttributes` array to an array of strings which will be used as keys of links in your attributed string. Then, when setting up the attributes of your string, you can use these keys to point to appropriate `NSURL`s. - -
    -SwiftObjective-C - -
    -
    -_textNode.linkAttributeNames = @[ kLinkAttributeName ];
    -
    -NSString *blurb = @"kittens courtesy placekitten.com \U0001F638";
    -NSMutableAttributedString *string = [[NSMutableAttributedString alloc] initWithString:blurb];
    -[string addAttribute:NSFontAttributeName value:[UIFont fontWithName:@"HelveticaNeue-Light" size:16.0f] range:NSMakeRange(0, blurb.length)];
    -[string addAttributes:@{
    -                      kLinkAttributeName: [NSURL URLWithString:@"http://placekitten.com/"],
    -                      NSForegroundColorAttributeName: [UIColor grayColor],
    -                      NSUnderlineStyleAttributeName: @(NSUnderlineStyleSingle | NSUnderlinePatternDot),
    -                      }
    -              range:[blurb rangeOfString:@"placekitten.com"]];
    -_textNode.attributedText = string;
    -_textNode.userInteractionEnabled = YES;
    -
    - - -
    -
    - -Which results in a light gray link with a dash-dot style underline! - - - -As you can see, it's relatively convenient to apply various styles to each link given its range in the attributed string. - -### ASTextNodeDelegate - -Conforming to `ASTextNodeDelegate` allows your class to react to various events associated with a text node. For example, if you want to react to one of your links being tapped: - -
    -SwiftObjective-C - -
    -
    -- (void)textNode:(ASTextNode *)richTextNode tappedLinkAttribute:(NSString *)attribute value:(NSURL *)URL atPoint:(CGPoint)point textRange:(NSRange)textRange
    -{
    -  // the link was tapped, open it
    -  [[UIApplication sharedApplication] openURL:URL];
    -}
    -
    - - -
    -
    - -In a similar way, you can react to long presses and highlighting with the following methods: - -`– textNode:longPressedLinkAttribute:value:atPoint:textRange:` - -`– textNode:shouldHighlightLinkAttribute:value:atPoint:` - -`– textNode:shouldLongPressLinkAttribute:value:atPoint:` - - -### Incorrect maximum number of lines with line spacing - -Using a `NSParagraphStyle` with a non-default `lineSpacing` can cause problems if multiline text with a maximum number of lines is wanted. For example see the following code: - -
    -SwiftObjective-C - -
    -
    -// ...
    -NSString *someLongString = @"...";
    -
    -NSMutableParagraphStyle *paragraphStyle = [[NSMutableParagraphStyle alloc] init];
    -paragraphStyle.lineSpacing = 10.0;
    -
    -UIFont *font = [UIFont fontWithName:@"SomeFontName" size:15];
    -
    -NSDictionary *attributes = @{
    -	NSFontAttributeName : font,
    -	NSParagraphStyleAttributeName: paragraphStyle
    -};
    -
    -ASTextNode *textNode = [[ASTextNode alloc] init];
    -textNode.maximumNumberOfLines = 4;
    -textNode.attributedText = [[NSAttributedString	alloc] initWithString:someLongString
    -																												   attributes:attributes];
    -// ...
    -
    - - -
    -
    - -`ASTextNode` uses Text Kit internally to calculate the amount to shrink needed to result in the specified maximum number of lines. Unfortunately, in certain cases this will result in the text shrinking too much in the above example; Instead of 4 lines of text, 3 lines of text and a weird gap at the bottom will show up. To get around this issue for now, you have to set the `truncationMode` explicitly to `NSLineBreakByTruncatingTail` on the text node: - -
    -SwiftObjective-C - -
    -
    -// ...
    -ASTextNode *textNode = [[ASTextNode alloc] init];
    -textNode.maximumNumberOfLines = 4;
    -textNode.truncationMode = NSLineBreakByTruncatingTail;
    -textNode.attributedText = [[NSAttributedString	alloc] initWithString:someLongString
    -																												   attributes:attributes];
    -// ...
    -
    - - -
    -
    -``` diff --git a/submodules/AsyncDisplayKit/docs/_docs/tip-1-nodeBlocks.md b/submodules/AsyncDisplayKit/docs/_docs/tip-1-nodeBlocks.md deleted file mode 100755 index bcefc9c512..0000000000 --- a/submodules/AsyncDisplayKit/docs/_docs/tip-1-nodeBlocks.md +++ /dev/null @@ -1,133 +0,0 @@ ---- -title: Prefer `nodeBlocks` for Performance -layout: docs -permalink: /docs/tip-1-nodeBlocks.html ---- - -Texture’s `ASCollectionNode` replaces `UICollectionView`’s required method - -
    - - Swift - Objective-C - - -
    -
    -collectionView:cellForItemAtIndexPath:
    -  
    - - -
    -
    - -
    -with your choice of **one** of the two following methods - -
    - - Swift - Objective-C - - -
    -
    -// called on main thread, ASCellNode initialized on main and then returned 
    -collectionNode:nodeForItemAtIndexPath: 
    -
    -OR
    -
    -// called on main thread, ASCellNodeBlock returned, then
    -// ASCellNode initialized in background when block is called by system
    -collectionNode:nodeBlockForItemAtIndexPath: 
    -  
    - - -
    -
    - -
    -`ASTableNode` has the same options: - -
    - - Swift - Objective-C - - -
    -
    -`tableNode:nodeForRow:`
    -`tableNode:nodeBlockforRow:`    // preferred
    -  
    - - -
    -
    - -`ASPagerNode` does as well: - -
    - - Swift - Objective-C - - -
    -
    -`pagerNode:nodeAtIndex:`
    -`pagerNode:nodeBlockAtIndex:`   // preferred
    -  
    - - -
    -
    - - -We recommend that you use nodeBlocks. Using the nodeBlock method allows table and collections to request blocks for each cell node, and execute them **concurrently** across multiple threads, which allows us to **parallelize the allocation costs** (in addition to layout measurement). - -This leaves our main thread more free to handle touch events and other time sensitive work, keeping our user's taps happy and responsive. - -### Access your data source outside of the nodeBlock - -Because nodeBlocks are executed on a background thread, it is very important they be thread-safe. - -The most important aspect to consider is accessing properties on self that may change, such as an array of data models. This can be handled safely by ensuring that any immutable state is collected above the node block. - -**Using the indexPath parameter to access a mutable collection inside the node block is not safe.** This is because by the time the block runs, the dataSource may have changed. - -Here's an example of a simple nodeBlock: - -
    - - Swift - Objective-C - - -
    -
    -- (ASCellNodeBlock)collectionNode:(ASCollectionNode *)collectionNode nodeBlockForItemAtIndexPath:(NSIndexPath *)indexPath
    -{
    -    // data model is accessed outside of the node block
    -    Board *board = [self.boards objectAtIndex:indexPath.item];
    -    return ^{
    -        BoardScrubberCellNode *node = [[BoardScrubberCellNode alloc] initWithBoard:board];
    -        return node;
    -    };
    -}
    -  
    - -
    -
    - -
    -Note that it is okay to use the indexPath if it is used strictly for its integer values and not to index a value from a mutable data source. - -## Do not return nil from a nodeBlock - -Just as when UIKit requests a cell, returning `nil` will crash the app, so it is important to ensure a valid ASCellNode is returned for either the node or nodeBlock method. Your code should ensure that at least a blank ASCellNode is returned, but ideally the number of items reported to the collection would prevent the method from being called when there is no data to display. diff --git a/submodules/AsyncDisplayKit/docs/_docs/uicollectionview-challenges.md b/submodules/AsyncDisplayKit/docs/_docs/uicollectionview-challenges.md deleted file mode 100755 index 4916bf3e94..0000000000 --- a/submodules/AsyncDisplayKit/docs/_docs/uicollectionview-challenges.md +++ /dev/null @@ -1,160 +0,0 @@ ---- -title: UICollectionView Challenges -layout: docs -permalink: /docs/uicollectionview-challenges.html ---- - -`UICollectionView` is one of the most commonly used classes and many challenges with iOS development are related to its architecture. - -## How `UICollectionView` Works - -There are two important methods that `UICollectionView` requires. - -

    Cell Measurement

    - -For each item in the data source, the collection must know its size to understand which items should be visible at a given momement. This is provided by: - -
    -SwiftObjective-C -
    -
    -- (CGSize)collectionView:(UICollectionView *)collectionView 
    -                  layout:(UICollectionViewLayout *)collectionViewLayout 
    -  sizeForItemAtIndexPath:(NSIndexPath *)indexPath;
    -
    - -
    -
    - -Although not formally named by Apple, we refer to this process as "measuring". Implementing this method is always difficult, because the view that implements the cell layout is never available at the time of this method call. - -This means that logic must be duplicated between the implementation of this method and the `-layoutSubviews` implementation of the cell subclass. This presents a tremendous maintainence burden, as the implementations must always match their behavior for any combination of content displayed. - -Additionally, once measurement is complete, there's no easy way to cache that information to use it during the layout process. As a result, expensive text measurements must be repeated. - -

    Cell Allocation

    - -Once an item reaches the screen, a view representing it is requested: - -
    -SwiftObjective-C -
    -
    -- (UICollectionViewCell *)cellForItemAtIndexPath:(NSIndexPath *)indexPath;
    -
    - -
    -
    - -In order to provide a cell, all subviews must be configured with the data that they are intended to display. Immediately afterwards, the layout of the cell is calculated, and finally the display (rendering) of the individual elements (text, images) contained within. - -
    -For those who are curious, this extremely detailed diagram shows the full process of UICollectionView communicating with its data source and delegate to display itself. -
    - -

    Limitations in `UICollectionView`'s Architecture

    - -There are several issues with the architecture outlined above: - -Lots of main thread work, which may degrade the user's experience, including - -
      -
    • cell measurement
    • -
    • cell creation + setup / reuse
    • -
    • layout
    • -
    • display (rendering)
    - -Duplicated layout logic - -You must have duplicate copies of your cell sizing logic for the cell measurement and cell layout stages. For example, if you want to add a price tag to your cell, both -sizeForItemAtIndexPath and the cell's own -layoutSubviews must be aware of how to size the tag. - -No automatic content loading - -There is no easy, universal way to handle loading content such as: -
      -
    • data pages - such as JSON fetching
    • -
    • other info - such as images or secondary JSON requests
    • -
    - -## How `ASCollectionNode` works - -

    Unified Cell Measurement & Allocation

    - -Texture takes both of the important collection methods explained above: - -
    -SwiftObjective-C -
    -
    -- (UICollectionViewCell *)cellForItemAtIndexPath:(NSIndexPath *)indexPath;
    -
    -- (CGSize)collectionView:(UICollectionView *)collectionView 
    -                  layout:(UICollectionViewLayout *)collectionViewLayout 
    -  sizeForItemAtIndexPath:(NSIndexPath *)indexPath;
    -
    - -
    -
    - -and replaces them with a single method*: - -
    -SwiftObjective-C -
    -
    -- (ASCellNode *)collectionNode:(ASCollectionNode *)collectionNode nodeForItemAtIndexPath:(NSIndexPath *)indexPath;
    -
    - -
    -
    - -or with the asynchronous versions - -
    -SwiftObjective-C -
    -
    -- (ASCellNodeBlock)collectionNode:(ASCollectionNode *)collectionNode nodeBlockForItemAtIndexPath:(NSIndexPath *)indexPath;
    -
    - -
    -
    - -*Note that there is an optional method to provide a constrained size for the cell, but it is not needed by most apps. - -ASCellNode, is Texture's universal cell class. They are light-weight enough to be created an an earlier time in the program (concurrently in the background) and they understand how to calculate their own size. `ASCellNode` automatically caches its measurement so that it can be quickly applied during the layout pass. - -
    -As a comparison to the diagram above, this detailed diagram shows the full process of an ASCollectionView communicating with its data source and delegate to display itself.. Note that ASCollectionView is ASCollectionNode's underlying UICollectionView subclass. -
    - -

    Benefits of Texture's Architecture

    - -Elimination of all of the types of main thread work described above (cell allocation, measurement, layout, display)! In addition, all of this work is preformed concurrently on multiple threads. - -Because `ASCollectionNode` is aware of the position of all of its nodes, it can automatically determine when content loading is needed. The Batch Fetching API handles loading of data pages (like JSON) and Intelligent Preloading automatically manages the loading of images and text. Additionally, convenient callbacks allow implementing accurate visibility logging and secondary data model requests. - -Lastly, almost all of the concepts we've discussed here apply to `UITableView` / `ASTableNode` and `UIPageViewController` / `ASPagerNode`. - -## iOS 10 Cell Pre-fetching -Inspired by Texture, iOS 10 introduced a cell pre-fetching. This API increases the number of cells that the collection tracks at any given time, which helps, but isn't anywhere as performance centric as being aware of all cells in the data source. - -Additionally, iOS9 still constitutes a substantial precentage of most app's userbase and will not reduce in number anywhere close to as quickly as the sunset trajectory of iOS 7 and iOS 8 devices. Whereas iOS 9 is the last supported version for about a half-dozen devices, there were zero devices that were deprecated on iOS 8 and only one deivce deprecated on iOS 7. - -Unfortunately, these iOS 9 devices are the ones in which performance is most key! diff --git a/submodules/AsyncDisplayKit/docs/_docs/uicollectionviewinterop.md b/submodules/AsyncDisplayKit/docs/_docs/uicollectionviewinterop.md deleted file mode 100755 index 26fc1942e7..0000000000 --- a/submodules/AsyncDisplayKit/docs/_docs/uicollectionviewinterop.md +++ /dev/null @@ -1,81 +0,0 @@ ---- -title: UICollectionViewCell Interoperability -layout: docs -permalink: /docs/uicollectionviewinterop.html -prevPage: placeholder-fade-duration.html -nextPage: accessibility.html ---- - -Texture's `ASCollectionNode` offers compatibility with synchronous, standard `UICollectionViewCell` objects alongside native `ASCellNodes`. - -Note that these UIKit cells will **not** have the performance benefits of `ASCellNodes` (like preloading, async layout, and async drawing), even when mixed within the same `ASCollectionNode`. - -However, this interoperability allows developers the flexibility to test out the framework without needing to convert all of their cells at once. - -## Implementing Interoperability - -In order to use this feature, you must: - -
      -
    1. Conform to ASCollectionDataSourceInterop and, optionally, ASCollectionDelegateInterop.
    2. -
    3. Call registerCellClass: on the collectionNode.view (in viewDidLoad, or register an onDidLoad: block).
    4. -
    5. Return nil from the nodeBlockForItem...: or nodeForItem...: method. Note: it is an error to return nil from within a nodeBlock, if you have returned a nodeBlock object.
    6. -
    7. Lastly, you must implement a method to provide the size for the cell. There are two ways this is done:
    8. -
        -
      1. UICollectionViewFlowLayout (incl. ASPagerNode). Implement - collectionNode:constrainedSizeForItemAtIndexPath:.
      2. -
      3. Custom collection layouts. Set .view.layoutInspector and have it implement - collectionView:constrainedSizeForNodeAtIndexPath:.
      4. -
      -
    - -By default, the interop data source will only be consulted in cases where no `ASCellNode` is provided to Texture. However, if .dequeuesCellsForNodeBackedItems is enabled, then the interop data source will always be consulted to dequeue cells, and will be expected to return _ASCollectionViewCells in cases where a node was provided. - -## CustomCollectionView Example App - -The [CustomCollectionView](https://github.com/texturegroup/texture/tree/master/examples/CustomCollectionView) example project demonstrates how to use raw `UIKit` cells alongside native `ASCellNodes`. - -Open the app and verify that `kShowUICollectionViewCells` is enabled in `Sample/ViewController.m`. - -For this example, the data source method `collectionNode:nodeBlockForItemAtIndexPath:` is setup to return nil for every third cell. When nil is returned, `ASCollectionNode` will automatically query the `cellForItemAtIndexPath:` data source method. - -
    - - Swift - Objective-C - - -
    -
    -- (ASCellNodeBlock)collectionNode:(ASCollectionNode *)collectionNode 
    -      nodeBlockForItemAtIndexPath:(NSIndexPath *)indexPath
    -{
    -  if (kShowUICollectionViewCells && indexPath.item % 3 == 1) {
    -    // When enabled, return nil for every third cell and then 
    -    // cellForItemAtIndexPath: will be called.
    -    return nil;
    -  }
    -  
    -  UIImage *image = _sections[indexPath.section][indexPath.item];
    -  return ^{
    -    return [[ImageCellNode alloc] initWithImage:image];
    -  };
    -}
    -
    -- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView 
    -                  cellForItemAtIndexPath:(NSIndexPath *)indexPath
    -{
    -  return [_collectionNode.view dequeueReusableCellWithReuseIdentifier:kReuseIdentifier 
    -                                                         forIndexPath:indexPath];
    -}
    -  
    - - -
    -
    - -Run the app to see the orange `UICollectionViewCells` interspersed every 3rd cell among the `ASCellNodes` containing images. - diff --git a/submodules/AsyncDisplayKit/docs/_docs/video-node.md b/submodules/AsyncDisplayKit/docs/_docs/video-node.md deleted file mode 100755 index 6a81074a85..0000000000 --- a/submodules/AsyncDisplayKit/docs/_docs/video-node.md +++ /dev/null @@ -1,87 +0,0 @@ ---- -title: ASVideoNode -layout: docs -permalink: /docs/video-node.html -prevPage: network-image-node.html -nextPage: map-node.html ---- - -`ASVideoNode` provides a convenient and performant way to display videos in your app. - -
    Note: If you use `ASVideoNode` in your application, you must link `AVFoundation` since it uses `AVPlayerLayer` and other `AVFoundation` classes under the hood.
    - -### Basic Usage - -The easiest way to use `ASVideoNode` is to assign it an `AVAsset`. - -
    -SwiftObjective-C - -
    -
    -ASVideoNode *videoNode = [[ASVideoNode alloc] init];
    -
    -AVAsset *asset = [AVAsset assetWithURL:[NSURL URLWithString:@"http://www.w3schools.com/html/mov_bbb.mp4"]];
    -videoNode.asset = asset;
    -
    - - -
    -
    - -### Autoplay, Autorepeat, and Muting - -You can configure the way your video node reacts to various events with a few simple `BOOL`s. - -If you'd like your video to automaticaly play when it enters the visible range, set the `shouldAutoplay` property to `YES`. Setting `shouldAutoRepeat` to `YES` will cause the video to loop indefinitely, and, of course, setting `muted` to `YES` will turn the video's sound off. - -To set up a node that automatically plays once silently, you would just do the following. - -
    -SwiftObjective-C - -
    -
    -videoNode.shouldAutoplay = YES;
    -videoNode.shouldAutorepeat = NO;
    -videoNode.muted = YES;
    -
    - -
    -
    - -### Placeholder Image - -Since video nodes inherit from `ASNetworkImageNode`, you can use the `URL` property to assign a placeholder image. If you decide not to, the first frame of your video will automatically decoded and used as the placeholder instead. - - - - -### ASVideoNode Delegate - -There are a ton of delegate methods available to you that allow you to react to what's happening with your video. For example, if you want to react to the player's state changing, you can use: - -
    -SwiftObjective-C - -
    -
    -- (void)videoNode:(ASVideoNode *)videoNode willChangePlayerState:(ASVideoNodePlayerState)state toState:(ASVideoNodePlayerState)toState;
    -
    - -
    -
    - -The easiest way to see them all is to take a look at the `ASVideoNode` header file. - diff --git a/submodules/AsyncDisplayKit/docs/_includes/analytics.html b/submodules/AsyncDisplayKit/docs/_includes/analytics.html deleted file mode 100755 index 71dbfbce70..0000000000 --- a/submodules/AsyncDisplayKit/docs/_includes/analytics.html +++ /dev/null @@ -1,10 +0,0 @@ - diff --git a/submodules/AsyncDisplayKit/docs/_includes/footer.html b/submodules/AsyncDisplayKit/docs/_includes/footer.html deleted file mode 100755 index f24db5c9ab..0000000000 --- a/submodules/AsyncDisplayKit/docs/_includes/footer.html +++ /dev/null @@ -1,19 +0,0 @@ - - - - - - diff --git a/submodules/AsyncDisplayKit/docs/_includes/header.html b/submodules/AsyncDisplayKit/docs/_includes/header.html deleted file mode 100755 index e22b49e1cd..0000000000 --- a/submodules/AsyncDisplayKit/docs/_includes/header.html +++ /dev/null @@ -1,64 +0,0 @@ - - - - - Texture | {{ page.title }} - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - {% if jekyll.environment == 'production' %} - {% include analytics.html %} - {% endif %} - - -
    -
    -

    AsyncDisplayKit is now Texture! LEARN MORE

    -
    -
    -
    -
    -

    - - Texture - -

    - -
    -
    diff --git a/submodules/AsyncDisplayKit/docs/_includes/hero.html b/submodules/AsyncDisplayKit/docs/_includes/hero.html deleted file mode 100755 index e94f6b5f1b..0000000000 --- a/submodules/AsyncDisplayKit/docs/_includes/hero.html +++ /dev/null @@ -1,9 +0,0 @@ -
    -
    -
    -

    Texture

    - -
    -
    diff --git a/submodules/AsyncDisplayKit/docs/_includes/nav_development.html b/submodules/AsyncDisplayKit/docs/_includes/nav_development.html deleted file mode 100644 index 248eb4388a..0000000000 --- a/submodules/AsyncDisplayKit/docs/_includes/nav_development.html +++ /dev/null @@ -1,22 +0,0 @@ - diff --git a/submodules/AsyncDisplayKit/docs/_includes/nav_docs.html b/submodules/AsyncDisplayKit/docs/_includes/nav_docs.html deleted file mode 100755 index ac4b089557..0000000000 --- a/submodules/AsyncDisplayKit/docs/_includes/nav_docs.html +++ /dev/null @@ -1,22 +0,0 @@ - diff --git a/submodules/AsyncDisplayKit/docs/_layouts/apidiff.html b/submodules/AsyncDisplayKit/docs/_layouts/apidiff.html deleted file mode 100755 index 8b404ac0dc..0000000000 --- a/submodules/AsyncDisplayKit/docs/_layouts/apidiff.html +++ /dev/null @@ -1,14 +0,0 @@ ---- -sectionid: appledocs ---- - -{% include header.html %} - -
    -
    - -
    - {{ content }} -
    -
    -
    \ No newline at end of file diff --git a/submodules/AsyncDisplayKit/docs/_layouts/appledocs.html b/submodules/AsyncDisplayKit/docs/_layouts/appledocs.html deleted file mode 100755 index 25b9391d93..0000000000 --- a/submodules/AsyncDisplayKit/docs/_layouts/appledocs.html +++ /dev/null @@ -1,15 +0,0 @@ ---- -sectionid: appledocs ---- - -{% include header.html %} - -
    -
    - -
    - {{ content }} -
    -
    -
    -{% include footer.html %} diff --git a/submodules/AsyncDisplayKit/docs/_layouts/default.html b/submodules/AsyncDisplayKit/docs/_layouts/default.html deleted file mode 100755 index c9b8ad18ec..0000000000 --- a/submodules/AsyncDisplayKit/docs/_layouts/default.html +++ /dev/null @@ -1,16 +0,0 @@ -{% include header.html %} - -{% if page.hero %} - {% include hero.html %} -{% endif %} - -
    -
    -
    - -{{ content }} - -
    -
    -
    -{% include footer.html %} diff --git a/submodules/AsyncDisplayKit/docs/_layouts/docs.html b/submodules/AsyncDisplayKit/docs/_layouts/docs.html deleted file mode 100755 index 42e7a8d4f6..0000000000 --- a/submodules/AsyncDisplayKit/docs/_layouts/docs.html +++ /dev/null @@ -1,40 +0,0 @@ ---- -sectionid: docs ---- - -{% include header.html %} - -
    - - - -
    -

    - {{ page.title }} -

    -

    {{ page.description }}

    - - {{ content }} - -

    Edit on GitHub

    - - -
    - {% if page.prevPage %} - ← Prev - {% endif %} - {% if page.nextPage %} - Next → - {% endif %} -
    - - -
    - -
    -
    - -{% include footer.html %} diff --git a/submodules/AsyncDisplayKit/docs/_layouts/redirect.html b/submodules/AsyncDisplayKit/docs/_layouts/redirect.html deleted file mode 100755 index c24f817484..0000000000 --- a/submodules/AsyncDisplayKit/docs/_layouts/redirect.html +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - diff --git a/submodules/AsyncDisplayKit/docs/_layouts/slack.html b/submodules/AsyncDisplayKit/docs/_layouts/slack.html deleted file mode 100755 index 95d73c3484..0000000000 --- a/submodules/AsyncDisplayKit/docs/_layouts/slack.html +++ /dev/null @@ -1,14 +0,0 @@ ---- -sectionid: slack ---- - -{% include header.html %} - -
    -
    - -
    - {{ content }} -
    -
    -
    diff --git a/submodules/AsyncDisplayKit/docs/_sass/_code.scss b/submodules/AsyncDisplayKit/docs/_sass/_code.scss deleted file mode 100644 index dd4df0e23e..0000000000 --- a/submodules/AsyncDisplayKit/docs/_sass/_code.scss +++ /dev/null @@ -1,221 +0,0 @@ -code { - letter-spacing: 0.02em; - padding: 2px 4px; - /*font-weight: 700; - color: #008ED4; - font-size: 14px; - vertical-align: baseline; - font-family: 'Droid Sans Mono',sans-serif;*/ -} - -p code, span code, li code { - background-color: rgba(135, 215, 255, 0.2); -} - -.paddingBetweenCols { - th { - text-align: left; - padding: 15px 15px 15px 15px; - } - td { - padding: 15px 15px 15px 15px; - /* border: 1 px solid black;*/ - } -} - -.highlight pre, .redhighlight pre { - font-size: 13px; - line-height: 20px; - padding: 0 10px 20px 10px; -} - -.highlighttable { - margin-left: 10px; - margin-bottom: 20px; - margin-right: 10px; - border-collapse: separate !important; - .highlight pre, .redhighlight pre { - padding: 0; - } - code { - padding-right: 10px; - margin: 0; - padding-left: 2px; - font-size: 12px; - display: block; - line-height: 20px; - white-space: pre; - color: hsl(210, 100%, 8%); - } -} - -.highlight pre code, .redhighlight pre code, .highlighttable { - overflow-x: scroll; - display: block; - padding: 0; - font-size: 13px; - border: 1px solid rgb(220, 220, 220); - padding: 5px 10px; - box-sizing: border-box; - border-radius: 3; -} - -.highlight pre code, .highlighttable { - background-color: rgba(90, 140, 140, 0.1); -} - -.redhighlight pre code { - background-color: rgba(180, 80, 80, 0.1); -} - -.showcasetable code { - padding: 10px 10px 30px 30px; - margin: 10; -} - -.highlight pre code, .redhighlight pre code { - width: 100%; - white-space: pre; -} - -.lineno { - color: rgb(214, 139, 0); - &::after { - content: ';'; - font-size: 0; - } -} - -.highlight + .highlight + .highlight, .highlighttable + .highlight + .highlight, .redhighlight + .redhighlight + .redhighlight .highlighttable + .redhighlight + .redhighlight { - margin-top: -20px; -} - -/** - * Syntax highlighting styles - */ -/* not official Xcode colors, but looks better on the web */ - -.highlight { - background: #fff; - .c { - color: #008d14; - font-style: italic; - } - .err { - color: #a61717; - background-color: #e3d2d2; - } - .k { - color: #103ffb; - } - .cm { - color: #008d14; - font-style: italic; - } - .cp { - color: #b72748; - } - .c1 { - color: #008d14; - font-style: italic; - } - .cs { - color: #008d14; - font-weight: bold; - font-style: italic; - } - .gd { - color: #000; - background-color: #fdd; - .x { - color: #000; - background-color: #faa; - } - } - .ge { - font-style: italic; - } - .gr { - color: #a00; - } - .gh { - color: #999; - } - .gi { - color: #000; - background-color: #dfd; - .x { - color: #000; - background-color: #afa; - } - } - .go { - color: #888; - } - .gp { - color: #555; - } - .gs { - font-weight: bold; - } - .gu { - color: #aaa; - } - .gt { - color: #a00; - } - .kc, .kd { - color: orange; - } - .kp, .kr { - color: #008d14; - } - .kt { - color: #103ffb; - } - .m { - color: orange; - } - .s { - color: #b72748; - } - .na { - color: orange; - } - .nb { - color: #103ffb; - } - .nc { - color: #3a95ba; - } - .no, .ni, .ne, .nn, .nt { - color: orange; - } - .w { - color: #bbb; - } - .mh, .mi, .mo, .il { - color: black; - } - .sb, .sc, .sd, .s2, .se, .sh, .si, .sx { - color: #d14; - } - .sr { - color: orange; - } - .s1, .ss { - color: #b72748; - } - .bp, .vc { - color: #3a95ba; - } - .vg { - color: black; - } - .vi { - color: orange; - } - .nl { - color: #3a95ba; - } -} \ No newline at end of file diff --git a/submodules/AsyncDisplayKit/docs/apidiff/ASDK_API_Diff_1.9.92_to_2.0.html b/submodules/AsyncDisplayKit/docs/apidiff/ASDK_API_Diff_1.9.92_to_2.0.html deleted file mode 100755 index 991484bb9c..0000000000 --- a/submodules/AsyncDisplayKit/docs/apidiff/ASDK_API_Diff_1.9.92_to_2.0.html +++ /dev/null @@ -1,2224 +0,0 @@ - - - - - - -
    -
    ASAbsoluteLayoutElement.h
    - -
    -
    Added ASAbsoluteLayoutElement
    -
    Added ASAbsoluteLayoutElement.layoutPosition
    -
    Added ASAbsoluteLayoutElement.sizeRange
    -
    - -
    - -
    -
    ASAbsoluteLayoutSpec.h
    - -
    -
    Added ASAbsoluteLayoutSpecSizing
    -
    Added ASAbsoluteLayoutSpecSizingDefault
    -
    Added ASAbsoluteLayoutSpecSizingSizeToFit
    -
    Added ASAbsoluteLayoutSpec
    -
    Added ASAbsoluteLayoutSpec.sizing
    -
    Added +[ASAbsoluteLayoutSpec absoluteLayoutSpecWithSizing:children:]
    -
    Added +[ASAbsoluteLayoutSpec absoluteLayoutSpecWithChildren:]
    -
    - - -
    -
    Modified ASStaticLayoutSpec
    - - - - -
    HeaderSuperclass
    FromASStaticLayoutSpec.hASLayoutSpec
    ToASAbsoluteLayoutSpec.hASAbsoluteLayoutSpec
    -
    -
    Modified +[ASStaticLayoutSpec staticLayoutSpecWithChildren:]
    - - - - -
    Availability
    FromAvailable
    ToDeprecated
    -
    -
    - -
    - -
    -
    ASAbstractLayoutController.h
    - -
    -
    Added ASAbstractLayoutController (Unavailable)
    -
    - -
    - -
    -
    ASAsciiArtBoxCreator.h
    - -
    -
    Removed ASLayoutableAsciiArtProtocol
    -
    Removed -[ASLayoutableAsciiArtProtocol asciiArtString]
    -
    Removed -[ASLayoutableAsciiArtProtocol asciiArtName]
    -
    - - -
    -
    Added ASLayoutElementAsciiArtProtocol
    -
    Added -[ASLayoutElementAsciiArtProtocol asciiArtString]
    -
    Added -[ASLayoutElementAsciiArtProtocol asciiArtName]
    -
    - -
    - -
    -
    ASAvailability.h
    - -
    -
    Added #def kCFCoreFoundationVersionNumber_iOS_10_0
    -
    Added #def AS_AT_LEAST_IOS10
    -
    - -
    - -
    -
    ASBaseDefines.h
    - -
    -
    Added #def ASDISPLAYNODE_DEPRECATED_MSG
    -
    Added #def AS_UNAVAILABLE
    -
    Added #def AS_WARN_UNUSED_RESULT
    -
    Added #def ASOVERLOADABLE
    -
    - -
    - -
    -
    ASBasicImageDownloader.h
    - -
    -
    Modified ASBasicImageDownloader
    - - - - -
    Protocols
    FromASImageDownloaderProtocolDeprecated, ASImageDownloaderProtocol
    ToASImageDownloaderProtocol
    -
    -
    - -
    - -
    -
    ASButtonNode.h
    - -
    -
    Added ASButtonNodeImageAlignment
    -
    Added ASButtonNodeImageAlignmentBeginning
    -
    Added ASButtonNodeImageAlignmentEnd
    -
    Added ASButtonNode.imageAlignment
    -
    - -
    - -
    -
    ASCellNode.h
    - -
    -
    Added ASCellNode.supplementaryElementKind
    -
    Added ASCellNode.layoutAttributes
    -
    Added ASCellNode.indexPath
    -
    Added ASCellNode.owningNode
    -
    Added ASCellNode (Unavailable)
    -
    - -
    - -
    -
    ASCollectionNode.h
    - -
    -
    Added ASCollectionNode.allowsSelection
    -
    Added ASCollectionNode.allowsMultipleSelection
    -
    Added -[ASCollectionNode scrollToItemAtIndexPath:atScrollPosition:animated:]
    -
    Added -[ASCollectionNode registerSupplementaryNodeOfKind:]
    -
    Added -[ASCollectionNode performBatchAnimated:updates:completion:]
    -
    Added -[ASCollectionNode performBatchUpdates:completion:]
    -
    Added -[ASCollectionNode waitUntilAllUpdatesAreCommitted]
    -
    Added -[ASCollectionNode insertSections:]
    -
    Added -[ASCollectionNode deleteSections:]
    -
    Added -[ASCollectionNode reloadSections:]
    -
    Added -[ASCollectionNode moveSection:toSection:]
    -
    Added -[ASCollectionNode insertItemsAtIndexPaths:]
    -
    Added -[ASCollectionNode deleteItemsAtIndexPaths:]
    -
    Added -[ASCollectionNode reloadItemsAtIndexPaths:]
    -
    Added -[ASCollectionNode moveItemAtIndexPath:toIndexPath:]
    -
    Added -[ASCollectionNode relayoutItems]
    -
    Added ASCollectionNode.indexPathsForSelectedItems
    -
    Added -[ASCollectionNode selectItemAtIndexPath:animated:scrollPosition:]
    -
    Added -[ASCollectionNode deselectItemAtIndexPath:animated:]
    -
    Added -[ASCollectionNode numberOfItemsInSection:]
    -
    Added ASCollectionNode.numberOfSections
    -
    Added ASCollectionNode.visibleNodes
    -
    Added -[ASCollectionNode nodeForItemAtIndexPath:]
    -
    Added -[ASCollectionNode indexPathForNode:]
    -
    Added ASCollectionNode.indexPathsForVisibleItems
    -
    Added -[ASCollectionNode indexPathForItemAtPoint:]
    -
    Added -[ASCollectionNode cellForItemAtIndexPath:]
    -
    Added -[ASCollectionNode contextForSection:]
    -
    Added ASCollectionNode (Deprecated)
    -
    Added -[ASCollectionDataSource collectionNode:numberOfItemsInSection:]
    -
    Added -[ASCollectionDataSource numberOfSectionsInCollectionNode:]
    -
    Added -[ASCollectionDataSource collectionNode:nodeBlockForItemAtIndexPath:]
    -
    Added -[ASCollectionDataSource collectionNode:nodeForItemAtIndexPath:]
    -
    Added -[ASCollectionDataSource collectionNode:nodeForSupplementaryElementOfKind:atIndexPath:]
    -
    Added -[ASCollectionDataSource collectionNode:contextForSection:]
    -
    Added -[ASCollectionDelegate collectionNode:constrainedSizeForItemAtIndexPath:]
    -
    Added -[ASCollectionDelegate collectionNode:willDisplayItemWithNode:]
    -
    Added -[ASCollectionDelegate collectionNode:didEndDisplayingItemWithNode:]
    -
    Added -[ASCollectionDelegate collectionNode:willDisplaySupplementaryElementWithNode:]
    -
    Added -[ASCollectionDelegate collectionNode:didEndDisplayingSupplementaryElementWithNode:]
    -
    Added -[ASCollectionDelegate collectionNode:shouldHighlightItemAtIndexPath:]
    -
    Added -[ASCollectionDelegate collectionNode:didHighlightItemAtIndexPath:]
    -
    Added -[ASCollectionDelegate collectionNode:didUnhighlightItemAtIndexPath:]
    -
    Added -[ASCollectionDelegate collectionNode:shouldSelectItemAtIndexPath:]
    -
    Added -[ASCollectionDelegate collectionNode:shouldDeselectItemAtIndexPath:]
    -
    Added -[ASCollectionDelegate collectionNode:didSelectItemAtIndexPath:]
    -
    Added -[ASCollectionDelegate collectionNode:didDeselectItemAtIndexPath:]
    -
    Added -[ASCollectionDelegate collectionNode:shouldShowMenuForItemAtIndexPath:]
    -
    Added -[ASCollectionDelegate collectionNode:canPerformAction:forItemAtIndexPath:sender:]
    -
    Added -[ASCollectionDelegate collectionNode:performAction:forItemAtIndexPath:sender:]
    -
    Added -[ASCollectionDelegate collectionNode:willBeginBatchFetchWithContext:]
    -
    Added -[ASCollectionDelegate shouldBatchFetchForCollectionNode:]
    -
    Added -[ASCollectionDelegate collectionView:constrainedSizeForNodeAtIndexPath:]
    -
    Added -[ASCollectionDelegate collectionView:willDisplayNode:forItemAtIndexPath:]
    -
    - - -
    -
    Modified -[ASCollectionNode reloadDataImmediately]
    - - - - -
    AvailabilityDeprecation Message
    FromAvailablenone
    ToDeprecatedUse -reloadData / -reloadDataWithCompletion: followed by -waitUntilAllUpdatesAreCommitted instead.
    -
    -
    Modified ASCollectionDataSource
    - - - - -
    HeaderProtocols
    FromASCollectionView.hASCommonCollectionViewDataSource
    ToASCollectionNode.hASCommonCollectionDataSource
    -
    -
    Modified -[ASCollectionDataSource collectionView:nodeForItemAtIndexPath:]
    - - - - -
    AvailabilityDeprecation Message
    FromAvailablenone
    ToDeprecatedUse ASCollectionNode's method instead.
    -
    -
    Modified -[ASCollectionDataSource collectionView:nodeBlockForItemAtIndexPath:]
    - - - - -
    AvailabilityDeprecation Message
    FromAvailablenone
    ToDeprecatedUse ASCollectionNode's method instead.
    -
    -
    Modified -[ASCollectionDataSource collectionView:nodeForSupplementaryElementOfKind:atIndexPath:]
    - - - - -
    AvailabilityDeprecation Message
    FromAvailablenone
    ToDeprecatedUse ASCollectionNode's method instead.
    -
    -
    Modified ASCollectionDelegate
    - - - - -
    HeaderProtocols
    FromASCollectionView.hASCommonCollectionViewDelegate, NSObject
    ToASCollectionNode.hASCommonCollectionDelegate, NSObject
    -
    -
    Modified -[ASCollectionDelegate collectionView:didEndDisplayingNode:forItemAtIndexPath:]
    - - - - -
    AvailabilityDeprecation Message
    FromAvailablenone
    ToDeprecatedUse ASCollectionNode's method instead.
    -
    -
    Modified -[ASCollectionDelegate collectionView:willBeginBatchFetchWithContext:]
    - - - - -
    AvailabilityDeprecation Message
    FromAvailablenone
    ToDeprecatedUse ASCollectionNode's method instead.
    -
    -
    Modified -[ASCollectionDelegate shouldBatchFetchForCollectionView:]
    - - - - -
    AvailabilityDeprecation Message
    FromAvailablenone
    ToDeprecatedUse ASCollectionNode's method instead.
    -
    -
    Modified -[ASCollectionDelegate collectionView:willDisplayNodeForItemAtIndexPath:]
    - - - - -
    AvailabilityDeprecation Message
    FromAvailablenone
    ToDeprecatedUse ASCollectionNode's method instead.
    -
    -
    - -
    - -
    -
    ASCollectionNode+Beta.h
    - -
    -
    Modified -[ASCollectionNode beginUpdates]
    - - - - -
    AvailabilityDeprecation Message
    FromAvailablenone
    ToDeprecatedUse -performBatchUpdates:completion: instead.
    -
    -
    Modified -[ASCollectionNode endUpdatesAnimated:]
    - - - - -
    AvailabilityDeprecation Message
    FromAvailablenone
    ToDeprecatedUse -performBatchUpdates:completion: instead.
    -
    -
    Modified -[ASCollectionNode endUpdatesAnimated:completion:]
    - - - - -
    AvailabilityDeprecation Message
    FromAvailablenone
    ToDeprecatedUse -performBatchUpdates:completion: instead.
    -
    -
    - -
    - -
    -
    ASCollectionView.h
    - -
    -
    Removed -[ASCollectionView clearContents]
    -
    Removed -[ASCollectionView clearFetchedData]
    -
    Removed #def ASCollectionViewDataSource
    -
    Removed -[ASCollectionDataSource collectionView:constrainedSizeForNodeAtIndexPath:]
    -
    Removed #def ASCollectionViewDelegate
    -
    Removed -[ASCollectionDelegate collectionView:didEndDisplayingNodeForItemAtIndexPath:]
    -
    Removed -[ASCollectionView initWithFrame:collectionViewLayout:asyncDataFetching:]
    -
    - - -
    -
    Added -[ASCollectionView contextForSection:]
    -
    Added -[ASCollectionView cellForItemAtIndexPath:]
    -
    Added -[ASCollectionView scrollToItemAtIndexPath:atScrollPosition:animated:]
    -
    Added -[ASCollectionView selectItemAtIndexPath:animated:scrollPosition:]
    -
    Added ASCollectionView.indexPathsForVisibleItems
    -
    Added ASCollectionView.indexPathsForSelectedItems
    -
    Added ASCollectionViewDataSource
    -
    Added ASCollectionViewDelegate
    -
    - - -
    -
    Modified -[ASCollectionView initWithCollectionViewLayout:]
    - - - - -
    AvailabilityDeprecation Message
    FromAvailablenone
    ToDeprecatedPlease use ASCollectionNode instead of ASCollectionView.
    -
    -
    Modified -[ASCollectionView initWithFrame:collectionViewLayout:]
    - - - - -
    AvailabilityDeprecation Message
    FromAvailablenone
    ToDeprecatedPlease use ASCollectionNode instead of ASCollectionView.
    -
    -
    Modified -[ASCollectionView tuningParametersForRangeType:]
    - - - - -
    AvailabilityDeprecation Message
    FromAvailablenone
    ToDeprecatedUse ASCollectionNode method instead.
    -
    -
    Modified -[ASCollectionView setTuningParameters:forRangeType:]
    - - - - -
    AvailabilityDeprecation Message
    FromAvailablenone
    ToDeprecatedUse ASCollectionNode method instead.
    -
    -
    Modified -[ASCollectionView tuningParametersForRangeMode:rangeType:]
    - - - - -
    AvailabilityDeprecation Message
    FromAvailablenone
    ToDeprecatedUse ASCollectionNode method instead.
    -
    -
    Modified -[ASCollectionView setTuningParameters:forRangeMode:rangeType:]
    - - - - -
    AvailabilityDeprecation Message
    FromAvailablenone
    ToDeprecatedUse ASCollectionNode method instead.
    -
    -
    Modified -[ASCollectionView performBatchAnimated:updates:completion:]
    - - - - -
    AvailabilityDeprecation Message
    FromAvailablenone
    ToDeprecatedUse ASCollectionNode method instead.
    -
    -
    Modified -[ASCollectionView performBatchUpdates:completion:]
    - - - - -
    AvailabilityDeprecation Message
    FromAvailablenone
    ToDeprecatedUse ASCollectionNode method instead.
    -
    -
    Modified -[ASCollectionView reloadDataWithCompletion:]
    - - - - -
    AvailabilityDeprecation Message
    FromAvailablenone
    ToDeprecatedUse ASCollectionNode method instead.
    -
    -
    Modified -[ASCollectionView reloadData]
    - - - - -
    AvailabilityDeprecation Message
    FromAvailablenone
    ToDeprecatedUse ASCollectionNode method instead.
    -
    -
    Modified -[ASCollectionView reloadDataImmediately]
    - - - - -
    AvailabilityDeprecation Message
    FromAvailablenone
    ToDeprecatedUse ASCollectionNode's -reloadDataWithCompletion: followed by -waitUntilAllUpdatesAreCommitted instead.
    -
    -
    Modified -[ASCollectionView relayoutItems]
    - - - - -
    AvailabilityDeprecation Message
    FromAvailablenone
    ToDeprecatedUse ASCollectionNode method instead.
    -
    -
    Modified -[ASCollectionView waitUntilAllUpdatesAreCommitted]
    - - - - -
    AvailabilityDeprecation Message
    FromAvailablenone
    ToDeprecatedUse ASCollectionNode method instead.
    -
    -
    Modified -[ASCollectionView registerSupplementaryNodeOfKind:]
    - - - - -
    AvailabilityDeprecation Message
    FromAvailablenone
    ToDeprecatedUse ASCollectionNode method instead.
    -
    -
    Modified -[ASCollectionView insertSections:]
    - - - - -
    AvailabilityDeprecation Message
    FromAvailablenone
    ToDeprecatedUse ASCollectionNode method instead.
    -
    -
    Modified -[ASCollectionView deleteSections:]
    - - - - -
    AvailabilityDeprecation Message
    FromAvailablenone
    ToDeprecatedUse ASCollectionNode method instead.
    -
    -
    Modified -[ASCollectionView reloadSections:]
    - - - - -
    AvailabilityDeprecation Message
    FromAvailablenone
    ToDeprecatedUse ASCollectionNode method instead.
    -
    -
    Modified -[ASCollectionView moveSection:toSection:]
    - - - - -
    AvailabilityDeprecation Message
    FromAvailablenone
    ToDeprecatedUse ASCollectionNode method instead.
    -
    -
    Modified -[ASCollectionView insertItemsAtIndexPaths:]
    - - - - -
    AvailabilityDeprecation Message
    FromAvailablenone
    ToDeprecatedUse ASCollectionNode method instead.
    -
    -
    Modified -[ASCollectionView deleteItemsAtIndexPaths:]
    - - - - -
    AvailabilityDeprecation Message
    FromAvailablenone
    ToDeprecatedUse ASCollectionNode method instead.
    -
    -
    Modified -[ASCollectionView reloadItemsAtIndexPaths:]
    - - - - -
    AvailabilityDeprecation Message
    FromAvailablenone
    ToDeprecatedUse ASCollectionNode method instead.
    -
    -
    Modified ASCollectionDataSource
    - - - - -
    HeaderProtocols
    FromASCollectionView.hASCommonCollectionViewDataSource
    ToASCollectionNode.hASCommonCollectionDataSource
    -
    -
    Modified -[ASCollectionView moveItemAtIndexPath:toIndexPath:]
    - - - - -
    AvailabilityDeprecation Message
    FromAvailablenone
    ToDeprecatedUse ASCollectionNode method instead.
    -
    -
    Modified -[ASCollectionView calculatedSizeForNodeAtIndexPath:]
    - - - - -
    AvailabilityDeprecation Message
    FromAvailablenone
    ToDeprecatedCall -calculatedSize on the node of interest instead.
    -
    -
    Modified -[ASCollectionView visibleNodes]
    - - - - -
    AvailabilityDeprecation Message
    FromAvailablenone
    ToDeprecatedUse ASCollectionNode method instead.
    -
    -
    Modified -[ASCollectionView indexPathForNode:]
    - - - - -
    AvailabilityDeprecation Message
    FromAvailablenone
    ToDeprecatedUse ASCollectionNode method instead.
    -
    -
    Modified ASCollectionDelegate
    - - - - -
    HeaderProtocols
    FromASCollectionView.hASCommonCollectionViewDelegate, NSObject
    ToASCollectionNode.hASCommonCollectionDelegate, NSObject
    -
    -
    - -
    - -
    -
    ASCollectionViewFlowLayoutInspector.h
    - -
    -
    Added -[ASCollectionViewLayoutInspecting scrollableDirections]
    -
    - - -
    -
    Modified -[ASCollectionViewLayoutInspecting collectionView:numberOfSectionsForSupplementaryNodeOfKind:]
    - - - - -
    AvailabilityDeprecation Message
    FromAvailablenone
    ToDeprecatedUse ASCollectionNode's method instead.
    -
    -
    - -
    - -
    -
    ASCollectionViewProtocols.h
    - -
    -
    Removed ASCommonCollectionViewDataSource
    -
    Removed -[ASCommonCollectionViewDataSource collectionView:numberOfItemsInSection:]
    -
    Removed -[ASCommonCollectionViewDataSource numberOfSectionsInCollectionView:]
    -
    Removed -[ASCommonCollectionViewDataSource collectionView:viewForSupplementaryElementOfKind:atIndexPath:]
    -
    Removed ASCommonCollectionViewDelegate
    -
    Removed -[ASCommonCollectionViewDelegate collectionView:transitionLayoutForOldLayout:newLayout:]
    -
    Removed -[ASCommonCollectionViewDelegate collectionView:willDisplaySupplementaryView:forElementKind:atIndexPath:]
    -
    Removed -[ASCommonCollectionViewDelegate collectionView:didEndDisplayingSupplementaryView:forElementOfKind:atIndexPath:]
    -
    Removed -[ASCommonCollectionViewDelegate collectionView:shouldHighlightItemAtIndexPath:]
    -
    Removed -[ASCommonCollectionViewDelegate collectionView:didHighlightItemAtIndexPath:]
    -
    Removed -[ASCommonCollectionViewDelegate collectionView:didUnhighlightItemAtIndexPath:]
    -
    Removed -[ASCommonCollectionViewDelegate collectionView:shouldSelectItemAtIndexPath:]
    -
    Removed -[ASCommonCollectionViewDelegate collectionView:didSelectItemAtIndexPath:]
    -
    Removed -[ASCommonCollectionViewDelegate collectionView:shouldDeselectItemAtIndexPath:]
    -
    Removed -[ASCommonCollectionViewDelegate collectionView:didDeselectItemAtIndexPath:]
    -
    Removed -[ASCommonCollectionViewDelegate collectionView:shouldShowMenuForItemAtIndexPath:]
    -
    Removed -[ASCommonCollectionViewDelegate collectionView:canPerformAction:forItemAtIndexPath:withSender:]
    -
    Removed -[ASCommonCollectionViewDelegate collectionView:performAction:forItemAtIndexPath:withSender:]
    -
    - - -
    -
    Added ASCommonCollectionDataSource
    -
    Added -[ASCommonCollectionDataSource collectionView:numberOfItemsInSection:]
    -
    Added -[ASCommonCollectionDataSource numberOfSectionsInCollectionView:]
    -
    Added -[ASCommonCollectionDataSource collectionView:viewForSupplementaryElementOfKind:atIndexPath:]
    -
    Added ASCommonCollectionDelegate
    -
    Added -[ASCommonCollectionDelegate collectionView:transitionLayoutForOldLayout:newLayout:]
    -
    Added -[ASCommonCollectionDelegate collectionView:willDisplaySupplementaryView:forElementKind:atIndexPath:]
    -
    Added -[ASCommonCollectionDelegate collectionView:didEndDisplayingSupplementaryView:forElementOfKind:atIndexPath:]
    -
    Added -[ASCommonCollectionDelegate collectionView:shouldHighlightItemAtIndexPath:]
    -
    Added -[ASCommonCollectionDelegate collectionView:didHighlightItemAtIndexPath:]
    -
    Added -[ASCommonCollectionDelegate collectionView:didUnhighlightItemAtIndexPath:]
    -
    Added -[ASCommonCollectionDelegate collectionView:shouldSelectItemAtIndexPath:]
    -
    Added -[ASCommonCollectionDelegate collectionView:didSelectItemAtIndexPath:]
    -
    Added -[ASCommonCollectionDelegate collectionView:shouldDeselectItemAtIndexPath:]
    -
    Added -[ASCommonCollectionDelegate collectionView:didDeselectItemAtIndexPath:]
    -
    Added -[ASCommonCollectionDelegate collectionView:shouldShowMenuForItemAtIndexPath:]
    -
    Added -[ASCommonCollectionDelegate collectionView:canPerformAction:forItemAtIndexPath:withSender:]
    -
    Added -[ASCommonCollectionDelegate collectionView:performAction:forItemAtIndexPath:withSender:]
    -
    - -
    - -
    -
    ASDataController.h
    - -
    -
    Added -[ASDataController initWithDataSource:]
    -
    Added -[ASDataController completedNumberOfSections]
    -
    Added -[ASDataController completedNumberOfRowsInSection:]
    -
    Added -[ASDataController nodeAtCompletedIndexPath:]
    -
    Added -[ASDataController completedIndexPathForNode:]
    -
    Added -[ASDataController moveCompletedNodeAtIndexPath:toIndexPath:]
    -
    - -
    - -
    -
    ASDimension.h
    - -
    -
    Removed ASRelativeDimensionTypePercent
    -
    Removed ASRelativeDimension
    -
    Removed ASRelativeDimensionUnconstrained
    -
    Removed #def isValidForLayout
    -
    Removed ASRelativeDimensionMakeWithPoints()
    -
    Removed ASRelativeDimensionMakeWithPercent()
    -
    Removed ASRelativeDimensionCopy()
    -
    Removed ASRelativeDimensionEqualToRelativeDimension()
    -
    Removed NSStringFromASRelativeDimension()
    -
    Removed ASRelativeDimensionResolve()
    -
    - - -
    -
    Added ASPointsValidForLayout()
    -
    Added ASIsCGSizeValidForLayout()
    -
    Added ASPointsValidForSize()
    -
    Added ASIsCGSizeValidForSize()
    -
    Added ASDimensionUnit
    -
    Added ASDimensionUnitAuto
    -
    Added ASDimensionUnitPoints
    -
    Added ASDimensionUnitFraction
    -
    Added ASDimension
    -
    Added ASLayoutElementSize
    -
    Added ASDimensionAuto
    -
    Added ASDimensionMake()
    -
    Added ASDimensionMakeWithPoints()
    -
    Added ASDimensionMakeWithFraction()
    -
    Added ASDimensionEqualToDimension()
    -
    Added NSStringFromASDimension()
    -
    Added ASDimensionResolve()
    -
    Added NSNumber (ASDimension)
    -
    Added NSNumber.as_pointDimension
    -
    Added NSNumber.as_fractionDimension
    -
    Added ASLayoutSize
    -
    Added ASLayoutSizeAuto
    -
    Added ASLayoutSizeMake()
    -
    Added NSStringFromASLayoutSize()
    -
    Added ASLayoutElementSizeMake()
    -
    Added ASLayoutElementSizeMakeFromCGSize()
    -
    Added ASLayoutElementSizeEqualToLayoutElementSize()
    -
    Added NSStringFromASLayoutElementSize()
    -
    Added ASLayoutElementSizeResolveAutoSize()
    -
    Added ASLayoutElementSizeResolve()
    -
    Added ASRelativeDimensionTypeAuto
    -
    Added ASRelativeDimensionTypeFraction
    -
    Added #def ASRelativeDimension
    -
    Added #def ASRelativeSize
    -
    Added #def ASRelativeDimensionMakeWithPoints
    -
    Added #def ASRelativeDimensionMakeWithFraction
    -
    Added ASRelativeSizeMakeWithFraction()
    -
    Added ASRelativeSizeRangeMakeWithExactFraction()
    -
    - - -
    -
    Modified ASSizeRangeMakeExactSize()
    - - - - -
    AvailabilityDeprecation Message
    FromAvailablenone
    ToDeprecatedUse ASSizeRangeMake instead.
    -
    -
    Modified ASRelativeSizeRange
    - - - - -
    Header
    FromASRelativeSize.h
    ToASDimension.h
    -
    -
    Modified ASRelativeSizeRangeUnconstrained
    - - - - -
    Header
    FromASRelativeSize.h
    ToASDimension.h
    -
    -
    Modified ASRelativeDimensionMake()
    - - - - -
    Availability
    FromAvailable
    ToDeprecated
    -
    -
    Modified ASRelativeSizeMake()
    - - - - -
    HeaderAvailability
    FromASRelativeSize.hAvailable
    ToASDimension.hDeprecated
    -
    -
    Modified ASRelativeSizeMakeWithCGSize()
    - - - - -
    HeaderAvailability
    FromASRelativeSize.hAvailable
    ToASDimension.hDeprecated
    -
    -
    Modified ASRelativeSizeEqualToRelativeSize()
    - - - - -
    HeaderAvailability
    FromASRelativeSize.hAvailable
    ToASDimension.hDeprecated
    -
    -
    Modified NSStringFromASRelativeSize()
    - - - - -
    HeaderAvailability
    FromASRelativeSize.hAvailable
    ToASDimension.hDeprecated
    -
    -
    Modified ASRelativeSizeRangeMake()
    - - - - -
    HeaderAvailability
    FromASRelativeSize.hAvailable
    ToASDimension.hDeprecated
    -
    -
    Modified ASRelativeSizeRangeMakeWithExactRelativeSize()
    - - - - -
    HeaderAvailability
    FromASRelativeSize.hAvailable
    ToASDimension.hDeprecated
    -
    -
    Modified ASRelativeSizeRangeMakeWithExactCGSize()
    - - - - -
    HeaderAvailability
    FromASRelativeSize.hAvailable
    ToASDimension.hDeprecated
    -
    -
    Modified ASRelativeSizeRangeMakeWithExactRelativeDimensions()
    - - - - -
    HeaderAvailability
    FromASRelativeSize.hAvailable
    ToASDimension.hDeprecated
    -
    -
    Modified ASRelativeSizeRangeEqualToRelativeSizeRange()
    - - - - -
    HeaderAvailability
    FromASRelativeSize.hAvailable
    ToASDimension.hDeprecated
    -
    -
    Modified ASRelativeSizeRangeResolve()
    - - - - -
    HeaderAvailability
    FromASRelativeSize.hAvailable
    ToASDimension.hDeprecated
    -
    -
    - -
    - -
    -
    ASDisplayNode.h
    - -
    -
    Removed ASInterfaceStateFetchData
    -
    Removed -[ASDisplayNode measureWithSizeRange:]
    -
    Removed ASDisplayNode (ASDisplayNodeAsyncTransactionContainer)
    -
    Removed -[ASDisplayNode reclaimMemory]
    -
    Removed -[ASDisplayNode recursivelyReclaimMemory]
    -
    Removed ASDisplayNode.placeholderFadesOut
    -
    - - -
    -
    Added ASInterfaceStatePreload
    -
    Added -[ASDisplayNode onDidLoad:]
    -
    Added ASDisplayNode.visible
    -
    Added ASDisplayNode.inPreloadState
    -
    Added ASDisplayNode.inDisplayState
    -
    Added -[ASDisplayNode layoutThatFits:]
    -
    Added ASDisplayNode.allowsGroupOpacity
    -
    Added ASDisplayNode (LayoutTransitioning)
    -
    Added ASDisplayNode.defaultLayoutTransitionDuration
    -
    Added ASDisplayNode.defaultLayoutTransitionDelay
    -
    Added ASDisplayNode.defaultLayoutTransitionOptions
    -
    Added -[ASDisplayNode cancelLayoutTransition]
    -
    Added ASDisplayNode (AutomaticSubnodeManagement)
    -
    Added ASDisplayNode.automaticallyManagesSubnodes
    -
    Added ASDisplayNode (ASAsyncTransactionContainer)
    -
    - - -
    -
    Modified ASDisplayNode
    - - - - -
    Protocols
    FromASLayoutable
    ToASLayoutElement
    -
    -
    Modified ASDisplayNode (Debugging)
    - - - - -
    Protocols
    FromASLayoutableAsciiArtProtocol
    ToASLayoutElementAsciiArtProtocol
    -
    -
    Modified ASDisplayNode (Deprecated)
    - - - - -
    Header
    FromASDisplayNode.h
    ToASDisplayNode+Deprecated.h
    -
    -
    - -
    - -
    -
    ASDisplayNode+Beta.h
    - -
    -
    Removed +[ASDisplayNode usesImplicitHierarchyManagement]
    -
    Removed +[ASDisplayNode setUsesImplicitHierarchyManagement:]
    -
    - - -
    -
    Added #def ASDISPLAYNODE_EVENTLOG_CAPACITY
    -
    Added #def ASDISPLAYNODE_EVENTLOG_ENABLE
    -
    Added #def ASDisplayNodeLogEvent
    -
    Added ASDisplayNodePerformanceMeasurementOptions
    -
    Added ASDisplayNodePerformanceMeasurementOptionLayoutSpec
    -
    Added ASDisplayNodePerformanceMeasurementOptionLayoutComputation
    -
    Added ASDisplayNodePerformanceMeasurements
    -
    Added ASDisplayNode.measurementOptions
    -
    Added ASDisplayNode.performanceMeasurements
    -
    - -
    - -
    -
    ASDisplayNode+Deprecated.h
    - -
    -
    Added ASDisplayNode.alignSelf
    -
    Added ASDisplayNode.ascender
    -
    Added ASDisplayNode.descender
    -
    Added ASDisplayNode.flexBasis
    -
    Added ASDisplayNode.flexGrow
    -
    Added ASDisplayNode.flexShrink
    -
    Added ASDisplayNode.layoutPosition
    -
    Added ASDisplayNode.sizeRange
    -
    Added ASDisplayNode.spacingAfter
    -
    Added ASDisplayNode.spacingBefore
    -
    - - -
    -
    Modified ASDisplayNode (Deprecated)
    - - - - -
    Header
    FromASDisplayNode.h
    ToASDisplayNode+Deprecated.h
    -
    -
    Modified ASDisplayNode.name
    - - - - -
    AvailabilityDeprecation Message
    FromAvailablenone
    ToDeprecatedUse .debugName instead.
    -
    -
    Modified ASDisplayNode.preferredFrameSize
    - - - - -
    AvailabilityDeprecation Message
    FromAvailablenone
    ToDeprecatedUse .style.preferredSize instead OR set individual values with .style.height and .style.width.
    -
    -
    Modified -[ASDisplayNode measure:]
    - - - - -
    AvailabilityDeprecation Message
    FromAvailablenone
    ToDeprecatedUse layoutThatFits: with a constrained size of (CGSizeZero, constrainedSize) and call size on the returned ASLayout.
    -
    -
    Modified -[ASDisplayNode visibilityDidChange:]
    - - - - -
    AvailabilityDeprecation Message
    FromAvailablenone
    ToDeprecatedUse -didEnterVisibleState / -didExitVisibleState instead.
    -
    -
    Modified -[ASDisplayNode visibleStateDidChange:]
    - - - - -
    AvailabilityDeprecation Message
    FromAvailablenone
    ToDeprecatedUse -didEnterVisibleState / -didExitVisibleState instead.
    -
    -
    Modified -[ASDisplayNode displayStateDidChange:]
    - - - - -
    AvailabilityDeprecation Message
    FromAvailablenone
    ToDeprecatedUse -didEnterDisplayState / -didExitDisplayState instead.
    -
    -
    Modified -[ASDisplayNode loadStateDidChange:]
    - - - - -
    AvailabilityDeprecation Message
    FromAvailablenone
    ToDeprecatedUse -didEnterPreloadState / -didExitPreloadState instead.
    -
    -
    Modified -[ASDisplayNode cancelLayoutTransitionsInProgress]
    - - - - -
    AvailabilityDeprecation Message
    FromAvailablenone
    ToDeprecatedUse -cancelLayoutTransition instead.
    -
    -
    Modified ASDisplayNode.usesImplicitHierarchyManagement
    - - - - -
    AvailabilityDeprecation Message
    FromAvailablenone
    ToDeprecatedSet .automaticallyManagesSubnodes instead.
    -
    -
    - -
    - -
    -
    ASDisplayNode+Subclasses.h
    - -
    -
    Added -[ASDisplayNode calculateLayoutThatFits:restrictedToSize:relativeToParentSize:]
    -
    Added -[ASDisplayNode displayWillStartAsynchronously:]
    -
    Added -[ASDisplayNode didEnterVisibleState]
    -
    Added -[ASDisplayNode didExitVisibleState]
    -
    Added -[ASDisplayNode didEnterDisplayState]
    -
    Added -[ASDisplayNode didExitDisplayState]
    -
    Added -[ASDisplayNode didEnterPreloadState]
    -
    Added -[ASDisplayNode didExitPreloadState]
    -
    - -
    - -
    -
    ASDisplayNodeExtras.h
    - -
    -
    Removed ASInterfaceStateIncludesFetchData()
    -
    - - -
    -
    Added ASInterfaceStateIncludesPreload()
    -
    - -
    - -
    -
    ASEditableTextNode.h
    - -
    -
    Added ASEditableTextNode (Unavailable)
    -
    - -
    - -
    -
    ASEnvironment.h
    - -
    -
    Removed -[ASEnvironment supportsUpwardPropagation]
    -
    - - -
    -
    Added NSStringFromASEnvironmentTraitCollection()
    -
    - -
    - -
    -
    ASImageNode.h
    - -
    -
    Added ASImageNode.forcedSize
    -
    Added ASImageNode (Unavailable)
    -
    - -
    - -
    -
    ASImageProtocols.h
    - -
    -
    Removed ASImageDownloaderProtocolDeprecated
    -
    Removed -[ASImageDownloaderProtocolDeprecated downloadImageWithURL:callbackQueue:downloadProgressBlock:completion:]
    -
    Removed ASImageCacheProtocolDeprecated
    -
    Removed -[ASImageCacheProtocolDeprecated fetchCachedImageWithURL:callbackQueue:completion:]
    -
    - -
    - -
    -
    ASLayout.h
    - -
    -
    Removed ASLayout.constrainedSizeRange
    -
    Removed ASLayout.dirty
    -
    Removed -[ASLayout initWithLayoutableObject:constrainedSizeRange:size:position:sublayouts:]
    -
    Removed +[ASLayout layoutWithLayoutableObject:constrainedSizeRange:size:position:sublayouts:]
    -
    Removed +[ASLayout flattenedLayoutWithLayoutableObject:constrainedSizeRange:size:sublayouts:]
    -
    - - -
    -
    Added ASCalculateRootLayout()
    -
    Added ASCalculateLayout()
    -
    Added ASLayout.layoutElement
    -
    Added -[ASLayout initWithLayoutElement:size:position:sublayouts:]
    -
    Added +[ASLayout layoutWithLayoutElement:size:position:sublayouts:]
    -
    Added +[ASLayout layoutWithLayoutElement:size:sublayouts:]
    -
    Added +[ASLayout layoutWithLayoutElement:size:]
    -
    Added ASLayout (Unavailable)
    -
    Added ASLayout (Deprecated)
    -
    - - -
    -
    Modified -[ASLayout layoutableObject]
    - - - - -
    Availability
    FromAvailable
    ToDeprecated
    -
    -
    Modified +[ASLayout layoutWithLayoutableObject:constrainedSizeRange:size:]
    - - - - -
    Availability
    FromAvailable
    ToDeprecated
    -
    -
    Modified +[ASLayout layoutWithLayoutableObject:constrainedSizeRange:size:sublayouts:]
    - - - - -
    Availability
    FromAvailable
    ToDeprecated
    -
    -
    - -
    - -
    -
    ASLayoutable.h
    - -
    -
    Removed ASLayoutableType
    -
    Removed ASLayoutableTypeLayoutSpec
    -
    Removed ASLayoutableTypeDisplayNode
    -
    Removed ASLayoutable
    -
    Removed ASLayoutable.layoutableType
    -
    Removed ASLayoutable.canLayoutAsynchronous
    -
    Removed -[ASLayoutable measureWithSizeRange:]
    -
    Removed ASLayoutable.spacingBefore
    -
    Removed ASLayoutable.spacingAfter
    -
    Removed ASLayoutable.flexGrow
    -
    Removed ASLayoutable.flexShrink
    -
    Removed ASLayoutable.flexBasis
    -
    Removed ASLayoutable.alignSelf
    -
    Removed ASLayoutable.ascender
    -
    Removed ASLayoutable.descender
    -
    Removed ASLayoutable.sizeRange
    -
    Removed ASLayoutable.layoutPosition
    -
    - -
    - -
    -
    ASLayoutableExtensibility.h
    - -
    -
    Removed ASLayoutableExtensibility
    -
    Removed -[ASLayoutableExtensibility setLayoutOptionExtensionBool:atIndex:]
    -
    Removed -[ASLayoutableExtensibility layoutOptionExtensionBoolAtIndex:]
    -
    Removed -[ASLayoutableExtensibility setLayoutOptionExtensionInteger:atIndex:]
    -
    Removed -[ASLayoutableExtensibility layoutOptionExtensionIntegerAtIndex:]
    -
    Removed -[ASLayoutableExtensibility setLayoutOptionExtensionEdgeInsets:atIndex:]
    -
    Removed -[ASLayoutableExtensibility layoutOptionExtensionEdgeInsetsAtIndex:]
    -
    - -
    - -
    -
    ASLayoutablePrivate.h
    - -
    -
    Removed ASLayoutableContextInvalidTransitionID
    -
    Removed ASLayoutableContextDefaultTransitionID
    -
    Removed ASLayoutableContextNull
    -
    Removed ASLayoutableContextIsNull()
    -
    Removed ASLayoutableContextMake()
    -
    Removed ASLayoutableSetCurrentContext()
    -
    Removed ASLayoutableGetCurrentContext()
    -
    Removed ASLayoutableClearCurrentContext()
    -
    Removed ASLayoutablePrivate
    -
    Removed -[ASLayoutablePrivate finalLayoutable]
    -
    Removed ASLayoutablePrivate.isFinalLayoutable
    -
    Removed #def ASEnvironmentLayoutOptionsForwarding
    -
    - - -
    -
    Modified #def ASEnvironmentLayoutExtensibilityForwarding
    - - - - -
    Header
    FromASLayoutablePrivate.h
    ToASLayoutElementPrivate.h
    -
    -
    - -
    - -
    -
    ASLayoutElement.h
    - -
    -
    Added ASLayoutElementParentDimensionUndefined
    -
    Added ASLayoutElementParentSizeUndefined
    -
    Added ASLayoutElementType
    -
    Added ASLayoutElementTypeLayoutSpec
    -
    Added ASLayoutElementTypeDisplayNode
    -
    Added ASLayoutElement
    -
    Added ASLayoutElement.layoutElementType
    -
    Added ASLayoutElement.canLayoutAsynchronous
    -
    Added ASLayoutElement.style
    -
    Added ASLayoutElement.debugName
    -
    Added -[ASLayoutElement layoutThatFits:]
    -
    Added -[ASLayoutElement layoutThatFits:parentSize:]
    -
    Added -[ASLayoutElement calculateLayoutThatFits:]
    -
    Added -[ASLayoutElement calculateLayoutThatFits:restrictedToSize:relativeToParentSize:]
    -
    Added -[ASLayoutElement measureWithSizeRange:]
    -
    Added ASLayoutElementStyleWidthProperty
    -
    Added ASLayoutElementStyleMinWidthProperty
    -
    Added ASLayoutElementStyleMaxWidthProperty
    -
    Added ASLayoutElementStyleHeightProperty
    -
    Added ASLayoutElementStyleMinHeightProperty
    -
    Added ASLayoutElementStyleMaxHeightProperty
    -
    Added ASLayoutElementStyleSpacingBeforeProperty
    -
    Added ASLayoutElementStyleSpacingAfterProperty
    -
    Added ASLayoutElementStyleFlexGrowProperty
    -
    Added ASLayoutElementStyleFlexShrinkProperty
    -
    Added ASLayoutElementStyleFlexBasisProperty
    -
    Added ASLayoutElementStyleAlignSelfProperty
    -
    Added ASLayoutElementStyleAscenderProperty
    -
    Added ASLayoutElementStyleDescenderProperty
    -
    Added ASLayoutElementStyleLayoutPositionProperty
    -
    Added ASLayoutElementStyleDelegate
    -
    Added -[ASLayoutElementStyleDelegate style:propertyDidChange:]
    -
    Added ASLayoutElementStyle
    -
    Added -[ASLayoutElementStyle initWithDelegate:]
    -
    Added ASLayoutElementStyle.delegate
    -
    Added ASLayoutElementStyle.width
    -
    Added ASLayoutElementStyle.height
    -
    Added ASLayoutElementStyle.minHeight
    -
    Added ASLayoutElementStyle.maxHeight
    -
    Added ASLayoutElementStyle.minWidth
    -
    Added ASLayoutElementStyle.maxWidth
    -
    Added ASLayoutElementStyle.preferredSize
    -
    Added ASLayoutElementStyle.minSize
    -
    Added ASLayoutElementStyle.maxSize
    -
    Added ASLayoutElementStyle.preferredLayoutSize
    -
    Added ASLayoutElementStyle.minLayoutSize
    -
    Added ASLayoutElementStyle.maxLayoutSize
    -
    Added ASLayoutElementStylability
    -
    Added -[ASLayoutElementStylability styledWithBlock:]
    -
    - -
    - -
    -
    ASLayoutElementExtensibility.h
    - -
    -
    Added ASLayoutElementExtensibility
    -
    Added -[ASLayoutElementExtensibility setLayoutOptionExtensionBool:atIndex:]
    -
    Added -[ASLayoutElementExtensibility layoutOptionExtensionBoolAtIndex:]
    -
    Added -[ASLayoutElementExtensibility setLayoutOptionExtensionInteger:atIndex:]
    -
    Added -[ASLayoutElementExtensibility layoutOptionExtensionIntegerAtIndex:]
    -
    Added -[ASLayoutElementExtensibility setLayoutOptionExtensionEdgeInsets:atIndex:]
    -
    Added -[ASLayoutElementExtensibility layoutOptionExtensionEdgeInsetsAtIndex:]
    -
    - -
    - -
    -
    ASLayoutElementPrivate.h
    - -
    -
    Added ASLayoutElementContextInvalidTransitionID
    -
    Added ASLayoutElementContextDefaultTransitionID
    -
    Added ASLayoutElementContextNull
    -
    Added ASLayoutElementContextIsNull()
    -
    Added ASLayoutElementContextMake()
    -
    Added ASLayoutElementSetCurrentContext()
    -
    Added ASLayoutElementGetCurrentContext()
    -
    Added ASLayoutElementClearCurrentContext()
    -
    Added ASLayoutElementPrivate
    -
    Added -[ASLayoutElementPrivate finalLayoutElement]
    -
    Added ASLayoutElementPrivate.isFinalLayoutElement
    -
    Added #def ASLayoutElementStyleForwardingDeclaration
    -
    Added #def ASLayoutElementStyleForwarding
    -
    - - -
    -
    Modified #def ASEnvironmentLayoutExtensibilityForwarding
    - - - - -
    Header
    FromASLayoutablePrivate.h
    ToASLayoutElementPrivate.h
    -
    -
    - -
    - -
    -
    ASLayoutRangeType.h
    - -
    -
    Removed ASLayoutRangeTypeFetchData
    -
    - - -
    -
    Added ASLayoutRangeTypePreload
    -
    - -
    - -
    -
    ASLayoutSpec.h
    - -
    -
    Removed -[ASLayoutSpec init]
    -
    Removed -[ASLayoutSpec setChild:forIndex:]
    -
    Removed -[ASLayoutSpec childForIndex:]
    -
    - - -
    -
    Added ASWrapperLayoutSpec
    -
    Added +[ASWrapperLayoutSpec wrapperWithLayoutElement:]
    -
    Added +[ASWrapperLayoutSpec wrapperWithLayoutElements:]
    -
    Added -[ASWrapperLayoutSpec initWithLayoutElement:]
    -
    Added -[ASWrapperLayoutSpec initWithLayoutElements:]
    -
    Added ASLayoutSpec (Deprecated)
    -
    Added ASLayoutSpec.alignSelf
    -
    Added ASLayoutSpec.ascender
    -
    Added ASLayoutSpec.descender
    -
    Added ASLayoutSpec.flexBasis
    -
    Added ASLayoutSpec.flexGrow
    -
    Added ASLayoutSpec.flexShrink
    -
    Added ASLayoutSpec.layoutPosition
    -
    Added ASLayoutSpec.sizeRange
    -
    Added ASLayoutSpec.spacingAfter
    -
    Added ASLayoutSpec.spacingBefore
    -
    - - -
    -
    Modified ASLayoutSpec
    - - - - -
    Protocols
    FromASLayoutable
    ToASLayoutElement
    -
    -
    Modified ASLayoutSpec (Debugging)
    - - - - -
    Protocols
    FromASLayoutableAsciiArtProtocol
    ToASLayoutElementAsciiArtProtocol
    -
    -
    - -
    - -
    -
    ASLog.h
    - -
    -
    Added #def ASProfilingSignpost
    -
    Added #def ASProfilingSignpostStart
    -
    Added #def ASProfilingSignpostEnd
    -
    - -
    - -
    -
    ASMapNode.h
    - -
    -
    Added ASMapNode.imageForStaticMapAnnotationBlock
    -
    - -
    - -
    -
    ASObjectDescriptionHelpers.h
    - -
    -
    Added ASDebugDescriptionProvider
    -
    Added -[ASDebugDescriptionProvider propertiesForDebugDescription]
    -
    Added ASDescriptionProvider
    -
    Added -[ASDescriptionProvider propertiesForDescription]
    -
    Added ASObjectDescriptionMakeWithoutObject()
    -
    Added ASObjectDescriptionMake()
    -
    Added ASObjectDescriptionMakeTiny()
    -
    Added ASStringWithQuotesIfMultiword()
    -
    - -
    - -
    -
    ASPagerNode.h
    - -
    -
    Removed -[ASPagerDataSource pagerNode:constrainedSizeForNodeAtIndexPath:]
    -
    - - -
    -
    Added -[ASPagerDelegate pagerNode:constrainedSizeForNodeAtIndex:]
    -
    - -
    - -
    -
    ASRangeController.h
    - -
    -
    Added -[ASRangeControllerDataSource nameForRangeControllerDataSource]
    -
    - -
    - -
    -
    ASRelativeLayoutSpec.h
    - -
    -
    Added ASRelativeLayoutSpecPositionNone
    -
    - -
    - -
    -
    ASRelativeSize.h
    - -
    -
    Removed ASRelativeSize
    -
    Removed ASRelativeSizeMakeWithPercent()
    -
    Removed ASRelativeSizeResolveSize()
    -
    Removed ASRelativeSizeRangeMakeWithExactPercent()
    -
    - - -
    -
    Modified ASRelativeSizeRange
    - - - - -
    Header
    FromASRelativeSize.h
    ToASDimension.h
    -
    -
    Modified ASRelativeSizeRangeUnconstrained
    - - - - -
    Header
    FromASRelativeSize.h
    ToASDimension.h
    -
    -
    Modified ASRelativeSizeMake()
    - - - - -
    HeaderAvailability
    FromASRelativeSize.hAvailable
    ToASDimension.hDeprecated
    -
    -
    Modified ASRelativeSizeMakeWithCGSize()
    - - - - -
    HeaderAvailability
    FromASRelativeSize.hAvailable
    ToASDimension.hDeprecated
    -
    -
    Modified ASRelativeSizeEqualToRelativeSize()
    - - - - -
    HeaderAvailability
    FromASRelativeSize.hAvailable
    ToASDimension.hDeprecated
    -
    -
    Modified NSStringFromASRelativeSize()
    - - - - -
    HeaderAvailability
    FromASRelativeSize.hAvailable
    ToASDimension.hDeprecated
    -
    -
    Modified ASRelativeSizeRangeMake()
    - - - - -
    HeaderAvailability
    FromASRelativeSize.hAvailable
    ToASDimension.hDeprecated
    -
    -
    Modified ASRelativeSizeRangeMakeWithExactRelativeSize()
    - - - - -
    HeaderAvailability
    FromASRelativeSize.hAvailable
    ToASDimension.hDeprecated
    -
    -
    Modified ASRelativeSizeRangeMakeWithExactCGSize()
    - - - - -
    HeaderAvailability
    FromASRelativeSize.hAvailable
    ToASDimension.hDeprecated
    -
    -
    Modified ASRelativeSizeRangeMakeWithExactRelativeDimensions()
    - - - - -
    HeaderAvailability
    FromASRelativeSize.hAvailable
    ToASDimension.hDeprecated
    -
    -
    Modified ASRelativeSizeRangeEqualToRelativeSizeRange()
    - - - - -
    HeaderAvailability
    FromASRelativeSize.hAvailable
    ToASDimension.hDeprecated
    -
    -
    Modified ASRelativeSizeRangeResolve()
    - - - - -
    HeaderAvailability
    FromASRelativeSize.hAvailable
    ToASDimension.hDeprecated
    -
    -
    - -
    - -
    -
    ASRunLoopQueue.h
    - -
    -
    Added ASRunLoopQueue.ensureExclusiveMembership
    -
    Added ASDeallocQueue
    -
    Added +[ASDeallocQueue sharedDeallocationQueue]
    -
    Added -[ASDeallocQueue releaseObjectInBackground:]
    -
    - -
    - -
    -
    ASSectionContext.h
    - -
    -
    Added ASSectionContext
    -
    Added ASSectionContext.sectionName
    -
    Added ASSectionContext.collectionView
    -
    - -
    - -
    -
    ASStackLayoutable.h
    - -
    -
    Removed ASStackLayoutable
    -
    Removed ASStackLayoutable.spacingBefore
    -
    Removed ASStackLayoutable.spacingAfter
    -
    Removed ASStackLayoutable.flexGrow
    -
    Removed ASStackLayoutable.flexShrink
    -
    Removed ASStackLayoutable.flexBasis
    -
    Removed ASStackLayoutable.alignSelf
    -
    Removed ASStackLayoutable.ascender
    -
    Removed ASStackLayoutable.descender
    -
    - -
    - -
    -
    ASStackLayoutElement.h
    - -
    -
    Added ASStackLayoutElement
    -
    Added ASStackLayoutElement.spacingBefore
    -
    Added ASStackLayoutElement.spacingAfter
    -
    Added ASStackLayoutElement.flexGrow
    -
    Added ASStackLayoutElement.flexShrink
    -
    Added ASStackLayoutElement.flexBasis
    -
    Added ASStackLayoutElement.alignSelf
    -
    Added ASStackLayoutElement.ascender
    -
    Added ASStackLayoutElement.descender
    -
    - -
    - -
    -
    ASStaticLayoutable.h
    - -
    -
    Removed ASStaticLayoutable
    -
    Removed ASStaticLayoutable.sizeRange
    -
    Removed ASStaticLayoutable.layoutPosition
    -
    - -
    - -
    -
    ASStaticLayoutSpec.h
    - -
    -
    Modified ASStaticLayoutSpec
    - - - - -
    HeaderSuperclass
    FromASStaticLayoutSpec.hASLayoutSpec
    ToASAbsoluteLayoutSpec.hASAbsoluteLayoutSpec
    -
    -
    - -
    - -
    -
    ASTableNode.h
    - -
    -
    Added ASTableNode.allowsSelection
    -
    Added ASTableNode.allowsSelectionDuringEditing
    -
    Added ASTableNode.allowsMultipleSelection
    -
    Added ASTableNode.allowsMultipleSelectionDuringEditing
    -
    Added -[ASTableNode tuningParametersForRangeType:]
    -
    Added -[ASTableNode setTuningParameters:forRangeType:]
    -
    Added -[ASTableNode tuningParametersForRangeMode:rangeType:]
    -
    Added -[ASTableNode setTuningParameters:forRangeMode:rangeType:]
    -
    Added -[ASTableNode scrollToRowAtIndexPath:atScrollPosition:animated:]
    -
    Added -[ASTableNode reloadDataWithCompletion:]
    -
    Added -[ASTableNode reloadData]
    -
    Added -[ASTableNode relayoutItems]
    -
    Added -[ASTableNode performBatchAnimated:updates:completion:]
    -
    Added -[ASTableNode performBatchUpdates:completion:]
    -
    Added -[ASTableNode waitUntilAllUpdatesAreCommitted]
    -
    Added -[ASTableNode insertSections:withRowAnimation:]
    -
    Added -[ASTableNode deleteSections:withRowAnimation:]
    -
    Added -[ASTableNode reloadSections:withRowAnimation:]
    -
    Added -[ASTableNode moveSection:toSection:]
    -
    Added -[ASTableNode insertRowsAtIndexPaths:withRowAnimation:]
    -
    Added -[ASTableNode deleteRowsAtIndexPaths:withRowAnimation:]
    -
    Added -[ASTableNode reloadRowsAtIndexPaths:withRowAnimation:]
    -
    Added -[ASTableNode moveRowAtIndexPath:toIndexPath:]
    -
    Added -[ASTableNode selectRowAtIndexPath:animated:scrollPosition:]
    -
    Added -[ASTableNode deselectRowAtIndexPath:animated:]
    -
    Added -[ASTableNode numberOfRowsInSection:]
    -
    Added ASTableNode.numberOfSections
    -
    Added ASTableNode.visibleNodes
    -
    Added -[ASTableNode nodeForRowAtIndexPath:]
    -
    Added -[ASTableNode indexPathForNode:]
    -
    Added -[ASTableNode rectForRowAtIndexPath:]
    -
    Added -[ASTableNode cellForRowAtIndexPath:]
    -
    Added ASTableNode.indexPathForSelectedRow
    -
    Added ASTableNode.indexPathsForSelectedRows
    -
    Added -[ASTableNode indexPathForRowAtPoint:]
    -
    Added -[ASTableNode indexPathsForRowsInRect:]
    -
    Added -[ASTableNode indexPathsForVisibleRows]
    -
    Added -[ASTableDataSource numberOfSectionsInTableNode:]
    -
    Added -[ASTableDataSource tableNode:numberOfRowsInSection:]
    -
    Added -[ASTableDataSource tableNode:nodeBlockForRowAtIndexPath:]
    -
    Added -[ASTableDataSource tableNode:nodeForRowAtIndexPath:]
    -
    Added -[ASTableDelegate tableNode:willDisplayRowWithNode:]
    -
    Added -[ASTableDelegate tableNode:didEndDisplayingRowWithNode:]
    -
    Added -[ASTableDelegate tableNode:willSelectRowAtIndexPath:]
    -
    Added -[ASTableDelegate tableNode:didSelectRowAtIndexPath:]
    -
    Added -[ASTableDelegate tableNode:willDeselectRowAtIndexPath:]
    -
    Added -[ASTableDelegate tableNode:didDeselectRowAtIndexPath:]
    -
    Added -[ASTableDelegate tableNode:shouldHighlightRowAtIndexPath:]
    -
    Added -[ASTableDelegate tableNode:didHighlightRowAtIndexPath:]
    -
    Added -[ASTableDelegate tableNode:didUnhighlightRowAtIndexPath:]
    -
    Added -[ASTableDelegate tableNode:shouldShowMenuForRowAtIndexPath:]
    -
    Added -[ASTableDelegate tableNode:canPerformAction:forRowAtIndexPath:withSender:]
    -
    Added -[ASTableDelegate tableNode:performAction:forRowAtIndexPath:withSender:]
    -
    Added -[ASTableDelegate tableNode:constrainedSizeForRowAtIndexPath:]
    -
    Added -[ASTableDelegate tableNode:willBeginBatchFetchWithContext:]
    -
    Added -[ASTableDelegate shouldBatchFetchForTableNode:]
    -
    Added -[ASTableDelegate tableView:willDisplayNode:forRowAtIndexPath:]
    -
    - - -
    -
    Modified ASTableDataSource
    - - - - -
    HeaderProtocols
    FromASTableView.hASCommonTableViewDataSource, NSObject
    ToASTableNode.hASCommonTableDataSource, NSObject
    -
    -
    Modified -[ASTableDataSource tableView:nodeForRowAtIndexPath:]
    - - - - -
    AvailabilityDeprecation Message
    FromAvailablenone
    ToDeprecatedUse ASTableNode's method instead.
    -
    -
    Modified -[ASTableDataSource tableView:nodeBlockForRowAtIndexPath:]
    - - - - -
    AvailabilityDeprecation Message
    FromAvailablenone
    ToDeprecatedUse ASTableNode's method instead.
    -
    -
    Modified ASTableDelegate
    - - - - -
    Header
    FromASTableView.h
    ToASTableNode.h
    -
    -
    Modified -[ASTableDelegate tableView:didEndDisplayingNode:forRowAtIndexPath:]
    - - - - -
    AvailabilityDeprecation Message
    FromAvailablenone
    ToDeprecatedUse ASTableNode's method instead.
    -
    -
    Modified -[ASTableDelegate tableView:willBeginBatchFetchWithContext:]
    - - - - -
    AvailabilityDeprecation Message
    FromAvailablenone
    ToDeprecatedUse ASTableNode's method instead.
    -
    -
    Modified -[ASTableDelegate shouldBatchFetchForTableView:]
    - - - - -
    AvailabilityDeprecation Message
    FromAvailablenone
    ToDeprecatedUse ASTableNode's method instead.
    -
    -
    Modified -[ASTableDelegate tableView:constrainedSizeForRowAtIndexPath:]
    - - - - -
    AvailabilityDeprecation Message
    FromAvailablenone
    ToDeprecatedUse ASTableNode's method instead.
    -
    -
    Modified -[ASTableDelegate tableView:willDisplayNodeForRowAtIndexPath:]
    - - - - -
    AvailabilityDeprecation Message
    FromAvailablenone
    ToDeprecatedUse ASTableNode's method instead.
    -
    -
    - -
    - -
    -
    ASTableView.h
    - -
    -
    Removed -[ASTableDelegate tableView:didEndDisplayingNodeForRowAtIndexPath:]
    -
    Removed -[ASTableView initWithFrame:style:asyncDataFetching:]
    -
    - - -
    -
    Added ASTableView.tableNode
    -
    Added -[ASTableView cellForRowAtIndexPath:]
    -
    Added -[ASTableView scrollToRowAtIndexPath:atScrollPosition:animated:]
    -
    Added -[ASTableView selectRowAtIndexPath:animated:scrollPosition:]
    -
    Added ASTableView.indexPathForSelectedRow
    -
    Added ASTableView.indexPathsForSelectedRows
    -
    Added ASTableView.indexPathsForVisibleRows
    -
    Added -[ASTableView indexPathForRowAtPoint:]
    -
    Added -[ASTableView indexPathsForRowsInRect:]
    -
    - - -
    -
    Modified -[ASTableView initWithFrame:style:]
    - - - - -
    AvailabilityDeprecation Message
    FromAvailablenone
    ToDeprecatedPlease use ASTableNode instead of ASTableView.
    -
    -
    Modified -[ASTableView tuningParametersForRangeType:]
    - - - - -
    AvailabilityDeprecation Message
    FromAvailablenone
    ToDeprecatedUse ASTableNode method instead.
    -
    -
    Modified -[ASTableView setTuningParameters:forRangeType:]
    - - - - -
    AvailabilityDeprecation Message
    FromAvailablenone
    ToDeprecatedUse ASTableNode method instead.
    -
    -
    Modified -[ASTableView tuningParametersForRangeMode:rangeType:]
    - - - - -
    AvailabilityDeprecation Message
    FromAvailablenone
    ToDeprecatedUse ASTableNode method instead.
    -
    -
    Modified -[ASTableView setTuningParameters:forRangeMode:rangeType:]
    - - - - -
    AvailabilityDeprecation Message
    FromAvailablenone
    ToDeprecatedUse ASTableNode method instead.
    -
    -
    Modified -[ASTableView visibleNodes]
    - - - - -
    AvailabilityDeprecation Message
    FromAvailablenone
    ToDeprecatedUse ASTableNode method instead.
    -
    -
    Modified -[ASTableView indexPathForNode:]
    - - - - -
    AvailabilityDeprecation Message
    FromAvailablenone
    ToDeprecatedUse ASTableNode method instead.
    -
    -
    Modified -[ASTableView reloadDataWithCompletion:]
    - - - - -
    AvailabilityDeprecation Message
    FromAvailablenone
    ToDeprecatedUse ASTableNode method instead.
    -
    -
    Modified -[ASTableView reloadData]
    - - - - -
    AvailabilityDeprecation Message
    FromAvailablenone
    ToDeprecatedUse ASTableNode method instead.
    -
    -
    Modified -[ASTableView reloadDataImmediately]
    - - - - -
    AvailabilityDeprecation Message
    FromAvailablenone
    ToDeprecatedUse ASTableNode's reloadDataWithCompletion: followed by ASTableNode's -waitUntilAllUpdatesAreCommitted instead.
    -
    -
    Modified -[ASTableView relayoutItems]
    - - - - -
    AvailabilityDeprecation Message
    FromAvailablenone
    ToDeprecatedUse ASTableNode method instead.
    -
    -
    Modified -[ASTableView beginUpdates]
    - - - - -
    AvailabilityDeprecation Message
    FromAvailablenone
    ToDeprecatedUse ASTableNode's -performBatchUpdates:completion: instead.
    -
    -
    Modified -[ASTableView endUpdates]
    - - - - -
    AvailabilityDeprecation Message
    FromAvailablenone
    ToDeprecatedUse ASTableNode's -performBatchUpdates:completion: instead.
    -
    -
    Modified -[ASTableView endUpdatesAnimated:completion:]
    - - - - -
    AvailabilityDeprecation Message
    FromAvailablenone
    ToDeprecatedUse ASTableNode's -performBatchUpdates:completion: instead.
    -
    -
    Modified -[ASTableView waitUntilAllUpdatesAreCommitted]
    - - - - -
    AvailabilityDeprecation Message
    FromAvailablenone
    ToDeprecatedUse ASTableNode method instead.
    -
    -
    Modified -[ASTableView insertSections:withRowAnimation:]
    - - - - -
    AvailabilityDeprecation Message
    FromAvailablenone
    ToDeprecatedUse ASTableNode method instead.
    -
    -
    Modified -[ASTableView deleteSections:withRowAnimation:]
    - - - - -
    AvailabilityDeprecation Message
    FromAvailablenone
    ToDeprecatedUse ASTableNode method instead.
    -
    -
    Modified -[ASTableView reloadSections:withRowAnimation:]
    - - - - -
    AvailabilityDeprecation Message
    FromAvailablenone
    ToDeprecatedUse ASTableNode method instead.
    -
    -
    Modified -[ASTableView moveSection:toSection:]
    - - - - -
    AvailabilityDeprecation Message
    FromAvailablenone
    ToDeprecatedUse ASTableNode method instead.
    -
    -
    Modified -[ASTableView insertRowsAtIndexPaths:withRowAnimation:]
    - - - - -
    AvailabilityDeprecation Message
    FromAvailablenone
    ToDeprecatedUse ASTableNode method instead.
    -
    -
    Modified -[ASTableView deleteRowsAtIndexPaths:withRowAnimation:]
    - - - - -
    AvailabilityDeprecation Message
    FromAvailablenone
    ToDeprecatedUse ASTableNode method instead.
    -
    -
    Modified -[ASTableView reloadRowsAtIndexPaths:withRowAnimation:]
    - - - - -
    AvailabilityDeprecation Message
    FromAvailablenone
    ToDeprecatedUse ASTableNode method instead.
    -
    -
    Modified -[ASTableView moveRowAtIndexPath:toIndexPath:]
    - - - - -
    AvailabilityDeprecation Message
    FromAvailablenone
    ToDeprecatedUse ASTableNode method instead.
    -
    -
    Modified -[ASTableView clearContents]
    - - - - -
    AvailabilityDeprecation Message
    FromAvailablenone
    ToDeprecatedYou should not call this method directly. Intead, rely on the Interstate State callback methods.
    -
    -
    Modified -[ASTableView clearFetchedData]
    - - - - -
    AvailabilityDeprecation Message
    FromAvailablenone
    ToDeprecatedYou should not call this method directly. Intead, rely on the Interstate State callback methods.
    -
    -
    Modified ASTableViewDataSource
    - - - - -
    AvailabilityDeprecation Message
    FromAvailablenone
    ToDeprecatedRenamed to ASTableDataSource.
    -
    -
    Modified ASTableViewDelegate
    - - - - -
    AvailabilityDeprecation Message
    FromAvailablenone
    ToDeprecatedRenamed to ASTableDelegate.
    -
    -
    Modified ASTableDataSource
    - - - - -
    HeaderProtocols
    FromASTableView.hASCommonTableViewDataSource, NSObject
    ToASTableNode.hASCommonTableDataSource, NSObject
    -
    -
    Modified ASTableDelegate
    - - - - -
    Header
    FromASTableView.h
    ToASTableNode.h
    -
    -
    - -
    - -
    -
    ASTableViewProtocols.h
    - -
    -
    Removed ASCommonTableViewDataSource
    -
    Removed -[ASCommonTableViewDataSource tableView:numberOfRowsInSection:]
    -
    Removed -[ASCommonTableViewDataSource numberOfSectionsInTableView:]
    -
    Removed -[ASCommonTableViewDataSource tableView:titleForHeaderInSection:]
    -
    Removed -[ASCommonTableViewDataSource tableView:titleForFooterInSection:]
    -
    Removed -[ASCommonTableViewDataSource tableView:canEditRowAtIndexPath:]
    -
    Removed -[ASCommonTableViewDataSource tableView:canMoveRowAtIndexPath:]
    -
    Removed -[ASCommonTableViewDataSource sectionIndexTitlesForTableView:]
    -
    Removed -[ASCommonTableViewDataSource tableView:sectionForSectionIndexTitle:atIndex:]
    -
    Removed -[ASCommonTableViewDataSource tableView:commitEditingStyle:forRowAtIndexPath:]
    -
    Removed -[ASCommonTableViewDataSource tableView:moveRowAtIndexPath:toIndexPath:]
    -
    - - -
    -
    Added ASCommonTableDataSource
    -
    Added -[ASCommonTableDataSource tableView:numberOfRowsInSection:]
    -
    Added -[ASCommonTableDataSource numberOfSectionsInTableView:]
    -
    Added -[ASCommonTableDataSource tableView:titleForHeaderInSection:]
    -
    Added -[ASCommonTableDataSource tableView:titleForFooterInSection:]
    -
    Added -[ASCommonTableDataSource tableView:canEditRowAtIndexPath:]
    -
    Added -[ASCommonTableDataSource tableView:canMoveRowAtIndexPath:]
    -
    Added -[ASCommonTableDataSource sectionIndexTitlesForTableView:]
    -
    Added -[ASCommonTableDataSource tableView:sectionForSectionIndexTitle:atIndex:]
    -
    Added -[ASCommonTableDataSource tableView:commitEditingStyle:forRowAtIndexPath:]
    -
    Added -[ASCommonTableDataSource tableView:moveRowAtIndexPath:toIndexPath:]
    -
    - - -
    -
    Modified -[ASCommonTableViewDelegate tableView:shouldHighlightRowAtIndexPath:]
    - - - - -
    AvailabilityDeprecation Message
    FromAvailablenone
    ToDeprecatedImplement -tableNode:shouldHighlightRowAtIndexPath: instead.
    -
    -
    Modified -[ASCommonTableViewDelegate tableView:didHighlightRowAtIndexPath:]
    - - - - -
    AvailabilityDeprecation Message
    FromAvailablenone
    ToDeprecatedImplement -tableNode:didHighlightRowAtIndexPath: instead.
    -
    -
    Modified -[ASCommonTableViewDelegate tableView:didUnhighlightRowAtIndexPath:]
    - - - - -
    AvailabilityDeprecation Message
    FromAvailablenone
    ToDeprecatedImplement -tableNode:didUnhighlightRowAtIndexPath: instead.
    -
    -
    Modified -[ASCommonTableViewDelegate tableView:willSelectRowAtIndexPath:]
    - - - - -
    AvailabilityDeprecation Message
    FromAvailablenone
    ToDeprecatedImplement -tableNode:willSelectRowAtIndexPath: instead.
    -
    -
    Modified -[ASCommonTableViewDelegate tableView:willDeselectRowAtIndexPath:]
    - - - - -
    AvailabilityDeprecation Message
    FromAvailablenone
    ToDeprecatedImplement -tableNode:willDeselectRowAtIndexPath: instead.
    -
    -
    Modified -[ASCommonTableViewDelegate tableView:didSelectRowAtIndexPath:]
    - - - - -
    AvailabilityDeprecation Message
    FromAvailablenone
    ToDeprecatedImplement -tableNode:didSelectRowAtIndexPath: instead.
    -
    -
    Modified -[ASCommonTableViewDelegate tableView:didDeselectRowAtIndexPath:]
    - - - - -
    AvailabilityDeprecation Message
    FromAvailablenone
    ToDeprecatedImplement -tableNode:didDeselectRowAtIndexPath: instead.
    -
    -
    Modified -[ASCommonTableViewDelegate tableView:shouldShowMenuForRowAtIndexPath:]
    - - - - -
    AvailabilityDeprecation Message
    FromAvailablenone
    ToDeprecatedImplement -tableNode:shouldShowMenuForRowAtIndexPath: instead.
    -
    -
    Modified -[ASCommonTableViewDelegate tableView:canPerformAction:forRowAtIndexPath:withSender:]
    - - - - -
    AvailabilityDeprecation Message
    FromAvailablenone
    ToDeprecatedImplement -tableNode:canPerformAction:forRowAtIndexPath:withSender: instead.
    -
    -
    Modified -[ASCommonTableViewDelegate tableView:performAction:forRowAtIndexPath:withSender:]
    - - - - -
    AvailabilityDeprecation Message
    FromAvailablenone
    ToDeprecatedImplement -tableNode:performAction:forRowAtIndexPath:withSender: instead.
    -
    -
    - -
    - -
    -
    ASTextNode.h
    - -
    -
    Added ASTextNode (Unavailable)
    -
    - - -
    -
    Modified ASTextNode.attributedString
    - - - - -
    AvailabilityDeprecation Message
    FromAvailablenone
    ToDeprecatedUse .attributedText instead.
    -
    -
    Modified ASTextNode.truncationAttributedString
    - - - - -
    AvailabilityDeprecation Message
    FromAvailablenone
    ToDeprecatedUse .truncationAttributedText instead.
    -
    -
    - -
    - -
    -
    ASTraceEvent.h
    - -
    -
    Added ASTraceEvent
    -
    Added -[ASTraceEvent initWithObject:backtrace:format:arguments:]
    -
    Added ASTraceEvent.backtrace
    -
    Added ASTraceEvent.message
    -
    Added ASTraceEvent.timestamp
    -
    - -
    - -
    -
    ASVideoNode.h
    - -
    -
    Removed -[ASVideoNodeDelegate videoPlaybackDidFinish:]
    -
    Removed -[ASVideoNodeDelegate videoNodeWasTapped:]
    -
    Removed -[ASVideoNodeDelegate videoNode:didPlayToSecond:]
    -
    - - -
    -
    Added ASVideoNode.playerLayer
    -
    Added ASVideoNode (Unavailable)
    -
    - -
    - -
    -
    ASViewController.h
    - -
    -
    Added ASViewController (Unavailable)
    -
    - -
    - -
    -
    ASWeakSet.h
    - -
    -
    Added ASWeakSet
    -
    Added ObjectType
    -
    Added ASWeakSet.empty
    -
    Added -[ASWeakSet containsObject:]
    -
    Added -[ASWeakSet addObject:]
    -
    Added -[ASWeakSet removeObject:]
    -
    Added -[ASWeakSet removeAllObjects]
    -
    Added -[ASWeakSet allObjects]
    -
    Added ASWeakSet.count
    -
    - -
    - -
    -
    AsyncDisplayKit+Debug.h
    - -
    -
    Added ASRangeController (Debugging)
    -
    Added +[ASRangeController setShouldShowRangeDebugOverlay:]
    -
    Added +[ASRangeController shouldShowRangeDebugOverlay]
    -
    Added +[ASRangeController layoutDebugOverlayIfNeeded]
    -
    Added -[ASRangeController addRangeControllerToRangeDebugOverlay]
    -
    Added -[ASRangeController updateRangeController:withScrollableDirections:scrollDirection:rangeMode:displayTuningParameters:preloadTuningParameters:interfaceState:]
    -
    - -
    - -
    -
    CGRect+ASConvenience.h
    - -
    -
    Modified ASDirectionalScreenfulBuffer
    - - - - -
    Header
    FromCGRect+ASConvenience.h
    ToCoreGraphics+ASConvenience.h
    -
    -
    Modified ASDirectionalScreenfulBufferHorizontal()
    - - - - -
    Header
    FromCGRect+ASConvenience.h
    ToCoreGraphics+ASConvenience.h
    -
    -
    Modified ASDirectionalScreenfulBufferVertical()
    - - - - -
    Header
    FromCGRect+ASConvenience.h
    ToCoreGraphics+ASConvenience.h
    -
    -
    Modified CGRectExpandToRangeWithScrollableDirections()
    - - - - -
    Header
    FromCGRect+ASConvenience.h
    ToCoreGraphics+ASConvenience.h
    -
    -
    - -
    - -
    -
    CoreGraphics+ASConvenience.h
    - -
    -
    Added #def CGFLOAT_EPSILON
    -
    Added ASCGFloatFromString()
    -
    Added ASCGFloatFromNumber()
    -
    Added CGSizeEqualToSizeWithIn()
    -
    - - -
    -
    Modified ASDirectionalScreenfulBuffer
    - - - - -
    Header
    FromCGRect+ASConvenience.h
    ToCoreGraphics+ASConvenience.h
    -
    -
    Modified ASDirectionalScreenfulBufferHorizontal()
    - - - - -
    Header
    FromCGRect+ASConvenience.h
    ToCoreGraphics+ASConvenience.h
    -
    -
    Modified ASDirectionalScreenfulBufferVertical()
    - - - - -
    Header
    FromCGRect+ASConvenience.h
    ToCoreGraphics+ASConvenience.h
    -
    -
    Modified CGRectExpandToRangeWithScrollableDirections()
    - - - - -
    Header
    FromCGRect+ASConvenience.h
    ToCoreGraphics+ASConvenience.h
    -
    -
    - -
    - -
    -
    NSArray+Diffing.h
    - -
    -
    Added NSArray (Diffing)
    -
    Added -[NSArray asdk_diffWithArray:insertions:deletions:]
    -
    Added -[NSArray asdk_diffWithArray:insertions:deletions:compareBlock:]
    -
    - -
    - -
    -
    UIView+ASConvenience.h
    - -
    -
    Added ASDisplayProperties.allowsGroupOpacity
    -
    - -
    - - diff --git a/submodules/AsyncDisplayKit/docs/apidiff/apidiff.css b/submodules/AsyncDisplayKit/docs/apidiff/apidiff.css deleted file mode 100755 index 822ae40118..0000000000 --- a/submodules/AsyncDisplayKit/docs/apidiff/apidiff.css +++ /dev/null @@ -1,87 +0,0 @@ -body { - font: 12px 'Lucida Grande', 'Lucida Sans Unicode', Helvetica, Arial, Verdana, sans-serif; - margin: 0; - padding: 0 2em 2em 2em; -} - -h1 { - margin-top: 30px; - margin-bottom: 30px; - font-size: 28px; - font-weight: bold; -} - -.headerFile { - margin-left: 20px; -} - -.headerName { - margin: 15px 0px 10px -20px; - padding: 4px 4px 4px 20px; - font-weight: bold; - font-size: 120%; - background-color: #f8f8f8; -} - -.differenceGroup { - margin-top: 5px; -} - -.difference { - padding-left: 20px; - font-family: Courier, Consolas, monospace; - font-size: 110%; -} - -.status { - font-style: italic; - font-size: 80%; -} - -.removed { - color: red; -} - -.added { - color: blue; -} - -.modified { - color: #080; -} - -.declaration { - font-family: Courier, Consolas, monospace; -} - -table { - border: 1px #888 solid; - padding: 2px; - border-spacing: 0px; - border-collapse: collapse; - margin-left: 40px; - margin-top: 7px; -} - -td, th { - font-size: 10px; - border: 1px #888 solid; - padding:3px 6px; -} - -th { - font-size: 10px; - text-align: center; - background-color: #eee; -} - -td { - font-size: 90%; - text-align: left; -} - -.message { - margin-left: 20px; - font-style: italic; - color: #888; -} diff --git a/submodules/AsyncDisplayKit/docs/appledoc/Blocks/ASDisplayNodeContextModifier.html b/submodules/AsyncDisplayKit/docs/appledoc/Blocks/ASDisplayNodeContextModifier.html deleted file mode 100755 index f52dec6351..0000000000 --- a/submodules/AsyncDisplayKit/docs/appledoc/Blocks/ASDisplayNodeContextModifier.html +++ /dev/null @@ -1,128 +0,0 @@ - - - - - - ASDisplayNodeContextModifier Block Reference - - - - - - -
    -
    - -

    - -

    - -

    - AsyncDisplayKit -

    - -
    -
    - - - -
    -
    -
    -
    -

    ASDisplayNodeContextModifier Block Reference

    - - -
    - - - - -
    Declared inASDisplayNode.h
    - - - - - - - - - - -

    Block Definition

    -

    ASDisplayNodeContextModifier

    - - -
    -

    ASDisplayNode will / did render node content in context.

    -
    - - - -typedef void (^ASDisplayNodeContextModifier) (CGContextRef context) - - - - - - - - - - - -
    -

    Declared In

    - ASDisplayNode.h
    -
    - - - -
    - -
    - -
    -
    -
    -
    - - - - \ No newline at end of file diff --git a/submodules/AsyncDisplayKit/docs/appledoc/Blocks/ASDisplayNodeDidLoadBlock.html b/submodules/AsyncDisplayKit/docs/appledoc/Blocks/ASDisplayNodeDidLoadBlock.html deleted file mode 100755 index eba4dee2c3..0000000000 --- a/submodules/AsyncDisplayKit/docs/appledoc/Blocks/ASDisplayNodeDidLoadBlock.html +++ /dev/null @@ -1,128 +0,0 @@ - - - - - - ASDisplayNodeDidLoadBlock Block Reference - - - - - - -
    -
    - -

    - -

    - -

    - AsyncDisplayKit -

    - -
    -
    - - - -
    -
    -
    -
    -

    ASDisplayNodeDidLoadBlock Block Reference

    - - -
    - - - - -
    Declared inASDisplayNode.h
    - - - - - - - - - - -

    Block Definition

    -

    ASDisplayNodeDidLoadBlock

    - - -
    -

    ASDisplayNode loaded callback block. This block is called BEFORE the -didLoad method and is always called on the main thread.

    -
    - - - -typedef void (^ASDisplayNodeDidLoadBlock) (__kindof ASDisplayNode, * node) - - - - - - - - - - - -
    -

    Declared In

    - ASDisplayNode.h
    -
    - - - -
    - -
    - -
    -
    -
    -
    - - - - \ No newline at end of file diff --git a/submodules/AsyncDisplayKit/docs/appledoc/Categories/ASCellNode+.html b/submodules/AsyncDisplayKit/docs/appledoc/Categories/ASCellNode+.html deleted file mode 100755 index 23e0e26c26..0000000000 --- a/submodules/AsyncDisplayKit/docs/appledoc/Categories/ASCellNode+.html +++ /dev/null @@ -1,222 +0,0 @@ - - - - - - ASCellNode() Category Reference - - - - - - -
    -
    - -

    - -

    - -

    - Texture -

    - -
    -
    - - - -
    -
    -
    -
    -

    ASCellNode() Category Reference

    - - -
    - - - - -
    Declared inASCellNode+Internal.h
    - - - - - - -
    - - - - - - -
    -
    - -

      layoutAttributes -

    - -
    -
    - -
    - - -
    -

    This could be declared @c copy, but since this is only settable internally, we can ensure -that it’s always safe simply to retain it, and copy if needed. Since @c UICollectionViewLayoutAttributes -is always mutable, @c copy is never “free” like it is for e.g. NSString.

    -
    - - - -
    @property (nonatomic, strong, nullable) UICollectionViewLayoutAttributes *layoutAttributes
    - - - - - - - - - -
    -

    Discussion

    -

    Note: This could be declared @c copy, but since this is only settable internally, we can ensure -that it’s always safe simply to retain it, and copy if needed. Since @c UICollectionViewLayoutAttributes -is always mutable, @c copy is never “free” like it is for e.g. NSString.

    -
    - - - - - - - -
    -

    Declared In

    -

    ASCellNode+Internal.h

    -
    - - -
    -
    -
    - -

      supplementaryElementKind -

    - -
    -
    - -
    - - -
    -

    readwrite variant of the readonly public property.

    -
    - - - -
    @property (nonatomic, copy, nullable) NSString *supplementaryElementKind
    - - - - - - - - - - - - - - - -
    -

    Declared In

    -

    ASCellNode+Internal.h

    -
    - - -
    -
    -
    -
    - -
    - - - - - - -
    - - -
    -
    -
    - - - - \ No newline at end of file diff --git a/submodules/AsyncDisplayKit/docs/appledoc/Categories/ASCollectionNode+Deprecated.html b/submodules/AsyncDisplayKit/docs/appledoc/Categories/ASCollectionNode+Deprecated.html deleted file mode 100755 index 3a528cffbd..0000000000 --- a/submodules/AsyncDisplayKit/docs/appledoc/Categories/ASCollectionNode+Deprecated.html +++ /dev/null @@ -1,176 +0,0 @@ - - - - - - ASCollectionNode(Deprecated) Category Reference - - - - - - -
    -
    - -

    - -

    - -

    - AsyncDisplayKit -

    - -
    -
    - - - -
    -
    -
    -
    -

    ASCollectionNode(Deprecated) Category Reference

    - - -
    - - - - -
    Declared inASCollectionNode.h
    - - - - - - -
    - - - - - - -
    -
    - -

    – reloadDataImmediately -

    - -
    -
    - -
    - - -
    -

    Reload everything from scratch, destroying the working range and all cached nodes. (Deprecated: This method is deprecated in 2.0. Use @c reloadDataWithCompletion: and -then @c waitUntilAllUpdatesAreCommitted instead.)

    -
    - - - -
    - (void)reloadDataImmediately
    - - - - - - - - - -
    -

    Discussion

    -

    Warning: This method is substantially more expensive than UICollectionView’s version.

    -
    - - - - - - - -
    -

    Declared In

    -

    ASCollectionNode.h

    -
    - - -
    -
    -
    -
    - -
    - - - - - - -
    - -
    - -
    -
    -
    -
    - - - - \ No newline at end of file diff --git a/submodules/AsyncDisplayKit/docs/appledoc/Categories/ASCollectionView+Deprecated.html b/submodules/AsyncDisplayKit/docs/appledoc/Categories/ASCollectionView+Deprecated.html deleted file mode 100755 index 9d4741fee3..0000000000 --- a/submodules/AsyncDisplayKit/docs/appledoc/Categories/ASCollectionView+Deprecated.html +++ /dev/null @@ -1,1616 +0,0 @@ - - - - - - ASCollectionView(Deprecated) Category Reference - - - - - - -
    -
    - -

    - -

    - -

    - AsyncDisplayKit -

    - -
    -
    - - - -
    -
    -
    -
    -

    ASCollectionView(Deprecated) Category Reference

    - - -
    - - - - -
    Declared inASCollectionView.h
    - - - - - - -
    - - - - - - -
    -
    - -

    – initWithCollectionViewLayout: -

    - -
    -
    - -
    - - -
    -

    Initializes an ASCollectionView

    -
    - - - -
    - (instancetype)initWithCollectionViewLayout:(UICollectionViewLayout *)layout
    - - - -
    -

    Parameters

    - - - - - - - -
    layout

    The layout object to use for organizing items. The collection view stores a strong reference to the specified object. Must not be nil.

    -
    - - - - - - - -
    -

    Discussion

    -

    Initializes and returns a newly allocated collection view object with the specified layout.

    -
    - - - - - - - -
    -

    Declared In

    -

    ASCollectionView.h

    -
    - - -
    -
    -
    - -

    – initWithFrame:collectionViewLayout: -

    - -
    -
    - -
    - - -
    -

    Initializes an ASCollectionView

    -
    - - - -
    - (instancetype)initWithFrame:(CGRect)frame collectionViewLayout:(UICollectionViewLayout *)layout
    - - - -
    -

    Parameters

    - - - - - - - - - - - - -
    frame

    The frame rectangle for the collection view, measured in points. The origin of the frame is relative to the superview in which you plan to add it. This frame is passed to the superclass during initialization.

    layout

    The layout object to use for organizing items. The collection view stores a strong reference to the specified object. Must not be nil.

    -
    - - - - - - - -
    -

    Discussion

    -

    Initializes and returns a newly allocated collection view object with the specified frame and layout.

    -
    - - - - - - - -
    -

    Declared In

    -

    ASCollectionView.h

    -
    - - -
    -
    -
    - -

    – tuningParametersForRangeType: -

    - -
    -
    - -
    - - -
    -

    Tuning parameters for a range type in full mode.

    -
    - - - -
    - (ASRangeTuningParameters)tuningParametersForRangeType:(ASLayoutRangeType)rangeType
    - - - -
    -

    Parameters

    - - - - - - - -
    rangeType

    The range type to get the tuning parameters for.

    -
    - - - -
    -

    Return Value

    -

    A tuning parameter value for the given range type in full mode.

    -
    - - - - - - - - - - - -
    -

    Declared In

    -

    ASCollectionView.h

    -
    - - -
    -
    -
    - -

    – setTuningParameters:forRangeType: -

    - -
    -
    - -
    - - -
    -

    Set the tuning parameters for a range type in full mode.

    -
    - - - -
    - (void)setTuningParameters:(ASRangeTuningParameters)tuningParameters forRangeType:(ASLayoutRangeType)rangeType
    - - - -
    -

    Parameters

    - - - - - - - - - - - - -
    tuningParameters

    The tuning parameters to store for a range type.

    rangeType

    The range type to set the tuning parameters for.

    -
    - - - - - - - - - - - - - -
    -

    Declared In

    -

    ASCollectionView.h

    -
    - - -
    -
    -
    - -

    – tuningParametersForRangeMode:rangeType: -

    - -
    -
    - -
    - - -
    -

    Tuning parameters for a range type in the specified mode.

    -
    - - - -
    - (ASRangeTuningParameters)tuningParametersForRangeMode:(ASLayoutRangeMode)rangeMode rangeType:(ASLayoutRangeType)rangeType
    - - - -
    -

    Parameters

    - - - - - - - - - - - - -
    rangeMode

    The range mode to get the running parameters for.

    rangeType

    The range type to get the tuning parameters for.

    -
    - - - -
    -

    Return Value

    -

    A tuning parameter value for the given range type in the given mode.

    -
    - - - - - - - - - - - -
    -

    Declared In

    -

    ASCollectionView.h

    -
    - - -
    -
    -
    - -

    – setTuningParameters:forRangeMode:rangeType: -

    - -
    -
    - -
    - - -
    -

    Set the tuning parameters for a range type in the specified mode.

    -
    - - - -
    - (void)setTuningParameters:(ASRangeTuningParameters)tuningParameters forRangeMode:(ASLayoutRangeMode)rangeMode rangeType:(ASLayoutRangeType)rangeType
    - - - -
    -

    Parameters

    - - - - - - - - - - - - - - - - - -
    tuningParameters

    The tuning parameters to store for a range type.

    rangeMode

    The range mode to set the running parameters for.

    rangeType

    The range type to set the tuning parameters for.

    -
    - - - - - - - - - - - - - -
    -

    Declared In

    -

    ASCollectionView.h

    -
    - - -
    -
    -
    - -

    – performBatchAnimated:updates:completion: -

    - -
    -
    - -
    - - -
    -

    Perform a batch of updates asynchronously, optionally disabling all animations in the batch. This method must be called from the main thread. -The asyncDataSource must be updated to reflect the changes before the update block completes.

    -
    - - - -
    - (void)performBatchAnimated:(BOOL)animated updates:(nullable __attribute ( ( noescape ) ) void ( ^ ) ( ))updates completion:(nullable void ( ^ ) ( BOOL finished ))completion
    - - - -
    -

    Parameters

    - - - - - - - - - - - - - - - - - -
    animated

    NO to disable animations for this batch

    updates

    The block that performs the relevant insert, delete, reload, or move operations.

    completion

    A completion handler block to execute when all of the operations are finished. This block takes a single -Boolean parameter that contains the value YES if all of the related animations completed successfully or -NO if they were interrupted. This parameter may be nil. If supplied, the block is run on the main thread.

    -
    - - - - - - - - - - - - - -
    -

    Declared In

    -

    ASCollectionView.h

    -
    - - -
    -
    -
    - -

    – performBatchUpdates:completion: -

    - -
    -
    - -
    - - -
    -

    Perform a batch of updates asynchronously. This method must be called from the main thread. -The asyncDataSource must be updated to reflect the changes before update block completes.

    -
    - - - -
    - (void)performBatchUpdates:(nullable __attribute ( ( noescape ) ) void ( ^ ) ( ))updates completion:(nullable void ( ^ ) ( BOOL finished ))completion
    - - - -
    -

    Parameters

    - - - - - - - - - - - - -
    updates

    The block that performs the relevant insert, delete, reload, or move operations.

    completion

    A completion handler block to execute when all of the operations are finished. This block takes a single -Boolean parameter that contains the value YES if all of the related animations completed successfully or -NO if they were interrupted. This parameter may be nil. If supplied, the block is run on the main thread.

    -
    - - - - - - - - - - - - - -
    -

    Declared In

    -

    ASCollectionView.h

    -
    - - -
    -
    -
    - -

    – reloadDataWithCompletion: -

    - -
    -
    - -
    - - -
    -

    Reload everything from scratch, destroying the working range and all cached nodes.

    -
    - - - -
    - (void)reloadDataWithCompletion:(nullable void ( ^ ) ( ))completion
    - - - -
    -

    Parameters

    - - - - - - - -
    completion

    block to run on completion of asynchronous loading or nil. If supplied, the block is run on -the main thread.

    -
    - - - - - - - -
    -

    Discussion

    -

    Warning: This method is substantially more expensive than UICollectionView’s version.

    -
    - - - - - - - -
    -

    Declared In

    -

    ASCollectionView.h

    -
    - - -
    -
    -
    - -

    – reloadData -

    - -
    -
    - -
    - - -
    -

    Reload everything from scratch, destroying the working range and all cached nodes.

    -
    - - - -
    - (void)reloadData
    - - - - - - - - - -
    -

    Discussion

    -

    Warning: This method is substantially more expensive than UICollectionView’s version.

    -
    - - - - - - - -
    -

    Declared In

    -

    ASCollectionView.h

    -
    - - -
    -
    -
    - -

    – reloadDataImmediately -

    - -
    -
    - -
    - - -
    -

    Reload everything from scratch entirely on the main thread, destroying the working range and all cached nodes.

    -
    - - - -
    - (void)reloadDataImmediately
    - - - - - - - - - -
    -

    Discussion

    -

    Warning: This method is substantially more expensive than UICollectionView’s version and will block the main thread -while all the cells load.

    -
    - - - - - - - -
    -

    Declared In

    -

    ASCollectionView.h

    -
    - - -
    -
    -
    - -

    – relayoutItems -

    - -
    -
    - -
    - - -
    -

    Triggers a relayout of all nodes.

    -
    - - - -
    - (void)relayoutItems
    - - - - - - - - - -
    -

    Discussion

    -

    This method invalidates and lays out every cell node in the collection.

    -
    - - - - - - - -
    -

    Declared In

    -

    ASCollectionView.h

    -
    - - -
    -
    -
    - -

    – waitUntilAllUpdatesAreCommitted -

    - -
    -
    - -
    - - -
    -

    Blocks execution of the main thread until all section and row updates are committed. This method must be called from the main thread.

    -
    - - - -
    - (void)waitUntilAllUpdatesAreCommitted
    - - - - - - - - - - - - - - - -
    -

    Declared In

    -

    ASCollectionView.h

    -
    - - -
    -
    -
    - -

    – registerSupplementaryNodeOfKind: -

    - -
    -
    - -
    - - -
    -

    Registers the given kind of supplementary node for use in creating node-backed supplementary views.

    -
    - - - -
    - (void)registerSupplementaryNodeOfKind:(NSString *)elementKind
    - - - -
    -

    Parameters

    - - - - - - - -
    elementKind

    The kind of supplementary node that will be requested through the data source.

    -
    - - - - - - - -
    -

    Discussion

    -

    Use this method to register support for the use of supplementary nodes in place of the default -registerClass:forSupplementaryViewOfKind:withReuseIdentifier: and registerNib:forSupplementaryViewOfKind:withReuseIdentifier: -methods. This method will register an internal backing view that will host the contents of the supplementary nodes -returned from the data source.

    -
    - - - - - - - -
    -

    Declared In

    -

    ASCollectionView.h

    -
    - - -
    -
    -
    - -

    – insertSections: -

    - -
    -
    - -
    - - -
    -

    Inserts one or more sections.

    -
    - - - -
    - (void)insertSections:(NSIndexSet *)sections
    - - - -
    -

    Parameters

    - - - - - - - -
    sections

    An index set that specifies the sections to insert.

    -
    - - - - - - - -
    -

    Discussion

    -

    This method must be called from the main thread. The asyncDataSource must be updated to reflect the changes -before this method is called.

    -
    - - - - - - - -
    -

    Declared In

    -

    ASCollectionView.h

    -
    - - -
    -
    -
    - -

    – deleteSections: -

    - -
    -
    - -
    - - -
    -

    Deletes one or more sections.

    -
    - - - -
    - (void)deleteSections:(NSIndexSet *)sections
    - - - -
    -

    Parameters

    - - - - - - - -
    sections

    An index set that specifies the sections to delete.

    -
    - - - - - - - -
    -

    Discussion

    -

    This method must be called from the main thread. The asyncDataSource must be updated to reflect the changes -before this method is called.

    -
    - - - - - - - -
    -

    Declared In

    -

    ASCollectionView.h

    -
    - - -
    -
    -
    - -

    – reloadSections: -

    - -
    -
    - -
    - - -
    -

    Reloads the specified sections.

    -
    - - - -
    - (void)reloadSections:(NSIndexSet *)sections
    - - - -
    -

    Parameters

    - - - - - - - -
    sections

    An index set that specifies the sections to reload.

    -
    - - - - - - - -
    -

    Discussion

    -

    This method must be called from the main thread. The asyncDataSource must be updated to reflect the changes -before this method is called.

    -
    - - - - - - - -
    -

    Declared In

    -

    ASCollectionView.h

    -
    - - -
    -
    -
    - -

    – moveSection:toSection: -

    - -
    -
    - -
    - - -
    -

    Moves a section to a new location.

    -
    - - - -
    - (void)moveSection:(NSInteger)section toSection:(NSInteger)newSection
    - - - -
    -

    Parameters

    - - - - - - - - - - - - -
    section

    The index of the section to move.

    newSection

    The index that is the destination of the move for the section.

    -
    - - - - - - - -
    -

    Discussion

    -

    This method must be called from the main thread. The asyncDataSource must be updated to reflect the changes -before this method is called.

    -
    - - - - - - - -
    -

    Declared In

    -

    ASCollectionView.h

    -
    - - -
    -
    -
    - -

    – insertItemsAtIndexPaths: -

    - -
    -
    - -
    - - -
    -

    Inserts items at the locations identified by an array of index paths.

    -
    - - - -
    - (void)insertItemsAtIndexPaths:(NSArray<NSIndexPath*> *)indexPaths
    - - - -
    -

    Parameters

    - - - - - - - -
    indexPaths

    An array of NSIndexPath objects, each representing an item index and section index that together identify an item.

    -
    - - - - - - - -
    -

    Discussion

    -

    This method must be called from the main thread. The asyncDataSource must be updated to reflect the changes -before this method is called.

    -
    - - - - - - - -
    -

    Declared In

    -

    ASCollectionView.h

    -
    - - -
    -
    -
    - -

    – deleteItemsAtIndexPaths: -

    - -
    -
    - -
    - - -
    -

    Deletes the items specified by an array of index paths.

    -
    - - - -
    - (void)deleteItemsAtIndexPaths:(NSArray<NSIndexPath*> *)indexPaths
    - - - -
    -

    Parameters

    - - - - - - - -
    indexPaths

    An array of NSIndexPath objects identifying the items to delete.

    -
    - - - - - - - -
    -

    Discussion

    -

    This method must be called from the main thread. The asyncDataSource must be updated to reflect the changes -before this method is called.

    -
    - - - - - - - -
    -

    Declared In

    -

    ASCollectionView.h

    -
    - - -
    -
    -
    - -

    – reloadItemsAtIndexPaths: -

    - -
    -
    - -
    - - -
    -

    Reloads the specified items.

    -
    - - - -
    - (void)reloadItemsAtIndexPaths:(NSArray<NSIndexPath*> *)indexPaths
    - - - -
    -

    Parameters

    - - - - - - - -
    indexPaths

    An array of NSIndexPath objects identifying the items to reload.

    -
    - - - - - - - -
    -

    Discussion

    -

    This method must be called from the main thread. The asyncDataSource must be updated to reflect the changes -before this method is called.

    -
    - - - - - - - -
    -

    Declared In

    -

    ASCollectionView.h

    -
    - - -
    -
    -
    - -

    – moveItemAtIndexPath:toIndexPath: -

    - -
    -
    - -
    - - -
    -

    Moves the item at a specified location to a destination location.

    -
    - - - -
    - (void)moveItemAtIndexPath:(NSIndexPath *)indexPath toIndexPath:(NSIndexPath *)newIndexPath
    - - - -
    -

    Parameters

    - - - - - - - - - - - - -
    indexPath

    The index path identifying the item to move.

    newIndexPath

    The index path that is the destination of the move for the item.

    -
    - - - - - - - -
    -

    Discussion

    -

    This method must be called from the main thread. The asyncDataSource must be updated to reflect the changes -before this method is called.

    -
    - - - - - - - -
    -

    Declared In

    -

    ASCollectionView.h

    -
    - - -
    -
    -
    - -

    – calculatedSizeForNodeAtIndexPath: -

    - -
    -
    - -
    - - -
    -

    Query the sized node at @c indexPath for its calculatedSize.

    -
    - - - -
    - (CGSize)calculatedSizeForNodeAtIndexPath:(NSIndexPath *)indexPath
    - - - -
    -

    Parameters

    - - - - - - - -
    indexPath

    The index path for the node of interest.

    - -

    This method is deprecated. Call @c calculatedSize on the node of interest instead. First deprecated in version 2.0.

    -
    - - - - - - - - - - - - - -
    -

    Declared In

    -

    ASCollectionView.h

    -
    - - -
    -
    -
    - -

    – visibleNodes -

    - -
    -
    - -
    - - -
    -

    Similar to -visibleCells.

    -
    - - - -
    - (NSArray<__kindofASCellNode*> *)visibleNodes
    - - - - - -
    -

    Return Value

    -

    an array containing the nodes being displayed on screen.

    -
    - - - - - - - - - - - -
    -

    Declared In

    -

    ASCollectionView.h

    -
    - - -
    -
    -
    - -

    – indexPathForNode: -

    - -
    -
    - -
    - - -
    -

    Similar to -indexPathForCell:.

    -
    - - - -
    - (nullable NSIndexPath *)indexPathForNode:(ASCellNode *)cellNode
    - - - -
    -

    Parameters

    - - - - - - - -
    cellNode

    a cellNode in the collection view

    -
    - - - -
    -

    Return Value

    -

    The index path for this cell node.

    -
    - - - - - -
    -

    Discussion

    -

    This index path returned by this method is in the view’s index space -and should only be used with @c ASCollectionView directly. To get an index path suitable -for use with your data source and @c ASCollectionNode, call @c indexPathForNode: on the -collection node instead.

    -
    - - - - - - - -
    -

    Declared In

    -

    ASCollectionView.h

    -
    - - -
    -
    -
    -
    - -
    - - - - - - -
    - -
    - -
    -
    -
    -
    - - - - \ No newline at end of file diff --git a/submodules/AsyncDisplayKit/docs/appledoc/Categories/ASControlNode+Debugging.html b/submodules/AsyncDisplayKit/docs/appledoc/Categories/ASControlNode+Debugging.html deleted file mode 100755 index 5f1703f06c..0000000000 --- a/submodules/AsyncDisplayKit/docs/appledoc/Categories/ASControlNode+Debugging.html +++ /dev/null @@ -1,187 +0,0 @@ - - - - - - ASControlNode(Debugging) Category Reference - - - - - - -
    -
    - -

    - -

    - -

    - AsyncDisplayKit -

    - -
    -
    - - - -
    -
    -
    -
    -

    ASControlNode(Debugging) Category Reference

    - - -
    - - - - -
    Declared inAsyncDisplayKit+Debug.h
    - - - - - - -
    - - - - - - -
    -
    - -

    + setEnableHitTestDebug: -

    - -
    -
    - -
    - - -
    -

    Class method to enable a visualization overlay of the tappable area on the ASControlNode. For app debugging purposes only. -NOTE: GESTURE RECOGNIZERS, (including tap gesture recognizers on a control node) WILL NOT BE VISUALIZED!!! -Overlay = translucent GREEN color, -edges that are clipped by the tappable area of any parent (their bounds + hitTestSlop) in the hierarchy = DARK GREEN BORDERED EDGE, -edges that are clipped by clipToBounds = YES of any parent in the hierarchy = ORANGE BORDERED EDGE (may still receive touches beyond -overlay rect, but can’t be visualized).

    -
    - - - -
    + (void)setEnableHitTestDebug:(BOOL)enable
    - - - -
    -

    Parameters

    - - - - - - - -
    enable

    Specify YES to make this debug feature enabled when messaging the ASControlNode class.

    -
    - - - - - - - - - - - - - -
    -

    Declared In

    -

    AsyncDisplayKit+Debug.h

    -
    - - -
    -
    -
    -
    - -
    - - - - - - -
    - -
    - -
    -
    -
    -
    - - - - \ No newline at end of file diff --git a/submodules/AsyncDisplayKit/docs/appledoc/Categories/ASControlNode+Subclassing.html b/submodules/AsyncDisplayKit/docs/appledoc/Categories/ASControlNode+Subclassing.html deleted file mode 100755 index cfff640cdc..0000000000 --- a/submodules/AsyncDisplayKit/docs/appledoc/Categories/ASControlNode+Subclassing.html +++ /dev/null @@ -1,497 +0,0 @@ - - - - - - ASControlNode(Subclassing) Category Reference - - - - - - -
    -
    - -

    - -

    - -

    - AsyncDisplayKit -

    - -
    -
    - - - -
    -
    -
    -
    -

    ASControlNode(Subclassing) Category Reference

    - - -
    - - - - -
    Declared inASControlNode+Subclasses.h
    - - - - -
    - -

    Overview

    -

    The subclass header ASControlNode+Subclasses defines methods to be -overridden by custom nodes that subclass ASControlNode.

    - -

    These methods should never be called directly by other classes.

    -
    - - - - - -
    - - - - - - -
    -
    - -

    – sendActionsForControlEvents:withEvent: -

    - -
    -
    - -
    - - -
    -

    Sends action messages for the given control events.

    -
    - - - -
    - (void)sendActionsForControlEvents:(ASControlNodeEvent)controlEvents withEvent:(nullable UIEvent *)touchEvent
    - - - -
    -

    Parameters

    - - - - - - - - - - - - -
    controlEvents

    A bitmask whose set flags specify the control events for which action messages are sent. See “Control Events” in ASControlNode.h for bitmask constants.

    touchEvent

    An event object encapsulating the information specific to the user event.

    -
    - - - - - - - -
    -

    Discussion

    -

    ASControlNode implements this method to send all action messages associated with controlEvents. The list of targets is constructed from prior invocations of addTarget:action:forControlEvents:.

    -
    - - - - - - - -
    -

    Declared In

    -

    ASControlNode+Subclasses.h

    -
    - - -
    -
    -
    - -

    – beginTrackingWithTouch:withEvent: -

    - -
    -
    - -
    - - -
    -

    Sent to the control when tracking begins.

    -
    - - - -
    - (BOOL)beginTrackingWithTouch:(UITouch *)touch withEvent:(nullable UIEvent *)touchEvent
    - - - -
    -

    Parameters

    - - - - - - - - - - - - -
    touch

    The touch on the receiving control.

    touchEvent

    An event object encapsulating the information specific to the user event.

    -
    - - - -
    -

    Return Value

    -

    YES if the receiver should respond continuously (respond when touch is dragged); NO otherwise.

    -
    - - - - - - - - - - - -
    -

    Declared In

    -

    ASControlNode+Subclasses.h

    -
    - - -
    -
    -
    - -

    – continueTrackingWithTouch:withEvent: -

    - -
    -
    - -
    - - -
    -

    Sent continuously to the control as it tracks a touch within the control’s bounds.

    -
    - - - -
    - (BOOL)continueTrackingWithTouch:(UITouch *)touch withEvent:(nullable UIEvent *)touchEvent
    - - - -
    -

    Parameters

    - - - - - - - - - - - - -
    touch

    The touch on the receiving control.

    touchEvent

    An event object encapsulating the information specific to the user event.

    -
    - - - -
    -

    Return Value

    -

    YES if touch tracking should continue; NO otherwise.

    -
    - - - - - - - - - - - -
    -

    Declared In

    -

    ASControlNode+Subclasses.h

    -
    - - -
    -
    -
    - -

    – cancelTrackingWithEvent: -

    - -
    -
    - -
    - - -
    -

    Sent to the control when tracking should be cancelled.

    -
    - - - -
    - (void)cancelTrackingWithEvent:(nullable UIEvent *)touchEvent
    - - - -
    -

    Parameters

    - - - - - - - -
    touchEvent

    An event object encapsulating the information specific to the user event. This parameter may be nil, indicating that the cancelation was caused by something other than an event, such as the display node being removed from its supernode.

    -
    - - - - - - - - - - - - - -
    -

    Declared In

    -

    ASControlNode+Subclasses.h

    -
    - - -
    -
    -
    - -

    – endTrackingWithTouch:withEvent: -

    - -
    -
    - -
    - - -
    -

    Sent to the control when the last touch completely ends, telling it to stop tracking.

    -
    - - - -
    - (void)endTrackingWithTouch:(nullable UITouch *)touch withEvent:(nullable UIEvent *)touchEvent
    - - - -
    -

    Parameters

    - - - - - - - - - - - - -
    touch

    The touch that ended.

    touchEvent

    An event object encapsulating the information specific to the user event.

    -
    - - - - - - - - - - - - - -
    -

    Declared In

    -

    ASControlNode+Subclasses.h

    -
    - - -
    -
    -
    - -

      highlighted -

    - -
    -
    - -
    - - -
    -

    Settable version of highlighted property.

    -
    - - - -
    @property (nonatomic, readwrite, assign, getter=isHighlighted) BOOL highlighted
    - - - - - - - - - - - - - - - -
    -

    Declared In

    -

    ASControlNode+Subclasses.h

    -
    - - -
    -
    -
    -
    - -
    - - - - - - -
    - -
    - -
    -
    -
    -
    - - - - \ No newline at end of file diff --git a/submodules/AsyncDisplayKit/docs/appledoc/Categories/ASDisplayNode+AutomaticSubnodeManagement.html b/submodules/AsyncDisplayKit/docs/appledoc/Categories/ASDisplayNode+AutomaticSubnodeManagement.html deleted file mode 100755 index d0bcbb6698..0000000000 --- a/submodules/AsyncDisplayKit/docs/appledoc/Categories/ASDisplayNode+AutomaticSubnodeManagement.html +++ /dev/null @@ -1,177 +0,0 @@ - - - - - - ASDisplayNode(AutomaticSubnodeManagement) Category Reference - - - - - - -
    -
    - -

    - -

    - -

    - AsyncDisplayKit -

    - -
    -
    - - - -
    -
    -
    -
    -

    ASDisplayNode(AutomaticSubnodeManagement) Category Reference

    - - -
    - - - - -
    Declared inASDisplayNode.h
    - - - - - - -
    - - - - - - -
    -
    - -

      automaticallyManagesSubnodes -

    - -
    -
    - -
    - - -
    -

    A boolean that shows whether the node automatically inserts and removes nodes based on the presence or -absence of the node and its subnodes is completely determined in its layoutSpecThatFits: method.

    -
    - - - -
    @property (nonatomic, assign) BOOL automaticallyManagesSubnodes
    - - - - - - - - - -
    -

    Discussion

    -

    If flag is YES the node no longer require addSubnode: or removeFromSupernode method calls. The presence -or absence of subnodes is completely determined in its layoutSpecThatFits: method.

    -
    - - - - - - - -
    -

    Declared In

    -

    ASDisplayNode.h

    -
    - - -
    -
    -
    -
    - -
    - - - - - - -
    - -
    - -
    -
    -
    -
    - - - - \ No newline at end of file diff --git a/submodules/AsyncDisplayKit/docs/appledoc/Categories/ASDisplayNode+Beta.html b/submodules/AsyncDisplayKit/docs/appledoc/Categories/ASDisplayNode+Beta.html deleted file mode 100755 index 3e7b7af638..0000000000 --- a/submodules/AsyncDisplayKit/docs/appledoc/Categories/ASDisplayNode+Beta.html +++ /dev/null @@ -1,635 +0,0 @@ - - - - - - ASDisplayNode(Beta) Category Reference - - - - - - -
    -
    - -

    - -

    - -

    - AsyncDisplayKit -

    - -
    -
    - - - -
    -
    -
    -
    -

    ASDisplayNode(Beta) Category Reference

    - - -
    - - - - -
    Declared inASDisplayNode+Beta.h
    - - - - - - -
    - - - - - - -
    -
    - -

    + suppressesInvalidCollectionUpdateExceptions -

    - -
    -
    - -
    - - -
    -

    ASTableView and ASCollectionView now throw exceptions on invalid updates -like their UIKit counterparts. If YES, these classes will log messages -on invalid updates rather than throwing exceptions.

    -
    - - - -
    + (BOOL)suppressesInvalidCollectionUpdateExceptions
    - - - - - - - - - -
    -

    Discussion

    -

    Note that even if AsyncDisplayKit’s exception is suppressed, the app may still crash -as it proceeds with an invalid update.

    - -

    This property defaults to NO. It will be removed in a future release.

    -
    - - - - - - - -
    -

    Declared In

    -

    ASDisplayNode+Beta.h

    -
    - - -
    -
    -
    - -

    – recursivelyEnsureDisplaySynchronously: -

    - -
    -
    - -
    - - -
    -

    Recursively ensures node and all subnodes are displayed.

    -
    - - - -
    - (void)recursivelyEnsureDisplaySynchronously:(BOOL)synchronously
    - - - - - - - - - - - - - - - -
    -

    Declared In

    -

    ASDisplayNode+Beta.h

    -
    - - -
    -
    -
    - -

      willDisplayNodeContentWithRenderingContext -

    - -
    -
    - -
    - - -
    -

    allow modification of a context before the node’s content is drawn

    -
    - - - -
    @property (nonatomic, copy, nullable) ASDisplayNodeContextModifier willDisplayNodeContentWithRenderingContext
    - - - - - - - - - -
    -

    Discussion

    -

    Set the block to be called after the context has been created and before the node’s content is drawn. -You can override this to modify the context before the content is drawn. You are responsible for saving and -restoring context if necessary. Restoring can be done in contextDidDisplayNodeContent -This block can be called from any thread and it is unsafe to access any UIKit main thread properties from it.

    -
    - - - - - - - -
    -

    Declared In

    -

    ASDisplayNode+Beta.h

    -
    - - -
    -
    -
    - -

      didDisplayNodeContentWithRenderingContext -

    - -
    -
    - -
    - - -
    -

    allow modification of a context after the node’s content is drawn

    -
    - - - -
    @property (nonatomic, copy, nullable) ASDisplayNodeContextModifier didDisplayNodeContentWithRenderingContext
    - - - - - - - - - - - - - - - -
    -

    Declared In

    -

    ASDisplayNode+Beta.h

    -
    - - -
    -
    -
    - -

      measurementOptions -

    - -
    -
    - -
    - - -
    -

    A bitmask representing which actions (layout spec, layout generation) should be measured.

    -
    - - - -
    @property (nonatomic, assign) ASDisplayNodePerformanceMeasurementOptions measurementOptions
    - - - - - - - - - - - - - - - -
    -

    Declared In

    -

    ASDisplayNode+Beta.h

    -
    - - -
    -
    -
    - -

      performanceMeasurements -

    - -
    -
    - -
    - - -
    -

    A simple struct representing performance measurements collected.

    -
    - - - -
    @property (nonatomic, assign, readonly) ASDisplayNodePerformanceMeasurements performanceMeasurements
    - - - - - - - - - - - - - - - -
    -

    Declared In

    -

    ASDisplayNode+Beta.h

    -
    - - -
    -
    -
    - -

    – placeholderShouldPersist -

    - -
    -
    - -
    - - -
    -

    Currently used by ASNetworkImageNode and ASMultiplexImageNode to allow their placeholders to stay if they are loading an image from the network. -Otherwise, a display pass is scheduled and completes, but does not actually draw anything - and ASDisplayNode considers the element finished.

    -
    - - - -
    - (BOOL)placeholderShouldPersist
    - - - - - - - - - - - - - - - -
    -

    Declared In

    -

    ASDisplayNode+Beta.h

    -
    - - -
    -
    -
    - -

    – hierarchyDisplayDidFinish -

    - -
    -
    - -
    - - -
    -

    Indicates that the receiver and all subnodes have finished displaying. May be called more than once, for example if the receiver has -a network image node. This is called after the first display pass even if network image nodes have not downloaded anything (text would be done, -and other nodes that are ready to do their final display). Each render of every progressive jpeg network node would cause this to be called, so -this hook could be called up to 1 + (pJPEGcount * pJPEGrenderCount) times. The render count depends on how many times the downloader calls the -progressImage block.

    -
    - - - -
    - (void)hierarchyDisplayDidFinish
    - - - - - - - - - - - - - - - -
    -

    Declared In

    -

    ASDisplayNode+Beta.h

    -
    - - -
    -
    -
    - -

    + setRangeModeForMemoryWarnings: -

    - -
    -
    - -
    - - -
    -

    Only ASLayoutRangeModeVisibleOnly or ASLayoutRangeModeLowMemory are recommended. Default is ASLayoutRangeModeVisibleOnly, -because this is the only way to ensure an application will not have blank / flashing views as the user navigates back after -a memory warning. Apps that wish to use the more effective / aggressive ASLayoutRangeModeLowMemory may need to take steps -to mitigate this behavior, including: restoring a larger range mode to the next controller before the user navigates there, -enabling .neverShowPlaceholders on ASCellNodes so that the navigation operation is blocked on redisplay completing, etc.

    -
    - - - -
    + (void)setRangeModeForMemoryWarnings:(ASLayoutRangeMode)rangeMode
    - - - - - - - - - - - - - - - -
    -

    Declared In

    -

    ASDisplayNode+Beta.h

    -
    - - -
    -
    -
    - -

    – _logEventWithBacktrace:format: -

    - -
    -
    - -
    - - -
    -

    The primitive event tracing method. You shouldn’t call this. Use the ASDisplayNodeLogEvent macro instead.

    -
    - - - -
    - (void)_logEventWithBacktrace:(NSArray<NSString*> *)backtrace format:(NSString *)format, ...
    - - - - - - - - - - - - - - - -
    -

    Declared In

    -

    ASDisplayNode+Beta.h

    -
    - - -
    -
    -
    - -

      eventLog -

    - -
    -
    - -
    - - -
    -

    The most recent trace events for this node. Max count is ASDISPLAYNODE_EVENTLOG_CAPACITY.

    -
    - - - -
    @property (readonly, copy) NSArray *eventLog
    - - - - - - - - - - - - - - - -
    -

    Declared In

    -

    ASDisplayNode+Beta.h

    -
    - - -
    -
    -
    -
    - -
    - - - - - - -
    - -
    - -
    -
    -
    -
    - - - - \ No newline at end of file diff --git a/submodules/AsyncDisplayKit/docs/appledoc/Categories/ASDisplayNode+Debugging.html b/submodules/AsyncDisplayKit/docs/appledoc/Categories/ASDisplayNode+Debugging.html deleted file mode 100755 index 33e97cf949..0000000000 --- a/submodules/AsyncDisplayKit/docs/appledoc/Categories/ASDisplayNode+Debugging.html +++ /dev/null @@ -1,188 +0,0 @@ - - - - - - ASDisplayNode(Debugging) Category Reference - - - - - - -
    -
    - -

    - -

    - -

    - AsyncDisplayKit -

    - -
    -
    - - - -
    -
    -
    -
    -

    ASDisplayNode(Debugging) Category Reference

    - - -
    - - - - - - - -
    Conforms toASLayoutElementAsciiArtProtocol
    Declared inASDisplayNode.h
    - - - - -
    - -

    Overview

    -

    Convenience methods for debugging.

    -
    - - - - - -
    - - - - - - -
    -
    - -

    – displayNodeRecursiveDescription -

    - -
    -
    - -
    - - -
    -

    Return a description of the node hierarchy.

    -
    - - - -
    - (NSString *)displayNodeRecursiveDescription
    - - - - - - - - - -
    -

    Discussion

    -

    For debugging: (lldb) po [node displayNodeRecursiveDescription]

    -
    - - - - - - - -
    -

    Declared In

    -

    ASDisplayNode.h

    -
    - - -
    -
    -
    -
    - -
    - - - - - - -
    - -
    - -
    -
    -
    -
    - - - - \ No newline at end of file diff --git a/submodules/AsyncDisplayKit/docs/appledoc/Categories/ASDisplayNode+Deprecated.html b/submodules/AsyncDisplayKit/docs/appledoc/Categories/ASDisplayNode+Deprecated.html deleted file mode 100755 index 5eb821eb29..0000000000 --- a/submodules/AsyncDisplayKit/docs/appledoc/Categories/ASDisplayNode+Deprecated.html +++ /dev/null @@ -1,487 +0,0 @@ - - - - - - ASDisplayNode(Deprecated) Category Reference - - - - - - -
    -
    - -

    - -

    - -

    - AsyncDisplayKit -

    - -
    -
    - - - -
    -
    -
    -
    -

    ASDisplayNode(Deprecated) Category Reference

    - - -
    - - - - -
    Declared inASDisplayNode+Deprecated.h
    - - - - - - -
    - - - - - - -
    -
    - -

      ) -

    - -
    -
    - -
    - - -
    -

    The name of this node, which will be displayed in description. The default value is nil. (Deprecated: Deprecated in version 2.0: Use .debugName instead. This value will display in -results of the -asciiArtString method (@see ASLayoutElementAsciiArtProtocol).)

    -
    - - - -
    @property (nullable, nonatomic, copy) NSString *ASDISPLAYNODE_DEPRECATED_MSG ( "Use .debugName instead." )
    - - - - - - - - - - - - - - - -
    -

    Declared In

    -

    ASDisplayNode+Deprecated.h

    -
    - - -
    -
    -
    - -

    – measure: -

    - -
    -
    - -
    - - -
    -

    Asks the node to measure and return the size that best fits its subnodes. (Deprecated: Deprecated in version 2.0: Use layoutThatFits: with a constrained size of (CGSizeZero, constrainedSize) and call size on the returned ASLayout)

    -
    - - - -
    - (CGSize)measure:(CGSize)constrainedSize
    - - - -
    -

    Parameters

    - - - - - - - -
    constrainedSize

    The maximum size the receiver should fit in.

    -
    - - - -
    -

    Return Value

    -

    A new size that fits the receiver’s subviews.

    -
    - - - - - -
    -

    Discussion

    -

    Though this method does not set the bounds of the view, it does have side effects–caching both the -constraint and the result.

    Warning: Subclasses must not override this; it calls -measureWithSizeRange: with zero min size. --measureWithSizeRange: caches results from -calculateLayoutThatFits:. Calling this method may -be expensive if result is not cached.

    -
    - - - - - - - - - -
    -

    Declared In

    -

    ASDisplayNode+Deprecated.h

    -
    - - -
    -
    -
    - -

    – visibilityDidChange: -

    - -
    -
    - -
    - - -
    -

    Called whenever the visiblity of the node changed. (Deprecated: @see didEnterVisibleState @see didExitVisibleState)

    -
    - - - -
    - (void)visibilityDidChange:(BOOL)isVisible
    - - - - - - - - - -
    -

    Discussion

    -

    Subclasses may use this to monitor when they become visible.

    -
    - - - - - - - -
    -

    Declared In

    -

    ASDisplayNode+Deprecated.h

    -
    - - -
    -
    -
    - -

    – visibleStateDidChange: -

    - -
    -
    - -
    - - -
    -

    Called whenever the visiblity of the node changed. (Deprecated: @see didEnterVisibleState @see didExitVisibleState)

    -
    - - - -
    - (void)visibleStateDidChange:(BOOL)isVisible
    - - - - - - - - - -
    -

    Discussion

    -

    Subclasses may use this to monitor when they become visible.

    -
    - - - - - - - -
    -

    Declared In

    -

    ASDisplayNode+Deprecated.h

    -
    - - -
    -
    -
    - -

    – displayStateDidChange: -

    - -
    -
    - -
    - - -
    -

    Called whenever the the node has entered or exited the display state. (Deprecated: @see didEnterDisplayState @see didExitDisplayState)

    -
    - - - -
    - (void)displayStateDidChange:(BOOL)inDisplayState
    - - - - - - - - - -
    -

    Discussion

    -

    Subclasses may use this to monitor when a node should be rendering its content.

    Note: This method can be called from any thread and should therefore be thread safe.

    -
    - - - - - - - -
    -

    Declared In

    -

    ASDisplayNode+Deprecated.h

    -
    - - -
    -
    -
    - -

    – loadStateDidChange: -

    - -
    -
    - -
    - - -
    -

    Called whenever the the node has entered or left the load state. (Deprecated: @see didEnterPreloadState @see didExitPreloadState)

    -
    - - - -
    - (void)loadStateDidChange:(BOOL)inLoadState
    - - - - - - - - - -
    -

    Discussion

    -

    Subclasses may use this to monitor data for a node should be loaded, either from a local or remote source.

    Note: This method can be called from any thread and should therefore be thread safe.

    -
    - - - - - - - -
    -

    Declared In

    -

    ASDisplayNode+Deprecated.h

    -
    - - -
    -
    -
    - -

    – cancelLayoutTransitionsInProgress -

    - -
    -
    - -
    - - -
    -

    Cancels all performing layout transitions. Can be called on any thread. (Deprecated: Deprecated in version 2.0: Use cancelLayoutTransition)

    -
    - - - -
    - (void)cancelLayoutTransitionsInProgress
    - - - - - - - - - - - - - - - -
    -

    Declared In

    -

    ASDisplayNode+Deprecated.h

    -
    - - -
    -
    -
    -
    - -
    - - - - - - -
    - -
    - -
    -
    -
    -
    - - - - \ No newline at end of file diff --git a/submodules/AsyncDisplayKit/docs/appledoc/Categories/ASDisplayNode+LayoutTransitioning.html b/submodules/AsyncDisplayKit/docs/appledoc/Categories/ASDisplayNode+LayoutTransitioning.html deleted file mode 100755 index 986923fb2a..0000000000 --- a/submodules/AsyncDisplayKit/docs/appledoc/Categories/ASDisplayNode+LayoutTransitioning.html +++ /dev/null @@ -1,560 +0,0 @@ - - - - - - ASDisplayNode(LayoutTransitioning) Category Reference - - - - - - -
    -
    - -

    - -

    - -

    - AsyncDisplayKit -

    - -
    -
    - - - -
    -
    -
    -
    -

    ASDisplayNode(LayoutTransitioning) Category Reference

    - - -
    - - - - -
    Declared inASDisplayNode.h
    - - - - - - -
    - - - - - - -
    -
    - -

      defaultLayoutTransitionDuration -

    - -
    -
    - -
    - - -
    -

    The amount of time it takes to complete the default transition animation. Default is 0.2.

    -
    - - - -
    @property (nonatomic, assign) NSTimeInterval defaultLayoutTransitionDuration
    - - - - - - - - - - - - - - - -
    -

    Declared In

    -

    ASDisplayNode.h

    -
    - - -
    -
    -
    - -

      defaultLayoutTransitionDelay -

    - -
    -
    - -
    - - -
    -

    The amount of time (measured in seconds) to wait before beginning the default transition animation. -Default is 0.0.

    -
    - - - -
    @property (nonatomic, assign) NSTimeInterval defaultLayoutTransitionDelay
    - - - - - - - - - - - - - - - -
    -

    Declared In

    -

    ASDisplayNode.h

    -
    - - -
    -
    -
    - -

      defaultLayoutTransitionOptions -

    - -
    -
    - -
    - - -
    -

    A mask of options indicating how you want to perform the default transition animations. -For a list of valid constants, see UIViewAnimationOptions.

    -
    - - - -
    @property (nonatomic, assign) UIViewAnimationOptions defaultLayoutTransitionOptions
    - - - - - - - - - - - - - - - -
    -

    Declared In

    -

    ASDisplayNode.h

    -
    - - -
    -
    -
    - -

    – animateLayoutTransition: -

    - -
    -
    - -
    - - -
    -

    A place to perform your animation. New nodes have been inserted here. You can also use this time to re-order the hierarchy.

    -
    - - - -
    - (void)animateLayoutTransition:(nonnull id<ASContextTransitioning>)context
    - - - - - - - - - -
    -

    Discussion

    -

    A place to perform your animation. New nodes have been inserted here. You can also use this time to re-order the hierarchy.

    -
    - - - - - - - -
    -

    Declared In

    -

    ASDisplayNode.h

    -
    - - -
    -
    -
    - -

    – didCompleteLayoutTransition: -

    - -
    -
    - -
    - - -
    -

    A place to clean up your nodes after the transition

    -
    - - - -
    - (void)didCompleteLayoutTransition:(nonnull id<ASContextTransitioning>)context
    - - - - - - - - - -
    -

    Discussion

    -

    A place to clean up your nodes after the transition

    -
    - - - - - - - -
    -

    Declared In

    -

    ASDisplayNode.h

    -
    - - -
    -
    -
    - -

    – transitionLayoutWithSizeRange:animated:shouldMeasureAsync:measurementCompletion: -

    - -
    -
    - -
    - - -
    -

    Transitions the current layout with a new constrained size. Must be called on main thread.

    -
    - - - -
    - (void)transitionLayoutWithSizeRange:(ASSizeRange)constrainedSize animated:(BOOL)animated shouldMeasureAsync:(BOOL)shouldMeasureAsync measurementCompletion:(nullable void ( ^ ) ( ))completion
    - - - -
    -

    Parameters

    - - - - - - - - - - - - - - - - - -
    animated

    Animation is optional, but will still proceed through your animateLayoutTransition implementation with isAnimated == NO.

    shouldMeasureAsync

    Measure the layout asynchronously.

    measurementCompletion

    Optional completion block called only if a new layout is calculated. -It is called on main, right after the measurement and before -animateLayoutTransition:.

    -
    - - - - - - - -
    -

    Discussion

    -

    If the passed constrainedSize is the the same as the node’s current constrained size, this method is noop. If passed YES to shouldMeasureAsync it’s guaranteed that measurement is happening on a background thread, otherwise measaurement will happen on the thread that the method was called on. The measurementCompletion callback is always called on the main thread right after the measurement and before -animateLayoutTransition:.

    -
    - - - - - -
    -

    See Also

    - -
    - - - -
    -

    Declared In

    -

    ASDisplayNode.h

    -
    - - -
    -
    -
    - -

    – transitionLayoutWithAnimation:shouldMeasureAsync:measurementCompletion: -

    - -
    -
    - -
    - - -
    -

    Invalidates the current layout and begins a relayout of the node with the current constrainedSize. Must be called on main thread.

    -
    - - - -
    - (void)transitionLayoutWithAnimation:(BOOL)animated shouldMeasureAsync:(BOOL)shouldMeasureAsync measurementCompletion:(nullable void ( ^ ) ( ))completion
    - - - -
    -

    Parameters

    - - - - - - - - - - - - - - - - - -
    animated

    Animation is optional, but will still proceed through your animateLayoutTransition implementation with isAnimated == NO.

    shouldMeasureAsync

    Measure the layout asynchronously.

    measurementCompletion

    Optional completion block called only if a new layout is calculated.

    -
    - - - - - - - -
    -

    Discussion

    -

    It is called right after the measurement and before -animateLayoutTransition:.

    -
    - - - - - -
    -

    See Also

    - -
    - - - -
    -

    Declared In

    -

    ASDisplayNode.h

    -
    - - -
    -
    -
    - -

    – cancelLayoutTransition -

    - -
    -
    - -
    - - -
    -

    Cancels all performing layout transitions. Can be called on any thread.

    -
    - - - -
    - (void)cancelLayoutTransition
    - - - - - - - - - - - - - - - -
    -

    Declared In

    -

    ASDisplayNode.h

    -
    - - -
    -
    -
    -
    - -
    - - - - - - -
    - -
    - -
    -
    -
    -
    - - - - \ No newline at end of file diff --git a/submodules/AsyncDisplayKit/docs/appledoc/Categories/ASDisplayNode+Subclassing.html b/submodules/AsyncDisplayKit/docs/appledoc/Categories/ASDisplayNode+Subclassing.html deleted file mode 100755 index f8844132c0..0000000000 --- a/submodules/AsyncDisplayKit/docs/appledoc/Categories/ASDisplayNode+Subclassing.html +++ /dev/null @@ -1,2562 +0,0 @@ - - - - - - ASDisplayNode(Subclassing) Category Reference - - - - - - -
    -
    - -

    - -

    - -

    - AsyncDisplayKit -

    - -
    -
    - - - -
    -
    -
    -
    -

    ASDisplayNode(Subclassing) Category Reference

    - - -
    - - - - -
    Declared inASDisplayNode+Subclasses.h
    - - - - -
    - -

    Overview

    -

    The subclass header ASDisplayNode+Subclasses defines the following methods that either must or can be overriden by -subclasses of ASDisplayNode.

    - -

    These methods should never be called directly by other classes.

    - -

    Drawing

    - -

    Implement one of +displayWithParameters:isCancelled: or +drawRect:withParameters:isCancelled: to provide -drawing for your node.

    - -

    Use -drawParametersForAsyncLayer: to copy any properties that are involved in drawing into an immutable object for -use on the display queue. The display and drawRect implementations MUST be thread-safe, as they can be called on -the displayQueue (asynchronously) or the main thread (synchronously/displayImmediately).

    - -

    Class methods that require passing in copies of the values are used to minimize the need for locking around instance -variable access, and the possibility of the asynchronous display pass grabbing an inconsistent state across multiple -variables.

    -
    - - - - - -
    - - - - -

    Properties

    - -
    -
    - -

      calculatedLayout -

    - -
    -
    - -
    - - -
    -

    Return the calculated layout.

    -
    - - - -
    @property (nullable, nonatomic, readonly, assign) ASLayout *calculatedLayout
    - - - - - -
    -

    Return Value

    -

    Layout that wraps calculated size returned by -calculateSizeThatFits: (in manual layout mode), -or layout already calculated from layout spec returned by -layoutSpecThatFits: (in automatic layout mode).

    -
    - - - - - -
    -

    Discussion

    -

    For node subclasses that implement manual layout (e.g., they have a custom -layout method), -calculatedLayout may be accessed on subnodes to retrieved cached information about their size. -This allows -layout to be very fast, saving time on the main thread. -Note: .calculatedLayout will only be set for nodes that have had -measure: called on them. -For manual layout, make sure you call -measure: in your implementation of -calculateSizeThatFits:.

    - -

    For node subclasses that use automatic layout (e.g., they implement -layoutSpecThatFits:), -it is typically not necessary to use .calculatedLayout at any point. For these nodes, -the ASLayoutSpec implementation will automatically call -measureWithSizeRange: on all of the subnodes, -and the ASDisplayNode base class implementation of -layout will automatically make use of .calculatedLayout on the subnodes.

    Warning: Subclasses must not override this; it returns the last cached layout and is never expensive.

    -
    - - - - - - - -
    -

    Declared In

    -

    ASDisplayNode+Subclasses.h

    -
    - - -
    -
    -
    -
    - - - -

    View Lifecycle

    - -
    -
    - -

    – didLoad -

    - -
    -
    - -
    - - -
    -

    Called on the main thread immediately after self.view is created.

    -
    - - - -
    - (void)didLoad
    - - - - - - - - - -
    -

    Discussion

    -

    This is the best time to add gesture recognizers to the view.

    -
    - - - - - - - -
    -

    Declared In

    -

    ASDisplayNode+Subclasses.h

    -
    - - -
    -
    -
    -
    - - - -

    Layout

    - -
    -
    - -

    – layout -

    - -
    -
    - -
    - - -
    -

    Called on the main thread by the view’s -layoutSubviews.

    -
    - - - -
    - (void)layout
    - - - - - - - - - -
    -

    Discussion

    -

    Subclasses override this method to layout all subnodes or subviews.

    -
    - - - - - - - -
    -

    Declared In

    -

    ASDisplayNode+Subclasses.h

    -
    - - -
    -
    -
    - -

    – layoutDidFinish -

    - -
    -
    - -
    - - -
    -

    Called on the main thread by the view’s -layoutSubviews, after -layout.

    -
    - - - -
    - (void)layoutDidFinish
    - - - - - - - - - -
    -

    Discussion

    -

    Gives a chance for subclasses to perform actions after the subclass and superclass have finished laying -out.

    -
    - - - - - - - -
    -

    Declared In

    -

    ASDisplayNode+Subclasses.h

    -
    - - -
    -
    -
    - -

    – calculatedLayoutDidChange -

    - -
    -
    - -
    - - -
    -

    Called on a background thread if !isNodeLoaded - called on the main thread if isNodeLoaded.

    -
    - - - -
    - (void)calculatedLayoutDidChange
    - - - - - - - - - -
    -

    Discussion

    -

    When the .calculatedLayout property is set to a new ASLayout (directly from -calculateLayoutThatFits: or -calculated via use of -layoutSpecThatFits:), subclasses may inspect it here.

    -
    - - - - - - - -
    -

    Declared In

    -

    ASDisplayNode+Subclasses.h

    -
    - - -
    -
    -
    -
    - - - -

    Layout calculation

    - -
    -
    - -

    – calculateLayoutThatFits: -

    - -
    -
    - -
    - - -
    -

    Calculate a layout based on given size range.

    -
    - - - -
    - (ASLayout *)calculateLayoutThatFits:(ASSizeRange)constrainedSize
    - - - -
    -

    Parameters

    - - - - - - - -
    constrainedSize

    The minimum and maximum sizes the receiver should fit in.

    -
    - - - -
    -

    Return Value

    -

    An ASLayout instance defining the layout of the receiver (and its children, if the box layout model is used).

    -
    - - - - - -
    -

    Discussion

    -

    This method is called on a non-main thread. The default implementation calls either -layoutSpecThatFits: -or -calculateSizeThatFits:, whichever method is overriden. Subclasses rarely need to override this method, -override -layoutSpecThatFits: or -calculateSizeThatFits: instead.

    Note: This method should not be called directly outside of ASDisplayNode; use -measure: or -calculatedLayout instead.

    -
    - - - - - - - -
    -

    Declared In

    -

    ASDisplayNode+Subclasses.h

    -
    - - -
    -
    -
    - -

    – calculateLayoutThatFits:restrictedToSize:relativeToParentSize: -

    - -
    -
    - -
    - - -
    -

    ASDisplayNode’s implementation of -layoutThatFits:parentSize: calls this method to resolve the node’s size -against parentSize, intersect it with constrainedSize, and call -calculateLayoutThatFits: with the result.

    -
    - - - -
    - (ASLayout *)calculateLayoutThatFits:(ASSizeRange)constrainedSize restrictedToSize:(ASLayoutElementSize)size relativeToParentSize:(CGSize)parentSize
    - - - - - - - - - -
    -

    Discussion

    -

    In certain advanced cases, you may want to customize this logic. Overriding this method allows you to receive all -three parameters and do the computation yourself.

    Warning: Overriding this method should be done VERY rarely.

    -
    - - - - - - - -
    -

    Declared In

    -

    ASDisplayNode+Subclasses.h

    -
    - - -
    -
    -
    - -

    – calculateSizeThatFits: -

    - -
    -
    - -
    - - -
    -

    Return the calculated size.

    -
    - - - -
    - (CGSize)calculateSizeThatFits:(CGSize)constrainedSize
    - - - -
    -

    Parameters

    - - - - - - - -
    constrainedSize

    The maximum size the receiver should fit in.

    -
    - - - - - - - -
    -

    Discussion

    -

    Subclasses that override should expect this method to be called on a non-main thread. The returned size -is wrapped in an ASLayout and cached for quick access during -layout. Other expensive work that needs to -be done before display can be performed here, and using ivars to cache any valuable intermediate results is -encouraged.

    Note: Subclasses that override are committed to manual layout. Therefore, -layout: must be overriden to layout all subnodes or subviews.

    Note: This method should not be called directly outside of ASDisplayNode; use -layoutThatFits: or layoutThatFits:parentSize: instead.

    -
    - - - - - - - -
    -

    Declared In

    -

    ASDisplayNode+Subclasses.h

    -
    - - -
    -
    -
    - -

    – layoutSpecThatFits: -

    - -
    -
    - -
    - - -
    -

    Return a layout spec that describes the layout of the receiver and its children.

    -
    - - - -
    - (ASLayoutSpec *)layoutSpecThatFits:(ASSizeRange)constrainedSize
    - - - -
    -

    Parameters

    - - - - - - - -
    constrainedSize

    The minimum and maximum sizes the receiver should fit in.

    -
    - - - - - - - -
    -

    Discussion

    -

    Subclasses that override should expect this method to be called on a non-main thread. The returned layout spec -is used to calculate an ASLayout and cached by ASDisplayNode for quick access during -layout. Other expensive work that needs to -be done before display can be performed here, and using ivars to cache any valuable intermediate results is -encouraged.

    Note: This method should not be called directly outside of ASDisplayNode; use -measure: or -calculatedLayout instead.

    Warning: Subclasses that implement -layoutSpecThatFits: must not use .layoutSpecBlock. Doing so will trigger an -exception. A future version of the framework may support using both, calling them serially, with the .layoutSpecBlock -superseding any values set by the method override.

    -
    - - - - - - - -
    -

    Declared In

    -

    ASDisplayNode+Subclasses.h

    -
    - - -
    -
    -
    - -

    – invalidateCalculatedLayout -

    - -
    -
    - -
    - - -
    -

    Invalidate previously measured and cached layout.

    -
    - - - -
    - (void)invalidateCalculatedLayout
    - - - - - - - - - -
    -

    Discussion

    -

    Subclasses should call this method to invalidate the previously measured and cached layout for the display -node, when the contents of the node change in such a way as to require measuring it again.

    -
    - - - - - - - -
    -

    Declared In

    -

    ASDisplayNode+Subclasses.h

    -
    - - -
    -
    -
    -
    - - - -

    Drawing

    - -
    -
    - -

    + drawRect:withParameters:isCancelled:isRasterizing: -

    - -
    -
    - -
    - - -
    -

    @summary Delegate method to draw layer contents into a CGBitmapContext. The current UIGraphics context will be set -to an appropriate context.

    -
    - - - -
    + (void)drawRect:(CGRect)bounds withParameters:(nullable id<NSObject>)parameters isCancelled:(asdisplaynode_iscancelled_block_t)isCancelledBlock isRasterizing:(BOOL)isRasterizing
    - - - -
    -

    Parameters

    - - - - - - - - - - - - - - - - - - - - - - -
    bounds

    Region to draw in.

    parameters

    An object describing all of the properties you need to draw. Return this from --drawParametersForAsyncLayer:

    isCancelledBlock

    Execute this block to check whether the current drawing operation has been cancelled to avoid -unnecessary work. A return value of YES means cancel drawing and return.

    isRasterizing

    YES if the layer is being rasterized into another layer, in which case drawRect: probably wants -to avoid doing things like filling its bounds with a zero-alpha color to clear the backing store.

    -
    - - - - - - - -
    -

    Discussion

    -

    Note: Called on the display queue and/or main queue (MUST BE THREAD SAFE)

    -
    - - - - - - - -
    -

    Declared In

    -

    ASDisplayNode+Subclasses.h

    -
    - - -
    -
    -
    - -

    + displayWithParameters:isCancelled: -

    - -
    -
    - -
    - - -
    -

    @summary Delegate override to provide new layer contents as a UIImage.

    -
    - - - -
    + (nullable UIImage *)displayWithParameters:(nullable id<NSObject>)parameters isCancelled:(asdisplaynode_iscancelled_block_t)isCancelledBlock
    - - - -
    -

    Parameters

    - - - - - - - - - - - - -
    parameters

    An object describing all of the properties you need to draw. Return this from --drawParametersForAsyncLayer:

    isCancelledBlock

    Execute this block to check whether the current drawing operation has been cancelled to avoid -unnecessary work. A return value of YES means cancel drawing and return.

    -
    - - - -
    -

    Return Value

    -

    A UIImage with contents that are ready to display on the main thread. Make sure that the image is already -decoded before returning it here.

    -
    - - - - - -
    -

    Discussion

    -

    Note: Called on the display queue and/or main queue (MUST BE THREAD SAFE)

    -
    - - - - - - - -
    -

    Declared In

    -

    ASDisplayNode+Subclasses.h

    -
    - - -
    -
    -
    - -

    – drawParametersForAsyncLayer: -

    - -
    -
    - -
    - - -
    -

    Delegate override for drawParameters

    -
    - - - -
    - (nullable id<NSObject>)drawParametersForAsyncLayer:(_ASDisplayLayer *)layer
    - - - -
    -

    Parameters

    - - - - - - - -
    layer

    The layer that will be drawn into.

    -
    - - - - - - - -
    -

    Discussion

    -

    Note: Called on the main thread only

    -
    - - - - - - - -
    -

    Declared In

    -

    ASDisplayNode+Subclasses.h

    -
    - - -
    -
    -
    - -

    – displayWillStart -

    - -
    -
    - -
    - - -
    -

    Indicates that the receiver is about to display.

    -
    - - - -
    - (void)displayWillStart
    - - - - - - - - - -
    -

    Discussion

    -

    Subclasses may override this method to be notified when display (asynchronous or synchronous) is -about to begin.

    Note: Called on the main thread only

    -
    - - - - - - - -
    -

    Declared In

    -

    ASDisplayNode+Subclasses.h

    -
    - - -
    -
    -
    - -

    – displayDidFinish -

    - -
    -
    - -
    - - -
    -

    Indicates that the receiver has finished displaying.

    -
    - - - -
    - (void)displayDidFinish
    - - - - - - - - - -
    -

    Discussion

    -

    Subclasses may override this method to be notified when display (asynchronous or synchronous) has -completed.

    Note: Called on the main thread only

    -
    - - - - - - - -
    -

    Declared In

    -

    ASDisplayNode+Subclasses.h

    -
    - - -
    -
    -
    -
    - - - -

    Observing node-related changes

    - -
    -
    - -

    – interfaceStateDidChange:fromState: -

    - -
    -
    - -
    - - -
    -

    Called whenever any bit in the ASInterfaceState bitfield is changed.

    -
    - - - -
    - (void)interfaceStateDidChange:(ASInterfaceState)newState fromState:(ASInterfaceState)oldState
    - - - - - - - - - -
    -

    Discussion

    -

    Subclasses may use this to monitor when they become visible, should free cached data, and much more.

    -
    - - - - - -
    -

    See Also

    - -
    - - - -
    -

    Declared In

    -

    ASDisplayNode+Subclasses.h

    -
    - - -
    -
    -
    - -

    – didEnterVisibleState -

    - -
    -
    - -
    - - -
    -

    Called whenever the node becomes visible.

    -
    - - - -
    - (void)didEnterVisibleState
    - - - - - - - - - -
    -

    Discussion

    -

    Subclasses may use this to monitor when they become visible.

    Note: This method is guaranteed to be called on main.

    -
    - - - - - - - -
    -

    Declared In

    -

    ASDisplayNode+Subclasses.h

    -
    - - -
    -
    -
    - -

    – didExitVisibleState -

    - -
    -
    - -
    - - -
    -

    Called whenever the node is no longer visible.

    -
    - - - -
    - (void)didExitVisibleState
    - - - - - - - - - -
    -

    Discussion

    -

    Subclasses may use this to monitor when they are no longer visible.

    Note: This method is guaranteed to be called on main.

    -
    - - - - - - - -
    -

    Declared In

    -

    ASDisplayNode+Subclasses.h

    -
    - - -
    -
    -
    - -

    – didEnterDisplayState -

    - -
    -
    - -
    - - -
    -

    Called whenever the the node has entered the display state.

    -
    - - - -
    - (void)didEnterDisplayState
    - - - - - - - - - -
    -

    Discussion

    -

    Subclasses may use this to monitor when a node should be rendering its content.

    Note: This method is guaranteed to be called on main.

    -
    - - - - - - - -
    -

    Declared In

    -

    ASDisplayNode+Subclasses.h

    -
    - - -
    -
    -
    - -

    – didExitDisplayState -

    - -
    -
    - -
    - - -
    -

    Called whenever the the node has exited the display state.

    -
    - - - -
    - (void)didExitDisplayState
    - - - - - - - - - -
    -

    Discussion

    -

    Subclasses may use this to monitor when a node should no longer be rendering its content.

    Note: This method is guaranteed to be called on main.

    -
    - - - - - - - -
    -

    Declared In

    -

    ASDisplayNode+Subclasses.h

    -
    - - -
    -
    -
    - -

    – didEnterPreloadState -

    - -
    -
    - -
    - - -
    -

    Called whenever the the node has entered the preload state.

    -
    - - - -
    - (void)didEnterPreloadState
    - - - - - - - - - -
    -

    Discussion

    -

    Subclasses may use this to monitor data for a node should be preloaded, either from a local or remote source.

    Note: This method is guaranteed to be called on main.

    -
    - - - - - - - -
    -

    Declared In

    -

    ASDisplayNode+Subclasses.h

    -
    - - -
    -
    -
    - -

    – didExitPreloadState -

    - -
    -
    - -
    - - -
    -

    Called whenever the the node has exited the preload state.

    -
    - - - -
    - (void)didExitPreloadState
    - - - - - - - - - -
    -

    Discussion

    -

    Subclasses may use this to monitor whether preloading data for a node should be canceled.

    Note: This method is guaranteed to be called on main.

    -
    - - - - - - - -
    -

    Declared In

    -

    ASDisplayNode+Subclasses.h

    -
    - - -
    -
    -
    - -

    – willEnterHierarchy -

    - -
    -
    - -
    - - -
    -

    Called just before the view is added to a window.

    -
    - - - -
    - (void)willEnterHierarchy
    - - - - - - - - - - - - - - - -
    -

    Declared In

    -

    ASDisplayNode+Subclasses.h

    -
    - - -
    -
    -
    - -

    – didExitHierarchy -

    - -
    -
    - -
    - - -
    -

    Called after the view is removed from the window.

    -
    - - - -
    - (void)didExitHierarchy
    - - - - - - - - - - - - - - - -
    -

    Declared In

    -

    ASDisplayNode+Subclasses.h

    -
    - - -
    -
    -
    - -

      inHierarchy -

    - -
    -
    - -
    - - -
    -

    Whether the view or layer of this display node is currently in a window

    -
    - - - -
    @property (nonatomic, readonly, assign, getter=isInHierarchy) BOOL inHierarchy
    - - - - - - - - - - - - - - - -
    -

    Declared In

    -

    ASDisplayNode+Subclasses.h

    -
    - - -
    -
    -
    - -

    – fetchData -

    - -
    -
    - -
    - - -
    -

    Indicates that the node should fetch any external data, such as images.

    -
    - - - -
    - (void)fetchData
    - - - - - - - - - -
    -

    Discussion

    -

    Subclasses may override this method to be notified when they should begin to fetch data. Fetching -should be done asynchronously. The node is also responsible for managing the memory of any data. -The data may be remote and accessed via the network, but could also be a local database query.

    -
    - - - - - - - -
    -

    Declared In

    -

    ASDisplayNode+Subclasses.h

    -
    - - -
    -
    -
    - -

    – clearFetchedData -

    - -
    -
    - -
    - - -
    -

    Provides an opportunity to clear any fetched data (e.g. remote / network or database-queried) on the current node.

    -
    - - - -
    - (void)clearFetchedData
    - - - - - - - - - -
    -

    Discussion

    -

    This will not clear data recursively for all subnodes. Either call -recursivelyClearFetchedData or -selectively clear fetched data.

    -
    - - - - - - - -
    -

    Declared In

    -

    ASDisplayNode+Subclasses.h

    -
    - - -
    -
    -
    - -

    – clearContents -

    - -
    -
    - -
    - - -
    -

    Provides an opportunity to clear backing store and other memory-intensive intermediates, such as text layout managers -on the current node.

    -
    - - - -
    - (void)clearContents
    - - - - - - - - - -
    -

    Discussion

    -

    Called by -recursivelyClearContents. Base class implements self.contents = nil, clearing any backing -store, for asynchronous regeneration when needed.

    -
    - - - - - - - -
    -

    Declared In

    -

    ASDisplayNode+Subclasses.h

    -
    - - -
    -
    -
    - -

    – subnodeDisplayWillStart: -

    - -
    -
    - -
    - - -
    -

    Indicates that the receiver is about to display its subnodes. This method is not called if there are no -subnodes present.

    -
    - - - -
    - (void)subnodeDisplayWillStart:(ASDisplayNode *)subnode
    - - - -
    -

    Parameters

    - - - - - - - -
    subnode

    The subnode of which display is about to begin.

    -
    - - - - - - - -
    -

    Discussion

    -

    Subclasses may override this method to be notified when subnode display (asynchronous or synchronous) is -about to begin.

    -
    - - - - - - - -
    -

    Declared In

    -

    ASDisplayNode+Subclasses.h

    -
    - - -
    -
    -
    - -

    – subnodeDisplayDidFinish: -

    - -
    -
    - -
    - - -
    -

    Indicates that the receiver is finished displaying its subnodes. This method is not called if there are -no subnodes present.

    -
    - - - -
    - (void)subnodeDisplayDidFinish:(ASDisplayNode *)subnode
    - - - -
    -

    Parameters

    - - - - - - - -
    subnode

    The subnode of which display is about to completed.

    -
    - - - - - - - -
    -

    Discussion

    -

    Subclasses may override this method to be notified when subnode display (asynchronous or synchronous) has -completed.

    -
    - - - - - - - -
    -

    Declared In

    -

    ASDisplayNode+Subclasses.h

    -
    - - -
    -
    -
    - -

    – setNeedsDisplayAtScale: -

    - -
    -
    - -
    - - -
    -

    Marks the receiver’s bounds as needing to be redrawn, with a scale value.

    -
    - - - -
    - (void)setNeedsDisplayAtScale:(CGFloat)contentsScale
    - - - -
    -

    Parameters

    - - - - - - - -
    contentsScale

    The scale at which the receiver should be drawn.

    -
    - - - - - - - -
    -

    Discussion

    -

    Subclasses should override this if they don’t want their contentsScale changed.

    Note: This changes an internal property. --setNeedsDisplay is also available to trigger display without changing contentsScaleForDisplay.

    -
    - - - - - -
    -

    See Also

    - -
    - - - -
    -

    Declared In

    -

    ASDisplayNode+Subclasses.h

    -
    - - -
    -
    -
    - -

    – recursivelySetNeedsDisplayAtScale: -

    - -
    -
    - -
    - - -
    -

    Recursively calls setNeedsDisplayAtScale: on subnodes.

    -
    - - - -
    - (void)recursivelySetNeedsDisplayAtScale:(CGFloat)contentsScale
    - - - -
    -

    Parameters

    - - - - - - - -
    contentsScale

    The scale at which the receiver’s subnode hierarchy should be drawn.

    -
    - - - - - - - -
    -

    Discussion

    -

    Subclasses may override this if they require modifying the scale set on their child nodes.

    Note: Only the node tree is walked, not the view or layer trees.

    -
    - - - - - - - - - -
    -

    Declared In

    -

    ASDisplayNode+Subclasses.h

    -
    - - -
    -
    -
    - -

      contentsScaleForDisplay -

    - -
    -
    - -
    - - -
    -

    The scale factor to apply to the rendering.

    -
    - - - -
    @property (nonatomic, assign, readonly) CGFloat contentsScaleForDisplay
    - - - - - - - - - -
    -

    Discussion

    -

    Use setNeedsDisplayAtScale: to set a value and then after display, the display node will set the layer’s -contentsScale. This is to prevent jumps when re-rasterizing at a different contentsScale. -Read this property if you need to know the future contentsScale of your layer, eg in drawParameters.

    -
    - - - - - -
    -

    See Also

    - -
    - - - -
    -

    Declared In

    -

    ASDisplayNode+Subclasses.h

    -
    - - -
    -
    -
    -
    - - - -

    Touch handling

    - -
    -
    - -

    – touchesBegan:withEvent: -

    - -
    -
    - -
    - - -
    -

    Tells the node when touches began in its view.

    -
    - - - -
    - (void)touchesBegan:(NSSet<UITouch*> *)touches withEvent:(nullable UIEvent *)event
    - - - -
    -

    Parameters

    - - - - - - - - - - - - -
    touches

    A set of UITouch instances.

    event

    A UIEvent associated with the touch.

    -
    - - - - - - - - - - - - - -
    -

    Declared In

    -

    ASDisplayNode+Subclasses.h

    -
    - - -
    -
    -
    - -

    – touchesMoved:withEvent: -

    - -
    -
    - -
    - - -
    -

    Tells the node when touches moved in its view.

    -
    - - - -
    - (void)touchesMoved:(NSSet<UITouch*> *)touches withEvent:(nullable UIEvent *)event
    - - - -
    -

    Parameters

    - - - - - - - - - - - - -
    touches

    A set of UITouch instances.

    event

    A UIEvent associated with the touch.

    -
    - - - - - - - - - - - - - -
    -

    Declared In

    -

    ASDisplayNode+Subclasses.h

    -
    - - -
    -
    -
    - -

    – touchesEnded:withEvent: -

    - -
    -
    - -
    - - -
    -

    Tells the node when touches ended in its view.

    -
    - - - -
    - (void)touchesEnded:(NSSet<UITouch*> *)touches withEvent:(nullable UIEvent *)event
    - - - -
    -

    Parameters

    - - - - - - - - - - - - -
    touches

    A set of UITouch instances.

    event

    A UIEvent associated with the touch.

    -
    - - - - - - - - - - - - - -
    -

    Declared In

    -

    ASDisplayNode+Subclasses.h

    -
    - - -
    -
    -
    - -

    – touchesCancelled:withEvent: -

    - -
    -
    - -
    - - -
    -

    Tells the node when touches was cancelled in its view.

    -
    - - - -
    - (void)touchesCancelled:(nullable NSSet<UITouch*> *)touches withEvent:(nullable UIEvent *)event
    - - - -
    -

    Parameters

    - - - - - - - - - - - - -
    touches

    A set of UITouch instances.

    event

    A UIEvent associated with the touch.

    -
    - - - - - - - - - - - - - -
    -

    Declared In

    -

    ASDisplayNode+Subclasses.h

    -
    - - -
    -
    -
    -
    - - - -

    Managing Gesture Recognizers

    - -
    -
    - -

    – gestureRecognizerShouldBegin: -

    - -
    -
    - -
    - - -
    -

    Asks the node if a gesture recognizer should continue tracking touches.

    -
    - - - -
    - (BOOL)gestureRecognizerShouldBegin:(UIGestureRecognizer *)gestureRecognizer
    - - - -
    -

    Parameters

    - - - - - - - -
    gestureRecognizer

    A gesture recognizer trying to recognize a gesture.

    -
    - - - - - - - - - - - - - -
    -

    Declared In

    -

    ASDisplayNode+Subclasses.h

    -
    - - -
    -
    -
    -
    - - - -

    Hit Testing

    - -
    -
    - -

    – hitTest:withEvent: -

    - -
    -
    - -
    - - -
    -

    Returns the view that contains the point.

    -
    - - - -
    - (nullable UIView *)hitTest:(CGPoint)point withEvent:(nullable UIEvent *)event
    - - - -
    -

    Parameters

    - - - - - - - - - - - - -
    point

    A point specified in the node’s local coordinate system (bounds).

    event

    The event that warranted a call to this method.

    -
    - - - -
    -

    Return Value

    -

    Returns a UIView, not ASDisplayNode, for two reasons: -1) allows sending events to plain UIViews that don’t have attached nodes, -2) hitTest: is never called before the views are created.

    -
    - - - - - -
    -

    Discussion

    -

    Override to make this node respond differently to touches: (e.g. hide touches from subviews, send all -touches to certain subviews (hit area maximizing), etc.)

    -
    - - - - - - - -
    -

    Declared In

    -

    ASDisplayNode+Subclasses.h

    -
    - - -
    -
    -
    -
    - - - -

    Placeholders

    - -
    -
    - -

    – placeholderImage -

    - -
    -
    - -
    - - -
    -

    Optionally provide an image to serve as the placeholder for the backing store while the contents are being -displayed.

    -
    - - - -
    - (nullable UIImage *)placeholderImage
    - - - - - - - - - -
    -

    Discussion

    -

    Note: Called on the display queue and/or main queue (MUST BE THREAD SAFE)

    -
    - - - - - - - -
    -

    Declared In

    -

    ASDisplayNode+Subclasses.h

    -
    - - -
    -
    -
    -
    - - - -

    Description

    - -
    -
    - -

    – descriptionForRecursiveDescription -

    - -
    -
    - -
    - - -
    -

    Return a description of the node

    -
    - - - -
    - (NSString *)descriptionForRecursiveDescription
    - - - - - - - - - -
    -

    Discussion

    -

    The function that gets called for each display node in -recursiveDescription

    -
    - - - - - - - -
    -

    Declared In

    -

    ASDisplayNode+Subclasses.h

    -
    - - -
    -
    -
    - -

    – asyncTraitCollectionDidChange -

    - -
    -
    - -
    - - -
    -

    Called when the node’s ASTraitCollection changes

    -
    - - - -
    - (void)asyncTraitCollectionDidChange
    - - - - - - - - - -
    -

    Discussion

    -

    Subclasses can override this method to react to a trait collection change.

    -
    - - - - - - - -
    -

    Declared In

    -

    ASDisplayNode+Subclasses.h

    -
    - - -
    -
    -
    -
    - -
    - - - - - - -
    - -
    - -
    -
    -
    -
    - - - - \ No newline at end of file diff --git a/submodules/AsyncDisplayKit/docs/appledoc/Categories/ASDisplayNode+UIViewBridge.html b/submodules/AsyncDisplayKit/docs/appledoc/Categories/ASDisplayNode+UIViewBridge.html deleted file mode 100755 index 97f565ab80..0000000000 --- a/submodules/AsyncDisplayKit/docs/appledoc/Categories/ASDisplayNode+UIViewBridge.html +++ /dev/null @@ -1,348 +0,0 @@ - - - - - - ASDisplayNode(UIViewBridge) Category Reference - - - - - - -
    -
    - -

    - -

    - -

    - AsyncDisplayKit -

    - -
    -
    - - - -
    -
    -
    -
    -

    ASDisplayNode(UIViewBridge) Category Reference

    - - -
    - - - - -
    Declared inASDisplayNode.h
    - - - - -
    - -

    Overview

    -

    UIView bridge

    - -

    ASDisplayNode provides thread-safe access to most of UIView and CALayer properties and methods, traditionally unsafe.

    - -

    Using them will not cause the actual view/layer to be created, and will be applied when it is created (when the view -or layer property is accessed).

    - -
      -
    • NOTE: After the view or layer is created, the properties pass through to the view or layer directly and must be called on the main thread.
    • -
    - - -

    See UIView and CALayer for documentation on these common properties.

    -
    - - - - - -
    - - - - - - -
    -
    - -

    – setNeedsDisplay -

    - -
    -
    - -
    - - -
    -

    Marks the view as needing display. Convenience for use whether the view / layer is loaded or not. Safe to call from a background thread.

    -
    - - - -
    - (void)setNeedsDisplay
    - - - - - - - - - - - - - - - -
    -

    Declared In

    -

    ASDisplayNode.h

    -
    - - -
    -
    -
    - -

    – setNeedsLayout -

    - -
    -
    - -
    - - -
    -

    Marks the node as needing layout. Convenience for use whether the view / layer is loaded or not. Safe to call from a background thread.

    -
    - - - -
    - (void)setNeedsLayout
    - - - - - - - - - -
    -

    Discussion

    -

    If this node was measured, calling this method triggers an internal relayout: the calculated layout is invalidated, -and the supernode is notified or (if this node is the root one) a full measurement pass is executed using the old constrained size.

    - -

    Note: ASCellNode has special behavior in that calling this method will automatically notify -the containing ASTableView / ASCollectionView that the cell should be resized, if necessary.

    -
    - - - - - - - -
    -

    Declared In

    -

    ASDisplayNode.h

    -
    - - -
    -
    -
    - -

      backgroundColor -

    - -
    -
    - -
    - - -
    -

    The node view’s background color.

    -
    - - - -
    @property (nonatomic, strong, nullable) UIColor *backgroundColor
    - - - - - - - - - -
    -

    Discussion

    -

    In contrast to UIView, setting a transparent color will not set opaque = NO. -This only affects nodes that implement +drawRect like ASTextNode.

    -
    - - - - - - - -
    -

    Declared In

    -

    ASDisplayNode.h

    -
    - - -
    -
    -
    - -

      contentMode -

    - -
    -
    - -
    - - -
    -

    A flag used to determine how a node lays out its content when its bounds change.

    -
    - - - -
    @property (nonatomic, assign) UIViewContentMode contentMode
    - - - - - - - - - -
    -

    Discussion

    -

    This is like UIView’s contentMode property, but better. We do our own mapping to layer.contentsGravity in -_ASDisplayView. You can set needsDisplayOnBoundsChange independently. -Thus, UIViewContentModeRedraw is not allowed; use needsDisplayOnBoundsChange = YES instead, and pick an appropriate -contentMode for your content while it’s being re-rendered.

    -
    - - - - - - - -
    -

    Declared In

    -

    ASDisplayNode.h

    -
    - - -
    -
    -
    -
    - -
    - - - - - - -
    - -
    - -
    -
    -
    -
    - - - - \ No newline at end of file diff --git a/submodules/AsyncDisplayKit/docs/appledoc/Categories/ASImageNode+AnimatedImage.html b/submodules/AsyncDisplayKit/docs/appledoc/Categories/ASImageNode+AnimatedImage.html deleted file mode 100755 index ff83bcb37f..0000000000 --- a/submodules/AsyncDisplayKit/docs/appledoc/Categories/ASImageNode+AnimatedImage.html +++ /dev/null @@ -1,275 +0,0 @@ - - - - - - ASImageNode(AnimatedImage) Category Reference - - - - - - -
    -
    - -

    - -

    - -

    - AsyncDisplayKit -

    - -
    -
    - - - -
    -
    -
    -
    -

    ASImageNode(AnimatedImage) Category Reference

    - - -
    - - - - -
    Declared inASImageNode.h
    - - - - - - -
    - - - - - - -
    -
    - -

      animatedImage -

    - -
    -
    - -
    - - -
    -

    The animated image to playback

    -
    - - - -
    @property (nullable, nonatomic, strong) id<ASAnimatedImageProtocol> animatedImage
    - - - - - - - - - -
    -

    Discussion

    -

    Set this to an object which conforms to ASAnimatedImageProtocol -to have the ASImageNode playback an animated image.

    -
    - - - - - - - -
    -

    Declared In

    -

    ASImageNode.h

    -
    - - -
    -
    -
    - -

      animatedImagePaused -

    - -
    -
    - -
    - - -
    -

    Pause the playback of an animated image.

    -
    - - - -
    @property (nonatomic, assign) BOOL animatedImagePaused
    - - - - - - - - - -
    -

    Discussion

    -

    Set to YES to pause playback of an animated image and NO to resume -playback.

    -
    - - - - - - - -
    -

    Declared In

    -

    ASImageNode.h

    -
    - - -
    -
    -
    - -

      animatedImageRunLoopMode -

    - -
    -
    - -
    - - -
    -

    The runloop mode used to animate the image.

    -
    - - - -
    @property (nonatomic, strong) NSString *animatedImageRunLoopMode
    - - - - - - - - - -
    -

    Discussion

    -

    Defaults to NSRunLoopCommonModes. Another commonly used mode is NSDefaultRunLoopMode. -Setting NSDefaultRunLoopMode will cause animation to pause while scrolling (if the ASImageNode is -in a scroll view), which may improve scroll performance in some use cases.

    -
    - - - - - - - -
    -

    Declared In

    -

    ASImageNode.h

    -
    - - -
    -
    -
    -
    - -
    - - - - - - -
    - -
    - -
    -
    -
    -
    - - - - \ No newline at end of file diff --git a/submodules/AsyncDisplayKit/docs/appledoc/Categories/ASImageNode+Debugging.html b/submodules/AsyncDisplayKit/docs/appledoc/Categories/ASImageNode+Debugging.html deleted file mode 100755 index d60ea6fd94..0000000000 --- a/submodules/AsyncDisplayKit/docs/appledoc/Categories/ASImageNode+Debugging.html +++ /dev/null @@ -1,184 +0,0 @@ - - - - - - ASImageNode(Debugging) Category Reference - - - - - - -
    -
    - -

    - -

    - -

    - AsyncDisplayKit -

    - -
    -
    - - - -
    -
    -
    -
    -

    ASImageNode(Debugging) Category Reference

    - - -
    - - - - -
    Declared inAsyncDisplayKit+Debug.h
    - - - - - - -
    - - - - - - -
    -
    - -

    + setShouldShowImageScalingOverlay: -

    - -
    -
    - -
    - - -
    -

    Enables an ASImageNode debug label that shows the ratio of pixels in the source image to those in -the displayed bounds (including cropRect). This helps detect excessive image fetching / downscaling, -as well as upscaling (such as providing a URL not suitable for a Retina device). For dev purposes only.

    -
    - - - -
    + (void)setShouldShowImageScalingOverlay:(BOOL)show
    - - - -
    -

    Parameters

    - - - - - - - -
    enabled

    Specify YES to show the label on all ASImageNodes with non-1.0x source-to-bounds pixel ratio.

    -
    - - - - - - - - - - - - - -
    -

    Declared In

    -

    AsyncDisplayKit+Debug.h

    -
    - - -
    -
    -
    -
    - -
    - - - - - - -
    - -
    - -
    -
    -
    -
    - - - - \ No newline at end of file diff --git a/submodules/AsyncDisplayKit/docs/appledoc/Categories/ASLayout+.html b/submodules/AsyncDisplayKit/docs/appledoc/Categories/ASLayout+.html deleted file mode 100755 index f07aea41ee..0000000000 --- a/submodules/AsyncDisplayKit/docs/appledoc/Categories/ASLayout+.html +++ /dev/null @@ -1,175 +0,0 @@ - - - - - - ASLayout() Category Reference - - - - - - -
    -
    - -

    - -

    - -

    - AsyncDisplayKit -

    - -
    -
    - - - -
    -
    -
    -
    -

    ASLayout() Category Reference

    - - -
    - - - - -
    Declared inASLayoutSpec+Subclasses.h
    - - - - - - -
    - - - - - - -
    -
    - -

      position -

    - -
    -
    - -
    - - -
    -

    Position in parent. Default to CGPointNull.

    -
    - - - -
    @property (nonatomic, assign, readwrite) CGPoint position
    - - - - - - - - - -
    -

    Discussion

    -

    When being used as a sublayout, this property must not equal CGPointNull.

    -
    - - - - - - - -
    -

    Declared In

    -

    ASLayoutSpec+Subclasses.h

    -
    - - -
    -
    -
    -
    - -
    - - - - - - -
    - -
    - -
    -
    -
    -
    - - - - \ No newline at end of file diff --git a/submodules/AsyncDisplayKit/docs/appledoc/Categories/ASLayout+Debugging.html b/submodules/AsyncDisplayKit/docs/appledoc/Categories/ASLayout+Debugging.html deleted file mode 100755 index 0b9fc0a9e4..0000000000 --- a/submodules/AsyncDisplayKit/docs/appledoc/Categories/ASLayout+Debugging.html +++ /dev/null @@ -1,170 +0,0 @@ - - - - - - ASLayout(Debugging) Category Reference - - - - - - -
    -
    - -

    - -

    - -

    - AsyncDisplayKit -

    - -
    -
    - - - -
    -
    -
    -
    -

    ASLayout(Debugging) Category Reference

    - - -
    - - - - -
    Declared inASLayout.h
    - - - - - - -
    - - - - - - -
    -
    - -

    – recursiveDescription -

    - -
    -
    - -
    - - -
    -

    Recrusively output the description of the layout tree.

    -
    - - - -
    - (NSString *)recursiveDescription
    - - - - - - - - - - - - - - - -
    -

    Declared In

    -

    ASLayout.h

    -
    - - -
    -
    -
    -
    - -
    - - - - - - -
    - -
    - -
    -
    -
    -
    - - - - \ No newline at end of file diff --git a/submodules/AsyncDisplayKit/docs/appledoc/Categories/ASLayoutElementStyle+.html b/submodules/AsyncDisplayKit/docs/appledoc/Categories/ASLayoutElementStyle+.html deleted file mode 100755 index 0bc980f565..0000000000 --- a/submodules/AsyncDisplayKit/docs/appledoc/Categories/ASLayoutElementStyle+.html +++ /dev/null @@ -1,221 +0,0 @@ - - - - - - ASLayoutElementStyle() Category Reference - - - - - - -
    -
    - -

    - -

    - -

    - AsyncDisplayKit -

    - -
    -
    - - - -
    -
    -
    -
    -

    ASLayoutElementStyle() Category Reference

    - - -
    - - - - - - - -
    Conforms toASDescriptionProvider
    Declared inASLayoutElementStylePrivate.h
    - - - - - - -
    - - - - - - -
    -
    - -

      delegate -

    - -
    -
    - -
    - - -
    -

    The object that acts as the delegate of the style.

    -
    - - - -
    @property (nullable, nonatomic, weak) id<ASLayoutElementStyleDelegate> delegate
    - - - - - - - - - -
    -

    Discussion

    -

    The delegate must adopt the ASLayoutElementStyleDelegate protocol. The delegate is not retained.

    -
    - - - - - - - -
    -

    Declared In

    -

    ASLayoutElementStylePrivate.h

    -
    - - -
    -
    -
    - -

      size -

    - -
    -
    - -
    - - -
    -

    A size constraint that should apply to this ASLayoutElement.

    -
    - - - -
    @property (nonatomic, assign, readonly) ASLayoutElementSize size
    - - - - - - - - - - - - - - - -
    -

    Declared In

    -

    ASLayoutElementStylePrivate.h

    -
    - - -
    -
    -
    -
    - -
    - - - - - - -
    - -
    - -
    -
    -
    -
    - - - - \ No newline at end of file diff --git a/submodules/AsyncDisplayKit/docs/appledoc/Categories/ASLayoutSpec+Debugging.html b/submodules/AsyncDisplayKit/docs/appledoc/Categories/ASLayoutSpec+Debugging.html deleted file mode 100755 index c039aa2246..0000000000 --- a/submodules/AsyncDisplayKit/docs/appledoc/Categories/ASLayoutSpec+Debugging.html +++ /dev/null @@ -1,173 +0,0 @@ - - - - - - ASLayoutSpec(Debugging) Category Reference - - - - - - -
    -
    - -

    - -

    - -

    - AsyncDisplayKit -

    - -
    -
    - - - -
    -
    -
    -
    -

    ASLayoutSpec(Debugging) Category Reference

    - - -
    - - - - - - - -
    Conforms toASLayoutElementAsciiArtProtocol
    Declared inASLayoutSpec.h
    - - - - - - -
    - - - - - - -
    -
    - -

    + asciiArtStringForChildren:parentName:direction: -

    - -
    -
    - -
    - - -
    -

    Used by other layout specs to create ascii art debug strings

    -
    - - - -
    + (NSString *)asciiArtStringForChildren:(NSArray *)children parentName:(NSString *)parentName direction:(ASStackLayoutDirection)direction
    - - - - - - - - - - - - - - - -
    -

    Declared In

    -

    ASLayoutSpec.h

    -
    - - -
    -
    -
    -
    - -
    - - - - - - -
    - -
    - -
    -
    -
    -
    - - - - \ No newline at end of file diff --git a/submodules/AsyncDisplayKit/docs/appledoc/Categories/ASLayoutSpec+Subclassing.html b/submodules/AsyncDisplayKit/docs/appledoc/Categories/ASLayoutSpec+Subclassing.html deleted file mode 100755 index 177cf376e9..0000000000 --- a/submodules/AsyncDisplayKit/docs/appledoc/Categories/ASLayoutSpec+Subclassing.html +++ /dev/null @@ -1,315 +0,0 @@ - - - - - - ASLayoutSpec(Subclassing) Category Reference - - - - - - -
    -
    - -

    - -

    - -

    - AsyncDisplayKit -

    - -
    -
    - - - -
    -
    -
    -
    -

    ASLayoutSpec(Subclassing) Category Reference

    - - -
    - - - - -
    Declared inASLayoutSpec+Subclasses.h
    - - - - - - -
    - - - - - - -
    -
    - -

    – layoutElementToAddFromLayoutElement: -

    - -
    -
    - -
    - - -
    -

    Helper method for finalLayoutElement support

    -
    - - - -
    - (id<ASLayoutElement>)layoutElementToAddFromLayoutElement:(id<ASLayoutElement>)child
    - - - - - - - - - -
    -

    Discussion

    -

    Warning: If you are getting recursion crashes here after implementing finalLayoutElement, make sure -that you are setting isFinalLayoutElement flag to YES. This must be one BEFORE adding a child -to the new ASLayoutElement.

    - -

    For example: -- (idASLayoutElement)finalLayoutElement -{ -ASInsetLayoutSpec *insetSpec = [[ASInsetLayoutSpec alloc] init]; -insetSpec.insets = UIEdgeInsetsMake(10,10,10,10); -insetSpec.isFinalLayoutElement = YES; -[insetSpec setChild:self]; -return insetSpec; -}

    -
    - - - - - - - -
    -

    Declared In

    -

    ASLayoutSpec+Subclasses.h

    -
    - - -
    -
    -
    - -

    – setChild:atIndex: -

    - -
    -
    - -
    - - -
    -

    Adds a child with the given identifier to this layout spec.

    -
    - - - -
    - (void)setChild:(id<ASLayoutElement>)child atIndex:(NSUInteger)index
    - - - -
    -

    Parameters

    - - - - - - - - - - - - -
    child

    A child to be added.

    index

    An index associated with the child.

    -
    - - - - - - - -
    -

    Discussion

    -

    Every ASLayoutSpec must act on at least one child. The ASLayoutSpec base class takes the -responsibility of holding on to the spec children. Some layout specs, like ASInsetLayoutSpec, -only require a single child.

    - -

    For layout specs that require a known number of children (ASBackgroundLayoutSpec, for example) -a subclass can use the setChild method to set the “primary” child. It should then use this method -to set any other required children. Ideally a subclass would hide this from the user, and use the -setChild:forIndex: internally. For example, ASBackgroundLayoutSpec exposes a backgroundChild -property that behind the scenes is calling setChild:forIndex:.

    -
    - - - - - - - -
    -

    Declared In

    -

    ASLayoutSpec+Subclasses.h

    -
    - - -
    -
    -
    - -

    – childAtIndex: -

    - -
    -
    - -
    - - -
    -

    Returns the child added to this layout spec using the given index.

    -
    - - - -
    - (nullable id<ASLayoutElement>)childAtIndex:(NSUInteger)index
    - - - -
    -

    Parameters

    - - - - - - - -
    index

    An identifier associated with the the child.

    -
    - - - - - - - - - - - - - -
    -

    Declared In

    -

    ASLayoutSpec+Subclasses.h

    -
    - - -
    -
    -
    -
    - -
    - - - - - - -
    - -
    - -
    -
    -
    -
    - - - - \ No newline at end of file diff --git a/submodules/AsyncDisplayKit/docs/appledoc/Categories/ASRangeController+ASRangeControllerUpdateRangeProtocol.html b/submodules/AsyncDisplayKit/docs/appledoc/Categories/ASRangeController+ASRangeControllerUpdateRangeProtocol.html deleted file mode 100755 index cbdbcb323a..0000000000 --- a/submodules/AsyncDisplayKit/docs/appledoc/Categories/ASRangeController+ASRangeControllerUpdateRangeProtocol.html +++ /dev/null @@ -1,198 +0,0 @@ - - - - - - ASRangeController(ASRangeControllerUpdateRangeProtocol) Category Reference - - - - - - -
    -
    - -

    - -

    - -

    - AsyncDisplayKit -

    - -
    -
    - - - -
    -
    -
    -
    -

    ASRangeController(ASRangeControllerUpdateRangeProtocol) Category Reference

    - - -
    - - - - - - - -
    Conforms toASRangeControllerUpdateRangeProtocol
    Declared inASRangeController.h
    - - - - - - -
    - - - - - - -
    -
    - -

    – updateCurrentRangeWithMode: -

    - -
    -
    - -
    - - -
    -
      -
    • Update the range mode for a range controller to a explicitly set mode until the node that contains the range
    • -
    • controller becomes visible again -*
    • -
    • Logic for the automatic range mode:
    • -
      1. -
      2. If there are no visible node paths available nothing is to be done and no range update will happen
      3. -
      -
    • -
      1. -
      2. The initial range update if the range controller is visible always will be ASLayoutRangeModeCount
      3. -
      -
    • -
    • (ASLayoutRangeModeMinimum) as it’s the initial fetch
    • -
      1. -
      2. The range mode set explicitly via updateCurrentRangeWithMode: will last at least one range update. After that it -the range controller will use the explicit set range mode until it becomes visible and a new range update was -triggered or a new range mode via updateCurrentRangeWithMode: is set
      3. -
      -
    • -
      1. -
      2. If range mode is not explicitly set the range mode is variying based if the range controller is visible or not
      3. -
      -
    • -
    - -
    - - - -
    - (void)updateCurrentRangeWithMode:(ASLayoutRangeMode)rangeMode
    - - - - - - - - - - - - - - - -
    -

    Declared In

    -

    ASRangeController.h

    -
    - - -
    -
    -
    -
    - -
    - - - - - - -
    - -
    - -
    -
    -
    -
    - - - - \ No newline at end of file diff --git a/submodules/AsyncDisplayKit/docs/appledoc/Categories/ASRangeController+Debugging.html b/submodules/AsyncDisplayKit/docs/appledoc/Categories/ASRangeController+Debugging.html deleted file mode 100755 index e85b0d47a3..0000000000 --- a/submodules/AsyncDisplayKit/docs/appledoc/Categories/ASRangeController+Debugging.html +++ /dev/null @@ -1,183 +0,0 @@ - - - - - - ASRangeController(Debugging) Category Reference - - - - - - -
    -
    - -

    - -

    - -

    - AsyncDisplayKit -

    - -
    -
    - - - -
    -
    -
    -
    -

    ASRangeController(Debugging) Category Reference

    - - -
    - - - - -
    Declared inAsyncDisplayKit+Debug.h
    - - - - - - -
    - - - - - - -
    -
    - -

    + setShouldShowRangeDebugOverlay: -

    - -
    -
    - -
    - - -
    -

    Class method to enable a visualization overlay of the all ASRangeController’s tuning parameters. For dev purposes only. -To use, message ASRangeController in the AppDelegate –> [ASRangeController setShouldShowRangeDebugOverlay:YES];

    -
    - - - -
    + (void)setShouldShowRangeDebugOverlay:(BOOL)show
    - - - -
    -

    Parameters

    - - - - - - - -
    enable

    Specify YES to make this debug feature enabled when messaging the ASRangeController class.

    -
    - - - - - - - - - - - - - -
    -

    Declared In

    -

    AsyncDisplayKit+Debug.h

    -
    - - -
    -
    -
    -
    - -
    - - - - - - -
    - -
    - -
    -
    -
    -
    - - - - \ No newline at end of file diff --git a/submodules/AsyncDisplayKit/docs/appledoc/Categories/ASTableView+Deprecated.html b/submodules/AsyncDisplayKit/docs/appledoc/Categories/ASTableView+Deprecated.html deleted file mode 100755 index c13c9fc87c..0000000000 --- a/submodules/AsyncDisplayKit/docs/appledoc/Categories/ASTableView+Deprecated.html +++ /dev/null @@ -1,948 +0,0 @@ - - - - - - ASTableView(Deprecated) Category Reference - - - - - - -
    -
    - -

    - -

    - -

    - AsyncDisplayKit -

    - -
    -
    - - - -
    -
    -
    -
    -

    ASTableView(Deprecated) Category Reference

    - - -
    - - - - -
    Declared inASTableView.h
    - - - - - - -
    - - - - - - -
    -
    - -

    – initWithFrame:style: -

    - -
    -
    - -
    - - -
    -

    Initializer.

    -
    - - - -
    - (instancetype)initWithFrame:(CGRect)frame style:(UITableViewStyle)style
    - - - -
    -

    Parameters

    - - - - - - - - - - - - -
    frame

    A rectangle specifying the initial location and size of the table view in its superview’€™s coordinates. -The frame of the table view changes as table cells are added and deleted.

    style

    A constant that specifies the style of the table view. See UITableViewStyle for descriptions of valid constants.

    -
    - - - - - - - - - - - - - -
    -

    Declared In

    -

    ASTableView.h

    -
    - - -
    -
    -
    - -

    – tuningParametersForRangeType: -

    - -
    -
    - -
    - - -
    -

    Tuning parameters for a range type in full mode.

    -
    - - - -
    - (ASRangeTuningParameters)tuningParametersForRangeType:(ASLayoutRangeType)rangeType
    - - - -
    -

    Parameters

    - - - - - - - -
    rangeType

    The range type to get the tuning parameters for.

    -
    - - - -
    -

    Return Value

    -

    A tuning parameter value for the given range type in full mode.

    -
    - - - - - - - - - - - -
    -

    Declared In

    -

    ASTableView.h

    -
    - - -
    -
    -
    - -

    – setTuningParameters:forRangeType: -

    - -
    -
    - -
    - - -
    -

    Set the tuning parameters for a range type in full mode.

    -
    - - - -
    - (void)setTuningParameters:(ASRangeTuningParameters)tuningParameters forRangeType:(ASLayoutRangeType)rangeType
    - - - -
    -

    Parameters

    - - - - - - - - - - - - -
    tuningParameters

    The tuning parameters to store for a range type.

    rangeType

    The range type to set the tuning parameters for.

    -
    - - - - - - - - - - - - - -
    -

    Declared In

    -

    ASTableView.h

    -
    - - -
    -
    -
    - -

    – tuningParametersForRangeMode:rangeType: -

    - -
    -
    - -
    - - -
    -

    Tuning parameters for a range type in the specified mode.

    -
    - - - -
    - (ASRangeTuningParameters)tuningParametersForRangeMode:(ASLayoutRangeMode)rangeMode rangeType:(ASLayoutRangeType)rangeType
    - - - -
    -

    Parameters

    - - - - - - - - - - - - -
    rangeMode

    The range mode to get the running parameters for.

    rangeType

    The range type to get the tuning parameters for.

    -
    - - - -
    -

    Return Value

    -

    A tuning parameter value for the given range type in the given mode.

    -
    - - - - - - - - - - - -
    -

    Declared In

    -

    ASTableView.h

    -
    - - -
    -
    -
    - -

    – setTuningParameters:forRangeMode:rangeType: -

    - -
    -
    - -
    - - -
    -

    Set the tuning parameters for a range type in the specified mode.

    -
    - - - -
    - (void)setTuningParameters:(ASRangeTuningParameters)tuningParameters forRangeMode:(ASLayoutRangeMode)rangeMode rangeType:(ASLayoutRangeType)rangeType
    - - - -
    -

    Parameters

    - - - - - - - - - - - - - - - - - -
    tuningParameters

    The tuning parameters to store for a range type.

    rangeMode

    The range mode to set the running parameters for.

    rangeType

    The range type to set the tuning parameters for.

    -
    - - - - - - - - - - - - - -
    -

    Declared In

    -

    ASTableView.h

    -
    - - -
    -
    -
    - -

    – visibleNodes -

    - -
    -
    - -
    - - -
    -

    Similar to -visibleCells.

    -
    - - - -
    - (NSArray<ASCellNode*> *)visibleNodes
    - - - - - -
    -

    Return Value

    -

    an array containing the cell nodes being displayed on screen.

    -
    - - - - - - - - - - - -
    -

    Declared In

    -

    ASTableView.h

    -
    - - -
    -
    -
    - -

    – indexPathForNode: -

    - -
    -
    - -
    - - -
    -

    Similar to -indexPathForCell:.

    -
    - - - -
    - (nullable NSIndexPath *)indexPathForNode:(ASCellNode *)cellNode
    - - - -
    -

    Parameters

    - - - - - - - -
    cellNode

    a cellNode part of the table view

    -
    - - - -
    -

    Return Value

    -

    an indexPath for this cellNode

    -
    - - - - - - - - - - - -
    -

    Declared In

    -

    ASTableView.h

    -
    - - -
    -
    -
    - -

    – reloadDataWithCompletion: -

    - -
    -
    - -
    - - -
    -

    Reload everything from scratch, destroying the working range and all cached nodes.

    -
    - - - -
    - (void)reloadDataWithCompletion:(void ( ^ _Nullable ) ( ))completion
    - - - -
    -

    Parameters

    - - - - - - - -
    completion

    block to run on completion of asynchronous loading or nil. If supplied, the block is run on -the main thread.

    -
    - - - - - - - -
    -

    Discussion

    -

    Warning: This method is substantially more expensive than UITableView’s version.

    -
    - - - - - - - -
    -

    Declared In

    -

    ASTableView.h

    -
    - - -
    -
    -
    - -

    – reloadData -

    - -
    -
    - -
    - - -
    -

    Reload everything from scratch, destroying the working range and all cached nodes.

    -
    - - - -
    - (void)reloadData
    - - - - - - - - - -
    -

    Discussion

    -

    Warning: This method is substantially more expensive than UITableView’s version.

    -
    - - - - - - - -
    -

    Declared In

    -

    ASTableView.h

    -
    - - -
    -
    -
    - -

    – reloadDataImmediately -

    - -
    -
    - -
    - - -
    -

    Reload everything from scratch entirely on the main thread, destroying the working range and all cached nodes.

    -
    - - - -
    - (void)reloadDataImmediately
    - - - - - - - - - -
    -

    Discussion

    -

    Warning: This method is substantially more expensive than UITableView’s version and will block the main thread while -all the cells load.

    -
    - - - - - - - -
    -

    Declared In

    -

    ASTableView.h

    -
    - - -
    -
    -
    - -

    – relayoutItems -

    - -
    -
    - -
    - - -
    -

    Triggers a relayout of all nodes.

    -
    - - - -
    - (void)relayoutItems
    - - - - - - - - - -
    -

    Discussion

    -

    This method invalidates and lays out every cell node in the table view.

    -
    - - - - - - - -
    -

    Declared In

    -

    ASTableView.h

    -
    - - -
    -
    -
    - -

    – endUpdatesAnimated:completion: -

    - -
    -
    - -
    - - -
    -

    Concludes a series of method calls that insert, delete, select, or reload rows and sections of the table view. -You call this method to bracket a series of method calls that begins with beginUpdates and that consists of operations -to insert, delete, select, and reload rows and sections of the table view. When you call endUpdates, ASTableView begins animating -the operations simultaneously. This method is must be called from the main thread. It’s important to remember that the ASTableView will -be processing the updates asynchronously after this call and are not guaranteed to be reflected in the ASTableView until -the completion block is executed.

    -
    - - - -
    - (void)endUpdatesAnimated:(BOOL)animated completion:(void ( ^ _Nullable ) ( BOOL completed ))completion
    - - - -
    -

    Parameters

    - - - - - - - - - - - - -
    animated

    NO to disable all animations.

    completion

    A completion handler block to execute when all of the operations are finished. This block takes a single -Boolean parameter that contains the value YES if all of the related animations completed successfully or -NO if they were interrupted. This parameter may be nil. If supplied, the block is run on the main thread.

    -
    - - - - - - - - - - - - - -
    -

    Declared In

    -

    ASTableView.h

    -
    - - -
    -
    -
    - -

    – waitUntilAllUpdatesAreCommitted -

    - -
    -
    - -
    - - -
    -

    Blocks execution of the main thread until all section and row updates are committed. This method must be called from the main thread.

    -
    - - - -
    - (void)waitUntilAllUpdatesAreCommitted
    - - - - - - - - - - - - - - - -
    -

    Declared In

    -

    ASTableView.h

    -
    - - -
    -
    -
    - -

    – clearContents -

    - -
    -
    - -
    - - -
    -

    Deprecated in 2.0. You should not call this method.

    -
    - - - -
    - (void)clearContents
    - - - - - - - - - - - - - - - -
    -

    Declared In

    -

    ASTableView.h

    -
    - - -
    -
    -
    - -

    – clearFetchedData -

    - -
    -
    - -
    - - -
    -

    Deprecated in 2.0. You should not call this method.

    -
    - - - -
    - (void)clearFetchedData
    - - - - - - - - - - - - - - - -
    -

    Declared In

    -

    ASTableView.h

    -
    - - -
    -
    -
    -
    - -
    - - - - - - -
    - -
    - -
    -
    -
    -
    - - - - \ No newline at end of file diff --git a/submodules/AsyncDisplayKit/docs/appledoc/Categories/ASTableView+Internal.html b/submodules/AsyncDisplayKit/docs/appledoc/Categories/ASTableView+Internal.html deleted file mode 100755 index e21fda7dad..0000000000 --- a/submodules/AsyncDisplayKit/docs/appledoc/Categories/ASTableView+Internal.html +++ /dev/null @@ -1,453 +0,0 @@ - - - - - - ASTableView(Internal) Category Reference - - - - - - -
    -
    - -

    - -

    - -

    - AsyncDisplayKit -

    - -
    -
    - - - -
    -
    -
    -
    -

    ASTableView(Internal) Category Reference

    - - -
    - - - - -
    Declared inASTableViewInternal.h
    - - - - - - -
    - - - - - - -
    -
    - -

    – _initWithFrame:style:dataControllerClass: -

    - -
    -
    - -
    - - -
    -

    Initializer.

    -
    - - - -
    - (instancetype)_initWithFrame:(CGRect)frame style:(UITableViewStyle)style dataControllerClass:(Class)dataControllerClass
    - - - -
    -

    Parameters

    - - - - - - - - - - - - - - - - - -
    frame

    A rectangle specifying the initial location and size of the table view in its superview’€™s coordinates. -The frame of the table view changes as table cells are added and deleted.

    style

    A constant that specifies the style of the table view. See UITableViewStyle for descriptions of valid constants.

    dataControllerClass

    A controller class injected to and used to create a data controller for the table view.

    -
    - - - - - - - - - - - - - -
    -

    Declared In

    -

    ASTableViewInternal.h

    -
    - - -
    -
    -
    - -

      test_enableSuperUpdateCallLogging -

    - -
    -
    - -
    - - -
    -

    Set YES and we’ll log every time we call [super insertRows…] etc

    -
    - - - -
    @property (nonatomic) BOOL test_enableSuperUpdateCallLogging
    - - - - - - - - - - - - - - - -
    -

    Declared In

    -

    ASTableViewInternal.h

    -
    - - -
    -
    -
    - -

    – convertIndexPathFromTableNode:waitingIfNeeded: -

    - -
    -
    - -
    - - -
    -

    Attempt to get the view-layer index path for the row with the given index path.

    -
    - - - -
    - (NSIndexPath *)convertIndexPathFromTableNode:(NSIndexPath *)indexPath waitingIfNeeded:(BOOL)wait
    - - - -
    -

    Parameters

    - - - - - - - - - - - - -
    indexPath

    The index path of the row.

    wait

    If the item hasn’t reached the view yet, this attempts to wait for updates to commit.

    -
    - - - - - - - - - - - - - -
    -

    Declared In

    -

    ASTableViewInternal.h

    -
    - - -
    -
    -
    - -

    – convertIndexPathToTableNode: -

    - -
    -
    - -
    - - -
    -

    Attempt to get the node index path given the view-layer index path.

    -
    - - - -
    - (NSIndexPath *)convertIndexPathToTableNode:(NSIndexPath *)indexPath
    - - - -
    -

    Parameters

    - - - - - - - -
    indexPath

    The index path of the row.

    -
    - - - - - - - - - - - - - -
    -

    Declared In

    -

    ASTableViewInternal.h

    -
    - - -
    -
    -
    - -

    – convertIndexPathsToTableNode: -

    - -
    -
    - -
    - - -
    -

    Attempt to get the node index paths given the view-layer index paths.

    -
    - - - -
    - (NSArray<NSIndexPath*> *)convertIndexPathsToTableNode:(NSArray<NSIndexPath*> *)indexPaths
    - - - -
    -

    Parameters

    - - - - - - - -
    indexPaths

    An array of index paths in the view space

    -
    - - - - - - - - - - - - - -
    -

    Declared In

    -

    ASTableViewInternal.h

    -
    - - -
    -
    -
    - -

    – sectionIndexWidth -

    - -
    -
    - -
    - - -
    -

    Returns the width of the section index view on the right-hand side of the table, if one is present.

    -
    - - - -
    - (CGFloat)sectionIndexWidth
    - - - - - - - - - - - - - - - -
    -

    Declared In

    -

    ASTableViewInternal.h

    -
    - - -
    -
    -
    -
    - -
    - - - - - - -
    - -
    - -
    -
    -
    -
    - - - - \ No newline at end of file diff --git a/submodules/AsyncDisplayKit/docs/appledoc/Categories/ASTextNode+.html b/submodules/AsyncDisplayKit/docs/appledoc/Categories/ASTextNode+.html deleted file mode 100755 index ec3bdd4fbb..0000000000 --- a/submodules/AsyncDisplayKit/docs/appledoc/Categories/ASTextNode+.html +++ /dev/null @@ -1,226 +0,0 @@ - - - - - - ASTextNode() Category Reference - - - - - - -
    -
    - -

    - -

    - -

    - AsyncDisplayKit -

    - -
    -
    - - - -
    -
    -
    -
    -

    ASTextNode() Category Reference

    - - -
    - - - - -
    Declared inASTextNode+Beta.h
    - - - - - - -
    - - - - - - -
    -
    - -

      pointSizeScaleFactors -

    - -
    -
    - -
    - - -
    -

    An array of descending scale factors that will be applied to this text node to try to make it fit within its constrained size

    -
    - - - -
    @property (nullable, nonatomic, copy) NSArray<NSNumber*> *pointSizeScaleFactors
    - - - - - - - - - -
    -

    Discussion

    -

    This array should be in descending order and NOT contain the scale factor 1.0. For example, it could return @[@(.9), @(.85), @(.8)]; -@default nil (no scaling)

    -
    - - - - - - - -
    -

    Declared In

    -

    ASTextNode+Beta.h

    -
    - - -
    -
    -
    - -

      textContainerInset -

    - -
    -
    - -
    - - -
    -

    Text margins for text laid out in the text node.

    -
    - - - -
    @property (nonatomic, assign) UIEdgeInsets textContainerInset
    - - - - - - - - - -
    -

    Discussion

    -

    defaults to UIEdgeInsetsZero. -This property can be useful for handling text which does not fit within the view by default. An example: like UILabel, -ASTextNode will clip the left and right of the string “judar” if it’s rendered in an italicised font.

    -
    - - - - - - - -
    -

    Declared In

    -

    ASTextNode+Beta.h

    -
    - - -
    -
    -
    -
    - -
    - - - - - - -
    - -
    - -
    -
    -
    -
    - - - - \ No newline at end of file diff --git a/submodules/AsyncDisplayKit/docs/appledoc/Categories/ASTextNode+Deprecated.html b/submodules/AsyncDisplayKit/docs/appledoc/Categories/ASTextNode+Deprecated.html deleted file mode 100755 index a310bc3f27..0000000000 --- a/submodules/AsyncDisplayKit/docs/appledoc/Categories/ASTextNode+Deprecated.html +++ /dev/null @@ -1,175 +0,0 @@ - - - - - - ASTextNode(Deprecated) Category Reference - - - - - - -
    -
    - -

    - -

    - -

    - AsyncDisplayKit -

    - -
    -
    - - - -
    -
    -
    -
    -

    ASTextNode(Deprecated) Category Reference

    - - -
    - - - - -
    Declared inASTextNode.h
    - - - - - - - - -
    - - - - - - -
    -
    - -

      ) -

    - -
    -
    - -
    - - -
    -

    The attributedString and attributedText properties are equivalent, but attributedText is now the standard API -name in order to match UILabel and ASEditableTextNode.

    -
    - - - -
    @property (nullable, nonatomic, copy) NSAttributedString *ASDISPLAYNODE_DEPRECATED_MSG ( "Use .attributedText instead." )
    - - - - - - - - - - - - - - - -
    -

    Declared In

    -

    ASTextNode.h

    -
    - - -
    -
    -
    -
    - -
    - - - - - - -
    - -
    - -
    -
    -
    -
    - - - - \ No newline at end of file diff --git a/submodules/AsyncDisplayKit/docs/appledoc/Categories/ASViewController+ASRangeControllerUpdateRangeProtocol.html b/submodules/AsyncDisplayKit/docs/appledoc/Categories/ASViewController+ASRangeControllerUpdateRangeProtocol.html deleted file mode 100755 index 0c0d6ab95f..0000000000 --- a/submodules/AsyncDisplayKit/docs/appledoc/Categories/ASViewController+ASRangeControllerUpdateRangeProtocol.html +++ /dev/null @@ -1,176 +0,0 @@ - - - - - - ASViewController(ASRangeControllerUpdateRangeProtocol) Category Reference - - - - - - -
    -
    - -

    - -

    - -

    - AsyncDisplayKit -

    - -
    -
    - - - -
    -
    -
    -
    -

    ASViewController(ASRangeControllerUpdateRangeProtocol) Category Reference

    - - -
    - - - - -
    Declared inASViewController.h
    - - - - - - -
    - - - - - - -
    -
    - -

      automaticallyAdjustRangeModeBasedOnViewEvents -

    - -
    -
    - -
    - - -
    -

    Automatically adjust range mode based on view events. If you set this to YES, the view controller or its node -must conform to the ASRangeControllerUpdateRangeProtocol.

    -
    - - - -
    @property (nonatomic, assign) BOOL automaticallyAdjustRangeModeBasedOnViewEvents
    - - - - - - - - - -
    -

    Discussion

    -

    Default value is YES if node or view controller conform to ASRangeControllerUpdateRangeProtocol otherwise it is NO.

    -
    - - - - - - - -
    -

    Declared In

    -

    ASViewController.h

    -
    - - -
    -
    -
    -
    - -
    - - - - - - -
    - -
    - -
    -
    -
    -
    - - - - \ No newline at end of file diff --git a/submodules/AsyncDisplayKit/docs/appledoc/Categories/CALayer+AsyncDisplayKit.html b/submodules/AsyncDisplayKit/docs/appledoc/Categories/CALayer+AsyncDisplayKit.html deleted file mode 100755 index 33a9fc83d1..0000000000 --- a/submodules/AsyncDisplayKit/docs/appledoc/Categories/CALayer+AsyncDisplayKit.html +++ /dev/null @@ -1,182 +0,0 @@ - - - - - - CALayer(AsyncDisplayKit) Category Reference - - - - - - -
    -
    - -

    - -

    - -

    - AsyncDisplayKit -

    - -
    -
    - - - -
    -
    -
    -
    -

    CALayer(AsyncDisplayKit) Category Reference

    - - -
    - - - - -
    Declared inASDisplayNode.h
    - - - - - - -
    - - - - - - -
    -
    - -

    – addSubnode: -

    - -
    -
    - -
    - - -
    -

    Convenience method, equivalent to [layer addSublayer:node.layer].

    -
    - - - -
    - (void)addSubnode:(nonnull ASDisplayNode *)node
    - - - -
    -

    Parameters

    - - - - - - - -
    node

    The node to be added.

    -
    - - - - - - - - - - - - - -
    -

    Declared In

    -

    ASDisplayNode.h

    -
    - - -
    -
    -
    -
    - -
    - - - - - - -
    - -
    - -
    -
    -
    -
    - - - - \ No newline at end of file diff --git a/submodules/AsyncDisplayKit/docs/appledoc/Categories/NSNumber+ASDimension.html b/submodules/AsyncDisplayKit/docs/appledoc/Categories/NSNumber+ASDimension.html deleted file mode 100755 index 7d11d7936e..0000000000 --- a/submodules/AsyncDisplayKit/docs/appledoc/Categories/NSNumber+ASDimension.html +++ /dev/null @@ -1,118 +0,0 @@ - - - - - - NSNumber(ASDimension) Category Reference - - - - - - -
    -
    - -

    - -

    - -

    - AsyncDisplayKit -

    - -
    -
    - - - -
    -
    -
    -
    -

    NSNumber(ASDimension) Category Reference

    - - -
    - - - - -
    Declared inASDimension.h
    - - - - -
    - -

    Overview

    -

    Resolve this dimension to a parent size.

    -
    - - - - - - - - - - -
    - -
    - -
    -
    -
    -
    - - - - \ No newline at end of file diff --git a/submodules/AsyncDisplayKit/docs/appledoc/Categories/NSURL+ASPhotosFrameworkURLs.html b/submodules/AsyncDisplayKit/docs/appledoc/Categories/NSURL+ASPhotosFrameworkURLs.html deleted file mode 100755 index 1ca4bce449..0000000000 --- a/submodules/AsyncDisplayKit/docs/appledoc/Categories/NSURL+ASPhotosFrameworkURLs.html +++ /dev/null @@ -1,176 +0,0 @@ - - - - - - NSURL(ASPhotosFrameworkURLs) Category Reference - - - - - - -
    -
    - -

    - -

    - -

    - AsyncDisplayKit -

    - -
    -
    - - - -
    -
    -
    -
    -

    NSURL(ASPhotosFrameworkURLs) Category Reference

    - - -
    - - - - -
    Declared inASMultiplexImageNode.h
    - - - - - - -
    - - - - - - -
    -
    - -

    + URLWithAssetLocalIdentifier:targetSize:contentMode:options: -

    - -
    -
    - -
    - - -
    -

    Create an NSURL that specifies an image from the Photos framework.

    -
    - - - -
    + (NSURL *)URLWithAssetLocalIdentifier:(NSString *)assetLocalIdentifier targetSize:(CGSize)targetSize contentMode:(PHImageContentMode)contentMode options:(PHImageRequestOptions *)options
    - - - - - - - - - -
    -

    Discussion

    -

    When implementing -multiplexImageNode:URLForImageIdentifier:, you can return a URL -created by this method and the image node will attempt to load the image from the Photos framework.

    Note: The synchronous flag in options is ignored.

    Note: The Opportunistic delivery mode is not supported and will be treated as HighQualityFormat.

    -
    - - - - - - - -
    -

    Declared In

    -

    ASMultiplexImageNode.h

    -
    - - -
    -
    -
    -
    - -
    - - - - - - -
    - -
    - -
    -
    -
    -
    - - - - \ No newline at end of file diff --git a/submodules/AsyncDisplayKit/docs/appledoc/Categories/UIImage+ASDKAdditions.html b/submodules/AsyncDisplayKit/docs/appledoc/Categories/UIImage+ASDKAdditions.html deleted file mode 100755 index 6bf7903113..0000000000 --- a/submodules/AsyncDisplayKit/docs/appledoc/Categories/UIImage+ASDKAdditions.html +++ /dev/null @@ -1,352 +0,0 @@ - - - - - - UIImage(ASDKAdditions) Category Reference - - - - - - -
    -
    - -

    - -

    - -

    - Texture -

    - -
    -
    - - - -
    -
    -
    -
    -

    UIImage(ASDKAdditions) Category Reference

    - - -
    - - - - -
    Declared inUIImage+ASConvenience.h
    - - - - - - -
    - - - - - - -
    -
    - -

    + as_resizableRoundedImageWithCornerRadius:cornerColor:fillColor: -

    - -
    -
    - -
    - - -
    -

    This generates a flat-color, rounded-corner resizeable image

    -
    - - - -
    + (UIImage *)as_resizableRoundedImageWithCornerRadius:(CGFloat)cornerRadius cornerColor:(UIColor *)cornerColor fillColor:(UIColor *)fillColor
    - - - -
    -

    Parameters

    - - - - - - - - - - - - - - - - - -
    cornerRadius

    The radius of the rounded-corner

    cornerColor

    The fill color of the corners (For Alpha corners use clearColor)

    fillColor

    The fill color of the rounded-corner image

    -
    - - - - - - - - - - - - - -
    -

    Declared In

    -

    UIImage+ASConvenience.h

    -
    - - -
    -
    -
    - -

    + as_resizableRoundedImageWithCornerRadius:cornerColor:fillColor:borderColor:borderWidth: -

    - -
    -
    - -
    - - -
    -

    This generates a flat-color, rounded-corner resizeable image with a border

    -
    - - - -
    + (UIImage *)as_resizableRoundedImageWithCornerRadius:(CGFloat)cornerRadius cornerColor:(UIColor *)cornerColor fillColor:(UIColor *)fillColor borderColor:(nullable UIColor *)borderColor borderWidth:(CGFloat)borderWidth
    - - - -
    -

    Parameters

    - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    cornerRadius

    The radius of the rounded-corner

    cornerColor

    The fill color of the corners (For Alpha corners use clearColor)

    fillColor

    The fill color of the rounded-corner image

    borderColor

    The border color. Set to nil for no border.

    borderWidth

    The border width. Dummy value if borderColor = nil.

    -
    - - - - - - - - - - - - - -
    -

    Declared In

    -

    UIImage+ASConvenience.h

    -
    - - -
    -
    -
    - -

    + as_resizableRoundedImageWithCornerRadius:cornerColor:fillColor:borderColor:borderWidth:roundedCorners:scale: -

    - -
    -
    - -
    - - -
    -

    This generates a flat-color, rounded-corner resizeable image with a border

    -
    - - - -
    + (UIImage *)as_resizableRoundedImageWithCornerRadius:(CGFloat)cornerRadius cornerColor:(UIColor *)cornerColor fillColor:(UIColor *)fillColor borderColor:(nullable UIColor *)borderColor borderWidth:(CGFloat)borderWidth roundedCorners:(UIRectCorner)roundedCorners scale:(CGFloat)scale
    - - - -
    -

    Parameters

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    cornerRadius

    The radius of the rounded-corner

    cornerColor

    The fill color of the corners (For Alpha corners use clearColor)

    fillColor

    The fill color of the rounded-corner image

    borderColor

    The border color. Set to nil for no border.

    borderWidth

    The border width. Dummy value if borderColor = nil.

    roundedCorners

    Select individual or multiple corners to round. Set to UIRectCornerAllCorners to round all 4 corners.

    scale

    The number of pixels per point. Provide 0.0 to use the screen scale.

    -
    - - - - - - - - - - - - - -
    -

    Declared In

    -

    UIImage+ASConvenience.h

    -
    - - -
    -
    -
    -
    - -
    - - - - - - -
    - - -
    -
    -
    - - - - \ No newline at end of file diff --git a/submodules/AsyncDisplayKit/docs/appledoc/Categories/UIView+AsyncDisplayKit.html b/submodules/AsyncDisplayKit/docs/appledoc/Categories/UIView+AsyncDisplayKit.html deleted file mode 100755 index a1bcd6c40b..0000000000 --- a/submodules/AsyncDisplayKit/docs/appledoc/Categories/UIView+AsyncDisplayKit.html +++ /dev/null @@ -1,192 +0,0 @@ - - - - - - UIView(AsyncDisplayKit) Category Reference - - - - - - -
    -
    - -

    - -

    - -

    - AsyncDisplayKit -

    - -
    -
    - - - -
    -
    -
    -
    -

    UIView(AsyncDisplayKit) Category Reference

    - - -
    - - - - -
    Declared inASDisplayNode.h
    - - - - -
    - -

    Overview

    -

    UIVIew(AsyncDisplayKit) defines convenience method for adding sub-ASDisplayNode to an UIView.

    -
    - - - - - -
    - - - - - - -
    -
    - -

    – addSubnode: -

    - -
    -
    - -
    - - -
    -

    Convenience method, equivalent to [view addSubview:node.view] or [view.layer addSublayer:node.layer] if layer-backed.

    -
    - - - -
    - (void)addSubnode:(nonnull ASDisplayNode *)node
    - - - -
    -

    Parameters

    - - - - - - - -
    node

    The node to be added.

    -
    - - - - - - - - - - - - - -
    -

    Declared In

    -

    ASDisplayNode.h

    -
    - - -
    -
    -
    -
    - -
    - - - - - - -
    - -
    - -
    -
    -
    -
    - - - - \ No newline at end of file diff --git a/submodules/AsyncDisplayKit/docs/appledoc/Classes/ASAbsoluteLayoutSpec.html b/submodules/AsyncDisplayKit/docs/appledoc/Classes/ASAbsoluteLayoutSpec.html deleted file mode 100755 index 4a526d9b96..0000000000 --- a/submodules/AsyncDisplayKit/docs/appledoc/Classes/ASAbsoluteLayoutSpec.html +++ /dev/null @@ -1,302 +0,0 @@ - - - - - - ASAbsoluteLayoutSpec Class Reference - - - - - - -
    -
    - -

    - -

    - -

    - AsyncDisplayKit -

    - -
    -
    - - - -
    -
    -
    -
    -

    ASAbsoluteLayoutSpec Class Reference

    - - -
    - - - - - - - -
    Inherits fromASLayoutSpec : NSObject
    Declared inASAbsoluteLayoutSpec.h
    - - - - -
    - -

    Overview

    -

    A layout spec that positions children at fixed positions.

    -
    - - - - - -
    - - - - - - -
    -
    - -

      sizing -

    - -
    -
    - -
    - - -
    -

    How much space will the spec taken up

    -
    - - - -
    @property (nonatomic, assign) ASAbsoluteLayoutSpecSizing sizing
    - - - - - - - - - - - - - - - -
    -

    Declared In

    -

    ASAbsoluteLayoutSpec.h

    -
    - - -
    -
    -
    - -

    + absoluteLayoutSpecWithSizing:children: -

    - -
    -
    - -
    - - -
    -

    How much space the spec will take up

    -
    - - - -
    + (instancetype)absoluteLayoutSpecWithSizing:(ASAbsoluteLayoutSpecSizing)sizing children:(NSArray<id<ASLayoutElement> > *)children
    - - - -
    -

    Parameters

    - - - - - - - - - - - - -
    sizing

    How much space the spec will take up

    children

    Children to be positioned at fixed positions

    -
    - - - - - - - - - - - - - -
    -

    Declared In

    -

    ASAbsoluteLayoutSpec.h

    -
    - - -
    -
    -
    - -

    + absoluteLayoutSpecWithChildren: -

    - -
    -
    - -
    - - -
    -

    Children to be positioned at fixed positions

    -
    - - - -
    + (instancetype)absoluteLayoutSpecWithChildren:(NSArray<id<ASLayoutElement> > *)children
    - - - -
    -

    Parameters

    - - - - - - - -
    children

    Children to be positioned at fixed positions

    -
    - - - - - - - - - - - - - -
    -

    Declared In

    -

    ASAbsoluteLayoutSpec.h

    -
    - - -
    -
    -
    -
    - -
    - - - - - - -
    - -
    - -
    -
    -
    -
    - - - - \ No newline at end of file diff --git a/submodules/AsyncDisplayKit/docs/appledoc/Classes/ASAsciiArtBoxCreator.html b/submodules/AsyncDisplayKit/docs/appledoc/Classes/ASAsciiArtBoxCreator.html deleted file mode 100755 index de14a95656..0000000000 --- a/submodules/AsyncDisplayKit/docs/appledoc/Classes/ASAsciiArtBoxCreator.html +++ /dev/null @@ -1,236 +0,0 @@ - - - - - - ASAsciiArtBoxCreator Class Reference - - - - - - -
    -
    - -

    - -

    - -

    - AsyncDisplayKit -

    - -
    -
    - - - -
    -
    -
    -
    -

    ASAsciiArtBoxCreator Class Reference

    - - -
    - - - - - - - -
    Inherits fromNSObject
    Declared inASAsciiArtBoxCreator.h
    - - - - -
    - -

    Overview

    -

    A that takes a parent and its children and renders as ascii art box.

    -
    - - - - - -
    - - - - - - -
    -
    - -

    + horizontalBoxStringForChildren:parent: -

    - -
    -
    - -
    - - -
    -

    Renders an ascii art box with the children aligned horizontally -Example: -————ASStackLayoutSpec———–

    - -

    | ASTextNode ASTextNode ASTextNode |

    -
    - - - -
    + (NSString *)horizontalBoxStringForChildren:(NSArray<NSString*> *)children parent:(NSString *)parent
    - - - - - - - - - - - - - - - -
    -

    Declared In

    -

    ASAsciiArtBoxCreator.h

    -
    - - -
    -
    -
    - -

    + verticalBoxStringForChildren:parent: -

    - -
    -
    - -
    - - -
    -

    Renders an ascii art box with the children aligned vertically. -Example: -–ASStackLayoutSpec– -| ASTextNode | -| ASTextNode |

    - -

    | ASTextNode |

    -
    - - - -
    + (NSString *)verticalBoxStringForChildren:(NSArray<NSString*> *)children parent:(NSString *)parent
    - - - - - - - - - - - - - - - -
    -

    Declared In

    -

    ASAsciiArtBoxCreator.h

    -
    - - -
    -
    -
    -
    - -
    - - - - - - -
    - -
    - -
    -
    -
    -
    - - - - \ No newline at end of file diff --git a/submodules/AsyncDisplayKit/docs/appledoc/Classes/ASBackgroundLayoutSpec.html b/submodules/AsyncDisplayKit/docs/appledoc/Classes/ASBackgroundLayoutSpec.html deleted file mode 100755 index e860a8b322..0000000000 --- a/submodules/AsyncDisplayKit/docs/appledoc/Classes/ASBackgroundLayoutSpec.html +++ /dev/null @@ -1,247 +0,0 @@ - - - - - - ASBackgroundLayoutSpec Class Reference - - - - - - -
    -
    - -

    - -

    - -

    - AsyncDisplayKit -

    - -
    -
    - - - -
    -
    -
    -
    -

    ASBackgroundLayoutSpec Class Reference

    - - -
    - - - - - - - -
    Inherits fromASLayoutSpec : NSObject
    Declared inASBackgroundLayoutSpec.h
    - - - - -
    - -

    Overview

    -

    Lays out a single layoutElement child, then lays out a background layoutElement instance behind it stretched to its size.

    -
    - - - - - -
    - - - - - - -
    -
    - -

      background -

    - -
    -
    - -
    - - -
    -

    Background layoutElement for this layout spec

    -
    - - - -
    @property (nullable, nonatomic, strong) id<ASLayoutElement> background
    - - - - - - - - - - - - - - - -
    -

    Declared In

    -

    ASBackgroundLayoutSpec.h

    -
    - - -
    -
    -
    - -

    + backgroundLayoutSpecWithChild:background: -

    - -
    -
    - -
    - - -
    -

    Creates and returns an ASBackgroundLayoutSpec object

    -
    - - - -
    + (instancetype)backgroundLayoutSpecWithChild:(id<ASLayoutElement>)child background:(nullable id<ASLayoutElement>)background
    - - - -
    -

    Parameters

    - - - - - - - - - - - - -
    child

    A child that is laid out to determine the size of this spec.

    background

    A layoutElement object that is laid out behind the child. If this is nil, the background is omitted.

    -
    - - - - - - - - - - - - - -
    -

    Declared In

    -

    ASBackgroundLayoutSpec.h

    -
    - - -
    -
    -
    -
    - -
    - - - - - - -
    - -
    - -
    -
    -
    -
    - - - - \ No newline at end of file diff --git a/submodules/AsyncDisplayKit/docs/appledoc/Classes/ASButtonNode.html b/submodules/AsyncDisplayKit/docs/appledoc/Classes/ASButtonNode.html deleted file mode 100755 index 3aca43f70f..0000000000 --- a/submodules/AsyncDisplayKit/docs/appledoc/Classes/ASButtonNode.html +++ /dev/null @@ -1,831 +0,0 @@ - - - - - - ASButtonNode Class Reference - - - - - - -
    -
    - -

    - -

    - -

    - AsyncDisplayKit -

    - -
    -
    - - - -
    -
    -
    -
    -

    ASButtonNode Class Reference

    - - -
    - - - - - - - -
    Inherits fromASControlNode : ASDisplayNode : ASDealloc2MainObject
    Declared inASButtonNode.h
    - - - - - - -
    - - - - - - -
    -
    - -

      contentSpacing -

    - -
    -
    - -
    - - -
    -

    Spacing between image and title. Defaults to 8.0.

    -
    - - - -
    @property (nonatomic, assign) CGFloat contentSpacing
    - - - - - - - - - - - - - - - -
    -

    Declared In

    -

    ASButtonNode.h

    -
    - - -
    -
    -
    - -

      laysOutHorizontally -

    - -
    -
    - -
    - - -
    -

    Whether button should be laid out vertically (image on top of text) or horizontally (image to the left of text). -ASButton node does not yet support RTL but it should be fairly easy to implement. -Defaults to YES.

    -
    - - - -
    @property (nonatomic, assign) BOOL laysOutHorizontally
    - - - - - - - - - - - - - - - -
    -

    Declared In

    -

    ASButtonNode.h

    -
    - - -
    -
    -
    - -

      contentHorizontalAlignment -

    - -
    -
    - -
    - - -
    -

    Horizontally align content (text or image). -Defaults to ASHorizontalAlignmentMiddle.

    -
    - - - -
    @property (nonatomic, assign) ASHorizontalAlignment contentHorizontalAlignment
    - - - - - - - - - - - - - - - -
    -

    Declared In

    -

    ASButtonNode.h

    -
    - - -
    -
    -
    - -

      contentVerticalAlignment -

    - -
    -
    - -
    - - -
    -

    Vertically align content (text or image). -Defaults to ASVerticalAlignmentCenter.

    -
    - - - -
    @property (nonatomic, assign) ASVerticalAlignment contentVerticalAlignment
    - - - - - - - - - - - - - - - -
    -

    Declared In

    -

    ASButtonNode.h

    -
    - - -
    -
    -
    - -

      contentEdgeInsets -

    - -
    -
    - -
    - - -
    -

    The insets used around the title and image node

    -
    - - - -
    @property (nonatomic, assign) UIEdgeInsets contentEdgeInsets
    - - - - - - - - - -
    -

    Discussion

    -

    The insets used around the title and image node

    -
    - - - - - - - -
    -

    Declared In

    -

    ASButtonNode.h

    -
    - - -
    -
    -
    - -

      imageAlignment -

    - -
    -
    - -
    - - -
    -

    @discusstion Whether the image should be aligned at the beginning or at the end of node. Default is ASButtonNodeImageAlignmentBeginning.

    -
    - - - -
    @property (nonatomic, assign) ASButtonNodeImageAlignment imageAlignment
    - - - - - - - - - - - - - - - -
    -

    Declared In

    -

    ASButtonNode.h

    -
    - - -
    -
    -
    - -

    – attributedTitleForState: -

    - -
    -
    - -
    - - -
    -

    Returns the styled title associated with the specified state.

    -
    - - - -
    - (NSAttributedString *_Nullable)attributedTitleForState:(ASControlState)state
    - - - -
    -

    Parameters

    - - - - - - - -
    state

    The state that uses the styled title. The possible values are described in ASControlState.

    -
    - - - -
    -

    Return Value

    -

    The title for the specified state.

    -
    - - - - - - - - - - - -
    -

    Declared In

    -

    ASButtonNode.h

    -
    - - -
    -
    -
    - -

    – setAttributedTitle:forState: -

    - -
    -
    - -
    - - -
    -

    Sets the styled title to use for the specified state. This will reset styled title previously set with -setTitle:withFont:withColor:forState.

    -
    - - - -
    - (void)setAttributedTitle:(nullable NSAttributedString *)title forState:(ASControlState)state
    - - - -
    -

    Parameters

    - - - - - - - - - - - - -
    title

    The styled text string to use for the title.

    state

    The state that uses the specified title. The possible values are described in ASControlState.

    -
    - - - - - - - - - - - - - -
    -

    Declared In

    -

    ASButtonNode.h

    -
    - - -
    -
    -
    - -

    – setTitle:withFont:withColor:forState: -

    - -
    -
    - -
    - - -
    -

    Sets the title to use for the specified state. This will reset styled title previously set with -setAttributedTitle:forState.

    -
    - - - -
    - (void)setTitle:(NSString *)title withFont:(nullable UIFont *)font withColor:(nullable UIColor *)color forState:(ASControlState)state
    - - - -
    -

    Parameters

    - - - - - - - - - - - - - - - - - - - - - - -
    title

    The styled text string to use for the title.

    font

    The font to use for the title.

    color

    The color to use for the title.

    state

    The state that uses the specified title. The possible values are described in ASControlState.

    -
    - - - - - - - - - - - - - -
    -

    Declared In

    -

    ASButtonNode.h

    -
    - - -
    -
    -
    - -

    – imageForState: -

    - -
    -
    - -
    - - -
    -

    Returns the image used for a button state.

    -
    - - - -
    - (nullable UIImage *)imageForState:(ASControlState)state
    - - - -
    -

    Parameters

    - - - - - - - -
    state

    The state that uses the image. Possible values are described in ASControlState.

    -
    - - - -
    -

    Return Value

    -

    The image used for the specified state.

    -
    - - - - - - - - - - - -
    -

    Declared In

    -

    ASButtonNode.h

    -
    - - -
    -
    -
    - -

    – setImage:forState: -

    - -
    -
    - -
    - - -
    -

    Sets the image to use for the specified state.

    -
    - - - -
    - (void)setImage:(nullable UIImage *)image forState:(ASControlState)state
    - - - -
    -

    Parameters

    - - - - - - - - - - - - -
    image

    The image to use for the specified state.

    state

    The state that uses the specified title. The values are described in ASControlState.

    -
    - - - - - - - - - - - - - -
    -

    Declared In

    -

    ASButtonNode.h

    -
    - - -
    -
    -
    - -

    – setBackgroundImage:forState: -

    - -
    -
    - -
    - - -
    -

    Sets the background image to use for the specified state.

    -
    - - - -
    - (void)setBackgroundImage:(nullable UIImage *)image forState:(ASControlState)state
    - - - -
    -

    Parameters

    - - - - - - - - - - - - -
    image

    The image to use for the specified state.

    state

    The state that uses the specified title. The values are described in ASControlState.

    -
    - - - - - - - - - - - - - -
    -

    Declared In

    -

    ASButtonNode.h

    -
    - - -
    -
    -
    - -

    – backgroundImageForState: -

    - -
    -
    - -
    - - -
    -

    Returns the background image used for a button state.

    -
    - - - -
    - (nullable UIImage *)backgroundImageForState:(ASControlState)state
    - - - -
    -

    Parameters

    - - - - - - - -
    state

    The state that uses the image. Possible values are described in ASControlState.

    -
    - - - -
    -

    Return Value

    -

    The background image used for the specified state.

    -
    - - - - - - - - - - - -
    -

    Declared In

    -

    ASButtonNode.h

    -
    - - -
    -
    -
    -
    - -
    - - - - - - -
    - -
    - -
    -
    -
    -
    - - - - \ No newline at end of file diff --git a/submodules/AsyncDisplayKit/docs/appledoc/Classes/ASCellNode.html b/submodules/AsyncDisplayKit/docs/appledoc/Classes/ASCellNode.html deleted file mode 100755 index 2f92770841..0000000000 --- a/submodules/AsyncDisplayKit/docs/appledoc/Classes/ASCellNode.html +++ /dev/null @@ -1,558 +0,0 @@ - - - - - - ASCellNode Class Reference - - - - - - -
    -
    - -

    - -

    - -

    - AsyncDisplayKit -

    - -
    -
    - - - -
    -
    -
    -
    -

    ASCellNode Class Reference

    - - -
    - - - - - - - -
    Inherits fromASDisplayNode : ASDealloc2MainObject
    Declared inASCellNode.h
    - - - - -
    - -

    Overview

    -
      -
    • Generic cell node. Subclass this instead of ASDisplayNode to use with ASTableView and ASCollectionView.

    • -
    • @note When a cell node is contained inside a collection view (or table view),

    • -
    • calling -setNeedsLayout will also notify the collection on the main thread
    • -
    • so that the collection can update its item layout if the cell’s size changed.
    • -
    - -
    - - - - - -
    - - - - - - -
    -
    - -

      neverShowPlaceholders -

    - -
    -
    - -
    - - -
    -

    When enabled, ensures that the cell is completely displayed before allowed onscreen.

    - -

    @default NO

    -
    - - - -
    @property (nonatomic, assign) BOOL neverShowPlaceholders
    - - - - - - - - - -
    -

    Discussion

    -

    Normally, ASCellNodes are preloaded and have finished display before they are onscreen. -However, if the Table or Collection’s rangeTuningParameters are set to small values (or 0), -or if the user is scrolling rapidly on a slow device, it is possible for a cell’s display to -be incomplete when it becomes visible.

    - -

    In this case, normally placeholder states are shown and scrolling continues uninterrupted. -The finished, drawn content is then shown as soon as it is ready.

    - -

    With this property set to YES, the main thread will be blocked until display is complete for -the cell. This is more similar to UIKit, and in fact makes AsyncDisplayKit scrolling visually -indistinguishable from UIKit’s, except being faster.

    - -

    Using this option does not eliminate all of the performance advantages of AsyncDisplayKit. -Normally, a cell has been preloading and is almost done when it reaches the screen, so the -blocking time is very short. If the rangeTuningParameters are set to 0, still this option -outperforms UIKit: while the main thread is waiting, subnode display executes concurrently.

    -
    - - - - - - - -
    -

    Declared In

    -

    ASCellNode.h

    -
    - - -
    -
    -
    - -

      selected -

    - -
    -
    - -
    - - -
    -

    A Boolean value that is synchronized with the underlying collection or tableView cell property. -Setting this value is equivalent to calling selectItem / deselectItem on the collection or table.

    -
    - - - -
    @property (nonatomic, assign, getter=isSelected) BOOL selected
    - - - - - - - - - - - - - - - -
    -

    Declared In

    -

    ASCellNode.h

    -
    - - -
    -
    -
    - -

      highlighted -

    - -
    -
    - -
    - - -
    -

    A Boolean value that is synchronized with the underlying collection or tableView cell property. -Setting this value is equivalent to calling highlightItem / unHighlightItem on the collection or table.

    -
    - - - -
    @property (nonatomic, assign, getter=isHighlighted) BOOL highlighted
    - - - - - - - - - - - - - - - -
    -

    Declared In

    -

    ASCellNode.h

    -
    - - -
    -
    -
    - -

      indexPath -

    - -
    -
    - -
    - - -
    -

    The current index path of this cell node, or @c nil if this node is -not a valid item inside a table node or collection node.

    -
    - - - -
    @property (nonatomic, readonly, nullable) NSIndexPath *indexPath
    - - - - - - - - - -
    -

    Discussion

    -

    Note: This property must be accessed on the main thread.

    -
    - - - - - - - -
    -

    Declared In

    -

    ASCellNode.h

    -
    - - -
    -
    -
    - -

      owningNode -

    - -
    -
    - -
    - - -
    -

    The owning node (ASCollectionNode/ASTableNode) of this cell node, or @c nil if this node is -not a valid item inside a table node or collection node or if those nodes are nil.

    -
    - - - -
    @property (weak, nonatomic, readonly, nullable) ASDisplayNode *owningNode
    - - - - - - - - - - - - - - - -
    -

    Declared In

    -

    ASCellNode.h

    -
    - - -
    -
    -
    - -

    – applyLayoutAttributes: -

    - -
    -
    - -
    - - -
    -

    Called by the system when ASCellNode is used with an ASCollectionNode. It will not be called by ASTableNode. -When the UICollectionViewLayout object returns a new UICollectionViewLayoutAttributes object, the corresponding ASCellNode will be updated. -See UICollectionViewCell’s applyLayoutAttributes: for a full description.

    -
    - - - -
    - (void)applyLayoutAttributes:(UICollectionViewLayoutAttributes *)layoutAttributes
    - - - - - - - - - - - - - - - -
    -

    Declared In

    -

    ASCellNode.h

    -
    - - -
    -
    -
    - -

    – initWithViewControllerBlock:didLoadBlock: -

    - -
    -
    - -
    - - -
    -

    Initializes a cell with a given view controller block.

    -
    - - - -
    - (instancetype)initWithViewControllerBlock:(ASDisplayNodeViewControllerBlock)viewControllerBlock didLoadBlock:(nullable ASDisplayNodeDidLoadBlock)didLoadBlock
    - - - -
    -

    Parameters

    - - - - - - - - - - - - -
    viewControllerBlock

    The block that will be used to create the backing view controller.

    didLoadBlock

    The block that will be called after the view controller’s view is loaded.

    -
    - - - -
    -

    Return Value

    -

    An ASCellNode created using the root view of the view controller provided by the viewControllerBlock. -The view controller’s root view is resized to match the calculated size produced during layout.

    -
    - - - - - - - - - - - -
    -

    Declared In

    -

    ASCellNode.h

    -
    - - -
    -
    -
    - -

    – cellNodeVisibilityEvent:inScrollView:withCellFrame: -

    - -
    -
    - -
    - - -
    -

    Notifies the cell node of certain visibility events, such as changing visible rect.

    -
    - - - -
    - (void)cellNodeVisibilityEvent:(ASCellNodeVisibilityEvent)event inScrollView:(nullable UIScrollView *)scrollView withCellFrame:(CGRect)cellFrame
    - - - - - - - - - -
    -

    Discussion

    -

    Warning: In cases where an ASCellNode is used as a plain node – i.e. not returned from the -nodeBlockForItemAtIndexPath/nodeForItemAtIndexPath data source methods – this method will -deliver only the Visible and Invisible events, scrollView will be nil, and -cellFrame will be the zero rect.

    -
    - - - - - - - -
    -

    Declared In

    -

    ASCellNode.h

    -
    - - -
    -
    -
    -
    - -
    - - - - - - -
    - -
    - -
    -
    -
    -
    - - - - \ No newline at end of file diff --git a/submodules/AsyncDisplayKit/docs/appledoc/Classes/ASCenterLayoutSpec.html b/submodules/AsyncDisplayKit/docs/appledoc/Classes/ASCenterLayoutSpec.html deleted file mode 100755 index fe4f01cffd..0000000000 --- a/submodules/AsyncDisplayKit/docs/appledoc/Classes/ASCenterLayoutSpec.html +++ /dev/null @@ -1,207 +0,0 @@ - - - - - - ASCenterLayoutSpec Class Reference - - - - - - -
    -
    - -

    - -

    - -

    - AsyncDisplayKit -

    - -
    -
    - - - -
    -
    -
    -
    -

    ASCenterLayoutSpec Class Reference

    - - -
    - - - - - - - -
    Inherits fromASRelativeLayoutSpec : ASLayoutSpec : NSObject
    Declared inASCenterLayoutSpec.h
    - - - - -
    - -

    Overview

    -

    Lays out a single layoutElement child and position it so that it is centered into the layout bounds. -NOTE: ASRelativeLayoutSpec offers all of the capabilities of Center, and more. -Check it out if you would like to be able to position the child at any corner or the middle of an edge.

    -
    - - - - - -
    - - - - - - -
    -
    - -

    + centerLayoutSpecWithCenteringOptions:sizingOptions:child: -

    - -
    -
    - -
    - - -
    -

    Initializer.

    -
    - - - -
    + (instancetype)centerLayoutSpecWithCenteringOptions:(ASCenterLayoutSpecCenteringOptions)centeringOptions sizingOptions:(ASCenterLayoutSpecSizingOptions)sizingOptions child:(id<ASLayoutElement>)child
    - - - -
    -

    Parameters

    - - - - - - - - - - - - - - - - - -
    centeringOptions

    How the child is centered.

    sizingOptions

    How much space will be taken up.

    child

    The child to center.

    -
    - - - - - - - - - - - - - -
    -

    Declared In

    -

    ASCenterLayoutSpec.h

    -
    - - -
    -
    -
    -
    - -
    - - - - - - -
    - -
    - -
    -
    -
    -
    - - - - \ No newline at end of file diff --git a/submodules/AsyncDisplayKit/docs/appledoc/Classes/ASCollectionNode.html b/submodules/AsyncDisplayKit/docs/appledoc/Classes/ASCollectionNode.html deleted file mode 100755 index 2471991465..0000000000 --- a/submodules/AsyncDisplayKit/docs/appledoc/Classes/ASCollectionNode.html +++ /dev/null @@ -1,2405 +0,0 @@ - - - - - - ASCollectionNode Class Reference - - - - - - -
    -
    - -

    - -

    - -

    - AsyncDisplayKit -

    - -
    -
    - - - -
    -
    -
    -
    -

    ASCollectionNode Class Reference

    - - -
    - - - - - - - - - - -
    Inherits fromASDisplayNode : ASDealloc2MainObject
    Conforms toASRangeControllerUpdateRangeProtocol
    Declared inASCollectionNode.h
    - - - - -
    - -

    Overview

    -

    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.

    -
    - - - - - -
    - - - - - - -
    -
    - -

    – initWithCollectionViewLayout: -

    - -
    -
    - -
    - - -
    -

    Initializes an ASCollectionNode

    -
    - - - -
    - (instancetype)initWithCollectionViewLayout:(UICollectionViewLayout *)layout
    - - - -
    -

    Parameters

    - - - - - - - -
    layout

    The layout object to use for organizing items. The collection view stores a strong reference to the specified object. Must not be nil.

    -
    - - - - - - - -
    -

    Discussion

    -

    Initializes and returns a newly allocated collection node object with the specified layout.

    -
    - - - - - - - -
    -

    Declared In

    -

    ASCollectionNode.h

    -
    - - -
    -
    -
    - -

    – initWithFrame:collectionViewLayout: -

    - -
    -
    - -
    - - -
    -

    Initializes an ASCollectionNode

    -
    - - - -
    - (instancetype)initWithFrame:(CGRect)frame collectionViewLayout:(UICollectionViewLayout *)layout
    - - - -
    -

    Parameters

    - - - - - - - - - - - - -
    frame

    The frame rectangle for the collection view, measured in points. The origin of the frame is relative to the superview in which you plan to add it. This frame is passed to the superclass during initialization.

    layout

    The layout object to use for organizing items. The collection view stores a strong reference to the specified object. Must not be nil.

    -
    - - - - - - - -
    -

    Discussion

    -

    Initializes and returns a newly allocated collection node object with the specified frame and layout.

    -
    - - - - - - - -
    -

    Declared In

    -

    ASCollectionNode.h

    -
    - - -
    -
    -
    - -

      view -

    - -
    -
    - -
    - - -
    -

    Returns the corresponding ASCollectionView

    -
    - - - -
    @property (strong, nonatomic, readonly) ASCollectionView *view
    - - - - - -
    -

    Return Value

    -

    view The corresponding ASCollectionView.

    -
    - - - - - - - - - - - -
    -

    Declared In

    -

    ASCollectionNode.h

    -
    - - -
    -
    -
    - -

      delegate -

    - -
    -
    - -
    - - -
    -

    The object that acts as the asynchronous delegate of the collection view

    -
    - - - -
    @property (weak, nonatomic) id<ASCollectionDelegate> delegate
    - - - - - - - - - -
    -

    Discussion

    -

    The delegate must adopt the ASCollectionDelegate protocol. The collection view maintains a weak reference to the delegate object.

    - -

    The delegate object is responsible for providing size constraints for nodes and indicating whether batch fetching should begin.

    Note: This is a convenience method which sets the asyncDelegate on the collection node’s collection view.

    -
    - - - - - - - -
    -

    Declared In

    -

    ASCollectionNode.h

    -
    - - -
    -
    -
    - -

      dataSource -

    - -
    -
    - -
    - - -
    -

    The object that acts as the asynchronous data source of the collection view

    -
    - - - -
    @property (weak, nonatomic) id<ASCollectionDataSource> dataSource
    - - - - - - - - - -
    -

    Discussion

    -

    The datasource must adopt the ASCollectionDataSource protocol. The collection view maintains a weak reference to the datasource object.

    - -

    The datasource object is responsible for providing nodes or node creation blocks to the collection view.

    Note: This is a convenience method which sets the asyncDatasource on the collection node’s collection view.

    -
    - - - - - - - -
    -

    Declared In

    -

    ASCollectionNode.h

    -
    - - -
    -
    -
    - -

      allowsSelection -

    - -
    -
    - -
    - - -
    -

    A Boolean value that indicates whether users can select items in the collection node. -If the value of this property is YES (the default), users can select items. If you want more fine-grained control over the selection of items, you must provide a delegate object and implement the appropriate methods of the UICollectionNodeDelegate protocol.

    -
    - - - -
    @property (nonatomic, assign) BOOL allowsSelection
    - - - - - - - - - - - - - - - -
    -

    Declared In

    -

    ASCollectionNode.h

    -
    - - -
    -
    -
    - -

      allowsMultipleSelection -

    - -
    -
    - -
    - - -
    -

    A Boolean value that determines whether users can select more than one item in the collection node. -This property controls whether multiple items can be selected simultaneously. The default value of this property is NO. -When the value of this property is YES, tapping a cell adds it to the current selection (assuming the delegate permits the cell to be selected). Tapping the cell again removes it from the selection.

    -
    - - - -
    @property (nonatomic, assign) BOOL allowsMultipleSelection
    - - - - - - - - - - - - - - - -
    -

    Declared In

    -

    ASCollectionNode.h

    -
    - - -
    -
    -
    - -

    – tuningParametersForRangeType: -

    - -
    -
    - -
    - - -
    -

    Tuning parameters for a range type in full mode.

    -
    - - - -
    - (ASRangeTuningParameters)tuningParametersForRangeType:(ASLayoutRangeType)rangeType
    - - - -
    -

    Parameters

    - - - - - - - -
    rangeType

    The range type to get the tuning parameters for.

    -
    - - - -
    -

    Return Value

    -

    A tuning parameter value for the given range type in full mode.

    -
    - - - - - - - - - - - -
    -

    Declared In

    -

    ASCollectionNode.h

    -
    - - -
    -
    -
    - -

    – setTuningParameters:forRangeType: -

    - -
    -
    - -
    - - -
    -

    Set the tuning parameters for a range type in full mode.

    -
    - - - -
    - (void)setTuningParameters:(ASRangeTuningParameters)tuningParameters forRangeType:(ASLayoutRangeType)rangeType
    - - - -
    -

    Parameters

    - - - - - - - - - - - - -
    tuningParameters

    The tuning parameters to store for a range type.

    rangeType

    The range type to set the tuning parameters for.

    -
    - - - - - - - - - - - - - -
    -

    Declared In

    -

    ASCollectionNode.h

    -
    - - -
    -
    -
    - -

    – tuningParametersForRangeMode:rangeType: -

    - -
    -
    - -
    - - -
    -

    Tuning parameters for a range type in the specified mode.

    -
    - - - -
    - (ASRangeTuningParameters)tuningParametersForRangeMode:(ASLayoutRangeMode)rangeMode rangeType:(ASLayoutRangeType)rangeType
    - - - -
    -

    Parameters

    - - - - - - - - - - - - -
    rangeMode

    The range mode to get the running parameters for.

    rangeType

    The range type to get the tuning parameters for.

    -
    - - - -
    -

    Return Value

    -

    A tuning parameter value for the given range type in the given mode.

    -
    - - - - - - - - - - - -
    -

    Declared In

    -

    ASCollectionNode.h

    -
    - - -
    -
    -
    - -

    – setTuningParameters:forRangeMode:rangeType: -

    - -
    -
    - -
    - - -
    -

    Set the tuning parameters for a range type in the specified mode.

    -
    - - - -
    - (void)setTuningParameters:(ASRangeTuningParameters)tuningParameters forRangeMode:(ASLayoutRangeMode)rangeMode rangeType:(ASLayoutRangeType)rangeType
    - - - -
    -

    Parameters

    - - - - - - - - - - - - - - - - - -
    tuningParameters

    The tuning parameters to store for a range type.

    rangeMode

    The range mode to set the running parameters for.

    rangeType

    The range type to set the tuning parameters for.

    -
    - - - - - - - - - - - - - -
    -

    Declared In

    -

    ASCollectionNode.h

    -
    - - -
    -
    -
    - -

    – scrollToItemAtIndexPath:atScrollPosition:animated: -

    - -
    -
    - -
    - - -
    -

    Scrolls the collection to the given item.

    -
    - - - -
    - (void)scrollToItemAtIndexPath:(NSIndexPath *)indexPath atScrollPosition:(UICollectionViewScrollPosition)scrollPosition animated:(BOOL)animated
    - - - -
    -

    Parameters

    - - - - - - - - - - - - - - - - - -
    indexPath

    The index path of the item.

    scrollPosition

    Where the item should end up after the scroll.

    animated

    Whether the scroll should be animated or not.

    - -

    This method must be called on the main thread.

    -
    - - - - - - - - - - - - - -
    -

    Declared In

    -

    ASCollectionNode.h

    -
    - - -
    -
    -
    - -

    – registerSupplementaryNodeOfKind: -

    - -
    -
    - -
    - - -
    -

    Registers the given kind of supplementary node for use in creating node-backed supplementary elements.

    -
    - - - -
    - (void)registerSupplementaryNodeOfKind:(NSString *)elementKind
    - - - -
    -

    Parameters

    - - - - - - - -
    elementKind

    The kind of supplementary node that will be requested through the data source.

    -
    - - - - - - - -
    -

    Discussion

    -

    Use this method to register support for the use of supplementary nodes in place of the default -registerClass:forSupplementaryViewOfKind:withReuseIdentifier: and registerNib:forSupplementaryViewOfKind:withReuseIdentifier: -methods. This method will register an internal backing view that will host the contents of the supplementary nodes -returned from the data source.

    -
    - - - - - - - -
    -

    Declared In

    -

    ASCollectionNode.h

    -
    - - -
    -
    -
    - -

    – performBatchAnimated:updates:completion: -

    - -
    -
    - -
    - - -
    -

    Perform a batch of updates asynchronously, optionally disabling all animations in the batch. This method must be called from the main thread. -The data source must be updated to reflect the changes before the update block completes.

    -
    - - - -
    - (void)performBatchAnimated:(BOOL)animated updates:(nullable __attribute ( ( noescape ) ) void ( ^ ) ( ))updates completion:(nullable void ( ^ ) ( BOOL finished ))completion
    - - - -
    -

    Parameters

    - - - - - - - - - - - - - - - - - -
    animated

    NO to disable animations for this batch

    updates

    The block that performs the relevant insert, delete, reload, or move operations.

    completion

    A completion handler block to execute when all of the operations are finished. This block takes a single -Boolean parameter that contains the value YES if all of the related animations completed successfully or -NO if they were interrupted. This parameter may be nil. If supplied, the block is run on the main thread.

    -
    - - - - - - - - - - - - - -
    -

    Declared In

    -

    ASCollectionNode.h

    -
    - - -
    -
    -
    - -

    – performBatchUpdates:completion: -

    - -
    -
    - -
    - - -
    -

    Perform a batch of updates asynchronously, optionally disabling all animations in the batch. This method must be called from the main thread. -The data source must be updated to reflect the changes before the update block completes.

    -
    - - - -
    - (void)performBatchUpdates:(nullable __attribute ( ( noescape ) ) void ( ^ ) ( ))updates completion:(nullable void ( ^ ) ( BOOL finished ))completion
    - - - -
    -

    Parameters

    - - - - - - - - - - - - -
    updates

    The block that performs the relevant insert, delete, reload, or move operations.

    completion

    A completion handler block to execute when all of the operations are finished. This block takes a single -Boolean parameter that contains the value YES if all of the related animations completed successfully or -NO if they were interrupted. This parameter may be nil. If supplied, the block is run on the main thread.

    -
    - - - - - - - - - - - - - -
    -

    Declared In

    -

    ASCollectionNode.h

    -
    - - -
    -
    -
    - -

    – waitUntilAllUpdatesAreCommitted -

    - -
    -
    - -
    - - -
    -

    Blocks execution of the main thread until all section and item updates are committed to the view. This method must be called from the main thread.

    -
    - - - -
    - (void)waitUntilAllUpdatesAreCommitted
    - - - - - - - - - - - - - - - -
    -

    Declared In

    -

    ASCollectionNode.h

    -
    - - -
    -
    -
    - -

    – insertSections: -

    - -
    -
    - -
    - - -
    -

    Inserts one or more sections.

    -
    - - - -
    - (void)insertSections:(NSIndexSet *)sections
    - - - -
    -

    Parameters

    - - - - - - - -
    sections

    An index set that specifies the sections to insert.

    -
    - - - - - - - -
    -

    Discussion

    -

    This method must be called from the main thread. The data source must be updated to reflect the changes -before this method is called.

    -
    - - - - - - - -
    -

    Declared In

    -

    ASCollectionNode.h

    -
    - - -
    -
    -
    - -

    – deleteSections: -

    - -
    -
    - -
    - - -
    -

    Deletes one or more sections.

    -
    - - - -
    - (void)deleteSections:(NSIndexSet *)sections
    - - - -
    -

    Parameters

    - - - - - - - -
    sections

    An index set that specifies the sections to delete.

    -
    - - - - - - - -
    -

    Discussion

    -

    This method must be called from the main thread. The data source must be updated to reflect the changes -before this method is called.

    -
    - - - - - - - -
    -

    Declared In

    -

    ASCollectionNode.h

    -
    - - -
    -
    -
    - -

    – reloadSections: -

    - -
    -
    - -
    - - -
    -

    Reloads the specified sections.

    -
    - - - -
    - (void)reloadSections:(NSIndexSet *)sections
    - - - -
    -

    Parameters

    - - - - - - - -
    sections

    An index set that specifies the sections to reload.

    -
    - - - - - - - -
    -

    Discussion

    -

    This method must be called from the main thread. The data source must be updated to reflect the changes -before this method is called.

    -
    - - - - - - - -
    -

    Declared In

    -

    ASCollectionNode.h

    -
    - - -
    -
    -
    - -

    – moveSection:toSection: -

    - -
    -
    - -
    - - -
    -

    Moves a section to a new location.

    -
    - - - -
    - (void)moveSection:(NSInteger)section toSection:(NSInteger)newSection
    - - - -
    -

    Parameters

    - - - - - - - - - - - - -
    section

    The index of the section to move.

    newSection

    The index that is the destination of the move for the section.

    -
    - - - - - - - -
    -

    Discussion

    -

    This method must be called from the main thread. The data source must be updated to reflect the changes -before this method is called.

    -
    - - - - - - - -
    -

    Declared In

    -

    ASCollectionNode.h

    -
    - - -
    -
    -
    - -

    – insertItemsAtIndexPaths: -

    - -
    -
    - -
    - - -
    -

    Inserts items at the locations identified by an array of index paths.

    -
    - - - -
    - (void)insertItemsAtIndexPaths:(NSArray<NSIndexPath*> *)indexPaths
    - - - -
    -

    Parameters

    - - - - - - - -
    indexPaths

    An array of NSIndexPath objects, each representing an item index and section index that together identify an item.

    -
    - - - - - - - -
    -

    Discussion

    -

    This method must be called from the main thread. The data source must be updated to reflect the changes -before this method is called.

    -
    - - - - - - - -
    -

    Declared In

    -

    ASCollectionNode.h

    -
    - - -
    -
    -
    - -

    – deleteItemsAtIndexPaths: -

    - -
    -
    - -
    - - -
    -

    Deletes the items specified by an array of index paths.

    -
    - - - -
    - (void)deleteItemsAtIndexPaths:(NSArray<NSIndexPath*> *)indexPaths
    - - - -
    -

    Parameters

    - - - - - - - -
    indexPaths

    An array of NSIndexPath objects identifying the items to delete.

    -
    - - - - - - - -
    -

    Discussion

    -

    This method must be called from the main thread. The data source must be updated to reflect the changes -before this method is called.

    -
    - - - - - - - -
    -

    Declared In

    -

    ASCollectionNode.h

    -
    - - -
    -
    -
    - -

    – reloadItemsAtIndexPaths: -

    - -
    -
    - -
    - - -
    -

    Reloads the specified items.

    -
    - - - -
    - (void)reloadItemsAtIndexPaths:(NSArray<NSIndexPath*> *)indexPaths
    - - - -
    -

    Parameters

    - - - - - - - -
    indexPaths

    An array of NSIndexPath objects identifying the items to reload.

    -
    - - - - - - - -
    -

    Discussion

    -

    This method must be called from the main thread. The data source must be updated to reflect the changes -before this method is called.

    -
    - - - - - - - -
    -

    Declared In

    -

    ASCollectionNode.h

    -
    - - -
    -
    -
    - -

    – moveItemAtIndexPath:toIndexPath: -

    - -
    -
    - -
    - - -
    -

    Moves the item at a specified location to a destination location.

    -
    - - - -
    - (void)moveItemAtIndexPath:(NSIndexPath *)indexPath toIndexPath:(NSIndexPath *)newIndexPath
    - - - -
    -

    Parameters

    - - - - - - - - - - - - -
    indexPath

    The index path identifying the item to move.

    newIndexPath

    The index path that is the destination of the move for the item.

    -
    - - - - - - - -
    -

    Discussion

    -

    This method must be called from the main thread. The data source must be updated to reflect the changes -before this method is called.

    -
    - - - - - - - -
    -

    Declared In

    -

    ASCollectionNode.h

    -
    - - -
    -
    -
    - -

    – reloadDataWithCompletion: -

    - -
    -
    - -
    - - -
    -

    Reload everything from scratch, destroying the working range and all cached nodes.

    -
    - - - -
    - (void)reloadDataWithCompletion:(nullable void ( ^ ) ( ))completion
    - - - -
    -

    Parameters

    - - - - - - - -
    completion

    block to run on completion of asynchronous loading or nil. If supplied, the block is run on -the main thread.

    -
    - - - - - - - -
    -

    Discussion

    -

    Warning: This method is substantially more expensive than UICollectionView’s version.

    -
    - - - - - - - -
    -

    Declared In

    -

    ASCollectionNode.h

    -
    - - -
    -
    -
    - -

    – reloadData -

    - -
    -
    - -
    - - -
    -

    Reload everything from scratch, destroying the working range and all cached nodes.

    -
    - - - -
    - (void)reloadData
    - - - - - - - - - -
    -

    Discussion

    -

    Warning: This method is substantially more expensive than UICollectionView’s version.

    -
    - - - - - - - -
    -

    Declared In

    -

    ASCollectionNode.h

    -
    - - -
    -
    -
    - -

    – relayoutItems -

    - -
    -
    - -
    - - -
    -

    Triggers a relayout of all nodes.

    -
    - - - -
    - (void)relayoutItems
    - - - - - - - - - -
    -

    Discussion

    -

    This method invalidates and lays out every cell node in the collection view.

    -
    - - - - - - - -
    -

    Declared In

    -

    ASCollectionNode.h

    -
    - - -
    -
    -
    - -

      indexPathsForSelectedItems -

    - -
    -
    - -
    - - -
    -

    The index paths of the selected items, or @c nil if no items are selected.

    -
    - - - -
    @property (nonatomic, readonly, nullable) NSArray<NSIndexPath*> *indexPathsForSelectedItems
    - - - - - - - - - - - - - - - -
    -

    Declared In

    -

    ASCollectionNode.h

    -
    - - -
    -
    -
    - -

    – selectItemAtIndexPath:animated:scrollPosition: -

    - -
    -
    - -
    - - -
    -

    Selects the item at the specified index path and optionally scrolls it into view. -If the allowsSelection property is NO, calling this method has no effect. If there is an existing selection with a different index path and the allowsMultipleSelection property is NO, calling this method replaces the previous selection. -This method does not cause any selection-related delegate methods to be called.

    -
    - - - -
    - (void)selectItemAtIndexPath:(nullable NSIndexPath *)indexPath animated:(BOOL)animated scrollPosition:(UICollectionViewScrollPosition)scrollPosition
    - - - -
    -

    Parameters

    - - - - - - - - - - - - - - - - - -
    indexPath

    The index path of the item to select. Specifying nil for this parameter clears the current selection.

    animated

    Specify YES to animate the change in the selection or NO to make the change without animating it.

    scrollPosition

    An option that specifies where the item should be positioned when scrolling finishes. For a list of possible values, see UICollectionViewScrollPosition.

    -
    - - - - - - - -
    -

    Discussion

    -

    This method must be called from the main thread.

    -
    - - - - - - - -
    -

    Declared In

    -

    ASCollectionNode.h

    -
    - - -
    -
    -
    - -

    – deselectItemAtIndexPath:animated: -

    - -
    -
    - -
    - - -
    -

    Deselects the item at the specified index. -If the allowsSelection property is NO, calling this method has no effect. -This method does not cause any selection-related delegate methods to be called.

    -
    - - - -
    - (void)deselectItemAtIndexPath:(NSIndexPath *)indexPath animated:(BOOL)animated
    - - - -
    -

    Parameters

    - - - - - - - - - - - - -
    indexPath

    The index path of the item to select. Specifying nil for this parameter clears the current selection.

    animated

    Specify YES to animate the change in the selection or NO to make the change without animating it.

    -
    - - - - - - - -
    -

    Discussion

    -

    This method must be called from the main thread.

    -
    - - - - - - - -
    -

    Declared In

    -

    ASCollectionNode.h

    -
    - - -
    -
    -
    - -

    – numberOfItemsInSection: -

    - -
    -
    - -
    - - -
    -

    Retrieves the number of items in the given section.

    -
    - - - -
    - (NSInteger)numberOfItemsInSection:(NSInteger)section
    - - - -
    -

    Parameters

    - - - - - - - -
    section

    The section.

    -
    - - - -
    -

    Return Value

    -

    The number of items.

    -
    - - - - - - - - - - - -
    -

    Declared In

    -

    ASCollectionNode.h

    -
    - - -
    -
    -
    - -

      numberOfSections -

    - -
    -
    - -
    - - -
    -

    The number of sections.

    -
    - - - -
    @property (nonatomic, readonly) NSInteger numberOfSections
    - - - - - - - - - - - - - - - -
    -

    Declared In

    -

    ASCollectionNode.h

    -
    - - -
    -
    -
    - -

      visibleNodes -

    - -
    -
    - -
    - - -
    -

    Similar to -visibleCells.

    -
    - - - -
    @property (nonatomic, readonly) NSArray<__kindofASCellNode*> *visibleNodes
    - - - - - -
    -

    Return Value

    -

    an array containing the nodes being displayed on screen. This must be called on the main thread.

    -
    - - - - - - - - - - - -
    -

    Declared In

    -

    ASCollectionNode.h

    -
    - - -
    -
    -
    - -

    – nodeForItemAtIndexPath: -

    - -
    -
    - -
    - - -
    -

    Retrieves the node for the item at the given index path.

    -
    - - - -
    - (nullable __kindof ASCellNode *)nodeForItemAtIndexPath:(NSIndexPath *)indexPath
    - - - -
    -

    Parameters

    - - - - - - - -
    indexPath

    The index path of the requested item.

    -
    - - - -
    -

    Return Value

    -

    The node for the given item, or @c nil if no item exists at the specified path.

    -
    - - - - - - - - - - - -
    -

    Declared In

    -

    ASCollectionNode.h

    -
    - - -
    -
    -
    - -

    – indexPathForNode: -

    - -
    -
    - -
    - - -
    -

    Retrieve the index path for the item with the given node.

    -
    - - - -
    - (nullable NSIndexPath *)indexPathForNode:(ASCellNode *)cellNode
    - - - -
    -

    Parameters

    - - - - - - - -
    cellNode

    A node for an item in the collection node.

    -
    - - - -
    -

    Return Value

    -

    The indexPath for this item.

    -
    - - - - - - - - - - - -
    -

    Declared In

    -

    ASCollectionNode.h

    -
    - - -
    -
    -
    - -

      indexPathsForVisibleItems -

    - -
    -
    - -
    - - -
    -

    Retrieve the index paths of all visible items.

    -
    - - - -
    @property (nonatomic, readonly) NSArray<NSIndexPath*> *indexPathsForVisibleItems
    - - - - - -
    -

    Return Value

    -

    an array containing the index paths of all visible items. This must be called on the main thread.

    -
    - - - - - - - - - - - -
    -

    Declared In

    -

    ASCollectionNode.h

    -
    - - -
    -
    -
    - -

    – indexPathForItemAtPoint: -

    - -
    -
    - -
    - - -
    -

    Retrieve the index path of the item at the given point.

    -
    - - - -
    - (nullable NSIndexPath *)indexPathForItemAtPoint:(CGPoint)point
    - - - -
    -

    Parameters

    - - - - - - - -
    point

    The point of the requested item.

    -
    - - - -
    -

    Return Value

    -

    The indexPath for the item at the given point. This must be called on the main thread.

    -
    - - - - - - - - - - - -
    -

    Declared In

    -

    ASCollectionNode.h

    -
    - - -
    -
    -
    - -

    – cellForItemAtIndexPath: -

    - -
    -
    - -
    - - -
    -

    Retrieve the cell at the given index path.

    -
    - - - -
    - (nullable UICollectionViewCell *)cellForItemAtIndexPath:(NSIndexPath *)indexPath
    - - - -
    -

    Parameters

    - - - - - - - -
    indexPath

    The index path of the requested item.

    -
    - - - -
    -

    Return Value

    -

    The cell for the given index path. This must be called on the main thread.

    -
    - - - - - - - - - - - -
    -

    Declared In

    -

    ASCollectionNode.h

    -
    - - -
    -
    -
    - -

    – contextForSection: -

    - -
    -
    - -
    - - -
    -

    Retrieves the context object for the given section, as provided by the data source in -the @c collectionNode:contextForSection: method.

    -
    - - - -
    - (nullable id<ASSectionContext>)contextForSection:(NSInteger)section
    - - - -
    -

    Parameters

    - - - - - - - -
    section

    The section to get the context for.

    -
    - - - -
    -

    Return Value

    -

    The context object, or @c nil if no context was provided.

    - -

    TODO: This method currently accepts @c section in the view index space, but it should -be in the node index space. To get the context in the view index space (e.g. for subclasses -of @c UICollectionViewLayout, the user will call the same method on @c ASCollectionView.

    -
    - - - - - - - - - - - -
    -

    Declared In

    -

    ASCollectionNode.h

    -
    - - -
    -
    -
    -
    - -
    - - - - - - -
    - -
    - -
    -
    -
    -
    - - - - \ No newline at end of file diff --git a/submodules/AsyncDisplayKit/docs/appledoc/Classes/ASCollectionView.html b/submodules/AsyncDisplayKit/docs/appledoc/Classes/ASCollectionView.html deleted file mode 100755 index c726f1a145..0000000000 --- a/submodules/AsyncDisplayKit/docs/appledoc/Classes/ASCollectionView.html +++ /dev/null @@ -1,731 +0,0 @@ - - - - - - ASCollectionView Class Reference - - - - - - -
    -
    - -

    - -

    - -

    - AsyncDisplayKit -

    - -
    -
    - - - -
    -
    -
    -
    -

    ASCollectionView Class Reference

    - - -
    - - - - - - - -
    Inherits fromUICollectionView
    Declared inASCollectionView.h
    - - - - -
    - -

    Overview

    -

    Asynchronous UICollectionView with Intelligent Preloading capabilities.

    ASCollectionView is a true subclass of UICollectionView, meaning it is pointer-compatible -with code that currently uses UICollectionView.

    - -

    The main difference is that asyncDataSource expects -nodeForItemAtIndexPath, an ASCellNode, and -the sizeForItemAtIndexPath: method is eliminated (as are the performance problems caused by it). -This is made possible because ASCellNodes can calculate their own size, and preload ahead of time.

    Note: ASCollectionNode is strongly recommended over ASCollectionView. This class exists for adoption convenience.

    -
    - - - - - -
    - - - - - - -
    -
    - -

      asyncDelegate -

    - -
    -
    - -
    - - -
    -

    The object that acts as the asynchronous delegate of the collection view

    -
    - - - -
    @property (nonatomic, weak) id<ASCollectionDelegate> asyncDelegate
    - - - - - - - - - -
    -

    Discussion

    -

    The delegate must adopt the ASCollectionDelegate protocol. The collection view maintains a weak reference to the delegate object.

    - -

    The delegate object is responsible for providing size constraints for nodes and indicating whether batch fetching should begin.

    -
    - - - - - - - -
    -

    Declared In

    -

    ASCollectionView.h

    -
    - - -
    -
    -
    - -

      asyncDataSource -

    - -
    -
    - -
    - - -
    -

    The object that acts as the asynchronous data source of the collection view

    -
    - - - -
    @property (nonatomic, weak) id<ASCollectionDataSource> asyncDataSource
    - - - - - - - - - -
    -

    Discussion

    -

    The datasource must adopt the ASCollectionDataSource protocol. The collection view maintains a weak reference to the datasource object.

    - -

    The datasource object is responsible for providing nodes or node creation blocks to the collection view.

    -
    - - - - - - - -
    -

    Declared In

    -

    ASCollectionView.h

    -
    - - -
    -
    -
    - -

      collectionNode -

    - -
    -
    - -
    - - -
    -

    Returns the corresponding ASCollectionNode

    -
    - - - -
    @property (nonatomic, weak, readonly) ASCollectionNode *collectionNode
    - - - - - -
    -

    Return Value

    -

    collectionNode The corresponding ASCollectionNode, if one exists.

    -
    - - - - - - - - - - - -
    -

    Declared In

    -

    ASCollectionView.h

    -
    - - -
    -
    -
    - -

      leadingScreensForBatching -

    - -
    -
    - -
    - - -
    -

    The number of screens left to scroll before the delegate -collectionView:beginBatchFetchingWithContext: is called.

    -
    - - - -
    @property (nonatomic, assign) CGFloat leadingScreensForBatching
    - - - - - - - - - -
    -

    Discussion

    -

    Defaults to two screenfuls.

    -
    - - - - - - - -
    -

    Declared In

    -

    ASCollectionView.h

    -
    - - -
    -
    -
    - -

      layoutInspector -

    - -
    -
    - -
    - - -
    -

    Optional introspection object for the collection view’s layout.

    -
    - - - -
    @property (nonatomic, weak) id<ASCollectionViewLayoutInspecting> layoutInspector
    - - - - - - - - - -
    -

    Discussion

    -

    Since supplementary and decoration views are controlled by the collection view’s layout, this object -is used as a bridge to provide information to the internal data controller about the existence of these views and -their associated index paths. For collection views using UICollectionViewFlowLayout, a default inspector -implementation ASCollectionViewFlowLayoutInspector is created and set on this property by default. Custom -collection view layout subclasses will need to provide their own implementation of an inspector object for their -supplementary views to be compatible with ASCollectionView’s supplementary node support.

    -
    - - - - - - - -
    -

    Declared In

    -

    ASCollectionView.h

    -
    - - -
    -
    -
    - -

    – nodeForItemAtIndexPath: -

    - -
    -
    - -
    - - -
    -

    Retrieves the node for the item at the given index path.

    -
    - - - -
    - (nullable ASCellNode *)nodeForItemAtIndexPath:(NSIndexPath *)indexPath
    - - - -
    -

    Parameters

    - - - - - - - -
    indexPath

    The index path of the requested node.

    -
    - - - -
    -

    Return Value

    -

    The node at the given index path, or @c nil if no item exists at the specified path.

    -
    - - - - - - - - - - - -
    -

    Declared In

    -

    ASCollectionView.h

    -
    - - -
    -
    -
    - -

    – supplementaryNodeForElementKind:atIndexPath: -

    - -
    -
    - -
    - - -
    -

    Similar to -supplementaryViewForElementKind:atIndexPath:

    -
    - - - -
    - (nullable ASCellNode *)supplementaryNodeForElementKind:(NSString *)elementKind atIndexPath:(NSIndexPath *)indexPath
    - - - -
    -

    Parameters

    - - - - - - - - - - - - -
    elementKind

    The kind of supplementary node to locate.

    indexPath

    The index path of the requested supplementary node.

    -
    - - - -
    -

    Return Value

    -

    The specified supplementary node or @c nil.

    -
    - - - - - - - - - - - -
    -

    Declared In

    -

    ASCollectionView.h

    -
    - - -
    -
    -
    - -

    – contextForSection: -

    - -
    -
    - -
    - - -
    -

    Retrieves the context object for the given section, as provided by the data source in -the @c collectionNode:contextForSection: method. This method must be called on the main thread.

    -
    - - - -
    - (nullable id<ASSectionContext>)contextForSection:(NSInteger)section
    - - - -
    -

    Parameters

    - - - - - - - -
    section

    The section to get the context for.

    -
    - - - -
    -

    Return Value

    -

    The context object, or @c nil if no context was provided.

    -
    - - - - - - - - - - - -
    -

    Declared In

    -

    ASCollectionView.h

    -
    - - -
    -
    -
    - -

      scrollDirection -

    - -
    -
    - -
    - - -
    -

    Determines collection view’s current scroll direction. Supports 2-axis collection views.

    -
    - - - -
    @property (nonatomic, readonly) ASScrollDirection scrollDirection
    - - - - - -
    -

    Return Value

    -

    a bitmask of ASScrollDirection values.

    -
    - - - - - - - - - - - -
    -

    Declared In

    -

    ASCollectionView.h

    -
    - - -
    -
    -
    - -

      scrollableDirections -

    - -
    -
    - -
    - - -
    -

    Determines collection view’s scrollable directions.

    -
    - - - -
    @property (nonatomic, readonly) ASScrollDirection scrollableDirections
    - - - - - -
    -

    Return Value

    -

    a bitmask of ASScrollDirection values.

    -
    - - - - - - - - - - - -
    -

    Declared In

    -

    ASCollectionView.h

    -
    - - -
    -
    -
    - -

      zeroContentInsets -

    - -
    -
    - -
    - - -
    -

    Forces the .contentInset to be UIEdgeInsetsZero.

    -
    - - - -
    @property (nonatomic) BOOL zeroContentInsets
    - - - - - - - - - -
    -

    Discussion

    -

    By default, UIKit sets the top inset to the navigation bar height, even for horizontally -scrolling views. This can only be disabled by setting a property on the containing UIViewController, -automaticallyAdjustsScrollViewInsets, which may not be accessible. ASPagerNode uses this to ensure -its flow layout behaves predictably and does not log undefined layout warnings.

    -
    - - - - - - - -
    -

    Declared In

    -

    ASCollectionView.h

    -
    - - -
    -
    -
    -
    - -
    - - - - - - -
    - -
    - -
    -
    -
    -
    - - - - \ No newline at end of file diff --git a/submodules/AsyncDisplayKit/docs/appledoc/Classes/ASControlNode.html b/submodules/AsyncDisplayKit/docs/appledoc/Classes/ASControlNode.html deleted file mode 100755 index 62781e4332..0000000000 --- a/submodules/AsyncDisplayKit/docs/appledoc/Classes/ASControlNode.html +++ /dev/null @@ -1,735 +0,0 @@ - - - - - - ASControlNode Class Reference - - - - - - -
    -
    - -

    - -

    - -

    - AsyncDisplayKit -

    - -
    -
    - - - -
    -
    -
    -
    -

    ASControlNode Class Reference

    - - -
    - - - - - - - -
    Inherits fromASDisplayNode : ASDealloc2MainObject
    Declared inASControlNode.h
    - - - - -
    - -

    Overview

    -

    ASControlNode cannot be used directly. It instead defines the common interface and behavior structure for all its subclasses. Subclasses should import “ASControlNode+Subclasses.h” for information on methods intended to be overriden.

    -
    - - - - - -
    - - - - - - -
    -
    - -

      enabled -

    - -
    -
    - -
    - - -
    -

    Indicates whether or not the receiver is enabled.

    -
    - - - -
    @property (nonatomic, assign, getter=isEnabled) BOOL enabled
    - - - - - - - - - -
    -

    Discussion

    -

    Specify YES to make the control enabled; otherwise, specify NO to make it disabled. The default value is YES. If the enabled state is NO, the control ignores touch events and subclasses may draw differently.

    -
    - - - - - - - -
    -

    Declared In

    -

    ASControlNode.h

    -
    - - -
    -
    -
    - -

      highlighted -

    - -
    -
    - -
    - - -
    -

    Indicates whether or not the receiver is highlighted.

    -
    - - - -
    @property (nonatomic, assign, getter=isHighlighted) BOOL highlighted
    - - - - - - - - - -
    -

    Discussion

    -

    This is set automatically when the there is a touch inside the control and removed on exit or touch up. This is different from touchInside in that it includes an area around the control, rather than just for touches inside the control.

    -
    - - - - - - - -
    -

    Declared In

    -

    ASControlNode.h

    -
    - - -
    -
    -
    - -

      selected -

    - -
    -
    - -
    - - -
    -

    Indicates whether or not the receiver is highlighted.

    -
    - - - -
    @property (nonatomic, assign, getter=isSelected) BOOL selected
    - - - - - - - - - -
    -

    Discussion

    -

    This is set automatically when the receiver is tapped.

    -
    - - - - - - - -
    -

    Declared In

    -

    ASControlNode.h

    -
    - - -
    -
    -
    - -

      tracking -

    - -
    -
    - -
    - - -
    -

    Indicates whether or not the receiver is currently tracking touches related to an event.

    -
    - - - -
    @property (nonatomic, readonly, assign, getter=isTracking) BOOL tracking
    - - - - - - - - - -
    -

    Discussion

    -

    YES if the receiver is tracking touches; NO otherwise.

    -
    - - - - - - - -
    -

    Declared In

    -

    ASControlNode.h

    -
    - - -
    -
    -
    - -

      touchInside -

    - -
    -
    - -
    - - -
    -

    Indicates whether or not a touch is inside the bounds of the receiver.

    -
    - - - -
    @property (nonatomic, readonly, assign, getter=isTouchInside) BOOL touchInside
    - - - - - - - - - -
    -

    Discussion

    -

    YES if a touch is inside the receiver’s bounds; NO otherwise.

    -
    - - - - - - - -
    -

    Declared In

    -

    ASControlNode.h

    -
    - - -
    -
    -
    - -

    – addTarget:action:forControlEvents: -

    - -
    -
    - -
    - - -
    -

    Adds a target-action pair for a particular event (or events).

    -
    - - - -
    - (void)addTarget:(nullable id)target action:(SEL)action forControlEvents:(ASControlNodeEvent)controlEvents
    - - - -
    -

    Parameters

    - - - - - - - - - - - - - - - - - -
    target

    The object to which the action message is sent. If this is nil, the responder chain is searched for an object willing to respond to the action message. target is not retained.

    action

    A selector identifying an action message. May optionally include the sender and the event as parameters, in that order. May not be NULL.

    controlEvents

    A bitmask specifying the control events for which the action message is sent. May not be 0. See “Control Events” for bitmask constants.

    -
    - - - - - - - -
    -

    Discussion

    -

    You may call this method multiple times, and you may specify multiple target-action pairs for a particular event. Targets are held weakly.

    -
    - - - - - - - -
    -

    Declared In

    -

    ASControlNode.h

    -
    - - -
    -
    -
    - -

    – actionsForTarget:forControlEvent: -

    - -
    -
    - -
    - - -
    -

    Returns the actions that are associated with a target and a particular control event.

    -
    - - - -
    - (nullable NSArray<NSString*> *)actionsForTarget:(id)target forControlEvent:(ASControlNodeEvent)controlEvent
    - - - -
    -

    Parameters

    - - - - - - - - - - - - -
    target

    The target object. May not be nil.

    controlEvent

    A single constant of type ASControlNodeEvent that specifies a particular user action on the control; for a list of these constants, see “Control Events”. May not be 0 or ASControlNodeEventAllEvents.

    -
    - - - -
    -

    Return Value

    -

    An array of selector names as NSString objects, or nil if there are no action selectors associated with controlEvent.

    -
    - - - - - - - - - - - -
    -

    Declared In

    -

    ASControlNode.h

    -
    - - -
    -
    -
    - -

    – allTargets -

    - -
    -
    - -
    - - -
    -

    Returns all target objects associated with the receiver.

    -
    - - - -
    - (NSSet *)allTargets
    - - - - - -
    -

    Return Value

    -

    A set of all targets for the receiver. The set may include NSNull to indicate at least one nil target (meaning, the responder chain is searched for a target.)

    -
    - - - - - - - - - - - -
    -

    Declared In

    -

    ASControlNode.h

    -
    - - -
    -
    -
    - -

    – removeTarget:action:forControlEvents: -

    - -
    -
    - -
    - - -
    -

    Removes a target-action pair for a particular event.

    -
    - - - -
    - (void)removeTarget:(nullable id)target action:(nullable SEL)action forControlEvents:(ASControlNodeEvent)controlEvents
    - - - -
    -

    Parameters

    - - - - - - - - - - - - - - - - - -
    target

    The target object. Pass nil to remove all targets paired with action and the specified control events.

    action

    A selector identifying an action message. Pass NULL to remove all action messages paired with target.

    controlEvents

    A bitmask specifying the control events associated with target and action. See “Control Events” for bitmask constants. May not be 0.

    -
    - - - - - - - - - - - - - -
    -

    Declared In

    -

    ASControlNode.h

    -
    - - -
    -
    -
    - -

    – sendActionsForControlEvents:withEvent: -

    - -
    -
    - -
    - - -
    -

    Sends the actions for the control events for a particular event.

    -
    - - - -
    - (void)sendActionsForControlEvents:(ASControlNodeEvent)controlEvents withEvent:(nullable UIEvent *)event
    - - - -
    -

    Parameters

    - - - - - - - - - - - - -
    controlEvents

    A bitmask specifying the control events for which to send actions. See “Control Events” for bitmask constants. May not be 0.

    event

    The event which triggered these control actions. May be nil.

    -
    - - - - - - - - - - - - - -
    -

    Declared In

    -

    ASControlNode.h

    -
    - - -
    -
    -
    - -

    – setDefaultFocusAppearance -

    - -
    -
    - -
    - - -
    -

    How the node looks when it isn’t focused. Exposed here so that subclasses can override.

    -
    - - - -
    - (void)setDefaultFocusAppearance
    - - - - - - - - - - - - - - - -
    -

    Declared In

    -

    ASControlNode.h

    -
    - - -
    -
    -
    -
    - -
    - - - - - - -
    - -
    - -
    -
    -
    -
    - - - - \ No newline at end of file diff --git a/submodules/AsyncDisplayKit/docs/appledoc/Classes/ASDisplayNode.html b/submodules/AsyncDisplayKit/docs/appledoc/Classes/ASDisplayNode.html deleted file mode 100755 index caf1107240..0000000000 --- a/submodules/AsyncDisplayKit/docs/appledoc/Classes/ASDisplayNode.html +++ /dev/null @@ -1,2727 +0,0 @@ - - - - - - ASDisplayNode Class Reference - - - - - - -
    -
    - -

    - -

    - -

    - AsyncDisplayKit -

    - -
    -
    - - - -
    -
    -
    -
    -

    ASDisplayNode Class Reference

    - - -
    - - - - - - - - - - -
    Inherits fromASDealloc2MainObject
    Conforms toASLayoutElement
    Declared inASDisplayNode.h
    - - - - -
    - -

    Overview

    -

    An ASDisplayNode is an abstraction over UIView and CALayer that allows you to perform calculations about a view -hierarchy off the main thread, and could do rendering off the main thread as well.

    - -

    The node API is designed to be as similar as possible to UIView. See the README for examples.

    - -

    Subclassing

    - -

    ASDisplayNode can be subclassed to create a new UI element. The subclass header ASDisplayNode+Subclasses provides -necessary declarations and conveniences.

    - -

    Commons reasons to subclass includes making a UIView property available and receiving a callback after async -display.

    -
    - - - - - -
    - - - - -

    Initializing a node object

    - -
    -
    - -

    – init -

    - -
    -
    - -
    - - -
    -

    Designated initializer.

    -
    - - - -
    - (instancetype)init
    - - - - - -
    -

    Return Value

    -

    An ASDisplayNode instance whose view will be a subclass that enables asynchronous rendering, and passes -through -layout and touch handling methods.

    -
    - - - - - - - - - - - -
    -

    Declared In

    -

    ASDisplayNode.h

    -
    - - -
    -
    -
    - -

    – initWithViewBlock: -

    - -
    -
    - -
    - - -
    -

    Alternative initializer with a block to create the backing view.

    -
    - - - -
    - (instancetype)initWithViewBlock:(ASDisplayNodeViewBlock)viewBlock
    - - - -
    -

    Parameters

    - - - - - - - -
    viewBlock

    The block that will be used to create the backing view.

    -
    - - - -
    -

    Return Value

    -

    An ASDisplayNode instance that loads its view with the given block that is guaranteed to run on the main -queue. The view will render synchronously and -layout and touch handling methods on the node will not be called.

    -
    - - - - - - - - - - - -
    -

    Declared In

    -

    ASDisplayNode.h

    -
    - - -
    -
    -
    - -

    – initWithViewBlock:didLoadBlock: -

    - -
    -
    - -
    - - -
    -

    Alternative initializer with a block to create the backing view.

    -
    - - - -
    - (instancetype)initWithViewBlock:(ASDisplayNodeViewBlock)viewBlock didLoadBlock:(nullable ASDisplayNodeDidLoadBlock)didLoadBlock
    - - - -
    -

    Parameters

    - - - - - - - - - - - - -
    viewBlock

    The block that will be used to create the backing view.

    didLoadBlock

    The block that will be called after the view created by the viewBlock is loaded

    -
    - - - -
    -

    Return Value

    -

    An ASDisplayNode instance that loads its view with the given block that is guaranteed to run on the main -queue. The view will render synchronously and -layout and touch handling methods on the node will not be called.

    -
    - - - - - - - - - - - -
    -

    Declared In

    -

    ASDisplayNode.h

    -
    - - -
    -
    -
    - -

    – initWithLayerBlock: -

    - -
    -
    - -
    - - -
    -

    Alternative initializer with a block to create the backing layer.

    -
    - - - -
    - (instancetype)initWithLayerBlock:(ASDisplayNodeLayerBlock)layerBlock
    - - - -
    -

    Parameters

    - - - - - - - -
    layerBlock

    The block that will be used to create the backing layer.

    -
    - - - -
    -

    Return Value

    -

    An ASDisplayNode instance that loads its layer with the given block that is guaranteed to run on the main -queue. The layer will render synchronously and -layout and touch handling methods on the node will not be called.

    -
    - - - - - - - - - - - -
    -

    Declared In

    -

    ASDisplayNode.h

    -
    - - -
    -
    -
    - -

    – initWithLayerBlock:didLoadBlock: -

    - -
    -
    - -
    - - -
    -

    Alternative initializer with a block to create the backing layer.

    -
    - - - -
    - (instancetype)initWithLayerBlock:(ASDisplayNodeLayerBlock)layerBlock didLoadBlock:(nullable ASDisplayNodeDidLoadBlock)didLoadBlock
    - - - -
    -

    Parameters

    - - - - - - - - - - - - -
    layerBlock

    The block that will be used to create the backing layer.

    didLoadBlock

    The block that will be called after the layer created by the layerBlock is loaded

    -
    - - - -
    -

    Return Value

    -

    An ASDisplayNode instance that loads its layer with the given block that is guaranteed to run on the main -queue. The layer will render synchronously and -layout and touch handling methods on the node will not be called.

    -
    - - - - - - - - - - - -
    -

    Declared In

    -

    ASDisplayNode.h

    -
    - - -
    -
    -
    - -

    – onDidLoad: -

    - -
    -
    - -
    - - -
    -

    Add a block of work to be performed on the main thread when the node’s view or layer is loaded. Thread safe.

    -
    - - - -
    - (void)onDidLoad:(ASDisplayNodeDidLoadBlock)body
    - - - -
    -

    Parameters

    - - - - - - - -
    body

    The work to be performed when the node is loaded.

    - -

    @precondition The node is not already loaded.

    -
    - - - - - - - -
    -

    Discussion

    -

    Warning: Be careful not to retain self in body. Change the block parameter list to ^(MYCustomNode *self) {} if you -want to shadow self (e.g. if calling this during init).

    Note: This will only be called the next time the node is loaded. If the node is later added to a subtree of a node -that has shouldRasterizeDescendants=YES, and is unloaded, this block will not be called if it is loaded again.

    -
    - - - - - - - -
    -

    Declared In

    -

    ASDisplayNode.h

    -
    - - -
    -
    -
    - -

      synchronous -

    - -
    -
    - -
    - - -
    -

    Returns whether the node is synchronous.

    -
    - - - -
    @property (nonatomic, readonly, assign, getter=isSynchronous) BOOL synchronous
    - - - - - -
    -

    Return Value

    -

    NO if the node wraps a _ASDisplayView, YES otherwise.

    -
    - - - - - - - - - - - -
    -

    Declared In

    -

    ASDisplayNode.h

    -
    - - -
    -
    -
    -
    - - - -

    Getting view and layer

    - -
    -
    - -

      view -

    - -
    -
    - -
    - - -
    -

    Returns a view.

    -
    - - - -
    @property (nonatomic, readonly, strong) UIView *view
    - - - - - - - - - -
    -

    Discussion

    -

    The view property is lazily initialized, similar to UIViewController. -To go the other direction, use ASViewToDisplayNode() in ASDisplayNodeExtras.h.

    Warning: The first access to it must be on the main thread, and should only be used on the main thread thereafter as -well.

    -
    - - - - - - - -
    -

    Declared In

    -

    ASDisplayNode.h

    -
    - - -
    -
    -
    - -

      nodeLoaded -

    - -
    -
    - -
    - - -
    -

    Returns whether a node’s backing view or layer is loaded.

    -
    - - - -
    @property (nonatomic, readonly, assign, getter=isNodeLoaded) BOOL nodeLoaded
    - - - - - -
    -

    Return Value

    -

    YES if a view is loaded, or if layerBacked is YES and layer is not nil; NO otherwise.

    -
    - - - - - - - - - - - -
    -

    Declared In

    -

    ASDisplayNode.h

    -
    - - -
    -
    -
    - -

      layerBacked -

    - -
    -
    - -
    - - -
    -

    Returns whether the node rely on a layer instead of a view.

    -
    - - - -
    @property (nonatomic, assign, getter=isLayerBacked) BOOL layerBacked
    - - - - - -
    -

    Return Value

    -

    YES if the node rely on a layer, NO otherwise.

    -
    - - - - - - - - - - - -
    -

    Declared In

    -

    ASDisplayNode.h

    -
    - - -
    -
    -
    - -

      layer -

    - -
    -
    - -
    - - -
    -

    Returns a layer.

    -
    - - - -
    @property (nonatomic, readonly, strong) CALayer *layer
    - - - - - - - - - -
    -

    Discussion

    -

    The layer property is lazily initialized, similar to the view property. -To go the other direction, use ASLayerToDisplayNode() in ASDisplayNodeExtras.h.

    Warning: The first access to it must be on the main thread, and should only be used on the main thread thereafter as -well.

    -
    - - - - - - - -
    -

    Declared In

    -

    ASDisplayNode.h

    -
    - - -
    -
    -
    - -

      visible -

    - -
    -
    - -
    - - -
    -

    Returns YES if the node is – at least partially – visible in a window.

    -
    - - - -
    @property (readonly, getter=isVisible) BOOL visible
    - - - - - - - - - - - - - - - -
    -

    Declared In

    -

    ASDisplayNode.h

    -
    - - -
    -
    -
    - -

      inPreloadState -

    - -
    -
    - -
    - - -
    -

    Returns YES if the node is in the preloading interface state.

    -
    - - - -
    @property (readonly, getter=isInPreloadState) BOOL inPreloadState
    - - - - - - - - - - - - - - - -
    -

    Declared In

    -

    ASDisplayNode.h

    -
    - - -
    -
    -
    - -

      inDisplayState -

    - -
    -
    - -
    - - -
    -

    Returns YES if the node is in the displaying interface state.

    -
    - - - -
    @property (readonly, getter=isInDisplayState) BOOL inDisplayState
    - - - - - - - - - - - - - - - -
    -

    Declared In

    -

    ASDisplayNode.h

    -
    - - -
    -
    -
    - -

      interfaceState -

    - -
    -
    - -
    - - -
    -

    Returns the Interface State of the node.

    -
    - - - -
    @property (readonly) ASInterfaceState interfaceState
    - - - - - -
    -

    Return Value

    -

    The current ASInterfaceState of the node, indicating whether it is visible and other situational properties.

    -
    - - - - - - - - - -
    -

    See Also

    - -
    - - - -
    -

    Declared In

    -

    ASDisplayNode.h

    -
    - - -
    -
    -
    -
    - - - -

    Managing dimensions

    - -
    -
    - -

    – layoutThatFits: -

    - -
    -
    - -
    - - -
    -

    Asks the node to return a layout based on given size range.

    -
    - - - -
    - (ASLayout *)layoutThatFits:(ASSizeRange)constrainedSize
    - - - -
    -

    Parameters

    - - - - - - - -
    constrainedSize

    The minimum and maximum sizes the receiver should fit in.

    -
    - - - -
    -

    Return Value

    -

    An ASLayout instance defining the layout of the receiver (and its children, if the box layout model is used).

    -
    - - - - - -
    -

    Discussion

    -

    Though this method does not set the bounds of the view, it does have side effects–caching both the -constraint and the result.

    Warning: Subclasses must not override this; it caches results from -calculateLayoutThatFits:. Calling this method may -be expensive if result is not cached.

    -
    - - - - - - - - - -
    -

    Declared In

    -

    ASDisplayNode.h

    -
    - - -
    -
    -
    - -

      layoutSpecBlock -

    - -
    -
    - -
    - - -
    -

    Provides a way to declare a block to provide an ASLayoutSpec without having to subclass ASDisplayNode and -implement layoutSpecThatFits:

    -
    - - - -
    @property (nonatomic, readwrite, copy, nullable) ASLayoutSpecBlock layoutSpecBlock
    - - - - - -
    -

    Return Value

    -

    A block that takes a constrainedSize ASSizeRange argument, and must return an ASLayoutSpec that includes all -of the subnodes to position in the layout. This input-output relationship is identical to the subclass override -method -layoutSpecThatFits:

    -
    - - - - - -
    -

    Discussion

    -

    Warning: Subclasses that implement -layoutSpecThatFits: must not also use .layoutSpecBlock. Doing so will trigger -an exception. A future version of the framework may support using both, calling them serially, with the -.layoutSpecBlock superseding any values set by the method override.

    -
    - - - - - - - -
    -

    Declared In

    -

    ASDisplayNode.h

    -
    - - -
    -
    -
    - -

      calculatedSize -

    - -
    -
    - -
    - - -
    -

    Return the calculated size.

    -
    - - - -
    @property (nonatomic, readonly, assign) CGSize calculatedSize
    - - - - - -
    -

    Return Value

    -

    Size already calculated by -calculateLayoutThatFits:.

    -
    - - - - - -
    -

    Discussion

    -

    Ideal for use by subclasses in -layout, having already prompted their subnodes to calculate their size by -calling -measure: on them in -calculateLayoutThatFits.

    Warning: Subclasses must not override this; it returns the last cached measurement and is never expensive.

    -
    - - - - - - - -
    -

    Declared In

    -

    ASDisplayNode.h

    -
    - - -
    -
    -
    - -

      constrainedSizeForCalculatedLayout -

    - -
    -
    - -
    - - -
    -

    Return the constrained size range used for calculating layout.

    -
    - - - -
    @property (nonatomic, readonly, assign) ASSizeRange constrainedSizeForCalculatedLayout
    - - - - - -
    -

    Return Value

    -

    The minimum and maximum constrained sizes used by calculateLayoutThatFits:.

    -
    - - - - - - - - - - - -
    -

    Declared In

    -

    ASDisplayNode.h

    -
    - - -
    -
    -
    -
    - - - -

    Managing the nodes hierarchy

    - -
    -
    - -

    – addSubnode: -

    - -
    -
    - -
    - - -
    -

    Add a node as a subnode to this node.

    -
    - - - -
    - (void)addSubnode:(ASDisplayNode *)subnode
    - - - -
    -

    Parameters

    - - - - - - - -
    subnode

    The node to be added.

    -
    - - - - - - - -
    -

    Discussion

    -

    The subnode’s view will automatically be added to this node’s view, lazily if the views are not created -yet.

    -
    - - - - - - - -
    -

    Declared In

    -

    ASDisplayNode.h

    -
    - - -
    -
    -
    - -

    – insertSubnode:belowSubnode: -

    - -
    -
    - -
    - - -
    -

    Insert a subnode before a given subnode in the list.

    -
    - - - -
    - (void)insertSubnode:(ASDisplayNode *)subnode belowSubnode:(ASDisplayNode *)below
    - - - -
    -

    Parameters

    - - - - - - - - - - - - -
    subnode

    The node to insert below another node.

    below

    The sibling node that will be above the inserted node.

    -
    - - - - - - - -
    -

    Discussion

    -

    If the views are loaded, the subnode’s view will be inserted below the given node’s view in the hierarchy -even if there are other non-displaynode views.

    -
    - - - - - - - -
    -

    Declared In

    -

    ASDisplayNode.h

    -
    - - -
    -
    -
    - -

    – insertSubnode:aboveSubnode: -

    - -
    -
    - -
    - - -
    -

    Insert a subnode after a given subnode in the list.

    -
    - - - -
    - (void)insertSubnode:(ASDisplayNode *)subnode aboveSubnode:(ASDisplayNode *)above
    - - - -
    -

    Parameters

    - - - - - - - - - - - - -
    subnode

    The node to insert below another node.

    above

    The sibling node that will be behind the inserted node.

    -
    - - - - - - - -
    -

    Discussion

    -

    If the views are loaded, the subnode’s view will be inserted above the given node’s view in the hierarchy -even if there are other non-displaynode views.

    -
    - - - - - - - -
    -

    Declared In

    -

    ASDisplayNode.h

    -
    - - -
    -
    -
    - -

    – insertSubnode:atIndex: -

    - -
    -
    - -
    - - -
    -

    Insert a subnode at a given index in subnodes.

    -
    - - - -
    - (void)insertSubnode:(ASDisplayNode *)subnode atIndex:(NSInteger)idx
    - - - -
    -

    Parameters

    - - - - - - - - - - - - -
    subnode

    The node to insert.

    idx

    The index in the array of the subnodes property at which to insert the node. Subnodes indices start at 0 -and cannot be greater than the number of subnodes.

    -
    - - - - - - - -
    -

    Discussion

    -

    If this node’s view is loaded, ASDisplayNode insert the subnode’s view after the subnode at index - 1’s -view even if there are other non-displaynode views.

    -
    - - - - - - - -
    -

    Declared In

    -

    ASDisplayNode.h

    -
    - - -
    -
    -
    - -

    – replaceSubnode:withSubnode: -

    - -
    -
    - -
    - - -
    -

    Replace subnode with replacementSubnode.

    -
    - - - -
    - (void)replaceSubnode:(ASDisplayNode *)subnode withSubnode:(ASDisplayNode *)replacementSubnode
    - - - -
    -

    Parameters

    - - - - - - - - - - - - -
    subnode

    A subnode of self.

    replacementSubnode

    A node with which to replace subnode.

    -
    - - - - - - - -
    -

    Discussion

    -

    Should both subnode and replacementSubnode already be subnodes of self, subnode is removed and -replacementSubnode inserted in its place. -If subnode is not a subnode of self, this method will throw an exception. -If replacementSubnode is nil, this method will throw an exception

    -
    - - - - - - - -
    -

    Declared In

    -

    ASDisplayNode.h

    -
    - - -
    -
    -
    - -

    – removeFromSupernode -

    - -
    -
    - -
    - - -
    -

    Remove this node from its supernode.

    -
    - - - -
    - (void)removeFromSupernode
    - - - - - - - - - -
    -

    Discussion

    -

    The node’s view will be automatically removed from the supernode’s view.

    -
    - - - - - - - -
    -

    Declared In

    -

    ASDisplayNode.h

    -
    - - -
    -
    -
    - -

      subnodes -

    - -
    -
    - -
    - - -
    -

    The receiver’s immediate subnodes.

    -
    - - - -
    @property (nonatomic, readonly, copy) NSArray<ASDisplayNode*> *subnodes
    - - - - - - - - - - - - - - - -
    -

    Declared In

    -

    ASDisplayNode.h

    -
    - - -
    -
    -
    - -

      supernode -

    - -
    -
    - -
    - - -
    -

    The receiver’s supernode.

    -
    - - - -
    @property (nonatomic, readonly, weak) ASDisplayNode *supernode
    - - - - - - - - - - - - - - - -
    -

    Declared In

    -

    ASDisplayNode.h

    -
    - - -
    -
    -
    -
    - - - -

    Drawing and Updating the View

    - -
    -
    - -

      displaysAsynchronously -

    - -
    -
    - -
    - - -
    -

    Whether this node’s view performs asynchronous rendering.

    -
    - - - -
    @property (nonatomic, assign) BOOL displaysAsynchronously
    - - - - - -
    -

    Return Value

    -

    Defaults to YES, except for synchronous views (ie, those created with -initWithViewBlock: / --initWithLayerBlock:), which are always NO.

    -
    - - - - - -
    -

    Discussion

    -

    If this flag is set, then the node will participate in the current asyncdisplaykit_async_transaction and -do its rendering on the displayQueue instead of the main thread.

    - -

    Asynchronous rendering proceeds as follows:

    - -

    When the view is initially added to the hierarchy, it has -needsDisplay true. -After layout, Core Animation will call -display on the _ASDisplayLayer --display enqueues a rendering operation on the displayQueue -When the render block executes, it calls the delegate display method (-drawRect:… or -display) -The delegate provides contents via this method and an operation is added to the asyncdisplaykit_async_transaction -Once all rendering is complete for the current asyncdisplaykit_async_transaction, -the completion for the block sets the contents on all of the layers in the same frame

    - -

    If asynchronous rendering is disabled:

    - -

    When the view is initially added to the hierarchy, it has -needsDisplay true. -After layout, Core Animation will call -display on the _ASDisplayLayer --display calls delegate display method (-drawRect:… or -display) immediately --display sets the layer contents immediately with the result

    - -

    Note: this has nothing to do with -[CALayer drawsAsynchronously].

    -
    - - - - - - - -
    -

    Declared In

    -

    ASDisplayNode.h

    -
    - - -
    -
    -
    - -

      shouldRasterizeDescendants -

    - -
    -
    - -
    - - -
    -

    Whether to draw all descendant nodes' layers/views into this node’s layer/view’s backing store.

    -
    - - - -
    @property (nonatomic, assign) BOOL shouldRasterizeDescendants
    - - - - - - - - - - - - - - - -
    -

    Declared In

    -

    ASDisplayNode.h

    -
    - - -
    -
    -
    - -

      displaySuspended -

    - -
    -
    - -
    - - -
    -

    Prevent the node’s layer from displaying.

    -
    - - - -
    @property (nonatomic, assign) BOOL displaySuspended
    - - - - - - - - - -
    -

    Discussion

    -

    A subclass may check this flag during -display or -drawInContext: to cancel a display that is already in -progress.

    - -

    Defaults to NO. Does not control display for any child or descendant nodes; for that, use --recursivelySetDisplaySuspended:.

    - -

    If a setNeedsDisplay occurs while displaySuspended is YES, and displaySuspended is set to NO, then the -layer will be automatically displayed.

    -
    - - - - - - - -
    -

    Declared In

    -

    ASDisplayNode.h

    -
    - - -
    -
    -
    - -

      shouldAnimateSizeChanges -

    - -
    -
    - -
    - - -
    -

    Whether size changes should be animated. Default to YES.

    -
    - - - -
    @property (nonatomic, assign) BOOL shouldAnimateSizeChanges
    - - - - - - - - - - - - - - - -
    -

    Declared In

    -

    ASDisplayNode.h

    -
    - - -
    -
    -
    - -

    – recursivelySetDisplaySuspended: -

    - -
    -
    - -
    - - -
    -

    Prevent the node and its descendants' layer from displaying.

    -
    - - - -
    - (void)recursivelySetDisplaySuspended:(BOOL)flag
    - - - -
    -

    Parameters

    - - - - - - - -
    flag

    YES if display should be prevented or cancelled; NO otherwise.

    -
    - - - - - - - - - - - -
    -

    See Also

    - -
    - - - -
    -

    Declared In

    -

    ASDisplayNode.h

    -
    - - -
    -
    -
    - -

    – recursivelyClearContents -

    - -
    -
    - -
    - - -
    -

    Calls -clearContents on the receiver and its subnode hierarchy.

    -
    - - - -
    - (void)recursivelyClearContents
    - - - - - - - - - -
    -

    Discussion

    -

    Clears backing stores and other memory-intensive intermediates. -If the node is removed from a visible hierarchy and then re-added, it will automatically trigger a new asynchronous display, -as long as displaySuspended is not set. -If the node remains in the hierarchy throughout, -setNeedsDisplay is required to trigger a new asynchronous display.

    -
    - - - - - -
    -

    See Also

    - -
    - - - -
    -

    Declared In

    -

    ASDisplayNode.h

    -
    - - -
    -
    -
    - -

    – recursivelyClearFetchedData -

    - -
    -
    - -
    - - -
    -

    Calls -clearFetchedData on the receiver and its subnode hierarchy.

    -
    - - - -
    - (void)recursivelyClearFetchedData
    - - - - - - - - - -
    -

    Discussion

    -

    Clears any memory-intensive fetched content. -This method is used to notify the node that it should purge any content that is both expensive to fetch and to -retain in memory.

    -
    - - - - - - - - - -
    -

    Declared In

    -

    ASDisplayNode.h

    -
    - - -
    -
    -
    - -

    – recursivelyFetchData -

    - -
    -
    - -
    - - -
    -

    Calls -fetchData on the receiver and its subnode hierarchy.

    -
    - - - -
    - (void)recursivelyFetchData
    - - - - - - - - - -
    -

    Discussion

    -

    Fetches content from remote sources for the current node and all subnodes.

    -
    - - - - - - - - - -
    -

    Declared In

    -

    ASDisplayNode.h

    -
    - - -
    -
    -
    - -

    – setNeedsDataFetch -

    - -
    -
    - -
    - - -
    -

    Triggers a recursive call to fetchData when the node has an interfaceState of ASInterfaceStatePreload

    -
    - - - -
    - (void)setNeedsDataFetch
    - - - - - - - - - - - - - - - -
    -

    Declared In

    -

    ASDisplayNode.h

    -
    - - -
    -
    -
    - -

      placeholderEnabled -

    - -
    -
    - -
    - - -
    -

    Toggle displaying a placeholder over the node that covers content until the node and all subnodes are -displayed.

    -
    - - - -
    @property (nonatomic, assign) BOOL placeholderEnabled
    - - - - - - - - - -
    -

    Discussion

    -

    Defaults to NO.

    -
    - - - - - - - -
    -

    Declared In

    -

    ASDisplayNode.h

    -
    - - -
    -
    -
    - -

      placeholderFadeDuration -

    - -
    -
    - -
    - - -
    -

    Set the time it takes to fade out the placeholder when a node’s contents are finished displaying.

    -
    - - - -
    @property (nonatomic, assign) NSTimeInterval placeholderFadeDuration
    - - - - - - - - - -
    -

    Discussion

    -

    Defaults to 0 seconds.

    -
    - - - - - - - -
    -

    Declared In

    -

    ASDisplayNode.h

    -
    - - -
    -
    -
    - -

      drawingPriority -

    - -
    -
    - -
    - - -
    -

    Determines drawing priority of the node. Nodes with higher priority will be drawn earlier.

    -
    - - - -
    @property (nonatomic, assign) NSInteger drawingPriority
    - - - - - - - - - -
    -

    Discussion

    -

    Defaults to ASDefaultDrawingPriority. There may be multiple drawing threads, and some of them may -decide to perform operations in queued order (regardless of drawingPriority)

    -
    - - - - - - - -
    -

    Declared In

    -

    ASDisplayNode.h

    -
    - - -
    -
    -
    -
    - - - -

    Hit Testing

    - -
    -
    - -

      hitTestSlop -

    - -
    -
    - -
    - - -
    -

    Bounds insets for hit testing.

    -
    - - - -
    @property (nonatomic, assign) UIEdgeInsets hitTestSlop
    - - - - - - - - - -
    -

    Discussion

    -

    When set to a non-zero inset, increases the bounds for hit testing to make it easier to tap or perform -gestures on this node. Default is UIEdgeInsetsZero.

    - -

    This affects the default implementation of -hitTest and -pointInside, so subclasses should call super if you override -it and want hitTestSlop applied.

    -
    - - - - - - - -
    -

    Declared In

    -

    ASDisplayNode.h

    -
    - - -
    -
    -
    - -

    – pointInside:withEvent: -

    - -
    -
    - -
    - - -
    -

    Returns a Boolean value indicating whether the receiver contains the specified point.

    -
    - - - -
    - (BOOL)pointInside:(CGPoint)point withEvent:(nullable UIEvent *)event
    - - - -
    -

    Parameters

    - - - - - - - - - - - - -
    point

    A point that is in the receiver’s local coordinate system (bounds).

    event

    The event that warranted a call to this method.

    -
    - - - -
    -

    Return Value

    -

    YES if point is inside the receiver’s bounds; otherwise, NO.

    -
    - - - - - -
    -

    Discussion

    -

    Includes the “slop” factor specified with hitTestSlop.

    -
    - - - - - - - -
    -

    Declared In

    -

    ASDisplayNode.h

    -
    - - -
    -
    -
    -
    - - - -

    Converting Between View Coordinate Systems

    - -
    -
    - -

    – convertPoint:toNode: -

    - -
    -
    - -
    - - -
    -

    Converts a point from the receiver’s coordinate system to that of the specified node.

    -
    - - - -
    - (CGPoint)convertPoint:(CGPoint)point toNode:(nullable ASDisplayNode *)node
    - - - -
    -

    Parameters

    - - - - - - - - - - - - -
    point

    A point specified in the local coordinate system (bounds) of the receiver.

    node

    The node into whose coordinate system point is to be converted.

    -
    - - - -
    -

    Return Value

    -

    The point converted to the coordinate system of node.

    -
    - - - - - - - - - - - -
    -

    Declared In

    -

    ASDisplayNode.h

    -
    - - -
    -
    -
    - -

    – convertPoint:fromNode: -

    - -
    -
    - -
    - - -
    -

    Converts a point from the coordinate system of a given node to that of the receiver.

    -
    - - - -
    - (CGPoint)convertPoint:(CGPoint)point fromNode:(nullable ASDisplayNode *)node
    - - - -
    -

    Parameters

    - - - - - - - - - - - - -
    point

    A point specified in the local coordinate system (bounds) of node.

    node

    The node with point in its coordinate system.

    -
    - - - -
    -

    Return Value

    -

    The point converted to the local coordinate system (bounds) of the receiver.

    -
    - - - - - - - - - - - -
    -

    Declared In

    -

    ASDisplayNode.h

    -
    - - -
    -
    -
    - -

    – convertRect:toNode: -

    - -
    -
    - -
    - - -
    -

    Converts a rectangle from the receiver’s coordinate system to that of another view.

    -
    - - - -
    - (CGRect)convertRect:(CGRect)rect toNode:(nullable ASDisplayNode *)node
    - - - -
    -

    Parameters

    - - - - - - - - - - - - -
    rect

    A rectangle specified in the local coordinate system (bounds) of the receiver.

    node

    The node that is the target of the conversion operation.

    -
    - - - -
    -

    Return Value

    -

    The converted rectangle.

    -
    - - - - - - - - - - - -
    -

    Declared In

    -

    ASDisplayNode.h

    -
    - - -
    -
    -
    - -

    – convertRect:fromNode: -

    - -
    -
    - -
    - - -
    -

    Converts a rectangle from the coordinate system of another node to that of the receiver.

    -
    - - - -
    - (CGRect)convertRect:(CGRect)rect fromNode:(nullable ASDisplayNode *)node
    - - - -
    -

    Parameters

    - - - - - - - - - - - - -
    rect

    A rectangle specified in the local coordinate system (bounds) of node.

    node

    The node with rect in its coordinate system.

    -
    - - - -
    -

    Return Value

    -

    The converted rectangle.

    -
    - - - - - - - - - - - -
    -

    Declared In

    -

    ASDisplayNode.h

    -
    - - -
    -
    -
    -
    - -
    - - - - - - -
    - -
    - -
    -
    -
    -
    - - - - \ No newline at end of file diff --git a/submodules/AsyncDisplayKit/docs/appledoc/Classes/ASEditableTextNode.html b/submodules/AsyncDisplayKit/docs/appledoc/Classes/ASEditableTextNode.html deleted file mode 100755 index 409bc45979..0000000000 --- a/submodules/AsyncDisplayKit/docs/appledoc/Classes/ASEditableTextNode.html +++ /dev/null @@ -1,700 +0,0 @@ - - - - - - ASEditableTextNode Class Reference - - - - - - -
    -
    - -

    - -

    - -

    - AsyncDisplayKit -

    - -
    -
    - - - -
    -
    -
    -
    -

    ASEditableTextNode Class Reference

    - - -
    - - - - - - - - - - -
    Inherits fromASDisplayNode : ASDealloc2MainObject
    Conforms toUITextInputTraits
    Declared inASEditableTextNode.h
    - - - - -
    - -

    Overview

    -

    Does not support layer backing.

    -
    - - - - - -
    - - - - - - -
    -
    - -

    – init -

    - -
    -
    - -
    - - -
    -

    Initializes an editable text node using default TextKit components.

    -
    - - - -
    - (instancetype)init
    - - - - - -
    -

    Return Value

    -

    An initialized ASEditableTextNode.

    -
    - - - - - - - - - - - -
    -

    Declared In

    -

    ASEditableTextNode.h

    -
    - - -
    -
    -
    - -

    – initWithTextKitComponents:placeholderTextKitComponents: -

    - -
    -
    - -
    - - -
    -

    Initializes an editable text node using the provided TextKit components.

    -
    - - - -
    - (instancetype)initWithTextKitComponents:(ASTextKitComponents *)textKitComponents placeholderTextKitComponents:(ASTextKitComponents *)placeholderTextKitComponents
    - - - -
    -

    Parameters

    - - - - - - - - - - - - -
    textKitComponents

    The TextKit stack used to render text.

    placeholderTextKitComponents

    The TextKit stack used to render placeholder text.

    -
    - - - -
    -

    Return Value

    -

    An initialized ASEditableTextNode.

    -
    - - - - - - - - - - - -
    -

    Declared In

    -

    ASEditableTextNode.h

    -
    - - -
    -
    -
    - -

      scrollEnabled -

    - -
    -
    - -
    - - -
    -

    Enable scrolling on the textView -@default true

    -
    - - - -
    @property (nonatomic) BOOL scrollEnabled
    - - - - - - - - - - - - - - - -
    -

    Declared In

    -

    ASEditableTextNode.h

    -
    - - -
    -
    -
    - -

      textView -

    - -
    -
    - -
    - - -
    -

    Access to underlying UITextView for more configuration options.

    -
    - - - -
    @property (nonatomic, readonly, strong) UITextView *textView
    - - - - - - - - - -
    -

    Discussion

    -

    Warning: This property should only be used on the main thread and should not be accessed before the editable text node’s view is created.

    -
    - - - - - - - -
    -

    Declared In

    -

    ASEditableTextNode.h

    -
    - - -
    -
    -
    - -

    – isDisplayingPlaceholder -

    - -
    -
    - -
    - - -
    -

    Indicates if the receiver is displaying the placeholder text.

    -
    - - - -
    - (BOOL)isDisplayingPlaceholder
    - - - - - -
    -

    Return Value

    -

    YES if the placeholder is currently displayed; NO otherwise.

    -
    - - - - - -
    -

    Discussion

    -

    To update the placeholder, see the attributedPlaceholderText property.

    -
    - - - - - - - -
    -

    Declared In

    -

    ASEditableTextNode.h

    -
    - - -
    -
    -
    - -

      attributedPlaceholderText -

    - -
    -
    - -
    - - -
    -

    The styled placeholder text displayed by the text node while no text is entered

    -
    - - - -
    @property (nonatomic, readwrite, strong, nullable) NSAttributedString *attributedPlaceholderText
    - - - - - - - - - -
    -

    Discussion

    -

    The placeholder is displayed when the user has not entered any text and the keyboard is not visible.

    -
    - - - - - - - -
    -

    Declared In

    -

    ASEditableTextNode.h

    -
    - - -
    -
    -
    - -

      attributedText -

    - -
    -
    - -
    - - -
    -

    The styled text displayed by the receiver.

    -
    - - - -
    @property (nonatomic, readwrite, copy, nullable) NSAttributedString *attributedText
    - - - - - - - - - -
    -

    Discussion

    -

    When the placeholder is displayed (as indicated by -isDisplayingPlaceholder), this value is nil. Otherwise, this value is the attributed text the user has entered. This value can be modified regardless of whether the receiver is the first responder (and thus, editing) or not. Changing this value from nil to non-nil will result in the placeholder being hidden, and the new value being displayed.

    -
    - - - - - - - -
    -

    Declared In

    -

    ASEditableTextNode.h

    -
    - - -
    -
    -
    - -

      textContainerInset -

    - -
    -
    - -
    - - -
    -

    The textContainerInset of both the placeholder and typed textView. This value defaults to UIEdgeInsetsZero.

    -
    - - - -
    @property (nonatomic, readwrite) UIEdgeInsets textContainerInset
    - - - - - - - - - - - - - - - -
    -

    Declared In

    -

    ASEditableTextNode.h

    -
    - - -
    -
    -
    - -

      autocapitalizationType -

    - -
    -
    - -
    - - -
    -

    properties.

    -
    - - - -
    @property (nonatomic, readwrite, assign) UITextAutocapitalizationType autocapitalizationType
    - - - - - - - - - - - - - - - -
    -

    Declared In

    -

    ASEditableTextNode.h

    -
    - - -
    -
    -
    - -

    – isFirstResponder -

    - -
    -
    - -
    - - -
    -

    Indicates whether the receiver’s text view is the first responder, and thus has the keyboard visible and is prepared for editing by the user.

    -
    - - - -
    - (BOOL)isFirstResponder
    - - - - - -
    -

    Return Value

    -

    YES if the receiver’s text view is the first-responder; NO otherwise.

    -
    - - - - - - - - - - - -
    -

    Declared In

    -

    ASEditableTextNode.h

    -
    - - -
    -
    -
    - -

    – frameForTextRange: -

    - -
    -
    - -
    - - -
    -

    Returns the frame of the given range of characters.

    -
    - - - -
    - (CGRect)frameForTextRange:(NSRange)textRange
    - - - -
    -

    Parameters

    - - - - - - - -
    textRange

    A range of characters.

    -
    - - - -
    -

    Return Value

    -

    A CGRect that is the bounding box of the glyphs covered by the given range of characters, in the coordinate system of the receiver.

    -
    - - - - - -
    -

    Discussion

    -

    This method raises an exception if textRange is not a valid range of characters within the receiver’s attributed text.

    -
    - - - - - - - -
    -

    Declared In

    -

    ASEditableTextNode.h

    -
    - - -
    -
    -
    -
    - -
    - - - - - - -
    - -
    - -
    -
    -
    -
    - - - - \ No newline at end of file diff --git a/submodules/AsyncDisplayKit/docs/appledoc/Classes/ASImageNode.html b/submodules/AsyncDisplayKit/docs/appledoc/Classes/ASImageNode.html deleted file mode 100755 index 387adaa081..0000000000 --- a/submodules/AsyncDisplayKit/docs/appledoc/Classes/ASImageNode.html +++ /dev/null @@ -1,674 +0,0 @@ - - - - - - ASImageNode Class Reference - - - - - - -
    -
    - -

    - -

    - -

    - AsyncDisplayKit -

    - -
    -
    - - - -
    -
    -
    -
    -

    ASImageNode Class Reference

    - - -
    - - - - - - - -
    Inherits fromASControlNode : ASDisplayNode : ASDealloc2MainObject
    Declared inASImageNode.h
    - - - - -
    - -

    Overview

    -

    Supports cropping, tinting, and arbitrary image modification blocks.

    -
    - - - - - -
    - - - - - - -
    -
    - -

      image -

    - -
    -
    - -
    - - -
    -

    The image to display.

    -
    - - - -
    @property (nullable, nonatomic, strong) UIImage *image
    - - - - - - - - - -
    -

    Discussion

    -

    The node will efficiently display stretchable images by using -the layer’s contentsCenter property. Non-stretchable images work too, of -course.

    -
    - - - - - - - -
    -

    Declared In

    -

    ASImageNode.h

    -
    - - -
    -
    -
    - -

      placeholderColor -

    - -
    -
    - -
    - - -
    -

    The placeholder color.

    -
    - - - -
    @property (nullable, nonatomic, strong) UIColor *placeholderColor
    - - - - - - - - - - - - - - - -
    -

    Declared In

    -

    ASImageNode.h

    -
    - - -
    -
    -
    - -

      cropEnabled -

    - -
    -
    - -
    - - -
    -

    Indicates whether efficient cropping of the receiver is enabled.

    -
    - - - -
    @property (nonatomic, assign, getter=isCropEnabled) BOOL cropEnabled
    - - - - - - - - - -
    -

    Discussion

    -

    Defaults to YES. See -setCropEnabled:recropImmediately:inBounds: for more -information.

    -
    - - - - - - - -
    -

    Declared In

    -

    ASImageNode.h

    -
    - - -
    -
    -
    - -

      forceUpscaling -

    - -
    -
    - -
    - - -
    -

    Indicates that efficient downsizing of backing store should not be enabled.

    -
    - - - -
    @property (nonatomic, assign) BOOL forceUpscaling
    - - - - - - - - - -
    -

    Discussion

    -

    Defaults to NO. @see ASCroppedImageBackingSizeAndDrawRectInBounds for more -information.

    -
    - - - - - - - -
    -

    Declared In

    -

    ASImageNode.h

    -
    - - -
    -
    -
    - -

      forcedSize -

    - -
    -
    - -
    - - -
    -

    Forces image to be rendered at forcedSize.

    -
    - - - -
    @property (nonatomic, assign) CGSize forcedSize
    - - - - - - - - - -
    -

    Discussion

    -

    Defaults to CGSizeZero to indicate that the forcedSize should not be used. -Setting forcedSize to non-CGSizeZero will force the backing of the layer contents to -be forcedSize (automatically adjusted for contentsSize).

    -
    - - - - - - - -
    -

    Declared In

    -

    ASImageNode.h

    -
    - - -
    -
    -
    - -

    – setCropEnabled:recropImmediately:inBounds: -

    - -
    -
    - -
    - - -
    -

    Enables or disables efficient cropping.

    -
    - - - -
    - (void)setCropEnabled:(BOOL)cropEnabled recropImmediately:(BOOL)recropImmediately inBounds:(CGRect)cropBounds
    - - - -
    -

    Parameters

    - - - - - - - - - - - - - - - - - -
    cropEnabled

    YES to efficiently crop the receiver’s contents such that -contents outside of its bounds are not included; NO otherwise.

    recropImmediately

    If the receiver has an image, YES to redisplay the -receiver immediately; NO otherwise.

    cropBounds

    The bounds into which the receiver will be cropped. Useful -if bounds are to change in response to cropping (but have not yet done so).

    -
    - - - - - - - -
    -

    Discussion

    -

    Efficient cropping is only performed when the receiver’s view’s -contentMode is UIViewContentModeScaleAspectFill. By default, cropping is -enabled. The crop alignment may be controlled via cropAlignmentFactor.

    -
    - - - - - - - -
    -

    Declared In

    -

    ASImageNode.h

    -
    - - -
    -
    -
    - -

      cropRect -

    - -
    -
    - -
    - - -
    -

    A value that controls how the receiver’s efficient cropping is aligned.

    -
    - - - -
    @property (nonatomic, readwrite, assign) CGRect cropRect
    - - - - - - - - - -
    -

    Discussion

    -

    This value defines a rectangle that is to be featured by the -receiver. The rectangle is specified as a “unit rectangle,” using -fractions of the source image’s width and height, e.g. CGRectMake(0.5, 0, -0.5, 1.0) will feature the full right half a photo. If the cropRect is -empty, the content mode of the receiver will be used to determine its -dimensions, and only the cropRect’s origin will be used for positioning. The -default value of this property is CGRectMake(0.5, 0.5, 0.0, 0.0).

    -
    - - - - - - - -
    -

    Declared In

    -

    ASImageNode.h

    -
    - - -
    -
    -
    - -

      imageModificationBlock -

    - -
    -
    - -
    - - -
    -

    An optional block which can perform drawing operations on image -during the display phase.

    -
    - - - -
    @property (nullable, nonatomic, readwrite, copy) asimagenode_modification_block_t imageModificationBlock
    - - - - - - - - - -
    -

    Discussion

    -

    Can be used to add image effects (such as rounding, adding -borders, or other pattern overlays) without extraneous display calls.

    -
    - - - - - - - -
    -

    Declared In

    -

    ASImageNode.h

    -
    - - -
    -
    -
    - -

    – setNeedsDisplayWithCompletion: -

    - -
    -
    - -
    - - -
    -

    Marks the receiver as needing display and performs a block after -display has finished.

    -
    - - - -
    - (void)setNeedsDisplayWithCompletion:(nullable void ( ^ ) ( BOOL canceled ))displayCompletionBlock
    - - - -
    -

    Parameters

    - - - - - - - -
    displayCompletionBlock

    The block to be performed after display has -finished. Its canceled property will be YES if display was prevented or -canceled (via displaySuspended); NO otherwise.

    -
    - - - - - - - -
    -

    Discussion

    -

    displayCompletionBlock will be performed on the main-thread. If -displaySuspended is YES, displayCompletionBlock is will be -performed immediately and YES will be passed for canceled.

    -
    - - - - - - - -
    -

    Declared In

    -

    ASImageNode.h

    -
    - - -
    -
    -
    - -

      isDefaultFocusAppearance -

    - -
    -
    - -
    - - -
    -

    A bool to track if the current appearance of the node -is the default focus appearance. -Exposed here so the category methods can set it.

    -
    - - - -
    @property (nonatomic, assign) BOOL isDefaultFocusAppearance
    - - - - - - - - - - - - - - - -
    -

    Declared In

    -

    ASImageNode.h

    -
    - - -
    -
    -
    -
    - -
    - - - - - - -
    - -
    - -
    -
    -
    -
    - - - - \ No newline at end of file diff --git a/submodules/AsyncDisplayKit/docs/appledoc/Classes/ASInsetLayoutSpec.html b/submodules/AsyncDisplayKit/docs/appledoc/Classes/ASInsetLayoutSpec.html deleted file mode 100755 index 5349d434f1..0000000000 --- a/submodules/AsyncDisplayKit/docs/appledoc/Classes/ASInsetLayoutSpec.html +++ /dev/null @@ -1,214 +0,0 @@ - - - - - - ASInsetLayoutSpec Class Reference - - - - - - -
    -
    - -

    - -

    - -

    - AsyncDisplayKit -

    - -
    -
    - - - -
    -
    -
    -
    -

    ASInsetLayoutSpec Class Reference

    - - -
    - - - - - - - -
    Inherits fromASLayoutSpec : NSObject
    Declared inASInsetLayoutSpec.h
    - - - - -
    - -

    Overview

    -

    A layout spec that wraps another layoutElement child, applying insets around it.

    - -

    If the child has a size specified as a fraction, the fraction is resolved against this spec’s parent -size after applying insets.

    - -

    @example ASOuterLayoutSpec contains an ASInsetLayoutSpec with an ASInnerLayoutSpec. Suppose that: -- ASOuterLayoutSpec is 200pt wide. -- ASInnerLayoutSpec specifies its width as 100%. -- The ASInsetLayoutSpec has insets of 10pt on every side. -ASInnerLayoutSpec will have size 180pt, not 200pt, because it receives a parent size that has been adjusted for insets.

    - -

    If you’re familiar with CSS: ASInsetLayoutSpec’s child behaves similarly to “box-sizing: border-box”.

    - -

    An infinite inset is resolved as an inset equal to all remaining space after applying the other insets and child size. -@example An ASInsetLayoutSpec with an infinite left inset and 10px for all other edges will position it’s child 10px from the right edge.

    -
    - - - - - -
    - - - - - - -
    -
    - -

    + insetLayoutSpecWithInsets:child: -

    - -
    -
    - -
    - - -
    -

    The amount of space to inset on each side.

    -
    - - - -
    + (instancetype)insetLayoutSpecWithInsets:(UIEdgeInsets)insets child:(id<ASLayoutElement>)child
    - - - -
    -

    Parameters

    - - - - - - - - - - - - -
    insets

    The amount of space to inset on each side.

    child

    The wrapped child to inset.

    -
    - - - - - - - - - - - - - -
    -

    Declared In

    -

    ASInsetLayoutSpec.h

    -
    - - -
    -
    -
    -
    - -
    - - - - - - -
    - -
    - -
    -
    -
    -
    - - - - \ No newline at end of file diff --git a/submodules/AsyncDisplayKit/docs/appledoc/Classes/ASLayout.html b/submodules/AsyncDisplayKit/docs/appledoc/Classes/ASLayout.html deleted file mode 100755 index 98474e1041..0000000000 --- a/submodules/AsyncDisplayKit/docs/appledoc/Classes/ASLayout.html +++ /dev/null @@ -1,762 +0,0 @@ - - - - - - ASLayout Class Reference - - - - - - -
    -
    - -

    - -

    - -

    - AsyncDisplayKit -

    - -
    -
    - - - -
    -
    -
    -
    -

    ASLayout Class Reference

    - - -
    - - - - - - - -
    Inherits fromNSObject
    Declared inASLayout.h
    - - - - -
    - -

    Overview

    -

    A node in the layout tree that represents the size and position of the object that created it (ASLayoutElement).

    -
    - - - - - -
    - - - - - - -
    -
    - -

      layoutElement -

    - -
    -
    - -
    - - -
    -

    The underlying object described by this layout

    -
    - - - -
    @property (nonatomic, weak, readonly) id<ASLayoutElement> layoutElement
    - - - - - - - - - - - - - - - -
    -

    Declared In

    -

    ASLayout.h

    -
    - - -
    -
    -
    - -

      type -

    - -
    -
    - -
    - - -
    -

    The type of ASLayoutElement that created this layout

    -
    - - - -
    @property (nonatomic, assign, readonly) ASLayoutElementType type
    - - - - - - - - - - - - - - - -
    -

    Declared In

    -

    ASLayout.h

    -
    - - -
    -
    -
    - -

      size -

    - -
    -
    - -
    - - -
    -

    Size of the current layout

    -
    - - - -
    @property (nonatomic, assign, readonly) CGSize size
    - - - - - - - - - - - - - - - -
    -

    Declared In

    -

    ASLayout.h

    -
    - - -
    -
    -
    - -

      position -

    - -
    -
    - -
    - - -
    -

    Position in parent. Default to CGPointNull.

    -
    - - - -
    @property (nonatomic, assign, readonly) CGPoint position
    - - - - - - - - - -
    -

    Discussion

    -

    When being used as a sublayout, this property must not equal CGPointNull.

    -
    - - - - - - - -
    -

    Declared In

    -

    ASLayout.h

    -
    - - -
    -
    -
    - -

      sublayouts -

    - -
    -
    - -
    - - -
    -

    Array of ASLayouts. Each must have a valid non-null position.

    -
    - - - -
    @property (nonatomic, copy, readonly) NSArray<ASLayout*> *sublayouts
    - - - - - - - - - - - - - - - -
    -

    Declared In

    -

    ASLayout.h

    -
    - - -
    -
    -
    - -

      frame -

    - -
    -
    - -
    - - -
    -

    Returns a valid frame for the current layout computed with the size and position.

    -
    - - - -
    @property (nonatomic, assign, readonly) CGRect frame
    - - - - - - - - - -
    -

    Discussion

    -

    Clamps the layout’s origin or position to 0 if any of the calculated values are infinite.

    -
    - - - - - - - -
    -

    Declared In

    -

    ASLayout.h

    -
    - - -
    -
    -
    - -

    – initWithLayoutElement:size:position:sublayouts: -

    - -
    -
    - -
    - - -
    -

    Designated initializer

    -
    - - - -
    - (instancetype)initWithLayoutElement:(id<ASLayoutElement>)layoutElement size:(CGSize)size position:(CGPoint)position sublayouts:(nullable NSArray<ASLayout*> *)sublayouts
    - - - - - - - - - - - - - - - -
    -

    Declared In

    -

    ASLayout.h

    -
    - - -
    -
    -
    - -

    + layoutWithLayoutElement:size:position:sublayouts: -

    - -
    -
    - -
    - - -
    -

    Convenience class initializer for layout construction.

    -
    - - - -
    + (instancetype)layoutWithLayoutElement:(id<ASLayoutElement>)layoutElement size:(CGSize)size position:(CGPoint)position sublayouts:(nullable NSArray<ASLayout*> *)sublayouts
    - - - -
    -

    Parameters

    - - - - - - - - - - - - - - - - - - - - - - -
    layoutElement

    The backing ASLayoutElement object.

    size

    The size of this layout.

    position

    The position of this layout within its parent (if available).

    sublayouts

    Sublayouts belong to the new layout.

    -
    - - - - - - - - - - - - - -
    -

    Declared In

    -

    ASLayout.h

    -
    - - -
    -
    -
    - -

    + layoutWithLayoutElement:size:sublayouts: -

    - -
    -
    - -
    - - -
    -

    Convenience initializer that has CGPointNull position. -Best used by ASDisplayNode subclasses that are manually creating a layout for -calculateLayoutThatFits:, -or for ASLayoutSpec subclasses that are referencing the “self” level in the layout tree, -or for creating a sublayout of which the position is yet to be determined.

    -
    - - - -
    + (instancetype)layoutWithLayoutElement:(id<ASLayoutElement>)layoutElement size:(CGSize)size sublayouts:(nullable NSArray<ASLayout*> *)sublayouts
    - - - -
    -

    Parameters

    - - - - - - - - - - - - - - - - - -
    layoutElement

    The backing ASLayoutElement object.

    size

    The size of this layout.

    sublayouts

    Sublayouts belong to the new layout.

    -
    - - - - - - - - - - - - - -
    -

    Declared In

    -

    ASLayout.h

    -
    - - -
    -
    -
    - -

    + layoutWithLayoutElement:size: -

    - -
    -
    - -
    - - -
    -

    Convenience that has CGPointNull position and no sublayouts. -Best used for creating a layout that has no sublayouts, and is either a root one -or a sublayout of which the position is yet to be determined.

    -
    - - - -
    + (instancetype)layoutWithLayoutElement:(id<ASLayoutElement>)layoutElement size:(CGSize)size
    - - - -
    -

    Parameters

    - - - - - - - - - - - - -
    layoutElement

    The backing ASLayoutElement object.

    size

    The size of this layout.

    -
    - - - - - - - - - - - - - -
    -

    Declared In

    -

    ASLayout.h

    -
    - - -
    -
    -
    - -

    + layoutWithLayout:position: -

    - -
    -
    - -
    - - -
    -

    Convenience initializer that creates a layout based on the values of the given layout, with a new position

    -
    - - - -
    + (instancetype)layoutWithLayout:(ASLayout *)layout position:(CGPoint)position
    - - - -
    -

    Parameters

    - - - - - - - - - - - - -
    layout

    The layout to use to create the new layout

    position

    The position of the new layout

    -
    - - - - - - - - - - - - - -
    -

    Declared In

    -

    ASLayout.h

    -
    - - -
    -
    -
    - -

    – filteredNodeLayoutTree -

    - -
    -
    - -
    - - -
    -

    Traverses the existing layout tree and generates a new tree that represents only ASDisplayNode layouts

    -
    - - - -
    - (ASLayout *)filteredNodeLayoutTree
    - - - - - - - - - - - - - - - -
    -

    Declared In

    -

    ASLayout.h

    -
    - - -
    -
    -
    -
    - -
    - - - - - - -
    - -
    - -
    -
    -
    -
    - - - - \ No newline at end of file diff --git a/submodules/AsyncDisplayKit/docs/appledoc/Classes/ASLayoutElementStyle.html b/submodules/AsyncDisplayKit/docs/appledoc/Classes/ASLayoutElementStyle.html deleted file mode 100755 index 6a71f721ed..0000000000 --- a/submodules/AsyncDisplayKit/docs/appledoc/Classes/ASLayoutElementStyle.html +++ /dev/null @@ -1,796 +0,0 @@ - - - - - - ASLayoutElementStyle Class Reference - - - - - - -
    -
    - -

    - -

    - -

    - AsyncDisplayKit -

    - -
    -
    - - - -
    -
    -
    -
    -

    ASLayoutElementStyle Class Reference

    - - -
    - - - - - - - - - - -
    Inherits fromNSObject
    Conforms toASAbsoluteLayoutElement
    ASStackLayoutElement
    Declared inASLayoutElement.h
    - - - - - - -
    - - - - - - -
    -
    - -

    – initWithDelegate: -

    - -
    -
    - -
    - - -
    -

    Initializes the layoutElement style with a specified delegate

    -
    - - - -
    - (instancetype)initWithDelegate:(id<ASLayoutElementStyleDelegate>)delegate
    - - - - - - - - - - - - - - - -
    -

    Declared In

    -

    ASLayoutElement.h

    -
    - - -
    -
    -
    - -

      delegate -

    - -
    -
    - -
    - - -
    -

    The object that acts as the delegate of the style.

    -
    - - - -
    @property (nullable, nonatomic, weak, readonly) id<ASLayoutElementStyleDelegate> delegate
    - - - - - - - - - -
    -

    Discussion

    -

    The delegate must adopt the ASLayoutElementStyleDelegate protocol. The delegate is not retained.

    -
    - - - - - - - -
    -

    Declared In

    -

    ASLayoutElement.h

    -
    - - -
    -
    -
    - -

      width -

    - -
    -
    - -
    - - -
    -

    The width property specifies the height of the content area of an ASLayoutElement. -The minWidth and maxWidth properties override width. -Defaults to ASDimensionAuto

    -
    - - - -
    @property (nonatomic, assign, readwrite) ASDimension width
    - - - - - - - - - - - - - - - -
    -

    Declared In

    -

    ASLayoutElement.h

    -
    - - -
    -
    -
    - -

      height -

    - -
    -
    - -
    - - -
    -

    The height property specifies the height of the content area of an ASLayoutElement -The minHeight and maxHeight properties override height. -Defaults to ASDimensionAuto

    -
    - - - -
    @property (nonatomic, assign, readwrite) ASDimension height
    - - - - - - - - - - - - - - - -
    -

    Declared In

    -

    ASLayoutElement.h

    -
    - - -
    -
    -
    - -

      minHeight -

    - -
    -
    - -
    - - -
    -

    The minHeight property is used to set the minimum height of a given element. It prevents the used value -of the height property from becoming smaller than the value specified for minHeight. -The value of minHeight overrides both maxHeight and height. -Defaults to ASDimensionAuto

    -
    - - - -
    @property (nonatomic, assign, readwrite) ASDimension minHeight
    - - - - - - - - - - - - - - - -
    -

    Declared In

    -

    ASLayoutElement.h

    -
    - - -
    -
    -
    - -

      maxHeight -

    - -
    -
    - -
    - - -
    -

    The maxHeight property is used to set the maximum height of an element. It prevents the used value of the -height property from becoming larger than the value specified for maxHeight. -The value of maxHeight overrides height, but minHeight overrides maxHeight. -Defaults to ASDimensionAuto

    -
    - - - -
    @property (nonatomic, assign, readwrite) ASDimension maxHeight
    - - - - - - - - - - - - - - - -
    -

    Declared In

    -

    ASLayoutElement.h

    -
    - - -
    -
    -
    - -

      minWidth -

    - -
    -
    - -
    - - -
    -

    The minWidth property is used to set the minimum width of a given element. It prevents the used value of -the width property from becoming smaller than the value specified for minWidth. -The value of minWidth overrides both maxWidth and width. -Defaults to ASDimensionAuto

    -
    - - - -
    @property (nonatomic, assign, readwrite) ASDimension minWidth
    - - - - - - - - - - - - - - - -
    -

    Declared In

    -

    ASLayoutElement.h

    -
    - - -
    -
    -
    - -

      maxWidth -

    - -
    -
    - -
    - - -
    -

    The maxWidth property is used to set the maximum width of a given element. It prevents the used value of -the width property from becoming larger than the value specified for maxWidth. -The value of maxWidth overrides width, but minWidth overrides maxWidth. -Defaults to ASDimensionAuto

    -
    - - - -
    @property (nonatomic, assign, readwrite) ASDimension maxWidth
    - - - - - - - - - - - - - - - -
    -

    Declared In

    -

    ASLayoutElement.h

    -
    - - -
    -
    -
    - -

      preferredSize -

    - -
    -
    - -
    - - -
    -

    Provides a suggested size for a layout element. If the optional minSize or maxSize are provided, -and the preferredSize exceeds these, the minSize or maxSize will be enforced. If this optional value is not -provided, the layout element’s size will default to it’s intrinsic content size provided calculateSizeThatFits:

    -
    - - - -
    @property (nonatomic, assign) CGSize preferredSize
    - - - - - - - - - -
    -

    Discussion

    -

    This method is optional, but one of either preferredSize or preferredLayoutSize is required -for nodes that either have no intrinsic content size or -should be laid out at a different size than its intrinsic content size. For example, this property could be -set on an ASImageNode to display at a size different from the underlying image size.

    Warning: Calling the getter when the size’s width or height are relative will cause an assert.

    -
    - - - - - - - -
    -

    Declared In

    -

    ASLayoutElement.h

    -
    - - -
    -
    -
    - -

      minSize -

    - -
    -
    - -
    - - -
    -

    An optional property that provides a minimum size bound for a layout element. If provided, this restriction will -always be enforced. If a parent layout element’s minimum size is smaller than its child’s minimum size, the child’s -minimum size will be enforced and its size will extend out of the layout spec’s.

    -
    - - - -
    @property (nonatomic, assign) CGSize minSize
    - - - - - - - - - -
    -

    Discussion

    -

    For example, if you set a preferred relative width of 50% and a minimum width of 200 points on an -element in a full screen container, this would result in a width of 160 points on an iPhone screen. However, -since 160 pts is lower than the minimum width of 200 pts, the minimum width would be used.

    -
    - - - - - - - -
    -

    Declared In

    -

    ASLayoutElement.h

    -
    - - -
    -
    -
    - -

      maxSize -

    - -
    -
    - -
    - - -
    -

    An optional property that provides a maximum size bound for a layout element. If provided, this restriction will -always be enforced. If a child layout element’s maximum size is smaller than its parent, the child’s maximum size will -be enforced and its size will extend out of the layout spec’s.

    -
    - - - -
    @property (nonatomic, assign) CGSize maxSize
    - - - - - - - - - -
    -

    Discussion

    -

    For example, if you set a preferred relative width of 50% and a maximum width of 120 points on an -element in a full screen container, this would result in a width of 160 points on an iPhone screen. However, -since 160 pts is higher than the maximum width of 120 pts, the maximum width would be used.

    -
    - - - - - - - -
    -

    Declared In

    -

    ASLayoutElement.h

    -
    - - -
    -
    -
    - -

      preferredLayoutSize -

    - -
    -
    - -
    - - -
    -

    Provides a suggested RELATIVE size for a layout element. An ASLayoutSize uses percentages rather -than points to specify layout. E.g. width should be 50% of the parent’s width. If the optional minLayoutSize or -maxLayoutSize are provided, and the preferredLayoutSize exceeds these, the minLayoutSize or maxLayoutSize -will be enforced. If this optional value is not provided, the layout element’s size will default to its intrinsic content size -provided calculateSizeThatFits:

    -
    - - - -
    @property (nonatomic, assign, readwrite) ASLayoutSize preferredLayoutSize
    - - - - - - - - - - - - - - - -
    -

    Declared In

    -

    ASLayoutElement.h

    -
    - - -
    -
    -
    - -

      minLayoutSize -

    - -
    -
    - -
    - - -
    -

    An optional property that provides a minimum RELATIVE size bound for a layout element. If provided, this -restriction will always be enforced. If a parent layout element’s minimum relative size is smaller than its child’s minimum -relative size, the child’s minimum relative size will be enforced and its size will extend out of the layout spec’s.

    -
    - - - -
    @property (nonatomic, assign, readwrite) ASLayoutSize minLayoutSize
    - - - - - - - - - - - - - - - -
    -

    Declared In

    -

    ASLayoutElement.h

    -
    - - -
    -
    -
    - -

      maxLayoutSize -

    - -
    -
    - -
    - - -
    -

    An optional property that provides a maximum RELATIVE size bound for a layout element. If provided, this -restriction will always be enforced. If a parent layout element’s maximum relative size is smaller than its child’s maximum -relative size, the child’s maximum relative size will be enforced and its size will extend out of the layout spec’s.

    -
    - - - -
    @property (nonatomic, assign, readwrite) ASLayoutSize maxLayoutSize
    - - - - - - - - - - - - - - - -
    -

    Declared In

    -

    ASLayoutElement.h

    -
    - - -
    -
    -
    -
    - -
    - - - - - - -
    - -
    - -
    -
    -
    -
    - - - - \ No newline at end of file diff --git a/submodules/AsyncDisplayKit/docs/appledoc/Classes/ASLayoutSpec.html b/submodules/AsyncDisplayKit/docs/appledoc/Classes/ASLayoutSpec.html deleted file mode 100755 index 3bb92fb29e..0000000000 --- a/submodules/AsyncDisplayKit/docs/appledoc/Classes/ASLayoutSpec.html +++ /dev/null @@ -1,363 +0,0 @@ - - - - - - ASLayoutSpec Class Reference - - - - - - -
    -
    - -

    - -

    - -

    - Texture -

    - -
    -
    - - - -
    -
    -
    -
    -

    ASLayoutSpec Class Reference

    - - -
    - - - - - - - - - - -
    Inherits fromNSObject
    Conforms toASLayoutElement
    Declared inASLayoutSpec.h
    - - - - -
    - -

    Overview

    -

    A layout spec is an immutable object that describes a layout, loosely inspired by React.

    -
    - - - - - -
    - - - - - - -
    -
    - -

      isMutable -

    - -
    -
    - -
    - - -
    -

    Creation of a layout spec should only happen by a user in layoutSpecThatFits:. During that method, a -layout spec can be created and mutated. Once it is passed back to ASDK, the isMutable flag will be -set to NO and any further mutations will cause an assert.

    -
    - - - -
    @property (nonatomic, assign) BOOL isMutable
    - - - - - - - - - - - - - - - -
    -

    Declared In

    -

    ASLayoutSpec.h

    -
    - - -
    -
    -
    - -

      parent -

    - -
    -
    - -
    - - -
    -

    Parent of the layout spec

    -
    - - - -
    @property (nullable, nonatomic, weak) id<ASLayoutElement> parent
    - - - - - - - - - - - - - - - -
    -

    Declared In

    -

    ASLayoutSpec.h

    -
    - - -
    -
    -
    - -

      child -

    - -
    -
    - -
    - - -
    -

    Adds a child to this layout spec using a default identifier.

    -
    - - - -
    @property (nullable, strong, nonatomic) id<ASLayoutElement> child
    - - - -
    -

    Parameters

    - - - - - - - -
    child

    A child to be added.

    -
    - - - - - - - -
    -

    Discussion

    -

    Every ASLayoutSpec must act on at least one child. The ASLayoutSpec base class takes the -responsibility of holding on to the spec children. Some layout specs, like ASInsetLayoutSpec, -only require a single child.

    - -

    For layout specs that require a known number of children (ASBackgroundLayoutSpec, for example) -a subclass should use this method to set the “primary” child. It can then use setChild:forIdentifier: -to set any other required children. Ideally a subclass would hide this from the user, and use the -setChild:forIdentifier: internally. For example, ASBackgroundLayoutSpec exposes a backgroundChild -property that behind the scenes is calling setChild:forIdentifier:.

    -
    - - - - - - - -
    -

    Declared In

    -

    ASLayoutSpec.h

    -
    - - -
    -
    -
    - -

      children -

    - -
    -
    - -
    - - -
    -

    Adds childen to this layout spec.

    -
    - - - -
    @property (nullable, strong, nonatomic) NSArray<id<ASLayoutElement> > *children
    - - - -
    -

    Parameters

    - - - - - - - -
    children

    An array of ASLayoutElement children to be added.

    -
    - - - - - - - -
    -

    Discussion

    -

    Every ASLayoutSpec must act on at least one child. The ASLayoutSpec base class takes the -reponsibility of holding on to the spec children. Some layout specs, like ASStackLayoutSpec, -can take an unknown number of children. In this case, the this method should be used. -For good measure, in these layout specs it probably makes sense to define -setChild: and setChild:forIdentifier: methods to do something appropriate or to assert.

    -
    - - - - - - - -
    -

    Declared In

    -

    ASLayoutSpec.h

    -
    - - -
    -
    -
    -
    - -
    - - - - - - -
    - - -
    -
    -
    - - - - \ No newline at end of file diff --git a/submodules/AsyncDisplayKit/docs/appledoc/Classes/ASMapNode.html b/submodules/AsyncDisplayKit/docs/appledoc/Classes/ASMapNode.html deleted file mode 100755 index 75a586bc13..0000000000 --- a/submodules/AsyncDisplayKit/docs/appledoc/Classes/ASMapNode.html +++ /dev/null @@ -1,531 +0,0 @@ - - - - - - ASMapNode Class Reference - - - - - - -
    -
    - -

    - -

    - -

    - AsyncDisplayKit -

    - -
    -
    - - - -
    -
    -
    -
    -

    ASMapNode Class Reference

    - - -
    - - - - - - - -
    Inherits fromASImageNode : ASControlNode : ASDisplayNode : ASDealloc2MainObject
    Declared inASMapNode.h
    - - - - - - -
    - - - - - - -
    -
    - -

      options -

    - -
    -
    - -
    - - -
    -

    The current options of ASMapNode. This can be set at any time and ASMapNode will animate the change.

    This property may be set from a background thread before the node is loaded, and will automatically be applied to define the behavior of the static snapshot (if .liveMap = NO) or the internal MKMapView (otherwise).

    Changes to the region and camera options will only be animated when when the liveMap mode is enabled, otherwise these options will be applied statically to the new snapshot.

    The options object is used to specify properties even when the liveMap mode is enabled, allowing seamless transitions between the snapshot and liveMap (as well as back to the snapshot).

    -
    - - - -
    @property (nonatomic, strong) MKMapSnapshotOptions *options
    - - - - - - - - - - - - - - - -
    -

    Declared In

    -

    ASMapNode.h

    -
    - - -
    -
    -
    - -

      region -

    - -
    -
    - -
    - - -
    -

    The region is simply the sub-field on the options object. If the objects object is reset, - this will in effect be overwritten and become the value of the .region property on that object. - Defaults to MKCoordinateRegionForMapRect(MKMapRectWorld).

    -
    - - - -
    @property (nonatomic, assign) MKCoordinateRegion region
    - - - - - - - - - - - - - - - -
    -

    Declared In

    -

    ASMapNode.h

    -
    - - -
    -
    -
    - -

      mapView -

    - -
    -
    - -
    - - -
    -

    This is the MKMapView that is the live map part of ASMapNode. This will be nil if .liveMap = NO. Note, MKMapView is not thread-safe.

    -
    - - - -
    @property (nullable, nonatomic, readonly) MKMapView *mapView
    - - - - - - - - - - - - - - - -
    -

    Declared In

    -

    ASMapNode.h

    -
    - - -
    -
    -
    - -

      liveMap -

    - -
    -
    - -
    - - -
    -

    Set this to YES to turn the snapshot into an interactive MKMapView and vice versa. Defaults to NO. This property may be set on a background thread before the node is loaded, and will automatically be actioned, once the node is loaded.

    -
    - - - -
    @property (nonatomic, assign, getter=isLiveMap) BOOL liveMap
    - - - - - - - - - - - - - - - -
    -

    Declared In

    -

    ASMapNode.h

    -
    - - -
    -
    -
    - -

      needsMapReloadOnBoundsChange -

    - -
    -
    - -
    - - -
    -

    Whether ASMapNode should automatically request a new map snapshot to correspond to the new node size. -@default Default value is YES.

    -
    - - - -
    @property (nonatomic, assign) BOOL needsMapReloadOnBoundsChange
    - - - - - - - - - -
    -

    Discussion

    -

    If mapSize is set then this will be set to NO, since the size will be the same in all orientations.

    -
    - - - - - - - -
    -

    Declared In

    -

    ASMapNode.h

    -
    - - -
    -
    -
    - -

      mapDelegate -

    - -
    -
    - -
    - - -
    -

    Set the delegate of the MKMapView. This can be set even before mapView is created and will be set on the map in the case that the liveMap mode is engaged.

    -
    - - - -
    @property (nonatomic, weak) id<MKMapViewDelegate> mapDelegate
    - - - - - - - - - - - - - - - -
    -

    Declared In

    -

    ASMapNode.h

    -
    - - -
    -
    -
    - -

      annotations -

    - -
    -
    - -
    - - -
    -

    The annotations to display on the map.

    -
    - - - -
    @property (nonatomic, copy) NSArray<id<MKAnnotation> > *annotations
    - - - - - - - - - - - - - - - -
    -

    Declared In

    -

    ASMapNode.h

    -
    - - -
    -
    -
    - -

      showAnnotationsOptions -

    - -
    -
    - -
    - - -
    -

    This property specifies how to show the annotations. -@default Default value is ASMapNodeShowAnnotationsIgnored

    -
    - - - -
    @property (nonatomic, assign) ASMapNodeShowAnnotationsOptions showAnnotationsOptions
    - - - - - - - - - - - - - - - -
    -

    Declared In

    -

    ASMapNode.h

    -
    - - -
    -
    -
    - -

      imageForStaticMapAnnotationBlock -

    - -
    -
    - -
    - - -
    -

    The block which should return annotation image for static map based on provided annotation.

    -
    - - - -
    @property (nonatomic, copy, nullable) UIImage *( ^ ) ( id<MKAnnotation> annotation , CGPoint *centerOffset ) imageForStaticMapAnnotationBlock
    - - - - - - - - - -
    -

    Discussion

    -

    This block is executed on an arbitrary serial queue. If this block is nil, standard pin is used.

    -
    - - - - - - - -
    -

    Declared In

    -

    ASMapNode.h

    -
    - - -
    -
    -
    -
    - -
    - - - - - - -
    - -
    - -
    -
    -
    -
    - - - - \ No newline at end of file diff --git a/submodules/AsyncDisplayKit/docs/appledoc/Classes/ASMultiplexImageNode.html b/submodules/AsyncDisplayKit/docs/appledoc/Classes/ASMultiplexImageNode.html deleted file mode 100755 index bb6387c5e7..0000000000 --- a/submodules/AsyncDisplayKit/docs/appledoc/Classes/ASMultiplexImageNode.html +++ /dev/null @@ -1,651 +0,0 @@ - - - - - - ASMultiplexImageNode Class Reference - - - - - - -
    -
    - -

    - -

    - -

    - AsyncDisplayKit -

    - -
    -
    - - - -
    -
    -
    -
    -

    ASMultiplexImageNode Class Reference

    - - -
    - - - - - - - -
    Inherits fromASImageNode : ASControlNode : ASDisplayNode : ASDealloc2MainObject
    Declared inASMultiplexImageNode.h
    - - - - -
    - -

    Overview

    -

    ASMultiplexImageNode begins loading images when its resource can either return a UIImage directly, or a URL the image node should load.

    -
    - - - - - -
    - - - - - - -
    -
    - -

    – initWithCache:downloader: -

    - -
    -
    - -
    - - -
    -

    The designated initializer.

    -
    - - - -
    - (instancetype)initWithCache:(nullable id<ASImageCacheProtocol>)cache downloader:(nullable id<ASImageDownloaderProtocol>)downloader
    - - - -
    -

    Parameters

    - - - - - - - - - - - - -
    cache

    The object that implements a cache of images for the image node.

    downloader

    The object that implements image downloading for the image node.

    -
    - - - -
    -

    Return Value

    -

    An initialized ASMultiplexImageNode.

    -
    - - - - - -
    -

    Discussion

    -

    If cache is nil, the receiver will not attempt to retrieve images from a cache before downloading them.

    -
    - - - - - - - -
    -

    Declared In

    -

    ASMultiplexImageNode.h

    -
    - - -
    -
    -
    - -

      delegate -

    - -
    -
    - -
    - - -
    -

    The delegate, which must conform to the ASMultiplexImageNodeDelegate protocol.

    -
    - - - -
    @property (nonatomic, readwrite, weak) id<ASMultiplexImageNodeDelegate> delegate
    - - - - - - - - - - - - - - - -
    -

    Declared In

    -

    ASMultiplexImageNode.h

    -
    - - -
    -
    -
    - -

      dataSource -

    - -
    -
    - -
    - - -
    -

    The data source, which must conform to the ASMultiplexImageNodeDataSource protocol.

    -
    - - - -
    @property (nonatomic, readwrite, weak) id<ASMultiplexImageNodeDataSource> dataSource
    - - - - - - - - - -
    -

    Discussion

    -

    This value is required for ASMultiplexImageNode to load images.

    -
    - - - - - - - -
    -

    Declared In

    -

    ASMultiplexImageNode.h

    -
    - - -
    -
    -
    - -

      downloadsIntermediateImages -

    - -
    -
    - -
    - - -
    -

    Whether the receiver should download more than just its highest-quality image. Defaults to NO.

    -
    - - - -
    @property (nonatomic, readwrite, assign) BOOL downloadsIntermediateImages
    - - - - - - - - - -
    -

    Discussion

    -

    ASMultiplexImageNode immediately loads and displays the first image specified in imageIdentifiers (its -highest-quality image). If that image is not immediately available or cached, the node can download and display -lesser-quality images. Set downloadsIntermediateImages to YES to enable this behaviour.

    -
    - - - - - - - -
    -

    Declared In

    -

    ASMultiplexImageNode.h

    -
    - - -
    -
    -
    - -

      imageIdentifiers -

    - -
    -
    - -
    - - -
    -

    An array of identifiers representing various versions of an image for ASMultiplexImageNode to display.

    -
    - - - -
    @property (nonatomic, readwrite, copy) NSArray<ASImageIdentifier> *imageIdentifiers
    - - - - - - - - - -
    -

    Discussion

    -

    An identifier can be any object that conforms to NSObject and NSCopying. The array should be in -decreasing order of image quality – that is, the first identifier in the array represents the best version.

    -
    - - - - - -
    -

    See Also

    - -
    - - - -
    -

    Declared In

    -

    ASMultiplexImageNode.h

    -
    - - -
    -
    -
    - -

    – reloadImageIdentifierSources -

    - -
    -
    - -
    - - -
    -

    Notify the receiver SSAA that its data source has new UIImages or NSURLs available for imageIdentifiers.

    -
    - - - -
    - (void)reloadImageIdentifierSources
    - - - - - - - - - -
    -

    Discussion

    -

    If a higher-quality image than is currently displayed is now available, it will be loaded.

    -
    - - - - - - - -
    -

    Declared In

    -

    ASMultiplexImageNode.h

    -
    - - -
    -
    -
    - -

      loadedImageIdentifier -

    - -
    -
    - -
    - - -
    -

    The identifier for the last image that the receiver loaded, or nil.

    -
    - - - -
    @property (nullable, nonatomic, readonly) ASImageIdentifier loadedImageIdentifier
    - - - - - - - - - -
    -

    Discussion

    -

    This value may differ from displayedImageIdentifier if the image hasn’t yet been displayed.

    -
    - - - - - - - -
    -

    Declared In

    -

    ASMultiplexImageNode.h

    -
    - - -
    -
    -
    - -

      displayedImageIdentifier -

    - -
    -
    - -
    - - -
    -

    The identifier for the image that the receiver is currently displaying, or nil.

    -
    - - - -
    @property (nullable, nonatomic, readonly) ASImageIdentifier displayedImageIdentifier
    - - - - - - - - - - - - - - - -
    -

    Declared In

    -

    ASMultiplexImageNode.h

    -
    - - -
    -
    -
    - -

      shouldRenderProgressImages -

    - -
    -
    - -
    - - -
    -

    If the downloader implements progressive image rendering and this value is YES progressive renders of the -image will be displayed as the image downloads. Regardless of this properties value, progress renders will -only occur when the node is visible. Defaults to YES.

    -
    - - - -
    @property (nonatomic, assign, readwrite) BOOL shouldRenderProgressImages
    - - - - - - - - - - - - - - - -
    -

    Declared In

    -

    ASMultiplexImageNode.h

    -
    - - -
    -
    -
    - -

      imageManager -

    - -
    -
    - -
    - - -
    -
      -
    • @abstract The image manager that this image node should use when requesting images from the Photos framework. If this is nil (the default), then PHImageManager.defaultManager is used.
    • -
    - -
    - - - -
    @property (nullable, nonatomic, strong) PHImageManager *imageManager
    - - - - - - - - - -
    -

    Discussion

    -
      -
    • @see +[NSURL URLWithAssetLocalIdentifier:targetSize:contentMode:options:] below.
    • -
    - -
    - - - - - - - -
    -

    Declared In

    -

    ASMultiplexImageNode.h

    -
    - - -
    -
    -
    -
    - -
    - - - - - - -
    - -
    - -
    -
    -
    -
    - - - - \ No newline at end of file diff --git a/submodules/AsyncDisplayKit/docs/appledoc/Classes/ASNavigationController.html b/submodules/AsyncDisplayKit/docs/appledoc/Classes/ASNavigationController.html deleted file mode 100755 index 4dd2da497c..0000000000 --- a/submodules/AsyncDisplayKit/docs/appledoc/Classes/ASNavigationController.html +++ /dev/null @@ -1,127 +0,0 @@ - - - - - - ASNavigationController Class Reference - - - - - - -
    -
    - -

    - -

    - -

    - AsyncDisplayKit -

    - -
    -
    - - - -
    -
    -
    -
    -

    ASNavigationController Class Reference

    - - -
    - - - - - - - - - - -
    Inherits fromUINavigationController
    Conforms toASManagesChildVisibilityDepth
    Declared inASNavigationController.h
    - - - - -
    - -

    Overview

    -

    ASNavigationController

    ASNavigationController is a drop in replacement for UINavigationController -which improves memory efficiency by implementing the @c ASManagesChildVisibilityDepth protocol. -You can use ASNavigationController with regular UIViewControllers, as well as ASViewControllers. -It is safe to subclass or use even where AsyncDisplayKit is not adopted.

    -
    - - - - - - - - - - -
    - -
    - -
    -
    -
    -
    - - - - \ No newline at end of file diff --git a/submodules/AsyncDisplayKit/docs/appledoc/Classes/ASNetworkImageNode.html b/submodules/AsyncDisplayKit/docs/appledoc/Classes/ASNetworkImageNode.html deleted file mode 100755 index 36b5f30476..0000000000 --- a/submodules/AsyncDisplayKit/docs/appledoc/Classes/ASNetworkImageNode.html +++ /dev/null @@ -1,633 +0,0 @@ - - - - - - ASNetworkImageNode Class Reference - - - - - - -
    -
    - -

    - -

    - -

    - AsyncDisplayKit -

    - -
    -
    - - - -
    -
    -
    -
    -

    ASNetworkImageNode Class Reference

    - - -
    - - - - - - - -
    Inherits fromASImageNode : ASControlNode : ASDisplayNode : ASDealloc2MainObject
    Declared inASNetworkImageNode.h
    - - - - -
    - -

    Overview

    -

    ASNetworkImageNode is a simple image node that can download and display an image from the network, with support for a -placeholder image (defaultImage). The currently-displayed image is always available in the inherited ASImageNode - property.

    -
    - - - - - -
    - - - - - - -
    -
    - -

    – initWithCache:downloader: -

    - -
    -
    - -
    - - -
    -

    The designated initializer. Cache and Downloader are WEAK references.

    -
    - - - -
    - (instancetype)initWithCache:(nullable id<ASImageCacheProtocol>)cache downloader:(id<ASImageDownloaderProtocol>)downloader
    - - - -
    -

    Parameters

    - - - - - - - - - - - - -
    cache

    The object that implements a cache of images for the image node. Weak reference.

    downloader

    The object that implements image downloading for the image node. Must not be nil. Weak reference.

    -
    - - - -
    -

    Return Value

    -

    An initialized ASNetworkImageNode.

    -
    - - - - - -
    -

    Discussion

    -

    If cache is nil, the receiver will not attempt to retrieve images from a cache before downloading them.

    -
    - - - - - - - -
    -

    Declared In

    -

    ASNetworkImageNode.h

    -
    - - -
    -
    -
    - -

    – init -

    - -
    -
    - -
    - - -
    -

    Convenience initialiser.

    -
    - - - -
    - (instancetype)init
    - - - - - -
    -

    Return Value

    -

    An ASNetworkImageNode configured to use the NSURLSession-powered ASBasicImageDownloader, and no extra cache.

    -
    - - - - - - - - - - - -
    -

    Declared In

    -

    ASNetworkImageNode.h

    -
    - - -
    -
    -
    - -

      delegate -

    - -
    -
    - -
    - - -
    -

    The delegate, which must conform to the ASNetworkImageNodeDelegate protocol.

    -
    - - - -
    @property (nullable, nonatomic, weak, readwrite) id<ASNetworkImageNodeDelegate> delegate
    - - - - - - - - - - - - - - - -
    -

    Declared In

    -

    ASNetworkImageNode.h

    -
    - - -
    -
    -
    - -

      defaultImage -

    - -
    -
    - -
    - - -
    -

    A placeholder image to display while the URL is loading.

    -
    - - - -
    @property (nullable, nonatomic, strong, readwrite) UIImage *defaultImage
    - - - - - - - - - - - - - - - -
    -

    Declared In

    -

    ASNetworkImageNode.h

    -
    - - -
    -
    -
    - -

      URL -

    - -
    -
    - -
    - - -
    -

    The URL of a new image to download and display.

    -
    - - - -
    @property (nullable, nonatomic, strong, readwrite) NSURL *URL
    - - - - - - - - - -
    -

    Discussion

    -

    Changing this property will reset the displayed image to a placeholder (defaultImage) while loading.

    -
    - - - - - - - -
    -

    Declared In

    -

    ASNetworkImageNode.h

    -
    - - -
    -
    -
    - -

    – setURL:resetToDefault: -

    - -
    -
    - -
    - - -
    -

    Download and display a new image.

    -
    - - - -
    - (void)setURL:(nullable NSURL *)URL resetToDefault:(BOOL)reset
    - - - -
    -

    Parameters

    - - - - - - - - - - - - -
    URL

    The URL of a new image to download and display.

    reset

    Whether to display a placeholder (defaultImage) while loading the new image.

    -
    - - - - - - - - - - - - - -
    -

    Declared In

    -

    ASNetworkImageNode.h

    -
    - - -
    -
    -
    - -

      shouldCacheImage -

    - -
    -
    - -
    - - -
    -

    If URL is a local file, set this property to YES to take advantage of UIKit’s image caching. Defaults to YES.

    -
    - - - -
    @property (nonatomic, assign, readwrite) BOOL shouldCacheImage
    - - - - - - - - - - - - - - - -
    -

    Declared In

    -

    ASNetworkImageNode.h

    -
    - - -
    -
    -
    - -

      shouldRenderProgressImages -

    - -
    -
    - -
    - - -
    -

    If the downloader implements progressive image rendering and this value is YES progressive renders of the -image will be displayed as the image downloads. Regardless of this properties value, progress renders will -only occur when the node is visible. Defaults to YES.

    -
    - - - -
    @property (nonatomic, assign, readwrite) BOOL shouldRenderProgressImages
    - - - - - - - - - - - - - - - -
    -

    Declared In

    -

    ASNetworkImageNode.h

    -
    - - -
    -
    -
    - -

      currentImageQuality -

    - -
    -
    - -
    - - -
    -

    The image quality of the current image. This is a number between 0 and 1 and can be used to track -progressive progress. Calculated by dividing number of bytes / expected number of total bytes.

    -
    - - - -
    @property (nonatomic, assign, readonly) CGFloat currentImageQuality
    - - - - - - - - - - - - - - - -
    -

    Declared In

    -

    ASNetworkImageNode.h

    -
    - - -
    -
    -
    - -

      renderedImageQuality -

    - -
    -
    - -
    - - -
    -

    The image quality (value between 0 and 1) of the last image that completed displaying.

    -
    - - - -
    @property (nonatomic, assign, readonly) CGFloat renderedImageQuality
    - - - - - - - - - - - - - - - -
    -

    Declared In

    -

    ASNetworkImageNode.h

    -
    - - -
    -
    -
    -
    - -
    - - - - - - -
    - -
    - -
    -
    -
    -
    - - - - \ No newline at end of file diff --git a/submodules/AsyncDisplayKit/docs/appledoc/Classes/ASOverlayLayoutSpec.html b/submodules/AsyncDisplayKit/docs/appledoc/Classes/ASOverlayLayoutSpec.html deleted file mode 100755 index 8ebefaec69..0000000000 --- a/submodules/AsyncDisplayKit/docs/appledoc/Classes/ASOverlayLayoutSpec.html +++ /dev/null @@ -1,247 +0,0 @@ - - - - - - ASOverlayLayoutSpec Class Reference - - - - - - -
    -
    - -

    - -

    - -

    - AsyncDisplayKit -

    - -
    -
    - - - -
    -
    -
    -
    -

    ASOverlayLayoutSpec Class Reference

    - - -
    - - - - - - - -
    Inherits fromASLayoutSpec : NSObject
    Declared inASOverlayLayoutSpec.h
    - - - - -
    - -

    Overview

    -

    This layout spec lays out a single layoutElement child and then overlays a layoutElement object on top of it streched to its size

    -
    - - - - - -
    - - - - - - -
    -
    - -

      overlay -

    - -
    -
    - -
    - - -
    -

    Overlay layoutElement of this layout spec

    -
    - - - -
    @property (nullable, nonatomic, strong) id<ASLayoutElement> overlay
    - - - - - - - - - - - - - - - -
    -

    Declared In

    -

    ASOverlayLayoutSpec.h

    -
    - - -
    -
    -
    - -

    + overlayLayoutSpecWithChild:overlay: -

    - -
    -
    - -
    - - -
    -

    Creates and returns an ASOverlayLayoutSpec object with a given child and an layoutElement that act as overlay.

    -
    - - - -
    + (instancetype)overlayLayoutSpecWithChild:(id<ASLayoutElement>)child overlay:(nullable id<ASLayoutElement>)overlay
    - - - -
    -

    Parameters

    - - - - - - - - - - - - -
    child

    A child that is laid out to determine the size of this spec.

    overlay

    A layoutElement object that is laid out over the child. If this is nil, the overlay is omitted.

    -
    - - - - - - - - - - - - - -
    -

    Declared In

    -

    ASOverlayLayoutSpec.h

    -
    - - -
    -
    -
    -
    - -
    - - - - - - -
    - -
    - -
    -
    -
    -
    - - - - \ No newline at end of file diff --git a/submodules/AsyncDisplayKit/docs/appledoc/Classes/ASPagerNode.html b/submodules/AsyncDisplayKit/docs/appledoc/Classes/ASPagerNode.html deleted file mode 100755 index b6f529ae77..0000000000 --- a/submodules/AsyncDisplayKit/docs/appledoc/Classes/ASPagerNode.html +++ /dev/null @@ -1,579 +0,0 @@ - - - - - - ASPagerNode Class Reference - - - - - - -
    -
    - -

    - -

    - -

    - AsyncDisplayKit -

    - -
    -
    - - - -
    -
    -
    -
    -

    ASPagerNode Class Reference

    - - -
    - - - - - - - -
    Inherits fromASCollectionNode : ASDisplayNode : ASDealloc2MainObject
    Declared inASPagerNode.h
    - - - - - - -
    - - - - - - -
    -
    - -

    – init -

    - -
    -
    - -
    - - -
    -

    Configures a default horizontal, paging flow layout with 0 inter-item spacing.

    -
    - - - -
    - (instancetype)init
    - - - - - - - - - - - - - - - -
    -

    Declared In

    -

    ASPagerNode.h

    -
    - - -
    -
    -
    - -

    – initWithCollectionViewLayout: -

    - -
    -
    - -
    - - -
    -

    Initializer with custom-configured flow layout properties.

    -
    - - - -
    - (instancetype)initWithCollectionViewLayout:(ASPagerFlowLayout *)flowLayout
    - - - - - - - - - - - - - - - -
    -

    Declared In

    -

    ASPagerNode.h

    -
    - - -
    -
    -
    - -

    – setDataSource: -

    - -
    -
    - -
    - - -
    -

    Data Source is required, and uses a different protocol from ASCollectionNode.

    -
    - - - -
    - (void)setDataSource:(nullable id<ASPagerDataSource>)dataSource
    - - - - - - - - - - - - - - - -
    -

    Declared In

    -

    ASPagerNode.h

    -
    - - -
    -
    -
    - -

    – dataSource -

    - -
    -
    - -
    - - -
    -

    The object that acts as the asynchronous data source of the collection view

    -
    - - - -
    - (nullable id<ASPagerDataSource>)dataSource
    - - - - - - - - - -
    -

    Discussion

    -

    The datasource must adopt the ASCollectionDataSource protocol. The collection view maintains a weak reference to the datasource object.

    - -

    The datasource object is responsible for providing nodes or node creation blocks to the collection view.

    Note: This is a convenience method which sets the asyncDatasource on the collection node’s collection view.

    -
    - - - - - - - -
    -

    Declared In

    -

    ASCollectionNode.h

    -
    - - -
    -
    -
    - -

    – setDelegate: -

    - -
    -
    - -
    - - -
    -

    Delegate is optional. -This includes UIScrollViewDelegate as well as most methods from UICollectionViewDelegate, like willDisplay…

    -
    - - - -
    - (void)setDelegate:(nullable id<ASPagerDelegate>)delegate
    - - - - - - - - - - - - - - - -
    -

    Declared In

    -

    ASPagerNode.h

    -
    - - -
    -
    -
    - -

    – delegate -

    - -
    -
    - -
    - - -
    -

    The object that acts as the asynchronous delegate of the collection view

    -
    - - - -
    - (nullable id<ASPagerDelegate>)delegate
    - - - - - - - - - -
    -

    Discussion

    -

    The delegate must adopt the ASCollectionDelegate protocol. The collection view maintains a weak reference to the delegate object.

    - -

    The delegate object is responsible for providing size constraints for nodes and indicating whether batch fetching should begin.

    Note: This is a convenience method which sets the asyncDelegate on the collection node’s collection view.

    -
    - - - - - - - -
    -

    Declared In

    -

    ASCollectionNode.h

    -
    - - -
    -
    -
    - -

      view -

    - -
    -
    - -
    - - -
    -

    The underlying ASCollectionView object.

    -
    - - - -
    @property (nonatomic, readonly) ASCollectionView *view
    - - - - - - - - - - - - - - - -
    -

    Declared In

    -

    ASPagerNode.h

    -
    - - -
    -
    -
    - -

      currentPageIndex -

    - -
    -
    - -
    - - -
    -

    Returns the current page index

    -
    - - - -
    @property (nonatomic, assign, readonly) NSInteger currentPageIndex
    - - - - - - - - - - - - - - - -
    -

    Declared In

    -

    ASPagerNode.h

    -
    - - -
    -
    -
    - -

    – scrollToPageAtIndex:animated: -

    - -
    -
    - -
    - - -
    -

    Scroll the contents of the receiver to ensure that the page is visible

    -
    - - - -
    - (void)scrollToPageAtIndex:(NSInteger)index animated:(BOOL)animated
    - - - - - - - - - - - - - - - -
    -

    Declared In

    -

    ASPagerNode.h

    -
    - - -
    -
    -
    - -

    – nodeForPageAtIndex: -

    - -
    -
    - -
    - - -
    -

    Returns the node for the passed page index

    -
    - - - -
    - (ASCellNode *)nodeForPageAtIndex:(NSInteger)index
    - - - - - - - - - - - - - - - -
    -

    Declared In

    -

    ASPagerNode.h

    -
    - - -
    -
    -
    -
    - -
    - - - - - - -
    - -
    - -
    -
    -
    -
    - - - - \ No newline at end of file diff --git a/submodules/AsyncDisplayKit/docs/appledoc/Classes/ASRangeController.html b/submodules/AsyncDisplayKit/docs/appledoc/Classes/ASRangeController.html deleted file mode 100755 index ad02f940ee..0000000000 --- a/submodules/AsyncDisplayKit/docs/appledoc/Classes/ASRangeController.html +++ /dev/null @@ -1,437 +0,0 @@ - - - - - - ASRangeController Class Reference - - - - - - -
    -
    - -

    - -

    - -

    - AsyncDisplayKit -

    - -
    -
    - - - -
    -
    -
    -
    -

    ASRangeController Class Reference

    - - -
    - - - - - - - - - - -
    Inherits fromASDealloc2MainObject
    Conforms toASDataControllerDelegate
    Declared inASRangeController.h
    - - - - -
    - -

    Overview

    -

    Working range controller.

    - -

    Used internally by ASTableView and ASCollectionView. It is paired with ASDataController. -It is designed to support custom scrolling containers as well. Observes the visible range, maintains -“working ranges” to trigger network calls and rendering, and is responsible for driving asynchronous layout of cells. -This includes cancelling those asynchronous operations as cells fall outside of the working ranges.

    -
    - - - - - -
    - - - - - - -
    -
    - -

    – setNeedsUpdate -

    - -
    -
    - -
    - - -
    -

    Notify the range controller that the visible range has been updated. -This is the primary input call that drives updating the working ranges, and triggering their actions. -The ranges will be updated in the next turn of the main loop, or when -updateIfNeeded is called.

    -
    - - - -
    - (void)setNeedsUpdate
    - - - - - - - - - - - - - - - -
    -

    Declared In

    -

    ASRangeController.h

    -
    - - -
    -
    -
    - -

    – updateIfNeeded -

    - -
    -
    - -
    - - -
    -

    Update the ranges immediately, if -setNeedsUpdate has been called since the last update. -This is useful because the ranges must be updated immediately after a cell is added -into a table/collection to satisfy interface state API guarantees.

    -
    - - - -
    - (void)updateIfNeeded
    - - - - - - - - - - - - - - - -
    -

    Declared In

    -

    ASRangeController.h

    -
    - - -
    -
    -
    - -

    – configureContentView:forCellNode: -

    - -
    -
    - -
    - - -
    -

    Add the sized node for indexPath as a subview of contentView.

    -
    - - - -
    - (void)configureContentView:(UIView *)contentView forCellNode:(ASCellNode *)node
    - - - -
    -

    Parameters

    - - - - - - - - - - - - -
    contentView

    UIView to add a (sized) node’s view to.

    node

    The cell node to be added.

    -
    - - - - - - - - - - - - - -
    -

    Declared In

    -

    ASRangeController.h

    -
    - - -
    -
    -
    - -

      layoutController -

    - -
    -
    - -
    - - -
    -

    An object that describes the layout behavior of the ranged component (table view, collection view, etc.)

    -
    - - - -
    @property (nonatomic, strong) id<ASLayoutController> layoutController
    - - - - - - - - - -
    -

    Discussion

    -

    Used primarily for providing the current range of index paths and identifying when the -range controller should invalidate its range.

    -
    - - - - - - - -
    -

    Declared In

    -

    ASRangeController.h

    -
    - - -
    -
    -
    - -

      dataSource -

    - -
    -
    - -
    - - -
    -

    The underlying data source for the range controller

    -
    - - - -
    @property (nonatomic, weak) id<ASRangeControllerDataSource> dataSource
    - - - - - - - - - - - - - - - -
    -

    Declared In

    -

    ASRangeController.h

    -
    - - -
    -
    -
    - -

      delegate -

    - -
    -
    - -
    - - -
    -

    Delegate for handling range controller events. Must not be nil.

    -
    - - - -
    @property (nonatomic, weak) id<ASRangeControllerDelegate> delegate
    - - - - - - - - - - - - - - - -
    -

    Declared In

    -

    ASRangeController.h

    -
    - - -
    -
    -
    -
    - -
    - - - - - - -
    - -
    - -
    -
    -
    -
    - - - - \ No newline at end of file diff --git a/submodules/AsyncDisplayKit/docs/appledoc/Classes/ASRatioLayoutSpec.html b/submodules/AsyncDisplayKit/docs/appledoc/Classes/ASRatioLayoutSpec.html deleted file mode 100755 index cc159b5851..0000000000 --- a/submodules/AsyncDisplayKit/docs/appledoc/Classes/ASRatioLayoutSpec.html +++ /dev/null @@ -1,139 +0,0 @@ - - - - - - ASRatioLayoutSpec Class Reference - - - - - - -
    -
    - -

    - -

    - -

    - AsyncDisplayKit -

    - -
    -
    - - - -
    -
    -
    -
    -

    ASRatioLayoutSpec Class Reference

    - - -
    - - - - - - - -
    Inherits fromASLayoutSpec : NSObject
    Declared inASRatioLayoutSpec.h
    - - - - -
    - -

    Overview

    -

    Ratio layout spec -For when the content should respect a certain inherent ratio but can be scaled (think photos or videos) -The ratio passed is the ratio of height / width you expect

    - -

    For a ratio 0.5, the spec will have a flat rectangle shape

    - -
    - -

    | | -| _ _ |

    - -

    For a ratio 2.0, the spec will be twice as tall as it is wide - _ _ -| | -| | -| | -| |

    - -

    *

    -
    - - - - - - - - - - -
    - -
    - -
    -
    -
    -
    - - - - \ No newline at end of file diff --git a/submodules/AsyncDisplayKit/docs/appledoc/Classes/ASRelativeLayoutSpec.html b/submodules/AsyncDisplayKit/docs/appledoc/Classes/ASRelativeLayoutSpec.html deleted file mode 100755 index ebcd558584..0000000000 --- a/submodules/AsyncDisplayKit/docs/appledoc/Classes/ASRelativeLayoutSpec.html +++ /dev/null @@ -1,305 +0,0 @@ - - - - - - ASRelativeLayoutSpec Class Reference - - - - - - -
    -
    - -

    - -

    - -

    - AsyncDisplayKit -

    - -
    -
    - - - -
    -
    -
    -
    -

    ASRelativeLayoutSpec Class Reference

    - - -
    - - - - - - - -
    Inherits fromASLayoutSpec : NSObject
    Declared inASRelativeLayoutSpec.h
    - - - - -
    - -

    Overview

    -

    Lays out a single layoutElement child and positions it within the layout bounds according to vertical and horizontal positional specifiers. -Can position the child at any of the 4 corners, or the middle of any of the 4 edges, as well as the center - similar to “9-part” image areas.

    -
    - - - - - -
    - - - - - - -
    -
    - -

    + relativePositionLayoutSpecWithHorizontalPosition:verticalPosition:sizingOption:child: -

    - -
    -
    - -
    - - -
    -

    convenience constructor for a ASRelativeLayoutSpec

    -
    - - - -
    + (instancetype)relativePositionLayoutSpecWithHorizontalPosition:(ASRelativeLayoutSpecPosition)horizontalPosition verticalPosition:(ASRelativeLayoutSpecPosition)verticalPosition sizingOption:(ASRelativeLayoutSpecSizingOption)sizingOption child:(id<ASLayoutElement>)child
    - - - -
    -

    Parameters

    - - - - - - - - - - - - - - - - - - - - - - -
    horizontalPosition

    how to position the item on the horizontal (x) axis

    verticalPosition

    how to position the item on the vertical (y) axis

    sizingOption

    how much size to take up

    child

    the child to layout

    -
    - - - -
    -

    Return Value

    -

    a configured ASRelativeLayoutSpec

    -
    - - - - - -
    -

    Discussion

    -

    convenience constructor for a ASRelativeLayoutSpec

    -
    - - - - - - - -
    -

    Declared In

    -

    ASRelativeLayoutSpec.h

    -
    - - -
    -
    -
    - -

    – initWithHorizontalPosition:verticalPosition:sizingOption:child: -

    - -
    -
    - -
    - - -
    -

    convenience initializer for a ASRelativeLayoutSpec

    -
    - - - -
    - (instancetype)initWithHorizontalPosition:(ASRelativeLayoutSpecPosition)horizontalPosition verticalPosition:(ASRelativeLayoutSpecPosition)verticalPosition sizingOption:(ASRelativeLayoutSpecSizingOption)sizingOption child:(id<ASLayoutElement>)child
    - - - -
    -

    Parameters

    - - - - - - - - - - - - - - - - - - - - - - -
    horizontalPosition

    how to position the item on the horizontal (x) axis

    verticalPosition

    how to position the item on the vertical (y) axis

    sizingOption

    how much size to take up

    child

    the child to layout

    -
    - - - -
    -

    Return Value

    -

    a configured ASRelativeLayoutSpec

    -
    - - - - - -
    -

    Discussion

    -

    convenience initializer for a ASRelativeLayoutSpec

    -
    - - - - - - - -
    -

    Declared In

    -

    ASRelativeLayoutSpec.h

    -
    - - -
    -
    -
    -
    - -
    - - - - - - -
    - -
    - -
    -
    -
    -
    - - - - \ No newline at end of file diff --git a/submodules/AsyncDisplayKit/docs/appledoc/Classes/ASScrollNode.html b/submodules/AsyncDisplayKit/docs/appledoc/Classes/ASScrollNode.html deleted file mode 100755 index 83843991b4..0000000000 --- a/submodules/AsyncDisplayKit/docs/appledoc/Classes/ASScrollNode.html +++ /dev/null @@ -1,183 +0,0 @@ - - - - - - ASScrollNode Class Reference - - - - - - -
    -
    - -

    - -

    - -

    - AsyncDisplayKit -

    - -
    -
    - - - -
    -
    -
    -
    -

    ASScrollNode Class Reference

    - - -
    - - - - - - - -
    Inherits fromASDisplayNode : ASDealloc2MainObject
    Declared inASScrollNode.h
    - - - - -
    - -

    Overview

    -

    Simple node that wraps UIScrollView.

    -
    - - - - - -
    - - - - - - -
    -
    - -

      view -

    - -
    -
    - -
    - - -
    -

    The node’s UIScrollView.

    -
    - - - -
    @property (nonatomic, readonly, strong) UIScrollView *view
    - - - - - - - - - - - - - - - -
    -

    Declared In

    -

    ASScrollNode.h

    -
    - - -
    -
    -
    -
    - -
    - - - - - - -
    - -
    - -
    -
    -
    -
    - - - - \ No newline at end of file diff --git a/submodules/AsyncDisplayKit/docs/appledoc/Classes/ASStackLayoutSpec.html b/submodules/AsyncDisplayKit/docs/appledoc/Classes/ASStackLayoutSpec.html deleted file mode 100755 index 80de7f100c..0000000000 --- a/submodules/AsyncDisplayKit/docs/appledoc/Classes/ASStackLayoutSpec.html +++ /dev/null @@ -1,649 +0,0 @@ - - - - - - ASStackLayoutSpec Class Reference - - - - - - -
    -
    - -

    - -

    - -

    - AsyncDisplayKit -

    - -
    -
    - - - -
    -
    -
    -
    -

    ASStackLayoutSpec Class Reference

    - - -
    - - - - - - - -
    Inherits fromASLayoutSpec : NSObject
    Declared inASStackLayoutSpec.h
    - - - - -
    - -

    Overview

    -

    A simple layout spec that stacks a list of children vertically or horizontally.

    - -
      -
    • All children are initially laid out with the an infinite available size in the stacking direction.
    • -
    • In the other direction, this spec’s constraint is passed.
    • -
    • The children’s sizes are summed in the stacking direction. - -
        -
      • If this sum is less than this spec’s minimum size in stacking direction, children with flexGrow are flexed.
      • -
      • If it is greater than this spec’s maximum size in the stacking direction, children with flexShrink are flexed.
      • -
      • If, even after flexing, the sum is still greater than this spec’s maximum size in the stacking direction, -justifyContent determines how children are laid out.
      • -
      -
    • -
    - - -

    For example:

    - -
      -
    • Suppose stacking direction is Vertical, min-width=100, max-width=300, min-height=200, max-height=500.
    • -
    • All children are laid out with min-width=100, max-width=300, min-height=0, max-height=INFINITY.
    • -
    • If the sum of the childrens' heights is less than 200, children with flexGrow are flexed larger.
    • -
    • If the sum of the childrens' heights is greater than 500, children with flexShrink are flexed smaller. - Each child is shrunk by ((sum of heights) - 500)/(number of flexShrink-able children).
    • -
    • If the sum of the childrens' heights is greater than 500 even after flexShrink-able children are flexed, - justifyContent determines how children are laid out.
    • -
    - -
    - - - - - -
    - - - - - - -
    -
    - -

      direction -

    - -
    -
    - -
    - - -
    -

    Specifies the direction children are stacked in. If horizontalAlignment and verticalAlignment were set, -they will be resolved again, causing justifyContent and alignItems to be updated accordingly

    -
    - - - -
    @property (nonatomic, assign) ASStackLayoutDirection direction
    - - - - - - - - - - - - - - - -
    -

    Declared In

    -

    ASStackLayoutSpec.h

    -
    - - -
    -
    -
    - -

      spacing -

    - -
    -
    - -
    - - -
    -

    The amount of space between each child.

    -
    - - - -
    @property (nonatomic, assign) CGFloat spacing
    - - - - - - - - - - - - - - - -
    -

    Declared In

    -

    ASStackLayoutSpec.h

    -
    - - -
    -
    -
    - -

      horizontalAlignment -

    - -
    -
    - -
    - - -
    -

    Specifies how children are aligned horizontally. Depends on the stack direction, setting the alignment causes either -justifyContent or alignItems to be updated. The alignment will remain valid after future direction changes. -Thus, it is preferred to those properties

    -
    - - - -
    @property (nonatomic, assign) ASHorizontalAlignment horizontalAlignment
    - - - - - - - - - - - - - - - -
    -

    Declared In

    -

    ASStackLayoutSpec.h

    -
    - - -
    -
    -
    - -

      verticalAlignment -

    - -
    -
    - -
    - - -
    -

    Specifies how children are aligned vertically. Depends on the stack direction, setting the alignment causes either -justifyContent or alignItems to be updated. The alignment will remain valid after future direction changes. -Thus, it is preferred to those properties

    -
    - - - -
    @property (nonatomic, assign) ASVerticalAlignment verticalAlignment
    - - - - - - - - - - - - - - - -
    -

    Declared In

    -

    ASStackLayoutSpec.h

    -
    - - -
    -
    -
    - -

      justifyContent -

    - -
    -
    - -
    - - -
    -

    The amount of space between each child.

    -
    - - - -
    @property (nonatomic, assign) ASStackLayoutJustifyContent justifyContent
    - - - - - - - - - - - - - - - -
    -

    Declared In

    -

    ASStackLayoutSpec.h

    -
    - - -
    -
    -
    - -

      alignItems -

    - -
    -
    - -
    - - -
    -

    Orientation of children along cross axis

    -
    - - - -
    @property (nonatomic, assign) ASStackLayoutAlignItems alignItems
    - - - - - - - - - - - - - - - -
    -

    Declared In

    -

    ASStackLayoutSpec.h

    -
    - - -
    -
    -
    - -

      baselineRelativeArrangement -

    - -
    -
    - -
    - - -
    -

    If YES the vertical spacing between two views is measured from the last baseline of the top view to the top of the bottom view

    -
    - - - -
    @property (nonatomic, assign) BOOL baselineRelativeArrangement
    - - - - - - - - - - - - - - - -
    -

    Declared In

    -

    ASStackLayoutSpec.h

    -
    - - -
    -
    -
    - -

    + stackLayoutSpecWithDirection:spacing:justifyContent:alignItems:children: -

    - -
    -
    - -
    - - -
    -

    The direction of the stack view (horizontal or vertical)

    -
    - - - -
    + (instancetype)stackLayoutSpecWithDirection:(ASStackLayoutDirection)direction spacing:(CGFloat)spacing justifyContent:(ASStackLayoutJustifyContent)justifyContent alignItems:(ASStackLayoutAlignItems)alignItems children:(NSArray<id<ASLayoutElement> > *)children
    - - - -
    -

    Parameters

    - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    direction

    The direction of the stack view (horizontal or vertical)

    spacing

    The spacing between the children

    justifyContent

    If no children are flexible, this describes how to fill any extra space

    alignItems

    Orientation of the children along the cross axis

    children

    ASLayoutElement children to be positioned.

    -
    - - - - - - - - - - - - - -
    -

    Declared In

    -

    ASStackLayoutSpec.h

    -
    - - -
    -
    -
    - -

    + verticalStackLayoutSpec -

    - -
    -
    - -
    - - -
    -

    A stack layout spec with direction of ASStackLayoutDirectionVertical

    -
    - - - -
    + (instancetype)verticalStackLayoutSpec
    - - - - - -
    -

    Return Value

    -

    A stack layout spec with direction of ASStackLayoutDirectionVertical

    -
    - - - - - - - - - - - -
    -

    Declared In

    -

    ASStackLayoutSpec.h

    -
    - - -
    -
    -
    - -

    + horizontalStackLayoutSpec -

    - -
    -
    - -
    - - -
    -

    A stack layout spec with direction of ASStackLayoutDirectionHorizontal

    -
    - - - -
    + (instancetype)horizontalStackLayoutSpec
    - - - - - -
    -

    Return Value

    -

    A stack layout spec with direction of ASStackLayoutDirectionHorizontal

    -
    - - - - - - - - - - - -
    -

    Declared In

    -

    ASStackLayoutSpec.h

    -
    - - -
    -
    -
    -
    - -
    - - - - - - -
    - -
    - -
    -
    -
    -
    - - - - \ No newline at end of file diff --git a/submodules/AsyncDisplayKit/docs/appledoc/Classes/ASTabBarController.html b/submodules/AsyncDisplayKit/docs/appledoc/Classes/ASTabBarController.html deleted file mode 100755 index 851476ab61..0000000000 --- a/submodules/AsyncDisplayKit/docs/appledoc/Classes/ASTabBarController.html +++ /dev/null @@ -1,125 +0,0 @@ - - - - - - ASTabBarController Class Reference - - - - - - -
    -
    - -

    - -

    - -

    - AsyncDisplayKit -

    - -
    -
    - - - -
    -
    -
    -
    -

    ASTabBarController Class Reference

    - - -
    - - - - - - - - - - -
    Inherits fromUITabBarController
    Conforms toASManagesChildVisibilityDepth
    Declared inASTabBarController.h
    - - - - -
    - -

    Overview

    -

    ASTabBarController

    ASTabBarController is a drop in replacement for UITabBarController -which implements the memory efficiency improving @c ASManagesChildVisibilityDepth protocol.

    -
    - - - - - - - - - - -
    - -
    - -
    -
    -
    -
    - - - - \ No newline at end of file diff --git a/submodules/AsyncDisplayKit/docs/appledoc/Classes/ASTableNode.html b/submodules/AsyncDisplayKit/docs/appledoc/Classes/ASTableNode.html deleted file mode 100755 index aa37fc25a1..0000000000 --- a/submodules/AsyncDisplayKit/docs/appledoc/Classes/ASTableNode.html +++ /dev/null @@ -1,2128 +0,0 @@ - - - - - - ASTableNode Class Reference - - - - - - -
    -
    - -

    - -

    - -

    - AsyncDisplayKit -

    - -
    -
    - - - -
    -
    -
    -
    -

    ASTableNode Class Reference

    - - -
    - - - - - - - - - - -
    Inherits fromASDisplayNode : ASDealloc2MainObject
    Conforms toASRangeControllerUpdateRangeProtocol
    Declared inASTableNode.h
    - - - - -
    - -

    Overview

    -

    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.

    -
    - - - - - -
    - - - - - - -
    -
    - -

    – init -

    - -
    -
    - -
    - - -
    -

    Designated initializer.

    -
    - - - -
    - (instancetype)init
    - - - - - -
    -

    Return Value

    -

    An ASDisplayNode instance whose view will be a subclass that enables asynchronous rendering, and passes -through -layout and touch handling methods.

    -
    - - - - - - - - - - - -
    -

    Declared In

    -

    ASDisplayNode.h

    -
    - - -
    -
    -
    - -

      view -

    - -
    -
    - -
    - - -
    -

    Returns a view.

    -
    - - - -
    @property (strong, nonatomic, readonly) ASTableView *view
    - - - - - - - - - -
    -

    Discussion

    -

    The view property is lazily initialized, similar to UIViewController. -To go the other direction, use ASViewToDisplayNode() in ASDisplayNodeExtras.h.

    Warning: The first access to it must be on the main thread, and should only be used on the main thread thereafter as -well.

    -
    - - - - - - - -
    -

    Declared In

    -

    ASDisplayNode.h

    -
    - - -
    -
    -
    - -

    – tuningParametersForRangeType: -

    - -
    -
    - -
    - - -
    -

    Tuning parameters for a range type in full mode.

    -
    - - - -
    - (ASRangeTuningParameters)tuningParametersForRangeType:(ASLayoutRangeType)rangeType
    - - - -
    -

    Parameters

    - - - - - - - -
    rangeType

    The range type to get the tuning parameters for.

    -
    - - - -
    -

    Return Value

    -

    A tuning parameter value for the given range type in full mode.

    -
    - - - - - - - - - - - -
    -

    Declared In

    -

    ASTableNode.h

    -
    - - -
    -
    -
    - -

    – setTuningParameters:forRangeType: -

    - -
    -
    - -
    - - -
    -

    Set the tuning parameters for a range type in full mode.

    -
    - - - -
    - (void)setTuningParameters:(ASRangeTuningParameters)tuningParameters forRangeType:(ASLayoutRangeType)rangeType
    - - - -
    -

    Parameters

    - - - - - - - - - - - - -
    tuningParameters

    The tuning parameters to store for a range type.

    rangeType

    The range type to set the tuning parameters for.

    -
    - - - - - - - - - - - - - -
    -

    Declared In

    -

    ASTableNode.h

    -
    - - -
    -
    -
    - -

    – tuningParametersForRangeMode:rangeType: -

    - -
    -
    - -
    - - -
    -

    Tuning parameters for a range type in the specified mode.

    -
    - - - -
    - (ASRangeTuningParameters)tuningParametersForRangeMode:(ASLayoutRangeMode)rangeMode rangeType:(ASLayoutRangeType)rangeType
    - - - -
    -

    Parameters

    - - - - - - - - - - - - -
    rangeMode

    The range mode to get the running parameters for.

    rangeType

    The range type to get the tuning parameters for.

    -
    - - - -
    -

    Return Value

    -

    A tuning parameter value for the given range type in the given mode.

    -
    - - - - - - - - - - - -
    -

    Declared In

    -

    ASTableNode.h

    -
    - - -
    -
    -
    - -

    – setTuningParameters:forRangeMode:rangeType: -

    - -
    -
    - -
    - - -
    -

    Set the tuning parameters for a range type in the specified mode.

    -
    - - - -
    - (void)setTuningParameters:(ASRangeTuningParameters)tuningParameters forRangeMode:(ASLayoutRangeMode)rangeMode rangeType:(ASLayoutRangeType)rangeType
    - - - -
    -

    Parameters

    - - - - - - - - - - - - - - - - - -
    tuningParameters

    The tuning parameters to store for a range type.

    rangeMode

    The range mode to set the running parameters for.

    rangeType

    The range type to set the tuning parameters for.

    -
    - - - - - - - - - - - - - -
    -

    Declared In

    -

    ASTableNode.h

    -
    - - -
    -
    -
    - -

    – scrollToRowAtIndexPath:atScrollPosition:animated: -

    - -
    -
    - -
    - - -
    -

    Scrolls the table to the given row.

    -
    - - - -
    - (void)scrollToRowAtIndexPath:(NSIndexPath *)indexPath atScrollPosition:(UITableViewScrollPosition)scrollPosition animated:(BOOL)animated
    - - - -
    -

    Parameters

    - - - - - - - - - - - - - - - - - -
    indexPath

    The index path of the row.

    scrollPosition

    Where the row should end up after the scroll.

    animated

    Whether the scroll should be animated or not.

    - -

    This method must be called on the main thread.

    -
    - - - - - - - - - - - - - -
    -

    Declared In

    -

    ASTableNode.h

    -
    - - -
    -
    -
    - -

    – reloadDataWithCompletion: -

    - -
    -
    - -
    - - -
    -

    Reload everything from scratch, destroying the working range and all cached nodes.

    -
    - - - -
    - (void)reloadDataWithCompletion:(nullable void ( ^ ) ( ))completion
    - - - -
    -

    Parameters

    - - - - - - - -
    completion

    block to run on completion of asynchronous loading or nil. If supplied, the block is run on -the main thread.

    -
    - - - - - - - -
    -

    Discussion

    -

    Warning: This method is substantially more expensive than UITableView’s version.

    -
    - - - - - - - -
    -

    Declared In

    -

    ASTableNode.h

    -
    - - -
    -
    -
    - -

    – reloadData -

    - -
    -
    - -
    - - -
    -

    Reload everything from scratch, destroying the working range and all cached nodes.

    -
    - - - -
    - (void)reloadData
    - - - - - - - - - -
    -

    Discussion

    -

    Warning: This method is substantially more expensive than UITableView’s version.

    -
    - - - - - - - -
    -

    Declared In

    -

    ASTableNode.h

    -
    - - -
    -
    -
    - -

    – relayoutItems -

    - -
    -
    - -
    - - -
    -

    Triggers a relayout of all nodes.

    -
    - - - -
    - (void)relayoutItems
    - - - - - - - - - -
    -

    Discussion

    -

    This method invalidates and lays out every cell node in the table view.

    -
    - - - - - - - -
    -

    Declared In

    -

    ASTableNode.h

    -
    - - -
    -
    -
    - -

    – performBatchAnimated:updates:completion: -

    - -
    -
    - -
    - - -
    -

    Perform a batch of updates asynchronously, optionally disabling all animations in the batch. This method must be called from the main thread. -The data source must be updated to reflect the changes before the update block completes.

    -
    - - - -
    - (void)performBatchAnimated:(BOOL)animated updates:(nullable __attribute ( ( noescape ) ) void ( ^ ) ( ))updates completion:(nullable void ( ^ ) ( BOOL finished ))completion
    - - - -
    -

    Parameters

    - - - - - - - - - - - - - - - - - -
    animated

    NO to disable animations for this batch

    updates

    The block that performs the relevant insert, delete, reload, or move operations.

    completion

    A completion handler block to execute when all of the operations are finished. This block takes a single -Boolean parameter that contains the value YES if all of the related animations completed successfully or -NO if they were interrupted. This parameter may be nil. If supplied, the block is run on the main thread.

    -
    - - - - - - - - - - - - - -
    -

    Declared In

    -

    ASTableNode.h

    -
    - - -
    -
    -
    - -

    – performBatchUpdates:completion: -

    - -
    -
    - -
    - - -
    -

    Perform a batch of updates asynchronously, optionally disabling all animations in the batch. This method must be called from the main thread. -The data source must be updated to reflect the changes before the update block completes.

    -
    - - - -
    - (void)performBatchUpdates:(nullable __attribute ( ( noescape ) ) void ( ^ ) ( ))updates completion:(nullable void ( ^ ) ( BOOL finished ))completion
    - - - -
    -

    Parameters

    - - - - - - - - - - - - -
    updates

    The block that performs the relevant insert, delete, reload, or move operations.

    completion

    A completion handler block to execute when all of the operations are finished. This block takes a single -Boolean parameter that contains the value YES if all of the related animations completed successfully or -NO if they were interrupted. This parameter may be nil. If supplied, the block is run on the main thread.

    -
    - - - - - - - - - - - - - -
    -

    Declared In

    -

    ASTableNode.h

    -
    - - -
    -
    -
    - -

    – waitUntilAllUpdatesAreCommitted -

    - -
    -
    - -
    - - -
    -

    Blocks execution of the main thread until all section and row updates are committed. This method must be called from the main thread.

    -
    - - - -
    - (void)waitUntilAllUpdatesAreCommitted
    - - - - - - - - - - - - - - - -
    -

    Declared In

    -

    ASTableNode.h

    -
    - - -
    -
    -
    - -

    – insertSections:withRowAnimation: -

    - -
    -
    - -
    - - -
    -

    Inserts one or more sections, with an option to animate the insertion.

    -
    - - - -
    - (void)insertSections:(NSIndexSet *)sections withRowAnimation:(UITableViewRowAnimation)animation
    - - - -
    -

    Parameters

    - - - - - - - - - - - - -
    sections

    An index set that specifies the sections to insert.

    animation

    A constant that indicates how the insertion is to be animated. See UITableViewRowAnimation.

    -
    - - - - - - - -
    -

    Discussion

    -

    This method must be called from the main thread. The asyncDataSource must be updated to reflect the changes -before this method is called.

    -
    - - - - - - - -
    -

    Declared In

    -

    ASTableNode.h

    -
    - - -
    -
    -
    - -

    – deleteSections:withRowAnimation: -

    - -
    -
    - -
    - - -
    -

    Deletes one or more sections, with an option to animate the deletion.

    -
    - - - -
    - (void)deleteSections:(NSIndexSet *)sections withRowAnimation:(UITableViewRowAnimation)animation
    - - - -
    -

    Parameters

    - - - - - - - - - - - - -
    sections

    An index set that specifies the sections to delete.

    animation

    A constant that indicates how the deletion is to be animated. See UITableViewRowAnimation.

    -
    - - - - - - - -
    -

    Discussion

    -

    This method must be called from the main thread. The asyncDataSource must be updated to reflect the changes -before this method is called.

    -
    - - - - - - - -
    -

    Declared In

    -

    ASTableNode.h

    -
    - - -
    -
    -
    - -

    – reloadSections:withRowAnimation: -

    - -
    -
    - -
    - - -
    -

    Reloads the specified sections using a given animation effect.

    -
    - - - -
    - (void)reloadSections:(NSIndexSet *)sections withRowAnimation:(UITableViewRowAnimation)animation
    - - - -
    -

    Parameters

    - - - - - - - - - - - - -
    sections

    An index set that specifies the sections to reload.

    animation

    A constant that indicates how the reloading is to be animated. See UITableViewRowAnimation.

    -
    - - - - - - - -
    -

    Discussion

    -

    This method must be called from the main thread. The asyncDataSource must be updated to reflect the changes -before this method is called.

    -
    - - - - - - - -
    -

    Declared In

    -

    ASTableNode.h

    -
    - - -
    -
    -
    - -

    – moveSection:toSection: -

    - -
    -
    - -
    - - -
    -

    Moves a section to a new location.

    -
    - - - -
    - (void)moveSection:(NSInteger)section toSection:(NSInteger)newSection
    - - - -
    -

    Parameters

    - - - - - - - - - - - - -
    section

    The index of the section to move.

    newSection

    The index that is the destination of the move for the section.

    -
    - - - - - - - -
    -

    Discussion

    -

    This method must be called from the main thread. The asyncDataSource must be updated to reflect the changes -before this method is called.

    -
    - - - - - - - -
    -

    Declared In

    -

    ASTableNode.h

    -
    - - -
    -
    -
    - -

    – insertRowsAtIndexPaths:withRowAnimation: -

    - -
    -
    - -
    - - -
    -

    Inserts rows at the locations identified by an array of index paths, with an option to animate the insertion.

    -
    - - - -
    - (void)insertRowsAtIndexPaths:(NSArray<NSIndexPath*> *)indexPaths withRowAnimation:(UITableViewRowAnimation)animation
    - - - -
    -

    Parameters

    - - - - - - - - - - - - -
    indexPaths

    An array of NSIndexPath objects, each representing a row index and section index that together identify a row.

    animation

    A constant that indicates how the insertion is to be animated. See UITableViewRowAnimation.

    -
    - - - - - - - -
    -

    Discussion

    -

    This method must be called from the main thread. The asyncDataSource must be updated to reflect the changes -before this method is called.

    -
    - - - - - - - -
    -

    Declared In

    -

    ASTableNode.h

    -
    - - -
    -
    -
    - -

    – deleteRowsAtIndexPaths:withRowAnimation: -

    - -
    -
    - -
    - - -
    -

    Deletes the rows specified by an array of index paths, with an option to animate the deletion.

    -
    - - - -
    - (void)deleteRowsAtIndexPaths:(NSArray<NSIndexPath*> *)indexPaths withRowAnimation:(UITableViewRowAnimation)animation
    - - - -
    -

    Parameters

    - - - - - - - - - - - - -
    indexPaths

    An array of NSIndexPath objects identifying the rows to delete.

    animation

    A constant that indicates how the deletion is to be animated. See UITableViewRowAnimation.

    -
    - - - - - - - -
    -

    Discussion

    -

    This method must be called from the main thread. The asyncDataSource must be updated to reflect the changes -before this method is called.

    -
    - - - - - - - -
    -

    Declared In

    -

    ASTableNode.h

    -
    - - -
    -
    -
    - -

    – reloadRowsAtIndexPaths:withRowAnimation: -

    - -
    -
    - -
    - - -
    -

    Reloads the specified rows using a given animation effect.

    -
    - - - -
    - (void)reloadRowsAtIndexPaths:(NSArray<NSIndexPath*> *)indexPaths withRowAnimation:(UITableViewRowAnimation)animation
    - - - -
    -

    Parameters

    - - - - - - - - - - - - -
    indexPaths

    An array of NSIndexPath objects identifying the rows to reload.

    animation

    A constant that indicates how the reloading is to be animated. See UITableViewRowAnimation.

    -
    - - - - - - - -
    -

    Discussion

    -

    This method must be called from the main thread. The asyncDataSource must be updated to reflect the changes -before this method is called.

    -
    - - - - - - - -
    -

    Declared In

    -

    ASTableNode.h

    -
    - - -
    -
    -
    - -

    – moveRowAtIndexPath:toIndexPath: -

    - -
    -
    - -
    - - -
    -

    Moves the row at a specified location to a destination location.

    -
    - - - -
    - (void)moveRowAtIndexPath:(NSIndexPath *)indexPath toIndexPath:(NSIndexPath *)newIndexPath
    - - - -
    -

    Parameters

    - - - - - - - - - - - - -
    indexPath

    The index path identifying the row to move.

    newIndexPath

    The index path that is the destination of the move for the row.

    -
    - - - - - - - -
    -

    Discussion

    -

    This method must be called from the main thread. The asyncDataSource must be updated to reflect the changes -before this method is called.

    -
    - - - - - - - -
    -

    Declared In

    -

    ASTableNode.h

    -
    - - -
    -
    -
    - -

    – selectRowAtIndexPath:animated:scrollPosition: -

    - -
    -
    - -
    - - -
    -

    Selects a row in the table view identified by index path, optionally scrolling the row to a location in the table view. -This method does not cause any selection-related delegate methods to be called.

    -
    - - - -
    - (void)selectRowAtIndexPath:(nullable NSIndexPath *)indexPath animated:(BOOL)animated scrollPosition:(UITableViewScrollPosition)scrollPosition
    - - - -
    -

    Parameters

    - - - - - - - - - - - - - - - - - -
    indexPath

    An index path identifying a row in the table view.

    animated

    Specify YES to animate the change in the selection or NO to make the change without animating it.

    scrollPosition

    A constant that identifies a relative position in the table view (top, middle, bottom) for the row when scrolling concludes. See UITableViewScrollPosition for descriptions of valid constants.

    -
    - - - - - - - -
    -

    Discussion

    -

    This method must be called from the main thread.

    -
    - - - - - - - -
    -

    Declared In

    -

    ASTableNode.h

    -
    - - -
    -
    -
    - -

    – numberOfRowsInSection: -

    - -
    -
    - -
    - - -
    -

    Retrieves the number of rows in the given section.

    -
    - - - -
    - (NSInteger)numberOfRowsInSection:(NSInteger)section
    - - - -
    -

    Parameters

    - - - - - - - -
    section

    The section.

    -
    - - - -
    -

    Return Value

    -

    The number of rows.

    -
    - - - - - - - - - - - -
    -

    Declared In

    -

    ASTableNode.h

    -
    - - -
    -
    -
    - -

      numberOfSections -

    - -
    -
    - -
    - - -
    -

    The number of sections in the table node.

    -
    - - - -
    @property (nonatomic, readonly) NSInteger numberOfSections
    - - - - - - - - - - - - - - - -
    -

    Declared In

    -

    ASTableNode.h

    -
    - - -
    -
    -
    - -

      visibleNodes -

    - -
    -
    - -
    - - -
    -

    Similar to -visibleCells.

    -
    - - - -
    @property (nonatomic, readonly) NSArray<__kindofASCellNode*> *visibleNodes
    - - - - - -
    -

    Return Value

    -

    an array containing the nodes being displayed on screen. This must be called on the main thread.

    -
    - - - - - - - - - - - -
    -

    Declared In

    -

    ASTableNode.h

    -
    - - -
    -
    -
    - -

    – nodeForRowAtIndexPath: -

    - -
    -
    - -
    - - -
    -

    Retrieves the node for the row at the given index path.

    -
    - - - -
    - (nullable __kindof ASCellNode *)nodeForRowAtIndexPath:(NSIndexPath *)indexPath
    - - - - - - - - - - - - - - - -
    -

    Declared In

    -

    ASTableNode.h

    -
    - - -
    -
    -
    - -

    – indexPathForNode: -

    - -
    -
    - -
    - - -
    -

    Similar to -indexPathForCell:.

    -
    - - - -
    - (nullable NSIndexPath *)indexPathForNode:(ASCellNode *)cellNode
    - - - -
    -

    Parameters

    - - - - - - - -
    cellNode

    a node for a row.

    -
    - - - -
    -

    Return Value

    -

    The index path to this row, if it exists.

    -
    - - - - - -
    -

    Discussion

    -

    This method will return @c nil for a node that is still being -displayed in the table view, if the data source has deleted the row. -That is, the node is visible but it no longer corresponds -to any item in the data source and will be removed soon.

    -
    - - - - - - - -
    -

    Declared In

    -

    ASTableNode.h

    -
    - - -
    -
    -
    - -

    – rectForRowAtIndexPath: -

    - -
    -
    - -
    - - -
    -

    Similar to -[UITableView rectForRowAtIndexPath:]

    -
    - - - -
    - (CGRect)rectForRowAtIndexPath:(NSIndexPath *)indexPath
    - - - -
    -

    Parameters

    - - - - - - - -
    indexPath

    An index path identifying a row in the table view.

    -
    - - - -
    -

    Return Value

    -

    A rectangle defining the area in which the table view draws the row or CGRectZero if indexPath is invalid.

    -
    - - - - - -
    -

    Discussion

    -

    This method must be called from the main thread.

    -
    - - - - - - - -
    -

    Declared In

    -

    ASTableNode.h

    -
    - - -
    -
    -
    - -

    – cellForRowAtIndexPath: -

    - -
    -
    - -
    - - -
    -

    Similar to -[UITableView cellForRowAtIndexPath:]

    -
    - - - -
    - (nullable __kindof UITableViewCell *)cellForRowAtIndexPath:(NSIndexPath *)indexPath
    - - - -
    -

    Parameters

    - - - - - - - -
    indexPath

    An index path identifying a row in the table view.

    -
    - - - -
    -

    Return Value

    -

    An object representing a cell of the table, or nil if the cell is not visible or indexPath is out of range.

    -
    - - - - - -
    -

    Discussion

    -

    This method must be called from the main thread.

    -
    - - - - - - - -
    -

    Declared In

    -

    ASTableNode.h

    -
    - - -
    -
    -
    - -

      indexPathForSelectedRow -

    - -
    -
    - -
    - - -
    -

    Similar to UITableView.indexPathForSelectedRow

    -
    - - - -
    @property (nonatomic, readonly, nullable) NSIndexPath *indexPathForSelectedRow
    - - - - - -
    -

    Return Value

    -

    The value of this property is an index path identifying the row and section -indexes of the selected row, or nil if the index path is invalid. If there are multiple selections, -this property contains the first index-path object in the array of row selections; -this object has the lowest index values for section and row.

    -
    - - - - - -
    -

    Discussion

    -

    This method must be called from the main thread.

    -
    - - - - - - - -
    -

    Declared In

    -

    ASTableNode.h

    -
    - - -
    -
    -
    - -

    – indexPathForRowAtPoint: -

    - -
    -
    - -
    - - -
    -

    Similar to -[UITableView indexPathForRowAtPoint:]

    -
    - - - -
    - (nullable NSIndexPath *)indexPathForRowAtPoint:(CGPoint)point
    - - - -
    -

    Parameters

    - - - - - - - -
    point

    A point in the local coordinate system of the table view (the table view’€™s bounds).

    -
    - - - -
    -

    Return Value

    -

    An index path representing the row and section associated with point, -or nil if the point is out of the bounds of any row.

    -
    - - - - - -
    -

    Discussion

    -

    This method must be called from the main thread.

    -
    - - - - - - - -
    -

    Declared In

    -

    ASTableNode.h

    -
    - - -
    -
    -
    - -

    – indexPathsForRowsInRect: -

    - -
    -
    - -
    - - -
    -

    Similar to -[UITableView indexPathsForRowsInRect:]

    -
    - - - -
    - (nullable NSArray<NSIndexPath*> *)indexPathsForRowsInRect:(CGRect)rect
    - - - -
    -

    Parameters

    - - - - - - - -
    rect

    A rectangle defining an area of the table view in local coordinates.

    -
    - - - -
    -

    Return Value

    -

    An array of NSIndexPath objects each representing a row and section index identifying a row within rect. -Returns an empty array if there aren’t any rows to return.

    -
    - - - - - -
    -

    Discussion

    -

    This method must be called from the main thread.

    -
    - - - - - - - -
    -

    Declared In

    -

    ASTableNode.h

    -
    - - -
    -
    -
    - -

    – indexPathsForVisibleRows -

    - -
    -
    - -
    - - -
    -

    Similar to -[UITableView indexPathsForVisibleRows]

    -
    - - - -
    - (NSArray<NSIndexPath*> *)indexPathsForVisibleRows
    - - - - - -
    -

    Return Value

    -

    The value of this property is an array of NSIndexPath objects each representing a row index and section index -that together identify a visible row in the table view. If no rows are visible, the value is nil.

    -
    - - - - - -
    -

    Discussion

    -

    This method must be called from the main thread.

    -
    - - - - - - - -
    -

    Declared In

    -

    ASTableNode.h

    -
    - - -
    -
    -
    -
    - -
    - - - - - - -
    - -
    - -
    -
    -
    -
    - - - - \ No newline at end of file diff --git a/submodules/AsyncDisplayKit/docs/appledoc/Classes/ASTableView.html b/submodules/AsyncDisplayKit/docs/appledoc/Classes/ASTableView.html deleted file mode 100755 index d1482c155a..0000000000 --- a/submodules/AsyncDisplayKit/docs/appledoc/Classes/ASTableView.html +++ /dev/null @@ -1,333 +0,0 @@ - - - - - - ASTableView Class Reference - - - - - - -
    -
    - -

    - -

    - -

    - AsyncDisplayKit -

    - -
    -
    - - - -
    -
    -
    -
    -

    ASTableView Class Reference

    - - -
    - - - - - - - -
    Inherits fromUITableView
    Declared inASTableView.h
    - - - - -
    - -

    Overview

    -

    Asynchronous UITableView with Intelligent Preloading capabilities.

    ASTableView is a true subclass of UITableView, meaning it is pointer-compatible with code that -currently uses UITableView

    - -

    The main difference is that asyncDataSource expects -nodeForRowAtIndexPath, an ASCellNode, and -the heightForRowAtIndexPath: method is eliminated (as are the performance problems caused by it). -This is made possible because ASCellNodes can calculate their own size, and preload ahead of time.

    Note: ASTableNode is strongly recommended over ASTableView. This class is provided for adoption convenience.

    -
    - - - - - -
    - - - - - - -
    -
    - -

      tableNode -

    - -
    -
    - -
    - - -
    -

    The corresponding table node, or nil if one does not exist.

    -
    - - - -
    @property (nonatomic, weak, readonly) ASTableNode *tableNode
    - - - - - - - - - - - - - - - -
    -

    Declared In

    -

    ASTableView.h

    -
    - - -
    -
    -
    - -

    – nodeForRowAtIndexPath: -

    - -
    -
    - -
    - - -
    -

    Retrieves the node for the row at the given index path.

    -
    - - - -
    - (nullable ASCellNode *)nodeForRowAtIndexPath:(NSIndexPath *)indexPath
    - - - - - - - - - - - - - - - -
    -

    Declared In

    -

    ASTableView.h

    -
    - - -
    -
    -
    - -

      automaticallyAdjustsContentOffset -

    - -
    -
    - -
    - - -
    -

    YES to automatically adjust the contentOffset when cells are inserted or deleted “before” -visible cells, maintaining the users' visible scroll position. Currently this feature tracks insertions, moves and deletions of -cells, but section edits are ignored.

    -
    - - - -
    @property (nonatomic) BOOL automaticallyAdjustsContentOffset
    - - - - - - - - - -
    -

    Discussion

    -

    default is NO.

    -
    - - - - - - - -
    -

    Declared In

    -

    ASTableView.h

    -
    - - -
    -
    -
    - -

      leadingScreensForBatching -

    - -
    -
    - -
    - - -
    -

    The number of screens left to scroll before the delegate -tableView:beginBatchFetchingWithContext: is called.

    -
    - - - -
    @property (nonatomic, assign) CGFloat leadingScreensForBatching
    - - - - - - - - - -
    -

    Discussion

    -

    Defaults to two screenfuls.

    -
    - - - - - - - -
    -

    Declared In

    -

    ASTableView.h

    -
    - - -
    -
    -
    -
    - -
    - - - - - - -
    - -
    - -
    -
    -
    -
    - - - - \ No newline at end of file diff --git a/submodules/AsyncDisplayKit/docs/appledoc/Classes/ASTextCellNode.html b/submodules/AsyncDisplayKit/docs/appledoc/Classes/ASTextCellNode.html deleted file mode 100755 index da3f0aa37d..0000000000 --- a/submodules/AsyncDisplayKit/docs/appledoc/Classes/ASTextCellNode.html +++ /dev/null @@ -1,316 +0,0 @@ - - - - - - ASTextCellNode Class Reference - - - - - - -
    -
    - -

    - -

    - -

    - AsyncDisplayKit -

    - -
    -
    - - - -
    -
    -
    -
    -

    ASTextCellNode Class Reference

    - - -
    - - - - - - - -
    Inherits fromASCellNode : ASDisplayNode : ASDealloc2MainObject
    Declared inASCellNode.h
    - - - - -
    - -

    Overview

    -

    Simple label-style cell node. Read its source for an example of custom ASCellNodes.

    -
    - - - - - -
    - - - - - - -
    -
    - -

    – initWithAttributes:insets: -

    - -
    -
    - -
    - - -
    -

    Initializes a text cell with given text attributes and text insets

    -
    - - - -
    - (instancetype)initWithAttributes:(NSDictionary *)textAttributes insets:(UIEdgeInsets)textInsets
    - - - - - - - - - - - - - - - -
    -

    Declared In

    -

    ASCellNode.h

    -
    - - -
    -
    -
    - -

      text -

    - -
    -
    - -
    - - -
    -

    Text to display.

    -
    - - - -
    @property (nonatomic, copy) NSString *text
    - - - - - - - - - - - - - - - -
    -

    Declared In

    -

    ASCellNode.h

    -
    - - -
    -
    -
    - -

      textAttributes -

    - -
    -
    - -
    - - -
    -

    A dictionary containing key-value pairs for text attributes. You can specify the font, text color, text shadow color, and text shadow offset using the keys listed in NSString UIKit Additions Reference.

    -
    - - - -
    @property (nonatomic, copy) NSDictionary *textAttributes
    - - - - - - - - - - - - - - - -
    -

    Declared In

    -

    ASCellNode.h

    -
    - - -
    -
    -
    - -

      textInsets -

    - -
    -
    - -
    - - -
    -

    The text inset or outset for each edge. The default value is 15.0 horizontal and 11.0 vertical padding.

    -
    - - - -
    @property (nonatomic, assign) UIEdgeInsets textInsets
    - - - - - - - - - - - - - - - -
    -

    Declared In

    -

    ASCellNode.h

    -
    - - -
    -
    -
    -
    - -
    - - - - - - -
    - -
    - -
    -
    -
    -
    - - - - \ No newline at end of file diff --git a/submodules/AsyncDisplayKit/docs/appledoc/Classes/ASTextNode.html b/submodules/AsyncDisplayKit/docs/appledoc/Classes/ASTextNode.html deleted file mode 100755 index fab6645fc8..0000000000 --- a/submodules/AsyncDisplayKit/docs/appledoc/Classes/ASTextNode.html +++ /dev/null @@ -1,1338 +0,0 @@ - - - - - - ASTextNode Class Reference - - - - - - -
    -
    - -

    - -

    - -

    - AsyncDisplayKit -

    - -
    -
    - - - -
    -
    -
    -
    -

    ASTextNode Class Reference

    - - -
    - - - - - - - -
    Inherits fromASControlNode : ASDisplayNode : ASDealloc2MainObject
    Declared inASTextNode.h
    - - - - -
    - -

    Overview

    -

    Backed by TextKit.

    -
    - - - - - -
    - - - - - - -
    -
    - -

      attributedText -

    - -
    -
    - -
    - - -
    -

    The styled text displayed by the node.

    -
    - - - -
    @property (nullable, nonatomic, copy) NSAttributedString *attributedText
    - - - - - - - - - -
    -

    Discussion

    -

    Defaults to nil, no text is shown. -For inline image attachments, add an attribute of key NSAttachmentAttributeName, with a value of an NSTextAttachment.

    -
    - - - - - - - -
    -

    Declared In

    -

    ASTextNode.h

    -
    - - -
    -
    -
    - -

      truncationAttributedText -

    - -
    -
    - -
    - - -
    -

    The attributedText to use when the text must be truncated.

    -
    - - - -
    @property (nullable, nonatomic, copy) NSAttributedString *truncationAttributedText
    - - - - - - - - - -
    -

    Discussion

    -

    Defaults to a localized ellipsis character.

    -
    - - - - - - - -
    -

    Declared In

    -

    ASTextNode.h

    -
    - - -
    -
    -
    - -

      additionalTruncationMessage -

    - -
    -
    - -
    - - -
    -

    @summary The second attributed string appended for truncation.

    -
    - - - -
    @property (nullable, nonatomic, copy) NSAttributedString *additionalTruncationMessage
    - - - - - - - - - -
    -

    Discussion

    -

    This string will be highlighted on touches. -@default nil

    -
    - - - - - - - -
    -

    Declared In

    -

    ASTextNode.h

    -
    - - -
    -
    -
    - -

      truncationMode -

    - -
    -
    - -
    - - -
    -

    Determines how the text is truncated to fit within the receiver’s maximum size.

    -
    - - - -
    @property (nonatomic, assign) NSLineBreakMode truncationMode
    - - - - - - - - - -
    -

    Discussion

    -

    Defaults to NSLineBreakByWordWrapping.

    Note: Setting a truncationMode in attributedString will override the truncation mode set here.

    -
    - - - - - - - -
    -

    Declared In

    -

    ASTextNode.h

    -
    - - -
    -
    -
    - -

      truncated -

    - -
    -
    - -
    - - -
    -

    If the text node is truncated. Text must have been sized first.

    -
    - - - -
    @property (nonatomic, readonly, assign, getter=isTruncated) BOOL truncated
    - - - - - - - - - - - - - - - -
    -

    Declared In

    -

    ASTextNode.h

    -
    - - -
    -
    -
    - -

      maximumNumberOfLines -

    - -
    -
    - -
    - - -
    -

    The maximum number of lines to render of the text before truncation. -@default 0 (No limit)

    -
    - - - -
    @property (nonatomic, assign) NSUInteger maximumNumberOfLines
    - - - - - - - - - - - - - - - -
    -

    Declared In

    -

    ASTextNode.h

    -
    - - -
    -
    -
    - -

      lineCount -

    - -
    -
    - -
    - - -
    -

    The number of lines in the text. Text must have been sized first.

    -
    - - - -
    @property (nonatomic, readonly, assign) NSUInteger lineCount
    - - - - - - - - - - - - - - - -
    -

    Declared In

    -

    ASTextNode.h

    -
    - - -
    -
    -
    - -

      exclusionPaths -

    - -
    -
    - -
    - - -
    -

    An array of path objects representing the regions where text should not be displayed.

    -
    - - - -
    @property (nullable, nonatomic, strong) NSArray<UIBezierPath*> *exclusionPaths
    - - - - - - - - - -
    -

    Discussion

    -

    The default value of this property is an empty array. You can -assign an array of UIBezierPath objects to exclude text from one or more regions in -the text node’s bounds. You can use this property to have text wrap around images, -shapes or other text like a fancy magazine.

    -
    - - - - - - - -
    -

    Declared In

    -

    ASTextNode.h

    -
    - - -
    -
    -
    - -

      placeholderEnabled -

    - -
    -
    - -
    - - -
    -

    ASTextNode has a special placeholder behavior when placeholderEnabled is YES.

    -
    - - - -
    @property (nonatomic, assign) BOOL placeholderEnabled
    - - - - - - - - - -
    -

    Discussion

    -

    Defaults to NO. When YES, it draws rectangles for each line of text, -following the true shape of the text’s wrapping. This visually mirrors the overall -shape and weight of paragraphs, making the appearance of the finished text less jarring.

    -
    - - - - - - - -
    -

    Declared In

    -

    ASTextNode.h

    -
    - - -
    -
    -
    - -

      placeholderColor -

    - -
    -
    - -
    - - -
    -

    The placeholder color.

    -
    - - - -
    @property (nullable, nonatomic, strong) UIColor *placeholderColor
    - - - - - - - - - - - - - - - -
    -

    Declared In

    -

    ASTextNode.h

    -
    - - -
    -
    -
    - -

      placeholderInsets -

    - -
    -
    - -
    - - -
    -

    Inset each line of the placeholder.

    -
    - - - -
    @property (nonatomic, assign) UIEdgeInsets placeholderInsets
    - - - - - - - - - - - - - - - -
    -

    Declared In

    -

    ASTextNode.h

    -
    - - -
    -
    -
    - -

      shadowPadding -

    - -
    -
    - -
    - - -
    -

    The number of pixels used for shadow padding on each side of the receiver.

    -
    - - - -
    @property (nonatomic, readonly, assign) UIEdgeInsets shadowPadding
    - - - - - - - - - -
    -

    Discussion

    -

    Each inset will be less than or equal to zero, so that applying -UIEdgeInsetsRect(boundingRectForText, shadowPadding) -will return a CGRect large enough to fit both the text and the appropriate shadow padding.

    -
    - - - - - - - -
    -

    Declared In

    -

    ASTextNode.h

    -
    - - -
    -
    -
    - -

    – rectsForTextRange: -

    - -
    -
    - -
    - - -
    -

    Returns an array of rects bounding the characters in a given text range.

    -
    - - - -
    - (NSArray<NSValue*> *)rectsForTextRange:(NSRange)textRange
    - - - -
    -

    Parameters

    - - - - - - - -
    textRange

    A range of text. Must be valid for the receiver’s string.

    -
    - - - - - - - -
    -

    Discussion

    -

    Use this method to detect all the different rectangles a given range of text occupies. -The rects returned are not guaranteed to be contiguous (for example, if the given text range spans -a line break, the rects returned will be on opposite sides and different lines). The rects returned -are in the coordinate system of the receiver.

    -
    - - - - - - - -
    -

    Declared In

    -

    ASTextNode.h

    -
    - - -
    -
    -
    - -

    – highlightRectsForTextRange: -

    - -
    -
    - -
    - - -
    -

    Returns an array of rects used for highlighting the characters in a given text range.

    -
    - - - -
    - (NSArray<NSValue*> *)highlightRectsForTextRange:(NSRange)textRange
    - - - -
    -

    Parameters

    - - - - - - - -
    textRange

    A range of text. Must be valid for the receiver’s string.

    -
    - - - - - - - -
    -

    Discussion

    -

    Use this method to detect all the different rectangles the highlights of a given range of text occupies. -The rects returned are not guaranteed to be contiguous (for example, if the given text range spans -a line break, the rects returned will be on opposite sides and different lines). The rects returned -are in the coordinate system of the receiver. This method is useful for visual coordination with a -highlighted range of text.

    -
    - - - - - - - -
    -

    Declared In

    -

    ASTextNode.h

    -
    - - -
    -
    -
    - -

    – frameForTextRange: -

    - -
    -
    - -
    - - -
    -

    Returns a bounding rect for the given text range.

    -
    - - - -
    - (CGRect)frameForTextRange:(NSRange)textRange
    - - - -
    -

    Parameters

    - - - - - - - -
    textRange

    A range of text. Must be valid for the receiver’s string.

    -
    - - - - - - - -
    -

    Discussion

    -

    The height of the frame returned is that of the receiver’s line-height; adjustment for -cap-height and descenders is not performed. This method raises an exception if textRange is not -a valid substring range of the receiver’s string.

    -
    - - - - - - - -
    -

    Declared In

    -

    ASTextNode.h

    -
    - - -
    -
    -
    - -

    – trailingRect -

    - -
    -
    - -
    - - -
    -

    Returns the trailing rectangle of space in the receiver, after the final character.

    -
    - - - -
    - (CGRect)trailingRect
    - - - - - - - - - -
    -

    Discussion

    -

    Use this method to detect which portion of the receiver is not occupied by characters. -The rect returned is in the coordinate system of the receiver.

    -
    - - - - - - - -
    -

    Declared In

    -

    ASTextNode.h

    -
    - - -
    -
    -
    - -

      linkAttributeNames -

    - -
    -
    - -
    - - -
    -

    The set of attribute names to consider links. Defaults to NSLinkAttributeName.

    -
    - - - -
    @property (nonatomic, copy) NSArray<NSString*> *linkAttributeNames
    - - - - - - - - - - - - - - - -
    -

    Declared In

    -

    ASTextNode.h

    -
    - - -
    -
    -
    - -

    – linkAttributeValueAtPoint:attributeName:range: -

    - -
    -
    - -
    - - -
    -

    Indicates whether the receiver has an entity at a given point.

    -
    - - - -
    - (nullable id)linkAttributeValueAtPoint:(CGPoint)point attributeName:(out NSString *_Nullable *_Nullable)attributeNameOut range:(out NSRange *_Nullable)rangeOut
    - - - -
    -

    Parameters

    - - - - - - - - - - - - - - - - - -
    point

    The point, in the receiver’s coordinate system.

    attributeNameOut

    The name of the attribute at the point. Can be NULL.

    rangeOut

    The ultimate range of the found text. Can be NULL.

    -
    - - - -
    -

    Return Value

    -

    YES if an entity exists at point; NO otherwise.

    -
    - - - - - - - - - - - -
    -

    Declared In

    -

    ASTextNode.h

    -
    - - -
    -
    -
    - -

      highlightStyle -

    - -
    -
    - -
    - - -
    -

    The style to use when highlighting text.

    -
    - - - -
    @property (nonatomic, assign) ASTextNodeHighlightStyle highlightStyle
    - - - - - - - - - - - - - - - -
    -

    Declared In

    -

    ASTextNode.h

    -
    - - -
    -
    -
    - -

      highlightRange -

    - -
    -
    - -
    - - -
    -

    The range of text highlighted by the receiver. Changes to this property are not animated by default.

    -
    - - - -
    @property (nonatomic, assign) NSRange highlightRange
    - - - - - - - - - - - - - - - -
    -

    Declared In

    -

    ASTextNode.h

    -
    - - -
    -
    -
    - -

    – setHighlightRange:animated: -

    - -
    -
    - -
    - - -
    -

    Set the range of text to highlight, with optional animation.

    -
    - - - -
    - (void)setHighlightRange:(NSRange)highlightRange animated:(BOOL)animated
    - - - -
    -

    Parameters

    - - - - - - - - - - - - -
    highlightRange

    The range of text to highlight.

    animated

    Whether the text should be highlighted with an animation.

    -
    - - - - - - - - - - - - - -
    -

    Declared In

    -

    ASTextNode.h

    -
    - - -
    -
    -
    - -

      delegate -

    - -
    -
    - -
    - - -
    -

    Responds to actions from links in the text node.

    -
    - - - -
    @property (nonatomic, weak) id<ASTextNodeDelegate> delegate
    - - - - - - - - - -
    -

    Discussion

    -

    The delegate must be set before the node is loaded, and implement - textNode:longPressedLinkAttribute:value:atPoint:textRange: in order for - the long press gesture recognizer to be installed.

    -
    - - - - - - - -
    -

    Declared In

    -

    ASTextNode.h

    -
    - - -
    -
    -
    - -

      longPressCancelsTouches -

    - -
    -
    - -
    - - -
    -

    If YES and a long press is recognized, touches are cancelled. Default is NO

    -
    - - - -
    @property (nonatomic, assign) BOOL longPressCancelsTouches
    - - - - - - - - - - - - - - - -
    -

    Declared In

    -

    ASTextNode.h

    -
    - - -
    -
    -
    - -

      passthroughNonlinkTouches -

    - -
    -
    - -
    - - -
    -

    if YES will not intercept touches for non-link areas of the text. Default is NO.

    -
    - - - -
    @property (nonatomic, assign) BOOL passthroughNonlinkTouches
    - - - - - - - - - - - - - - - -
    -

    Declared In

    -

    ASTextNode.h

    -
    - - -
    -
    -
    -
    - -
    - - - - - - -
    - -
    - -
    -
    -
    -
    - - - - \ No newline at end of file diff --git a/submodules/AsyncDisplayKit/docs/appledoc/Classes/ASVideoNode.html b/submodules/AsyncDisplayKit/docs/appledoc/Classes/ASVideoNode.html deleted file mode 100755 index f9b2b28315..0000000000 --- a/submodules/AsyncDisplayKit/docs/appledoc/Classes/ASVideoNode.html +++ /dev/null @@ -1,265 +0,0 @@ - - - - - - ASVideoNode Class Reference - - - - - - -
    -
    - -

    - -

    - -

    - AsyncDisplayKit -

    - -
    -
    - - - -
    -
    -
    -
    -

    ASVideoNode Class Reference

    - - -
    - - - - - - - -
    Inherits fromASNetworkImageNode : ASImageNode : ASControlNode : ASDisplayNode : ASDealloc2MainObject
    Declared inASVideoNode.h
    - - - - - - -
    - - - - - - -
    -
    - -

      assetURL -

    - -
    -
    - -
    - - -
    -
      -
    • @abstract The URL with which the asset was initialized.
    • -
    • @discussion Setting the URL will overwrite the current asset with a newly created AVURLAsset created from the given URL, and AVAsset *asset will point to that newly created AVURLAsset. Please don’t set both assetURL and asset.
    • -
    • @return Current URL the asset was initialized or nil if no URL was given.
    • -
    - -
    - - - -
    @property (nullable, nonatomic, strong, readwrite) NSURL *assetURL
    - - - - - - - - - - - - - - - -
    -

    Declared In

    -

    ASVideoNode.h

    -
    - - -
    -
    -
    - -

      shouldAutoplay -

    - -
    -
    - -
    - - -
    -

    When shouldAutoplay is set to true, a video node will play when it has both loaded and entered the “visible” interfaceState. -If it leaves the visible interfaceState it will pause but will resume once it has returned.

    -
    - - - -
    @property (nonatomic, assign, readwrite) BOOL shouldAutoplay
    - - - - - - - - - - - - - - - -
    -

    Declared In

    -

    ASVideoNode.h

    -
    - - -
    -
    -
    - -

      delegate -

    - -
    -
    - -
    - - -
    -

    The delegate, which must conform to the ASNetworkImageNodeDelegate protocol.

    -
    - - - -
    @property (nullable, nonatomic, weak, readwrite) id<ASVideoNodeDelegate,ASNetworkImageNodeDelegate> delegate
    - - - - - - - - - - - - - - - -
    -

    Declared In

    -

    ASNetworkImageNode.h

    -
    - - -
    -
    -
    -
    - -
    - - - - - - -
    - -
    - -
    -
    -
    -
    - - - - \ No newline at end of file diff --git a/submodules/AsyncDisplayKit/docs/appledoc/Classes/ASVideoPlayerNode.html b/submodules/AsyncDisplayKit/docs/appledoc/Classes/ASVideoPlayerNode.html deleted file mode 100755 index 3d6645c850..0000000000 --- a/submodules/AsyncDisplayKit/docs/appledoc/Classes/ASVideoPlayerNode.html +++ /dev/null @@ -1,174 +0,0 @@ - - - - - - ASVideoPlayerNode Class Reference - - - - - - -
    -
    - -

    - -

    - -

    - AsyncDisplayKit -

    - -
    -
    - - - -
    -
    -
    -
    -

    ASVideoPlayerNode Class Reference

    - - -
    - - - - - - - -
    Inherits fromASDisplayNode : ASDealloc2MainObject
    Declared inASVideoPlayerNode.h
    - - - - - - -
    - - - - - - -
    -
    - -

      shouldAutoPlay -

    - -
    -
    - -
    - - -
    -

    When shouldAutoplay is set to true, a video node will play when it has both loaded and entered the “visible” interfaceState. -If it leaves the visible interfaceState it will pause but will resume once it has returned.

    -
    - - - -
    @property (nonatomic, assign, readwrite) BOOL shouldAutoPlay
    - - - - - - - - - - - - - - - -
    -

    Declared In

    -

    ASVideoPlayerNode.h

    -
    - - -
    -
    -
    -
    - -
    - - - - - - -
    - -
    - -
    -
    -
    -
    - - - - \ No newline at end of file diff --git a/submodules/AsyncDisplayKit/docs/appledoc/Classes/ASViewController.html b/submodules/AsyncDisplayKit/docs/appledoc/Classes/ASViewController.html deleted file mode 100755 index d29e08e034..0000000000 --- a/submodules/AsyncDisplayKit/docs/appledoc/Classes/ASViewController.html +++ /dev/null @@ -1,450 +0,0 @@ - - - - - - ASViewController Class Reference - - - - - - -
    -
    - -

    - -

    - -

    - AsyncDisplayKit -

    - -
    -
    - - - -
    -
    -
    -
    -

    ASViewController Class Reference

    - - -
    - - - - - - - -
    Conforms to*
    :
    ASDisplayNode
    DisplayNodeType
    __covariant
    Declared inASViewController.h
    - - - - - - -
    - - - - - - -
    -
    - -

    – initWithNode: -

    - -
    -
    - -
    - - -
    -

    ASViewController Designated initializer.

    -
    - - - -
    - (instancetype)initWithNode:(DisplayNodeType)node
    - - - -
    -

    Parameters

    - - - - - - - -
    node

    An ASDisplayNode which will provide the root view (self.view)

    -
    - - - -
    -

    Return Value

    -

    An ASViewController instance whose root view will be backed by the provided ASDisplayNode.

    -
    - - - - - -
    -

    Discussion

    -

    ASViewController allows you to have a completely node backed heirarchy. It automatically -handles @c ASVisibilityDepth, automatic range mode and propogating @c ASDisplayTraits to contained nodes.

    -
    - - - - - -
    -

    See Also

    - -
    - - - -
    -

    Declared In

    -

    ASViewController.h

    -
    - - -
    -
    -
    - -

      node -

    - -
    -
    - -
    - - -
    -

    node Returns the ASDisplayNode which provides the backing view to the view controller.

    -
    - - - -
    @property (nonatomic, strong, readonly) DisplayNodeType node
    - - - - - -
    -

    Return Value

    -

    node Returns the ASDisplayNode which provides the backing view to the view controller.

    -
    - - - - - - - - - - - -
    -

    Declared In

    -

    ASViewController.h

    -
    - - -
    -
    -
    - -

      overrideDisplayTraitsWithTraitCollection -

    - -
    -
    - -
    - - -
    -

    Set this block to customize the ASDisplayTraits returned when the VC transitions to the given traitCollection.

    -
    - - - -
    @property (nonatomic, copy) ASDisplayTraitsForTraitCollectionBlock overrideDisplayTraitsWithTraitCollection
    - - - - - - - - - - - - - - - -
    -

    Declared In

    -

    ASViewController.h

    -
    - - -
    -
    -
    - -

      overrideDisplayTraitsWithWindowSize -

    - -
    -
    - -
    - - -
    -

    Set this block to customize the ASDisplayTraits returned when the VC transitions to the given window size.

    -
    - - - -
    @property (nonatomic, copy) ASDisplayTraitsForTraitWindowSizeBlock overrideDisplayTraitsWithWindowSize
    - - - - - - - - - - - - - - - -
    -

    Declared In

    -

    ASViewController.h

    -
    - - -
    -
    -
    - -

      interfaceState -

    - -
    -
    - -
    - - -
    -

    Passthrough property to the the .interfaceState of the node.

    -
    - - - -
    @property (nonatomic, readonly) ASInterfaceState interfaceState
    - - - - - -
    -

    Return Value

    -

    The current ASInterfaceState of the node, indicating whether it is visible and other situational properties.

    -
    - - - - - - - - - -
    -

    See Also

    - -
    - - - -
    -

    Declared In

    -

    ASViewController.h

    -
    - - -
    -
    -
    - -

    – nodeConstrainedSize -

    - -
    -
    - -
    - - -
    -

    The constrained size used to measure the backing node.

    -
    - - - -
    - (ASSizeRange)nodeConstrainedSize
    - - - - - - - - - -
    -

    Discussion

    -

    Defaults to providing a size range that uses the view controller view’s bounds as -both the min and max definitions. Override this method to provide a custom size range to the -backing node.

    -
    - - - - - - - -
    -

    Declared In

    -

    ASViewController.h

    -
    - - -
    -
    -
    -
    - -
    - - - - - - -
    - -
    - -
    -
    -
    -
    - - - - \ No newline at end of file diff --git a/submodules/AsyncDisplayKit/docs/appledoc/Classes/ASWrapperLayoutSpec.html b/submodules/AsyncDisplayKit/docs/appledoc/Classes/ASWrapperLayoutSpec.html deleted file mode 100755 index 844114f859..0000000000 --- a/submodules/AsyncDisplayKit/docs/appledoc/Classes/ASWrapperLayoutSpec.html +++ /dev/null @@ -1,123 +0,0 @@ - - - - - - ASWrapperLayoutSpec Class Reference - - - - - - -
    -
    - -

    - -

    - -

    - AsyncDisplayKit -

    - -
    -
    - - - -
    -
    -
    -
    -

    ASWrapperLayoutSpec Class Reference

    - - -
    - - - - - - - -
    Inherits fromASLayoutSpec : NSObject
    Declared inASLayoutSpec.h
    - - - - -
    - -

    Overview

    -

    An ASLayoutSpec subclass that can wrap one or more ASLayoutElement and calculates the layout based on the -sizes of the children. If multiple children are provided the size of the biggest child will be used to for -size of this layout spec.

    -
    - - - - - - - - - - -
    - -
    - -
    -
    -
    -
    - - - - \ No newline at end of file diff --git a/submodules/AsyncDisplayKit/docs/appledoc/Constants/ASAbsoluteLayoutSpecSizing.html b/submodules/AsyncDisplayKit/docs/appledoc/Constants/ASAbsoluteLayoutSpecSizing.html deleted file mode 100755 index ae500f68a5..0000000000 --- a/submodules/AsyncDisplayKit/docs/appledoc/Constants/ASAbsoluteLayoutSpecSizing.html +++ /dev/null @@ -1,175 +0,0 @@ - - - - - - ASAbsoluteLayoutSpecSizing Constants Reference - - - - - - -
    -
    - -

    - -

    - -

    - AsyncDisplayKit -

    - -
    -
    - - - -
    -
    -
    -
    -

    ASAbsoluteLayoutSpecSizing Constants Reference

    - - -
    - - - - -
    Declared inASAbsoluteLayoutSpec.h
    - - - - - - - -

    ASAbsoluteLayoutSpecSizing

    - - -
    -

    How much space the spec will take up.

    -
    - - -
    - - -

    Definition

    - typedef NS_ENUM(NSInteger, ASAbsoluteLayoutSpecSizing ) {
    - -    ASAbsoluteLayoutSpecSizingDefault,
    - -    ASAbsoluteLayoutSpecSizingSizeToFit,
    - - };
    - -
    - -
    -

    Constants

    -
    - -
    ASAbsoluteLayoutSpecSizingDefault
    -
    - - -

    The spec will take up the maximum size possible.

    - - - - - - -

    - Declared In ASAbsoluteLayoutSpec.h. -

    - -
    - -
    ASAbsoluteLayoutSpecSizingSizeToFit
    -
    - - -

    Computes a size for the spec that is the union of all childrens' frames.

    - - - - - - -

    - Declared In ASAbsoluteLayoutSpec.h. -

    - -
    - -
    -
    - - - - - - - - -
    -

    Declared In

    -

    ASAbsoluteLayoutSpec.h

    -
    - - - - - -
    - -
    - -
    -
    -
    -
    - - - - \ No newline at end of file diff --git a/submodules/AsyncDisplayKit/docs/appledoc/Constants/ASButtonNodeImageAlignment.html b/submodules/AsyncDisplayKit/docs/appledoc/Constants/ASButtonNodeImageAlignment.html deleted file mode 100755 index d03b419517..0000000000 --- a/submodules/AsyncDisplayKit/docs/appledoc/Constants/ASButtonNodeImageAlignment.html +++ /dev/null @@ -1,175 +0,0 @@ - - - - - - ASButtonNodeImageAlignment Constants Reference - - - - - - -
    -
    - -

    - -

    - -

    - AsyncDisplayKit -

    - -
    -
    - - - -
    -
    -
    -
    -

    ASButtonNodeImageAlignment Constants Reference

    - - -
    - - - - -
    Declared inASButtonNode.h
    - - - - - - - -

    ASButtonNodeImageAlignment

    - - -
    -

    Image alignment defines where the image will be placed relative to the text.

    -
    - - -
    - - -

    Definition

    - typedef NS_ENUM(NSInteger, ASButtonNodeImageAlignment ) {
    - -    ASButtonNodeImageAlignmentBeginning,
    - -    ASButtonNodeImageAlignmentEnd,
    - - };
    - -
    - -
    -

    Constants

    -
    - -
    ASButtonNodeImageAlignmentBeginning
    -
    - - -

    Places the image before the text.

    - - - - - - -

    - Declared In ASButtonNode.h. -

    - -
    - -
    ASButtonNodeImageAlignmentEnd
    -
    - - -

    Places the image after the text.

    - - - - - - -

    - Declared In ASButtonNode.h. -

    - -
    - -
    -
    - - - - - - - - -
    -

    Declared In

    -

    ASButtonNode.h

    -
    - - - - - -
    - -
    - -
    -
    -
    -
    - - - - \ No newline at end of file diff --git a/submodules/AsyncDisplayKit/docs/appledoc/Constants/ASCellNodeVisibilityEvent.html b/submodules/AsyncDisplayKit/docs/appledoc/Constants/ASCellNodeVisibilityEvent.html deleted file mode 100755 index eefd793fcd..0000000000 --- a/submodules/AsyncDisplayKit/docs/appledoc/Constants/ASCellNodeVisibilityEvent.html +++ /dev/null @@ -1,218 +0,0 @@ - - - - - - ASCellNodeVisibilityEvent Constants Reference - - - - - - -
    -
    - -

    - -

    - -

    - AsyncDisplayKit -

    - -
    -
    - - - -
    -
    -
    -
    -

    ASCellNodeVisibilityEvent Constants Reference

    - - -
    - - - - -
    Declared inASCellNode.h
    - - - - - - - -

    ASCellNodeVisibilityEvent

    - -
    - - -

    Definition

    - typedef NS_ENUM(NSUInteger, ASCellNodeVisibilityEvent ) {
    - -    ASCellNodeVisibilityEventVisible,
    - -    ASCellNodeVisibilityEventVisibleRectChanged,
    - -    ASCellNodeVisibilityEventInvisible,
    - -    ASCellNodeVisibilityEventWillBeginDragging,
    - -    ASCellNodeVisibilityEventDidEndDragging,
    - - };
    - -
    - -
    -

    Constants

    -
    - -
    ASCellNodeVisibilityEventVisible
    -
    - - -

    Indicates a cell has just became visible

    - - - - - - -

    - Declared In ASCellNode.h. -

    - -
    - -
    ASCellNodeVisibilityEventVisibleRectChanged
    -
    - - -

    Its position (determined by scrollView.contentOffset) has changed while at least 1px remains visible. -It is possible that 100% of the cell is visible both before and after and only its position has changed, -or that the position change has resulted in more or less of the cell being visible. -Use CGRectIntersect between cellFrame and scrollView.bounds to get this rectangle

    - - - - - - -

    - Declared In ASCellNode.h. -

    - -
    - -
    ASCellNodeVisibilityEventInvisible
    -
    - - -

    Indicates a cell is no longer visible

    - - - - - - -

    - Declared In ASCellNode.h. -

    - -
    - -
    ASCellNodeVisibilityEventWillBeginDragging
    -
    - - -

    Indicates user has started dragging the visible cell

    - - - - - - -

    - Declared In ASCellNode.h. -

    - -
    - -
    ASCellNodeVisibilityEventDidEndDragging
    -
    - - -

    Indicates user has ended dragging the visible cell

    - - - - - - -

    - Declared In ASCellNode.h. -

    - -
    - -
    -
    - - - - - - -
    - -
    - -
    -
    -
    -
    - - - - \ No newline at end of file diff --git a/submodules/AsyncDisplayKit/docs/appledoc/Constants/ASCenterLayoutSpecCenteringOptions.html b/submodules/AsyncDisplayKit/docs/appledoc/Constants/ASCenterLayoutSpecCenteringOptions.html deleted file mode 100755 index d99b9e76ed..0000000000 --- a/submodules/AsyncDisplayKit/docs/appledoc/Constants/ASCenterLayoutSpecCenteringOptions.html +++ /dev/null @@ -1,213 +0,0 @@ - - - - - - ASCenterLayoutSpecCenteringOptions Constants Reference - - - - - - -
    -
    - -

    - -

    - -

    - AsyncDisplayKit -

    - -
    -
    - - - -
    -
    -
    -
    -

    ASCenterLayoutSpecCenteringOptions Constants Reference

    - - -
    - - - - -
    Declared inASCenterLayoutSpec.h
    - - - - - - - -

    ASCenterLayoutSpecCenteringOptions

    - - -
    -

    How the child is centered within the spec.

    -
    - - -
    - - -

    Definition

    - typedef NS_OPTIONS(NSUInteger, ASCenterLayoutSpecCenteringOptions ) {
    - -    ASCenterLayoutSpecCenteringNone = 0,
    - -    ASCenterLayoutSpecCenteringX = 1 < < 0,
    - -    ASCenterLayoutSpecCenteringY = 1 < < 1,
    - -    ASCenterLayoutSpecCenteringXY = ASCenterLayoutSpecCenteringX | ASCenterLayoutSpecCenteringY,
    - - };
    - -
    - -
    -

    Constants

    -
    - -
    ASCenterLayoutSpecCenteringNone
    -
    - - -

    The child is positioned in {0,0} relatively to the layout bounds

    - - - - - - -

    - Declared In ASCenterLayoutSpec.h. -

    - -
    - -
    ASCenterLayoutSpecCenteringX
    -
    - - -

    The child is centered along the X axis

    - - - - - - -

    - Declared In ASCenterLayoutSpec.h. -

    - -
    - -
    ASCenterLayoutSpecCenteringY
    -
    - - -

    The child is centered along the Y axis

    - - - - - - -

    - Declared In ASCenterLayoutSpec.h. -

    - -
    - -
    ASCenterLayoutSpecCenteringXY
    -
    - - -

    Convenience option to center both along the X and Y axis

    - - - - - - -

    - Declared In ASCenterLayoutSpec.h. -

    - -
    - -
    -
    - - - - - - - - -
    -

    Declared In

    -

    ASCenterLayoutSpec.h

    -
    - - - - - -
    - -
    - -
    -
    -
    -
    - - - - \ No newline at end of file diff --git a/submodules/AsyncDisplayKit/docs/appledoc/Constants/ASCenterLayoutSpecSizingOptions.html b/submodules/AsyncDisplayKit/docs/appledoc/Constants/ASCenterLayoutSpecSizingOptions.html deleted file mode 100755 index f7dea9c8bc..0000000000 --- a/submodules/AsyncDisplayKit/docs/appledoc/Constants/ASCenterLayoutSpecSizingOptions.html +++ /dev/null @@ -1,213 +0,0 @@ - - - - - - ASCenterLayoutSpecSizingOptions Constants Reference - - - - - - -
    -
    - -

    - -

    - -

    - AsyncDisplayKit -

    - -
    -
    - - - -
    -
    -
    -
    -

    ASCenterLayoutSpecSizingOptions Constants Reference

    - - -
    - - - - -
    Declared inASCenterLayoutSpec.h
    - - - - - - - -

    ASCenterLayoutSpecSizingOptions

    - - -
    -

    How much space the spec will take up.

    -
    - - -
    - - -

    Definition

    - typedef NS_OPTIONS(NSUInteger, ASCenterLayoutSpecSizingOptions ) {
    - -    ASCenterLayoutSpecSizingOptionDefault = ASRelativeLayoutSpecSizingOptionDefault,
    - -    ASCenterLayoutSpecSizingOptionMinimumX = ASRelativeLayoutSpecSizingOptionMinimumWidth,
    - -    ASCenterLayoutSpecSizingOptionMinimumY = ASRelativeLayoutSpecSizingOptionMinimumHeight,
    - -    ASCenterLayoutSpecSizingOptionMinimumXY = ASRelativeLayoutSpecSizingOptionMinimumSize,
    - - };
    - -
    - -
    -

    Constants

    -
    - -
    ASCenterLayoutSpecSizingOptionDefault
    -
    - - -

    The spec will take up the maximum size possible

    - - - - - - -

    - Declared In ASCenterLayoutSpec.h. -

    - -
    - -
    ASCenterLayoutSpecSizingOptionMinimumX
    -
    - - -

    The spec will take up the minimum size possible along the X axis

    - - - - - - -

    - Declared In ASCenterLayoutSpec.h. -

    - -
    - -
    ASCenterLayoutSpecSizingOptionMinimumY
    -
    - - -

    The spec will take up the minimum size possible along the Y axis

    - - - - - - -

    - Declared In ASCenterLayoutSpec.h. -

    - -
    - -
    ASCenterLayoutSpecSizingOptionMinimumXY
    -
    - - -

    Convenience option to take up the minimum size along both the X and Y axis

    - - - - - - -

    - Declared In ASCenterLayoutSpec.h. -

    - -
    - -
    -
    - - - - - - - - -
    -

    Declared In

    -

    ASCenterLayoutSpec.h

    -
    - - - - - -
    - -
    - -
    -
    -
    -
    - - - - \ No newline at end of file diff --git a/submodules/AsyncDisplayKit/docs/appledoc/Constants/ASControlNodeEvent.html b/submodules/AsyncDisplayKit/docs/appledoc/Constants/ASControlNodeEvent.html deleted file mode 100755 index fba63ceab7..0000000000 --- a/submodules/AsyncDisplayKit/docs/appledoc/Constants/ASControlNodeEvent.html +++ /dev/null @@ -1,308 +0,0 @@ - - - - - - ASControlNodeEvent Constants Reference - - - - - - -
    -
    - -

    - -

    - -

    - AsyncDisplayKit -

    - -
    -
    - - - -
    -
    -
    -
    -

    ASControlNodeEvent Constants Reference

    - - -
    - - - - -
    Declared inASControlNode.h
    - - - - - - - -

    ASControlNodeEvent

    - - -
    -

    These events are identical to their UIControl counterparts.

    -
    - - -
    - - -

    Definition

    - typedef NS_OPTIONS(NSUInteger, ASControlNodeEvent ) {
    - -    ASControlNodeEventTouchDown = 1 < < 0,
    - -    ASControlNodeEventTouchDownRepeat = 1 < < 1,
    - -    ASControlNodeEventTouchDragInside = 1 < < 2,
    - -    ASControlNodeEventTouchDragOutside = 1 < < 3,
    - -    ASControlNodeEventTouchUpInside = 1 < < 4,
    - -    ASControlNodeEventTouchUpOutside = 1 < < 5,
    - -    ASControlNodeEventTouchCancel = 1 < < 6,
    - -    ASControlNodeEventPrimaryActionTriggered = 1 < < 13,
    - -    ASControlNodeEventAllEvents = 0 xFFFFFFFF,
    - - };
    - -
    - -
    -

    Constants

    -
    - -
    ASControlNodeEventTouchDown
    -
    - - -

    A touch-down event in the control node.

    - - - - - - -

    - Declared In ASControlNode.h. -

    - -
    - -
    ASControlNodeEventTouchDownRepeat
    -
    - - -

    A repeated touch-down event in the control node; for this event the value of the UITouch tapCount method is greater than one.

    - - - - - - -

    - Declared In ASControlNode.h. -

    - -
    - -
    ASControlNodeEventTouchDragInside
    -
    - - -

    An event where a finger is dragged inside the bounds of the control node.

    - - - - - - -

    - Declared In ASControlNode.h. -

    - -
    - -
    ASControlNodeEventTouchDragOutside
    -
    - - -

    An event where a finger is dragged just outside the bounds of the control.

    - - - - - - -

    - Declared In ASControlNode.h. -

    - -
    - -
    ASControlNodeEventTouchUpInside
    -
    - - -

    A touch-up event in the control node where the finger is inside the bounds of the node.

    - - - - - - -

    - Declared In ASControlNode.h. -

    - -
    - -
    ASControlNodeEventTouchUpOutside
    -
    - - -

    A touch-up event in the control node where the finger is outside the bounds of the node.

    - - - - - - -

    - Declared In ASControlNode.h. -

    - -
    - -
    ASControlNodeEventTouchCancel
    -
    - - -

    A system event canceling the current touches for the control node.

    - - - - - - -

    - Declared In ASControlNode.h. -

    - -
    - -
    ASControlNodeEventPrimaryActionTriggered
    -
    - - -

    A system event when the Play/Pause button on the Apple TV remote is pressed.

    - - - - - - -

    - Declared In ASControlNode.h. -

    - -
    - -
    ASControlNodeEventAllEvents
    -
    - - -

    All events, including system events.

    - - - - - - -

    - Declared In ASControlNode.h. -

    - -
    - -
    -
    - - - - - - - - -
    -

    Declared In

    -

    ASControlNode.h

    -
    - - - - - -
    - -
    - -
    -
    -
    -
    - - - - \ No newline at end of file diff --git a/submodules/AsyncDisplayKit/docs/appledoc/Constants/ASControlState.html b/submodules/AsyncDisplayKit/docs/appledoc/Constants/ASControlState.html deleted file mode 100755 index 64744c12dc..0000000000 --- a/submodules/AsyncDisplayKit/docs/appledoc/Constants/ASControlState.html +++ /dev/null @@ -1,180 +0,0 @@ - - - - - - ASControlState Constants Reference - - - - - - -
    -
    - -

    - -

    - -

    - AsyncDisplayKit -

    - -
    -
    - - - -
    -
    -
    -
    -

    ASControlState Constants Reference

    - - -
    - - - - -
    Declared inASControlNode.h
    - - - - - - - -

    ASControlState

    - -
    - - -

    Definition

    - typedef NS_OPTIONS(NSUInteger, ASControlState ) {
    - -    ASControlStateNormal = 0,
    - -    ASControlStateHighlighted = 1 < < 0,
    - -    ASControlStateDisabled = 1 < < 1,
    - -    ASControlStateSelected = 1 < < 2,
    - -    ASControlStateReserved = 0 xFF000000,
    - - };
    - -
    - -
    -

    Constants

    -
    - -
    ASControlStateNormal
    -
    - - -

    - Declared In ASControlNode.h. -

    - -
    - -
    ASControlStateHighlighted
    -
    - - -

    - Declared In ASControlNode.h. -

    - -
    - -
    ASControlStateDisabled
    -
    - - -

    - Declared In ASControlNode.h. -

    - -
    - -
    ASControlStateSelected
    -
    - - -

    - Declared In ASControlNode.h. -

    - -
    - -
    ASControlStateReserved
    -
    - - -

    - Declared In ASControlNode.h. -

    - -
    - -
    -
    - - - - - - -
    - -
    - -
    -
    -
    -
    - - - - \ No newline at end of file diff --git a/submodules/AsyncDisplayKit/docs/appledoc/Constants/ASDimensionUnit.html b/submodules/AsyncDisplayKit/docs/appledoc/Constants/ASDimensionUnit.html deleted file mode 100755 index aabf7a9803..0000000000 --- a/submodules/AsyncDisplayKit/docs/appledoc/Constants/ASDimensionUnit.html +++ /dev/null @@ -1,201 +0,0 @@ - - - - - - ASDimensionUnit Constants Reference - - - - - - -
    -
    - -

    - -

    - -

    - AsyncDisplayKit -

    - -
    -
    - - - -
    -
    -
    -
    -

    ASDimensionUnit Constants Reference

    - - -
    - - - - -
    Declared inASDimension.h
    - - - - - - - -

    ASDimensionUnit

    - - -
    -

    A dimension relative to constraints to be provided in the future. -A ASDimension can be one of three types:

    - -

    “Auto” - This indicated “I have no opinion” and may be resolved in whatever way makes most sense given the circumstances.

    - -

    “Points” - Just a number. It will always resolve to exactly this amount.

    - -

    “Percent” - Multiplied to a provided parent amount to resolve a final amount.

    -
    - - -
    - - -

    Definition

    - typedef NS_ENUM(NSInteger, ASDimensionUnit ) {
    - -    ASDimensionUnitAuto,
    - -    ASDimensionUnitPoints,
    - -    ASDimensionUnitFraction,
    - - };
    - -
    - -
    -

    Constants

    -
    - -
    ASDimensionUnitAuto
    -
    - - -

    This indicates “I have no opinion” and may be resolved in whatever way makes most sense given the circumstances.

    - - - - - - -

    - Declared In ASDimension.h. -

    - -
    - -
    ASDimensionUnitPoints
    -
    - - -

    Just a number. It will always resolve to exactly this amount. This is the default type.

    - - - - - - -

    - Declared In ASDimension.h. -

    - -
    - -
    ASDimensionUnitFraction
    -
    - - -

    Multiplied to a provided parent amount to resolve a final amount.

    - - - - - - -

    - Declared In ASDimension.h. -

    - -
    - -
    -
    - - - - - - - - -
    -

    Declared In

    -

    ASDimension.h

    -
    - - - - - -
    - -
    - -
    -
    -
    -
    - - - - \ No newline at end of file diff --git a/submodules/AsyncDisplayKit/docs/appledoc/Constants/ASDisplayNodePerformanceMeasurementOptions.html b/submodules/AsyncDisplayKit/docs/appledoc/Constants/ASDisplayNodePerformanceMeasurementOptions.html deleted file mode 100755 index ea8cb0d7ec..0000000000 --- a/submodules/AsyncDisplayKit/docs/appledoc/Constants/ASDisplayNodePerformanceMeasurementOptions.html +++ /dev/null @@ -1,175 +0,0 @@ - - - - - - ASDisplayNodePerformanceMeasurementOptions Constants Reference - - - - - - -
    -
    - -

    - -

    - -

    - AsyncDisplayKit -

    - -
    -
    - - - -
    -
    -
    -
    -

    ASDisplayNodePerformanceMeasurementOptions Constants Reference

    - - -
    - - - - -
    Declared inASDisplayNode+Beta.h
    - - - - - - - -

    ASDisplayNodePerformanceMeasurementOptions

    - - -
    -

    Bitmask to indicate what performance measurements the cell should record.

    -
    - - -
    - - -

    Definition

    - typedef NS_OPTIONS(NSUInteger, ASDisplayNodePerformanceMeasurementOptions ) {
    - -    ASDisplayNodePerformanceMeasurementOptionLayoutSpec = 1 < < 0,
    - -    ASDisplayNodePerformanceMeasurementOptionLayoutComputation = 1 < < 1,
    - - };
    - -
    - -
    -

    Constants

    -
    - -
    ASDisplayNodePerformanceMeasurementOptionLayoutSpec
    -
    - - -

    Bitmask to indicate what performance measurements the cell should record.

    - - - - - - -

    - Declared In ASDisplayNode+Beta.h. -

    - -
    - -
    ASDisplayNodePerformanceMeasurementOptionLayoutComputation
    -
    - - -

    Bitmask to indicate what performance measurements the cell should record.

    - - - - - - -

    - Declared In ASDisplayNode+Beta.h. -

    - -
    - -
    -
    - - - - - - - - -
    -

    Declared In

    -

    ASDisplayNode+Beta.h

    -
    - - - - - -
    - -
    - -
    -
    -
    -
    - - - - \ No newline at end of file diff --git a/submodules/AsyncDisplayKit/docs/appledoc/Constants/ASHorizontalAlignment.html b/submodules/AsyncDisplayKit/docs/appledoc/Constants/ASHorizontalAlignment.html deleted file mode 100755 index cfc38bf091..0000000000 --- a/submodules/AsyncDisplayKit/docs/appledoc/Constants/ASHorizontalAlignment.html +++ /dev/null @@ -1,270 +0,0 @@ - - - - - - ASHorizontalAlignment Constants Reference - - - - - - -
    -
    - -

    - -

    - -

    - AsyncDisplayKit -

    - -
    -
    - - - -
    -
    -
    -
    -

    ASHorizontalAlignment Constants Reference

    - - -
    - - - - -
    Declared inASStackLayoutDefines.h
    - - - - - - - -

    ASHorizontalAlignment

    - - -
    -

    Orientation of children along horizontal axis

    -
    - - -
    - - -

    Definition

    - typedef NS_ENUM(NSUInteger, ASHorizontalAlignment ) {
    - -    ASHorizontalAlignmentNone,
    - -    ASHorizontalAlignmentLeft,
    - -    ASHorizontalAlignmentMiddle,
    - -    ASHorizontalAlignmentRight,
    - -    ASAlignmentLeft = ASHorizontalAlignmentLeft,
    - -    ASAlignmentMiddle = ASHorizontalAlignmentMiddle,
    - -    ASAlignmentRight = ASHorizontalAlignmentRight,
    - - };
    - -
    - -
    -

    Constants

    -
    - -
    ASHorizontalAlignmentNone
    -
    - - -

    No alignment specified. Default value

    - - - - - - -

    - Declared In ASStackLayoutDefines.h. -

    - -
    - -
    ASHorizontalAlignmentLeft
    -
    - - -

    Left aligned

    - - - - - - -

    - Declared In ASStackLayoutDefines.h. -

    - -
    - -
    ASHorizontalAlignmentMiddle
    -
    - - -

    Center aligned

    - - - - - - -

    - Declared In ASStackLayoutDefines.h. -

    - -
    - -
    ASHorizontalAlignmentRight
    -
    - - -

    Right aligned

    - - - - - - -

    - Declared In ASStackLayoutDefines.h. -

    - -
    - -
    ASAlignmentLeft
    -
    - - -

    Use ASHorizontalAlignmentLeft instead (Deprecated: Use ASHorizontalAlignmentLeft instead)

    - - - - - - -

    - Declared In ASStackLayoutDefines.h. -

    - -
    - -
    ASAlignmentMiddle
    -
    - - -

    Use ASHorizontalAlignmentMiddle instead (Deprecated: Use ASHorizontalAlignmentMiddle instead)

    - - - - - - -

    - Declared In ASStackLayoutDefines.h. -

    - -
    - -
    ASAlignmentRight
    -
    - - -

    Use ASHorizontalAlignmentRight instead (Deprecated: Use ASHorizontalAlignmentRight instead)

    - - - - - - -

    - Declared In ASStackLayoutDefines.h. -

    - -
    - -
    -
    - - - - - - - - -
    -

    Declared In

    -

    ASStackLayoutDefines.h

    -
    - - - - - -
    - -
    - -
    -
    -
    -
    - - - - \ No newline at end of file diff --git a/submodules/AsyncDisplayKit/docs/appledoc/Constants/ASInterfaceState.html b/submodules/AsyncDisplayKit/docs/appledoc/Constants/ASInterfaceState.html deleted file mode 100755 index ab0706f83a..0000000000 --- a/submodules/AsyncDisplayKit/docs/appledoc/Constants/ASInterfaceState.html +++ /dev/null @@ -1,254 +0,0 @@ - - - - - - ASInterfaceState Constants Reference - - - - - - -
    -
    - -

    - -

    - -

    - AsyncDisplayKit -

    - -
    -
    - - - -
    -
    -
    -
    -

    ASInterfaceState Constants Reference

    - - -
    - - - - -
    Declared inASDisplayNode.h
    - - - - - - - -

    ASInterfaceState

    - - -
    -

    Interface state is available on ASDisplayNode and ASViewController, and -allows checking whether a node is in an interface situation where it is prudent to trigger certain -actions: measurement, data loading, display, and visibility (the latter for animations or other onscreen-only effects).

    -
    - - -
    - - -

    Definition

    - typedef NS_OPTIONS(NSUInteger, ASInterfaceState ) {
    - -    ASInterfaceStateNone = 0,
    - -    ASInterfaceStateMeasureLayout = 1 < < 0,
    - -    ASInterfaceStatePreload = 1 < < 1,
    - -    ASInterfaceStateDisplay = 1 < < 2,
    - -    ASInterfaceStateVisible = 1 < < 3,
    - -    ASInterfaceStateInHierarchy = ASInterfaceStateMeasureLayout | ASInterfaceStatePreload | ASInterfaceStateDisplay | ASInterfaceStateVisible,
    - - };
    - -
    - -
    -

    Constants

    -
    - -
    ASInterfaceStateNone
    -
    - - -

    The element is not predicted to be onscreen soon and preloading should not be performed

    - - - - - - -

    - Declared In ASDisplayNode.h. -

    - -
    - -
    ASInterfaceStateMeasureLayout
    -
    - - -

    The element may be added to a view soon that could become visible. Measure the layout, including size calculation.

    - - - - - - -

    - Declared In ASDisplayNode.h. -

    - -
    - -
    ASInterfaceStatePreload
    -
    - - -

    The element is likely enough to come onscreen that disk and/or network data required for display should be fetched.

    - - - - - - -

    - Declared In ASDisplayNode.h. -

    - -
    - -
    ASInterfaceStateDisplay
    -
    - - -

    The element is very likely to become visible, and concurrent rendering should be executed for any -setNeedsDisplay.

    - - - - - - -

    - Declared In ASDisplayNode.h. -

    - -
    - -
    ASInterfaceStateVisible
    -
    - - -

    The element is physically onscreen by at least 1 pixel. - In practice, all other bit fields should also be set when this flag is set.

    - - - - - - -

    - Declared In ASDisplayNode.h. -

    - -
    - -
    ASInterfaceStateInHierarchy
    -
    - - -

    The node is not contained in a cell but it is in a window.

    - - - - - - -

    - Declared In ASDisplayNode.h. -

    - -
    - -
    -
    - - - - - - - - -
    -

    Declared In

    -

    ASDisplayNode.h

    -
    - - - - - -
    - -
    - -
    -
    -
    -
    - - - - \ No newline at end of file diff --git a/submodules/AsyncDisplayKit/docs/appledoc/Constants/ASLayoutElementType.html b/submodules/AsyncDisplayKit/docs/appledoc/Constants/ASLayoutElementType.html deleted file mode 100755 index 0cf6cc9244..0000000000 --- a/submodules/AsyncDisplayKit/docs/appledoc/Constants/ASLayoutElementType.html +++ /dev/null @@ -1,175 +0,0 @@ - - - - - - ASLayoutElementType Constants Reference - - - - - - -
    -
    - -

    - -

    - -

    - AsyncDisplayKit -

    - -
    -
    - - - -
    -
    -
    -
    -

    ASLayoutElementType Constants Reference

    - - -
    - - - - -
    Declared inASLayoutElement.h
    - - - - - - - -

    ASLayoutElementType

    - - -
    -

    Type of ASLayoutElement

    -
    - - -
    - - -

    Definition

    - typedef NS_ENUM(NSUInteger, ASLayoutElementType ) {
    - -    ASLayoutElementTypeLayoutSpec,
    - -    ASLayoutElementTypeDisplayNode,
    - - };
    - -
    - -
    -

    Constants

    -
    - -
    ASLayoutElementTypeLayoutSpec
    -
    - - -

    Type of ASLayoutElement

    - - - - - - -

    - Declared In ASLayoutElement.h. -

    - -
    - -
    ASLayoutElementTypeDisplayNode
    -
    - - -

    Type of ASLayoutElement

    - - - - - - -

    - Declared In ASLayoutElement.h. -

    - -
    - -
    -
    - - - - - - - - -
    -

    Declared In

    -

    ASLayoutElement.h

    -
    - - - - - -
    - -
    - -
    -
    -
    -
    - - - - \ No newline at end of file diff --git a/submodules/AsyncDisplayKit/docs/appledoc/Constants/ASMapNodeShowAnnotationsOptions.html b/submodules/AsyncDisplayKit/docs/appledoc/Constants/ASMapNodeShowAnnotationsOptions.html deleted file mode 100755 index 0f7414e76e..0000000000 --- a/submodules/AsyncDisplayKit/docs/appledoc/Constants/ASMapNodeShowAnnotationsOptions.html +++ /dev/null @@ -1,177 +0,0 @@ - - - - - - ASMapNodeShowAnnotationsOptions Constants Reference - - - - - - -
    -
    - -

    - -

    - -

    - AsyncDisplayKit -

    - -
    -
    - - - -
    -
    -
    -
    -

    ASMapNodeShowAnnotationsOptions Constants Reference

    - - -
    - - - - -
    Declared inASMapNode.h
    - - - - - - - -

    ASMapNodeShowAnnotationsOptions

    - -
    - - -

    Definition

    - typedef NS_OPTIONS(NSUInteger, ASMapNodeShowAnnotationsOptions ) {
    - -    ASMapNodeShowAnnotationsOptionsIgnored = 0,
    - -    ASMapNodeShowAnnotationsOptionsZoomed = 1 < < 0,
    - -    ASMapNodeShowAnnotationsOptionsAnimated = 1 < < 1,
    - - };
    - -
    - -
    -

    Constants

    -
    - -
    ASMapNodeShowAnnotationsOptionsIgnored
    -
    - - -

    The annotations' positions are ignored, use the region or options specified instead.

    - - - - - - -

    - Declared In ASMapNode.h. -

    - -
    - -
    ASMapNodeShowAnnotationsOptionsZoomed
    -
    - - -

    The annotations' positions are used to calculate the region to show in the map, equivalent to showAnnotations:animated.

    - - - - - - -

    - Declared In ASMapNode.h. -

    - -
    - -
    ASMapNodeShowAnnotationsOptionsAnimated
    -
    - - -

    This will only have an effect if combined with the Zoomed state with liveMap turned on.

    - - - - - - -

    - Declared In ASMapNode.h. -

    - -
    - -
    -
    - - - - - - -
    - -
    - -
    -
    -
    -
    - - - - \ No newline at end of file diff --git a/submodules/AsyncDisplayKit/docs/appledoc/Constants/ASMultiplexImageNodeErrorCode.html b/submodules/AsyncDisplayKit/docs/appledoc/Constants/ASMultiplexImageNodeErrorCode.html deleted file mode 100755 index 3843f6a12f..0000000000 --- a/submodules/AsyncDisplayKit/docs/appledoc/Constants/ASMultiplexImageNodeErrorCode.html +++ /dev/null @@ -1,217 +0,0 @@ - - - - - - ASMultiplexImageNodeErrorCode Constants Reference - - - - - - -
    -
    - -

    - -

    - -

    - AsyncDisplayKit -

    - -
    -
    - - - -
    -
    -
    -
    -

    ASMultiplexImageNodeErrorCode Constants Reference

    - - -
    - - - - -
    Declared inASMultiplexImageNode.h
    - - - - - - - -

    ASMultiplexImageNodeErrorCode

    - - -
    -

    ASMultiplexImageNode error codes.

    -
    - - - - -
    -

    Constants

    -
    - -
    ASMultiplexImageNodeErrorCodeNoSourceForImage
    -
    - - -

    Indicates that the data source didn’t provide a source for an image identifier.

    - - - - - - -

    - Declared In ASMultiplexImageNode.h. -

    - -
    - -
    ASMultiplexImageNodeErrorCodeBestImageIdentifierChanged
    -
    - - -

    Indicates that the best image identifier changed before a download for a worse identifier began.

    - - - - - - -

    - Declared In ASMultiplexImageNode.h. -

    - -
    - -
    ASMultiplexImageNodeErrorCodePhotosImageManagerFailedWithoutError
    -
    - - -

    Indicates that the Photos framework returned no image and no error. -This may happen if the image is in iCloud and the user did not specify allowsNetworkAccess -in their image request.

    - - - - - - -

    - Declared In ASMultiplexImageNode.h. -

    - -
    - -
    ASMultiplexImageNodeErrorCodePHAssetIsUnavailable
    -
    - - -

    Indicates that the image node could not retrieve the PHAsset for a given asset identifier. -This typically means that the user has not given Photos framework permissions yet or the asset -has been removed from the device.

    - - - - - - -

    - Declared In ASMultiplexImageNode.h. -

    - -
    - -
    -
    - - - - - - - - -
    -

    Declared In

    -

    ASMultiplexImageNode.h

    -
    - - - - - -
    - -
    - -
    -
    -
    -
    - - - - \ No newline at end of file diff --git a/submodules/AsyncDisplayKit/docs/appledoc/Constants/ASRelativeDimensionType.html b/submodules/AsyncDisplayKit/docs/appledoc/Constants/ASRelativeDimensionType.html deleted file mode 100755 index f700916c7f..0000000000 --- a/submodules/AsyncDisplayKit/docs/appledoc/Constants/ASRelativeDimensionType.html +++ /dev/null @@ -1,201 +0,0 @@ - - - - - - ASRelativeDimensionType Constants Reference - - - - - - -
    -
    - -

    - -

    - -

    - AsyncDisplayKit -

    - -
    -
    - - - -
    -
    -
    -
    -

    ASRelativeDimensionType Constants Reference

    - - -
    - - - - -
    Declared inASDimension.h
    - - - - - - - -

    ASRelativeDimensionType

    - - -
    -

    A dimension relative to constraints to be provided in the future. -A ASDimension can be one of three types:

    - -

    “Auto” - This indicated “I have no opinion” and may be resolved in whatever way makes most sense given the circumstances.

    - -

    “Points” - Just a number. It will always resolve to exactly this amount.

    - -

    “Percent” - Multiplied to a provided parent amount to resolve a final amount.

    -
    - - -
    - - -

    Definition

    - typedef NS_ENUM(NSInteger, ASRelativeDimensionType ) {
    - -    ASRelativeDimensionTypeAuto,
    - -    ASRelativeDimensionTypePoints,
    - -    ASRelativeDimensionTypeFraction,
    - - };
    - -
    - -
    -

    Constants

    -
    - -
    ASRelativeDimensionTypeAuto
    -
    - - -

    This indicates “I have no opinion” and may be resolved in whatever way makes most sense given the circumstances.

    - - - - - - -

    - Declared In ASDimension.h. -

    - -
    - -
    ASRelativeDimensionTypePoints
    -
    - - -

    Just a number. It will always resolve to exactly this amount. This is the default type.

    - - - - - - -

    - Declared In ASDimension.h. -

    - -
    - -
    ASRelativeDimensionTypeFraction
    -
    - - -

    Multiplied to a provided parent amount to resolve a final amount.

    - - - - - - -

    - Declared In ASDimension.h. -

    - -
    - -
    -
    - - - - - - - - -
    -

    Declared In

    -

    ASDimension.h

    -
    - - - - - -
    - -
    - -
    -
    -
    -
    - - - - \ No newline at end of file diff --git a/submodules/AsyncDisplayKit/docs/appledoc/Constants/ASRelativeLayoutSpecPosition.html b/submodules/AsyncDisplayKit/docs/appledoc/Constants/ASRelativeLayoutSpecPosition.html deleted file mode 100755 index 3f78b744af..0000000000 --- a/submodules/AsyncDisplayKit/docs/appledoc/Constants/ASRelativeLayoutSpecPosition.html +++ /dev/null @@ -1,213 +0,0 @@ - - - - - - ASRelativeLayoutSpecPosition Constants Reference - - - - - - -
    -
    - -

    - -

    - -

    - AsyncDisplayKit -

    - -
    -
    - - - -
    -
    -
    -
    -

    ASRelativeLayoutSpecPosition Constants Reference

    - - -
    - - - - -
    Declared inASRelativeLayoutSpec.h
    - - - - - - - -

    ASRelativeLayoutSpecPosition

    - - -
    -

    How the child is positioned within the spec.

    -
    - - -
    - - -

    Definition

    - typedef NS_ENUM(NSUInteger, ASRelativeLayoutSpecPosition ) {
    - -    ASRelativeLayoutSpecPositionNone = 0,
    - -    ASRelativeLayoutSpecPositionStart = 1,
    - -    ASRelativeLayoutSpecPositionCenter = 2,
    - -    ASRelativeLayoutSpecPositionEnd = 3,
    - - };
    - -
    - -
    -

    Constants

    -
    - -
    ASRelativeLayoutSpecPositionNone
    -
    - - -

    The child is positioned at point 0

    - - - - - - -

    - Declared In ASRelativeLayoutSpec.h. -

    - -
    - -
    ASRelativeLayoutSpecPositionStart
    -
    - - -

    The child is positioned at point 0 relatively to the layout axis (ie left / top most)

    - - - - - - -

    - Declared In ASRelativeLayoutSpec.h. -

    - -
    - -
    ASRelativeLayoutSpecPositionCenter
    -
    - - -

    The child is centered along the specified axis

    - - - - - - -

    - Declared In ASRelativeLayoutSpec.h. -

    - -
    - -
    ASRelativeLayoutSpecPositionEnd
    -
    - - -

    The child is positioned at the maximum point of the layout axis (ie right / bottom most)

    - - - - - - -

    - Declared In ASRelativeLayoutSpec.h. -

    - -
    - -
    -
    - - - - - - - - -
    -

    Declared In

    -

    ASRelativeLayoutSpec.h

    -
    - - - - - -
    - -
    - -
    -
    -
    -
    - - - - \ No newline at end of file diff --git a/submodules/AsyncDisplayKit/docs/appledoc/Constants/ASRelativeLayoutSpecSizingOption.html b/submodules/AsyncDisplayKit/docs/appledoc/Constants/ASRelativeLayoutSpecSizingOption.html deleted file mode 100755 index 75d49d9737..0000000000 --- a/submodules/AsyncDisplayKit/docs/appledoc/Constants/ASRelativeLayoutSpecSizingOption.html +++ /dev/null @@ -1,213 +0,0 @@ - - - - - - ASRelativeLayoutSpecSizingOption Constants Reference - - - - - - -
    -
    - -

    - -

    - -

    - AsyncDisplayKit -

    - -
    -
    - - - -
    -
    -
    -
    -

    ASRelativeLayoutSpecSizingOption Constants Reference

    - - -
    - - - - -
    Declared inASRelativeLayoutSpec.h
    - - - - - - - -

    ASRelativeLayoutSpecSizingOption

    - - -
    -

    How much space the spec will take up.

    -
    - - -
    - - -

    Definition

    - typedef NS_OPTIONS(NSUInteger, ASRelativeLayoutSpecSizingOption ) {
    - -    ASRelativeLayoutSpecSizingOptionDefault,
    - -    ASRelativeLayoutSpecSizingOptionMinimumWidth = 1 < < 0,
    - -    ASRelativeLayoutSpecSizingOptionMinimumHeight = 1 < < 1,
    - -    ASRelativeLayoutSpecSizingOptionMinimumSize = ASRelativeLayoutSpecSizingOptionMinimumWidth | ASRelativeLayoutSpecSizingOptionMinimumHeight,
    - - };
    - -
    - -
    -

    Constants

    -
    - -
    ASRelativeLayoutSpecSizingOptionDefault
    -
    - - -

    The spec will take up the maximum size possible

    - - - - - - -

    - Declared In ASRelativeLayoutSpec.h. -

    - -
    - -
    ASRelativeLayoutSpecSizingOptionMinimumWidth
    -
    - - -

    The spec will take up the minimum size possible along the X axis

    - - - - - - -

    - Declared In ASRelativeLayoutSpec.h. -

    - -
    - -
    ASRelativeLayoutSpecSizingOptionMinimumHeight
    -
    - - -

    The spec will take up the minimum size possible along the Y axis

    - - - - - - -

    - Declared In ASRelativeLayoutSpec.h. -

    - -
    - -
    ASRelativeLayoutSpecSizingOptionMinimumSize
    -
    - - -

    Convenience option to take up the minimum size along both the X and Y axis

    - - - - - - -

    - Declared In ASRelativeLayoutSpec.h. -

    - -
    - -
    -
    - - - - - - - - -
    -

    Declared In

    -

    ASRelativeLayoutSpec.h

    -
    - - - - - -
    - -
    - -
    -
    -
    -
    - - - - \ No newline at end of file diff --git a/submodules/AsyncDisplayKit/docs/appledoc/Constants/ASStackLayoutAlignItems.html b/submodules/AsyncDisplayKit/docs/appledoc/Constants/ASStackLayoutAlignItems.html deleted file mode 100755 index 7a809bbe35..0000000000 --- a/submodules/AsyncDisplayKit/docs/appledoc/Constants/ASStackLayoutAlignItems.html +++ /dev/null @@ -1,251 +0,0 @@ - - - - - - ASStackLayoutAlignItems Constants Reference - - - - - - -
    -
    - -

    - -

    - -

    - AsyncDisplayKit -

    - -
    -
    - - - -
    -
    -
    -
    -

    ASStackLayoutAlignItems Constants Reference

    - - -
    - - - - -
    Declared inASStackLayoutDefines.h
    - - - - - - - -

    ASStackLayoutAlignItems

    - - -
    -

    Orientation of children along cross axis

    -
    - - -
    - - -

    Definition

    - typedef NS_ENUM(NSUInteger, ASStackLayoutAlignItems ) {
    - -    ASStackLayoutAlignItemsStart,
    - -    ASStackLayoutAlignItemsEnd,
    - -    ASStackLayoutAlignItemsCenter,
    - -    ASStackLayoutAlignItemsStretch,
    - -    ASStackLayoutAlignItemsBaselineFirst,
    - -    ASStackLayoutAlignItemsBaselineLast,
    - - };
    - -
    - -
    -

    Constants

    -
    - -
    ASStackLayoutAlignItemsStart
    -
    - - -

    Align children to start of cross axis

    - - - - - - -

    - Declared In ASStackLayoutDefines.h. -

    - -
    - -
    ASStackLayoutAlignItemsEnd
    -
    - - -

    Align children with end of cross axis

    - - - - - - -

    - Declared In ASStackLayoutDefines.h. -

    - -
    - -
    ASStackLayoutAlignItemsCenter
    -
    - - -

    Center children on cross axis

    - - - - - - -

    - Declared In ASStackLayoutDefines.h. -

    - -
    - -
    ASStackLayoutAlignItemsStretch
    -
    - - -

    Expand children to fill cross axis

    - - - - - - -

    - Declared In ASStackLayoutDefines.h. -

    - -
    - -
    ASStackLayoutAlignItemsBaselineFirst
    -
    - - -

    Children align to their first baseline. Only available for horizontal stack spec

    - - - - - - -

    - Declared In ASStackLayoutDefines.h. -

    - -
    - -
    ASStackLayoutAlignItemsBaselineLast
    -
    - - -

    Children align to their last baseline. Only available for horizontal stack spec

    - - - - - - -

    - Declared In ASStackLayoutDefines.h. -

    - -
    - -
    -
    - - - - - - - - -
    -

    Declared In

    -

    ASStackLayoutDefines.h

    -
    - - - - - -
    - -
    - -
    -
    -
    -
    - - - - \ No newline at end of file diff --git a/submodules/AsyncDisplayKit/docs/appledoc/Constants/ASStackLayoutAlignSelf.html b/submodules/AsyncDisplayKit/docs/appledoc/Constants/ASStackLayoutAlignSelf.html deleted file mode 100755 index 45606fd4db..0000000000 --- a/submodules/AsyncDisplayKit/docs/appledoc/Constants/ASStackLayoutAlignSelf.html +++ /dev/null @@ -1,244 +0,0 @@ - - - - - - ASStackLayoutAlignSelf Constants Reference - - - - - - -
    -
    - -

    - -

    - -

    - AsyncDisplayKit -

    - -
    -
    - - - -
    -
    -
    -
    -

    ASStackLayoutAlignSelf Constants Reference

    - - -
    - - - - - - - -
    Declared inASStackLayoutDefines.h
    ReferencesASStackLayoutAlignItems
    - - - - - - - -

    ASStackLayoutAlignSelf

    - - -
    -

    Each child may override their parent stack’s cross axis alignment.

    -
    - - -
    - - -

    Definition

    - typedef NS_ENUM(NSUInteger, ASStackLayoutAlignSelf ) {
    - -    ASStackLayoutAlignSelfAuto,
    - -    ASStackLayoutAlignSelfStart,
    - -    ASStackLayoutAlignSelfEnd,
    - -    ASStackLayoutAlignSelfCenter,
    - -    ASStackLayoutAlignSelfStretch,
    - - };
    - -
    - -
    -

    Constants

    -
    - -
    ASStackLayoutAlignSelfAuto
    -
    - - -

    Inherit alignment value from containing stack.

    - - - - - - -

    - Declared In ASStackLayoutDefines.h. -

    - -
    - -
    ASStackLayoutAlignSelfStart
    -
    - - -

    Align to start of cross axis

    - - - - - - -

    - Declared In ASStackLayoutDefines.h. -

    - -
    - -
    ASStackLayoutAlignSelfEnd
    -
    - - -

    Align with end of cross axis

    - - - - - - -

    - Declared In ASStackLayoutDefines.h. -

    - -
    - -
    ASStackLayoutAlignSelfCenter
    -
    - - -

    Center on cross axis

    - - - - - - -

    - Declared In ASStackLayoutDefines.h. -

    - -
    - -
    ASStackLayoutAlignSelfStretch
    -
    - - -

    Expand to fill cross axis

    - - - - - - -

    - Declared In ASStackLayoutDefines.h. -

    - -
    - -
    -
    - - - - - - -
    -

    See Also

    - -
    - - - -
    -

    Declared In

    -

    ASStackLayoutDefines.h

    -
    - - - - - -
    - -
    - -
    -
    -
    -
    - - - - \ No newline at end of file diff --git a/submodules/AsyncDisplayKit/docs/appledoc/Constants/ASStackLayoutDirection.html b/submodules/AsyncDisplayKit/docs/appledoc/Constants/ASStackLayoutDirection.html deleted file mode 100755 index ac22df4f8b..0000000000 --- a/submodules/AsyncDisplayKit/docs/appledoc/Constants/ASStackLayoutDirection.html +++ /dev/null @@ -1,175 +0,0 @@ - - - - - - ASStackLayoutDirection Constants Reference - - - - - - -
    -
    - -

    - -

    - -

    - AsyncDisplayKit -

    - -
    -
    - - - -
    -
    -
    -
    -

    ASStackLayoutDirection Constants Reference

    - - -
    - - - - -
    Declared inASStackLayoutDefines.h
    - - - - - - - -

    ASStackLayoutDirection

    - - -
    -

    The direction children are stacked in

    -
    - - -
    - - -

    Definition

    - typedef NS_ENUM(NSUInteger, ASStackLayoutDirection ) {
    - -    ASStackLayoutDirectionVertical,
    - -    ASStackLayoutDirectionHorizontal,
    - - };
    - -
    - -
    -

    Constants

    -
    - -
    ASStackLayoutDirectionVertical
    -
    - - -

    Children are stacked vertically

    - - - - - - -

    - Declared In ASStackLayoutDefines.h. -

    - -
    - -
    ASStackLayoutDirectionHorizontal
    -
    - - -

    Children are stacked horizontally

    - - - - - - -

    - Declared In ASStackLayoutDefines.h. -

    - -
    - -
    -
    - - - - - - - - -
    -

    Declared In

    -

    ASStackLayoutDefines.h

    -
    - - - - - -
    - -
    - -
    -
    -
    -
    - - - - \ No newline at end of file diff --git a/submodules/AsyncDisplayKit/docs/appledoc/Constants/ASStackLayoutJustifyContent.html b/submodules/AsyncDisplayKit/docs/appledoc/Constants/ASStackLayoutJustifyContent.html deleted file mode 100755 index 946d43e0dd..0000000000 --- a/submodules/AsyncDisplayKit/docs/appledoc/Constants/ASStackLayoutJustifyContent.html +++ /dev/null @@ -1,242 +0,0 @@ - - - - - - ASStackLayoutJustifyContent Constants Reference - - - - - - -
    -
    - -

    - -

    - -

    - AsyncDisplayKit -

    - -
    -
    - - - -
    -
    -
    -
    -

    ASStackLayoutJustifyContent Constants Reference

    - - -
    - - - - -
    Declared inASStackLayoutDefines.h
    - - - - - - - -

    ASStackLayoutJustifyContent

    - - -
    -

    If no children are flexible, how should this spec justify its children in the available space?

    -
    - - -
    - - -

    Definition

    - typedef NS_ENUM(NSUInteger, ASStackLayoutJustifyContent ) {
    - -    ASStackLayoutJustifyContentStart,
    - -    ASStackLayoutJustifyContentCenter,
    - -    ASStackLayoutJustifyContentEnd,
    - -    ASStackLayoutJustifyContentSpaceBetween,
    - -    ASStackLayoutJustifyContentSpaceAround,
    - - };
    - -
    - -
    -

    Constants

    -
    - -
    ASStackLayoutJustifyContentStart
    -
    - - -

    On overflow, children overflow out of this spec’s bounds on the right/bottom side. - On underflow, children are left/top-aligned within this spec’s bounds.

    - - - - - - -

    - Declared In ASStackLayoutDefines.h. -

    - -
    - -
    ASStackLayoutJustifyContentCenter
    -
    - - -

    On overflow, children are centered and overflow on both sides. - On underflow, children are centered within this spec’s bounds in the stacking direction.

    - - - - - - -

    - Declared In ASStackLayoutDefines.h. -

    - -
    - -
    ASStackLayoutJustifyContentEnd
    -
    - - -

    On overflow, children overflow out of this spec’s bounds on the left/top side. - On underflow, children are right/bottom-aligned within this spec’s bounds.

    - - - - - - -

    - Declared In ASStackLayoutDefines.h. -

    - -
    - -
    ASStackLayoutJustifyContentSpaceBetween
    -
    - - -

    On overflow or if the stack has only 1 child, this value is identical to ASStackLayoutJustifyContentStart. - Otherwise, the starting edge of the first child is at the starting edge of the stack, - the ending edge of the last child is at the ending edge of the stack, and the remaining children - are distributed so that the spacing between any two adjacent ones is the same. - If there is a remaining space after spacing division, it is combined with the last spacing (i.e the one between the last 2 children).

    - - - - - - -

    - Declared In ASStackLayoutDefines.h. -

    - -
    - -
    ASStackLayoutJustifyContentSpaceAround
    -
    - - -

    On overflow or if the stack has only 1 child, this value is identical to ASStackLayoutJustifyContentCenter. - Otherwise, children are distributed such that the spacing between any two adjacent ones is the same, - and the spacing between the first/last child and the stack edges is half the size of the spacing between children. - If there is a remaining space after spacing division, it is combined with the last spacing (i.e the one between the last child and the stack ending edge).

    - - - - - - -

    - Declared In ASStackLayoutDefines.h. -

    - -
    - -
    -
    - - - - - - - - -
    -

    Declared In

    -

    ASStackLayoutDefines.h

    -
    - - - - - -
    - -
    - -
    -
    -
    -
    - - - - \ No newline at end of file diff --git a/submodules/AsyncDisplayKit/docs/appledoc/Constants/ASTextNodeHighlightStyle.html b/submodules/AsyncDisplayKit/docs/appledoc/Constants/ASTextNodeHighlightStyle.html deleted file mode 100755 index e47cd046cf..0000000000 --- a/submodules/AsyncDisplayKit/docs/appledoc/Constants/ASTextNodeHighlightStyle.html +++ /dev/null @@ -1,175 +0,0 @@ - - - - - - ASTextNodeHighlightStyle Constants Reference - - - - - - -
    -
    - -

    - -

    - -

    - AsyncDisplayKit -

    - -
    -
    - - - -
    -
    -
    -
    -

    ASTextNodeHighlightStyle Constants Reference

    - - -
    - - - - -
    Declared inASTextNode.h
    - - - - - - - -

    ASTextNodeHighlightStyle

    - - -
    -

    Highlight styles.

    -
    - - -
    - - -

    Definition

    - typedef NS_ENUM(NSUInteger, ASTextNodeHighlightStyle ) {
    - -    ASTextNodeHighlightStyleLight,
    - -    ASTextNodeHighlightStyleDark,
    - - };
    - -
    - -
    -

    Constants

    -
    - -
    ASTextNodeHighlightStyleLight
    -
    - - -

    Highlight style for text on a light background.

    - - - - - - -

    - Declared In ASTextNode.h. -

    - -
    - -
    ASTextNodeHighlightStyleDark
    -
    - - -

    Highlight style for text on a dark background.

    - - - - - - -

    - Declared In ASTextNode.h. -

    - -
    - -
    -
    - - - - - - - - -
    -

    Declared In

    -

    ASTextNode.h

    -
    - - - - - -
    - -
    - -
    -
    -
    -
    - - - - \ No newline at end of file diff --git a/submodules/AsyncDisplayKit/docs/appledoc/Constants/ASVerticalAlignment.html b/submodules/AsyncDisplayKit/docs/appledoc/Constants/ASVerticalAlignment.html deleted file mode 100755 index 640a47dc9b..0000000000 --- a/submodules/AsyncDisplayKit/docs/appledoc/Constants/ASVerticalAlignment.html +++ /dev/null @@ -1,270 +0,0 @@ - - - - - - ASVerticalAlignment Constants Reference - - - - - - -
    -
    - -

    - -

    - -

    - AsyncDisplayKit -

    - -
    -
    - - - -
    -
    -
    -
    -

    ASVerticalAlignment Constants Reference

    - - -
    - - - - -
    Declared inASStackLayoutDefines.h
    - - - - - - - -

    ASVerticalAlignment

    - - -
    -

    Orientation of children along vertical axis

    -
    - - -
    - - -

    Definition

    - typedef NS_ENUM(NSUInteger, ASVerticalAlignment ) {
    - -    ASVerticalAlignmentNone,
    - -    ASVerticalAlignmentTop,
    - -    ASVerticalAlignmentCenter,
    - -    ASVerticalAlignmentBottom,
    - -    ASAlignmentTop = ASVerticalAlignmentTop,
    - -    ASAlignmentCenter = ASVerticalAlignmentCenter,
    - -    ASAlignmentBottom = ASVerticalAlignmentBottom,
    - - };
    - -
    - -
    -

    Constants

    -
    - -
    ASVerticalAlignmentNone
    -
    - - -

    No alignment specified. Default value

    - - - - - - -

    - Declared In ASStackLayoutDefines.h. -

    - -
    - -
    ASVerticalAlignmentTop
    -
    - - -

    Top aligned

    - - - - - - -

    - Declared In ASStackLayoutDefines.h. -

    - -
    - -
    ASVerticalAlignmentCenter
    -
    - - -

    Center aligned

    - - - - - - -

    - Declared In ASStackLayoutDefines.h. -

    - -
    - -
    ASVerticalAlignmentBottom
    -
    - - -

    Bottom aligned

    - - - - - - -

    - Declared In ASStackLayoutDefines.h. -

    - -
    - -
    ASAlignmentTop
    -
    - - -

    Use ASVerticalAlignmentTop instead (Deprecated: Use ASVerticalAlignmentTop instead)

    - - - - - - -

    - Declared In ASStackLayoutDefines.h. -

    - -
    - -
    ASAlignmentCenter
    -
    - - -

    Use ASVerticalAlignmentCenter instead (Deprecated: Use ASVerticalAlignmentCenter instead)

    - - - - - - -

    - Declared In ASStackLayoutDefines.h. -

    - -
    - -
    ASAlignmentBottom
    -
    - - -

    Use ASVerticalAlignmentBottom instead (Deprecated: Use ASVerticalAlignmentBottom instead)

    - - - - - - -

    - Declared In ASStackLayoutDefines.h. -

    - -
    - -
    -
    - - - - - - - - -
    -

    Declared In

    -

    ASStackLayoutDefines.h

    -
    - - - - - -
    - -
    - -
    -
    -
    -
    - - - - \ No newline at end of file diff --git a/submodules/AsyncDisplayKit/docs/appledoc/Protocols/ASAbsoluteLayoutElement.html b/submodules/AsyncDisplayKit/docs/appledoc/Protocols/ASAbsoluteLayoutElement.html deleted file mode 100755 index ecaff9596c..0000000000 --- a/submodules/AsyncDisplayKit/docs/appledoc/Protocols/ASAbsoluteLayoutElement.html +++ /dev/null @@ -1,180 +0,0 @@ - - - - - - ASAbsoluteLayoutElement Protocol Reference - - - - - - -
    -
    - -

    - -

    - -

    - AsyncDisplayKit -

    - -
    -
    - - - -
    -
    -
    -
    -

    ASAbsoluteLayoutElement Protocol Reference

    - - -
    - - - - -
    Declared inASAbsoluteLayoutElement.h
    - - - - -
    - -

    Overview

    -

    Layout options that can be defined for an ASLayoutElement being added to a ASAbsoluteLayoutSpec.

    -
    - - - - - -
    - - - - - - -
    -
    - -

      layoutPosition -required method

    - -
    -
    - -
    - - -
    -

    The position of this object within its parent spec.

    -
    - - - -
    @property (nonatomic, assign) CGPoint layoutPosition
    - - - - - - - - - - - - - - - -
    -

    Declared In

    -

    ASAbsoluteLayoutElement.h

    -
    - - -
    -
    -
    -
    - -
    - - - - - - -
    - -
    - -
    -
    -
    -
    - - - - \ No newline at end of file diff --git a/submodules/AsyncDisplayKit/docs/appledoc/Protocols/ASCellNodeInteractionDelegate.html b/submodules/AsyncDisplayKit/docs/appledoc/Protocols/ASCellNodeInteractionDelegate.html deleted file mode 100755 index 70d2a92642..0000000000 --- a/submodules/AsyncDisplayKit/docs/appledoc/Protocols/ASCellNodeInteractionDelegate.html +++ /dev/null @@ -1,198 +0,0 @@ - - - - - - ASCellNodeInteractionDelegate Protocol Reference - - - - - - -
    -
    - -

    - -

    - -

    - AsyncDisplayKit -

    - -
    -
    - - - -
    -
    -
    -
    -

    ASCellNodeInteractionDelegate Protocol Reference

    - - -
    - - - - - - - -
    Conforms toNSObject
    Declared inASCellNode+Internal.h
    - - - - - - -
    - - - - - - -
    -
    - -

    – nodeDidRelayout:sizeChanged: -required method

    - -
    -
    - -
    - - -
    -

    Notifies the delegate that the specified cell node has done a relayout. -The notification is done on main thread.

    -
    - - - -
    - (void)nodeDidRelayout:(ASCellNode *)node sizeChanged:(BOOL)sizeChanged
    - - - -
    -

    Parameters

    - - - - - - - - - - - - -
    node

    A node informing the delegate about the relayout.

    sizeChanged

    YES if the node’s calculatedSize changed during the relayout, NO otherwise.

    -
    - - - - - - - -
    -

    Discussion

    -

    This will not be called due to measurement passes before the node has loaded -its view, even if triggered by -setNeedsLayout, as it is assumed these are -not relevant to UIKit. Indeed, these calls can cause consistency issues.

    -
    - - - - - - - -
    -

    Declared In

    -

    ASCellNode+Internal.h

    -
    - - -
    -
    -
    -
    - -
    - - - - - - -
    - -
    - -
    -
    -
    -
    - - - - \ No newline at end of file diff --git a/submodules/AsyncDisplayKit/docs/appledoc/Protocols/ASCollectionDataSource.html b/submodules/AsyncDisplayKit/docs/appledoc/Protocols/ASCollectionDataSource.html deleted file mode 100755 index 1e4b1ec080..0000000000 --- a/submodules/AsyncDisplayKit/docs/appledoc/Protocols/ASCollectionDataSource.html +++ /dev/null @@ -1,807 +0,0 @@ - - - - - - ASCollectionDataSource Protocol Reference - - - - - - -
    -
    - -

    - -

    - -

    - AsyncDisplayKit -

    - -
    -
    - - - -
    -
    -
    -
    -

    ASCollectionDataSource Protocol Reference

    - - -
    - - - - - - - -
    Conforms toASCommonCollectionDataSource
    Declared inASCollectionNode.h
    - - - - -
    - -

    Overview

    -

    This is a node-based UICollectionViewDataSource.

    -
    - - - - - -
    - - - - - - -
    -
    - -

    – collectionNode:numberOfItemsInSection: -

    - -
    -
    - -
    - - -
    -

    Asks the data source for the number of items in the given section of the collection node.

    -
    - - - -
    - (NSInteger)collectionNode:(ASCollectionNode *)collectionNode numberOfItemsInSection:(NSInteger)section
    - - - - - - - - - - - - - - - -
    -

    Declared In

    -

    ASCollectionNode.h

    -
    - - -
    -
    -
    - -

    – numberOfSectionsInCollectionNode: -

    - -
    -
    - -
    - - -
    -

    Asks the data source for the number of sections in the collection node.

    -
    - - - -
    - (NSInteger)numberOfSectionsInCollectionNode:(ASCollectionNode *)collectionNode
    - - - - - - - - - - - - - - - -
    -

    Declared In

    -

    ASCollectionNode.h

    -
    - - -
    -
    -
    - -

    – collectionNode:nodeBlockForItemAtIndexPath: -

    - -
    -
    - -
    - - -
    -

    Similar to -collectionNode:nodeForItemAtIndexPath: -This method takes precedence over collectionNode:nodeForItemAtIndexPath: if implemented.

    -
    - - - -
    - (ASCellNodeBlock)collectionNode:(ASCollectionNode *)collectionNode nodeBlockForItemAtIndexPath:(NSIndexPath *)indexPath
    - - - -
    -

    Parameters

    - - - - - - - - - - - - -
    collectionNode

    The sender.

    indexPath

    The index path of the item.

    -
    - - - -
    -

    Return Value

    -

    a block that creates the node for display for this item. -Must be thread-safe (can be called on the main thread or a background -queue) and should not implement reuse (it will be called once per row).

    -
    - - - - - - - - - - - -
    -

    Declared In

    -

    ASCollectionNode.h

    -
    - - -
    -
    -
    - -

    – collectionNode:nodeForItemAtIndexPath: -

    - -
    -
    - -
    - - -
    -

    Similar to -collectionView:cellForItemAtIndexPath:.

    -
    - - - -
    - (ASCellNode *)collectionNode:(ASCollectionNode *)collectionNode nodeForItemAtIndexPath:(NSIndexPath *)indexPath
    - - - -
    -

    Parameters

    - - - - - - - - - - - - -
    indexPath

    The index path of the item.

    collectionView

    The sender.

    -
    - - - -
    -

    Return Value

    -

    A node to display for the given item. This will be called on the main thread and should -not implement reuse (it will be called once per item). Unlike UICollectionView’s version, -this method is not called when the item is about to display.

    -
    - - - - - - - - - - - -
    -

    Declared In

    -

    ASCollectionNode.h

    -
    - - -
    -
    -
    - -

    – collectionNode:nodeForSupplementaryElementOfKind:atIndexPath: -

    - -
    -
    - -
    - - -
    -

    Asks the data source to provide a node to display for the given supplementary element in the collection view.

    -
    - - - -
    - (ASCellNode *)collectionNode:(ASCollectionNode *)collectionNode nodeForSupplementaryElementOfKind:(NSString *)kind atIndexPath:(NSIndexPath *)indexPath
    - - - -
    -

    Parameters

    - - - - - - - - - - - - - - - - - -
    collectionNode

    The sender.

    kind

    The kind of supplementary element.

    indexPath

    The index path of the supplementary element.

    -
    - - - - - - - - - - - - - -
    -

    Declared In

    -

    ASCollectionNode.h

    -
    - - -
    -
    -
    - -

    – collectionNode:contextForSection: -

    - -
    -
    - -
    - - -
    -

    Asks the data source to provide a context object for the given section. This object -can later be retrieved by calling @c contextForSection: and is useful when implementing -custom @c UICollectionViewLayout subclasses. The context object is ret

    -
    - - - -
    - (nullable id<ASSectionContext>)collectionNode:(ASCollectionNode *)collectionNode contextForSection:(NSInteger)section
    - - - -
    -

    Parameters

    - - - - - - - - - - - - -
    collectionNode

    The sender.

    section

    The index of the section to provide context for.

    -
    - - - -
    -

    Return Value

    -

    A context object to assign to the given section, or @c nil.

    -
    - - - - - - - - - - - -
    -

    Declared In

    -

    ASCollectionNode.h

    -
    - - -
    -
    -
    - -

    – collectionView:nodeForItemAtIndexPath: -

    - -
    -
    - -
    - - -
    -

    Similar to -collectionView:cellForItemAtIndexPath:.

    -
    - - - -
    - (ASCellNode *)collectionView:(ASCollectionView *)collectionView nodeForItemAtIndexPath:(NSIndexPath *)indexPath
    - - - -
    -

    Parameters

    - - - - - - - - - - - - -
    collectionView

    The sender.

    indexPath

    The index path of the requested node.

    -
    - - - -
    -

    Return Value

    -

    a node for display at this indexpath. This will be called on the main thread and should -not implement reuse (it will be called once per row). Unlike UICollectionView’s version, -this method is not called when the row is about to display.

    -
    - - - - - - - - - - - -
    -

    Declared In

    -

    ASCollectionNode.h

    -
    - - -
    -
    -
    - -

    – collectionView:nodeBlockForItemAtIndexPath: -

    - -
    -
    - -
    - - -
    -

    Similar to -collectionView:nodeForItemAtIndexPath: -This method takes precedence over collectionView:nodeForItemAtIndexPath: if implemented.

    -
    - - - -
    - (ASCellNodeBlock)collectionView:(ASCollectionView *)collectionView nodeBlockForItemAtIndexPath:(NSIndexPath *)indexPath
    - - - -
    -

    Parameters

    - - - - - - - - - - - - -
    collectionView

    The sender.

    indexPath

    The index path of the requested node.

    -
    - - - -
    -

    Return Value

    -

    a block that creates the node for display at this indexpath. -Must be thread-safe (can be called on the main thread or a background -queue) and should not implement reuse (it will be called once per row).

    -
    - - - - - - - - - - - -
    -

    Declared In

    -

    ASCollectionNode.h

    -
    - - -
    -
    -
    - -

    – collectionView:nodeForSupplementaryElementOfKind:atIndexPath: -

    - -
    -
    - -
    - - -
    -

    Asks the collection view to provide a supplementary node to display in the collection view.

    -
    - - - -
    - (ASCellNode *)collectionView:(ASCollectionView *)collectionView nodeForSupplementaryElementOfKind:(NSString *)kind atIndexPath:(NSIndexPath *)indexPath
    - - - -
    -

    Parameters

    - - - - - - - - - - - - - - - - - -
    collectionView

    An object representing the collection view requesting this information.

    kind

    The kind of supplementary node to provide.

    indexPath

    The index path that specifies the location of the new supplementary node.

    -
    - - - - - - - - - - - - - -
    -

    Declared In

    -

    ASCollectionNode.h

    -
    - - -
    -
    -
    - -

    – collectionViewLockDataSource: -

    - -
    -
    - -
    - - -
    -

    Indicator to lock the data source for data fetching in async mode. -We should not update the data source until the data source has been unlocked. Otherwise, it will incur data inconsistency or exception -due to the data access in async mode. (Deprecated: The data source is always accessed on the main thread, and this method will not be called.)

    -
    - - - -
    - (void)collectionViewLockDataSource:(ASCollectionView *)collectionView
    - - - -
    -

    Parameters

    - - - - - - - -
    collectionView

    The sender.

    -
    - - - - - - - - - - - - - -
    -

    Declared In

    -

    ASCollectionNode.h

    -
    - - -
    -
    -
    - -

    – collectionViewUnlockDataSource: -

    - -
    -
    - -
    - - -
    -

    Indicator to unlock the data source for data fetching in async mode. -We should not update the data source until the data source has been unlocked. Otherwise, it will incur data inconsistency or exception -due to the data access in async mode. (Deprecated: The data source is always accessed on the main thread, and this method will not be called.)

    -
    - - - -
    - (void)collectionViewUnlockDataSource:(ASCollectionView *)collectionView
    - - - -
    -

    Parameters

    - - - - - - - -
    collectionView

    The sender.

    -
    - - - - - - - - - - - - - -
    -

    Declared In

    -

    ASCollectionNode.h

    -
    - - -
    -
    -
    -
    - -
    - - - - - - -
    - -
    - -
    -
    -
    -
    - - - - \ No newline at end of file diff --git a/submodules/AsyncDisplayKit/docs/appledoc/Protocols/ASCollectionDelegate.html b/submodules/AsyncDisplayKit/docs/appledoc/Protocols/ASCollectionDelegate.html deleted file mode 100755 index 8b40171190..0000000000 --- a/submodules/AsyncDisplayKit/docs/appledoc/Protocols/ASCollectionDelegate.html +++ /dev/null @@ -1,685 +0,0 @@ - - - - - - ASCollectionDelegate Protocol Reference - - - - - - -
    -
    - -

    - -

    - -

    - AsyncDisplayKit -

    - -
    -
    - - - -
    -
    -
    -
    -

    ASCollectionDelegate Protocol Reference

    - - -
    - - - - - - - -
    Conforms toASCommonCollectionDelegate
    NSObject
    Declared inASCollectionNode.h
    - - - - -
    - -

    Overview

    -

    This is a node-based UICollectionViewDelegate.

    -
    - - - - - -
    - - - - - - -
    -
    - -

    – collectionNode:constrainedSizeForItemAtIndexPath: -

    - -
    -
    - -
    - - -
    -

    Provides the constrained size range for measuring the given item.

    -
    - - - -
    - (ASSizeRange)collectionNode:(ASCollectionNode *)collectionNode constrainedSizeForItemAtIndexPath:(NSIndexPath *)indexPath
    - - - -
    -

    Parameters

    - - - - - - - - - - - - -
    collectionNode

    The sender.

    indexPath

    The index path of the item.

    -
    - - - -
    -

    Return Value

    -

    A constrained size range for layout for the item at this index path.

    -
    - - - - - - - - - - - -
    -

    Declared In

    -

    ASCollectionNode.h

    -
    - - -
    -
    -
    - -

    – collectionNode:willBeginBatchFetchWithContext: -

    - -
    -
    - -
    - - -
    -

    Receive a message that the collection node is near the end of its data set and more data should be fetched if -necessary.

    -
    - - - -
    - (void)collectionNode:(ASCollectionNode *)collectionNode willBeginBatchFetchWithContext:(ASBatchContext *)context
    - - - -
    -

    Parameters

    - - - - - - - - - - - - -
    collectionNode

    The sender.

    context

    A context object that must be notified when the batch fetch is completed.

    -
    - - - - - - - -
    -

    Discussion

    -

    You must eventually call -completeBatchFetching: with an argument of YES in order to receive future -notifications to do batch fetches. This method is called on a background queue.

    - -

    ASCollectionNode currently only supports batch events for tail loads. If you require a head load, consider -implementing a UIRefreshControl.

    -
    - - - - - - - -
    -

    Declared In

    -

    ASCollectionNode.h

    -
    - - -
    -
    -
    - -

    – shouldBatchFetchForCollectionNode: -

    - -
    -
    - -
    - - -
    -

    Tell the collection node if batch fetching should begin.

    -
    - - - -
    - (BOOL)shouldBatchFetchForCollectionNode:(ASCollectionNode *)collectionNode
    - - - -
    -

    Parameters

    - - - - - - - -
    collectionNode

    The sender.

    -
    - - - - - - - -
    -

    Discussion

    -

    Use this method to conditionally fetch batches. Example use cases are: limiting the total number of -objects that can be fetched or no network connection.

    - -

    If not implemented, the collection node assumes that it should notify its asyncDelegate when batch fetching -should occur.

    -
    - - - - - - - -
    -

    Declared In

    -

    ASCollectionNode.h

    -
    - - -
    -
    -
    - -

    – collectionView:constrainedSizeForNodeAtIndexPath: -

    - -
    -
    - -
    - - -
    -

    Provides the constrained size range for measuring the node at the index path.

    -
    - - - -
    - (ASSizeRange)collectionView:(ASCollectionView *)collectionView constrainedSizeForNodeAtIndexPath:(NSIndexPath *)indexPath
    - - - -
    -

    Parameters

    - - - - - - - - - - - - -
    collectionView

    The sender.

    indexPath

    The index path of the node.

    -
    - - - -
    -

    Return Value

    -

    A constrained size range for layout the node at this index path.

    -
    - - - - - - - - - - - -
    -

    Declared In

    -

    ASCollectionNode.h

    -
    - - -
    -
    -
    - -

    – collectionView:willDisplayNode:forItemAtIndexPath: -

    - -
    -
    - -
    - - -
    -

    Informs the delegate that the collection view will add the given node -at the given index path to the view hierarchy.

    -
    - - - -
    - (void)collectionView:(ASCollectionView *)collectionView willDisplayNode:(ASCellNode *)node forItemAtIndexPath:(NSIndexPath *)indexPath
    - - - -
    -

    Parameters

    - - - - - - - - - - - - - - - - - -
    collectionView

    The sender.

    node

    The node that will be displayed.

    indexPath

    The index path of the item that will be displayed.

    -
    - - - - - - - -
    -

    Discussion

    -

    Warning: AsyncDisplayKit processes collection view edits asynchronously. The index path -passed into this method may not correspond to the same item in your data source -if your data source has been updated since the last edit was processed.

    -
    - - - - - - - -
    -

    Declared In

    -

    ASCollectionNode.h

    -
    - - -
    -
    -
    - -

    – collectionView:didEndDisplayingNode:forItemAtIndexPath: -

    - -
    -
    - -
    - - -
    -

    Informs the delegate that the collection view did remove the provided node from the view hierarchy. -This may be caused by the node scrolling out of view, or by deleting the item -or its containing section with @c deleteItemsAtIndexPaths: or @c deleteSections: .

    -
    - - - -
    - (void)collectionView:(ASCollectionView *)collectionView didEndDisplayingNode:(ASCellNode *)node forItemAtIndexPath:(NSIndexPath *)indexPath
    - - - -
    -

    Parameters

    - - - - - - - - - - - - - - - - - -
    collectionView

    The sender.

    node

    The node which was removed from the view hierarchy.

    indexPath

    The index path at which the node was located before it was removed.

    -
    - - - - - - - -
    -

    Discussion

    -

    Warning: AsyncDisplayKit processes collection view edits asynchronously. The index path -passed into this method may not correspond to the same item in your data source -if your data source has been updated since the last edit was processed.

    -
    - - - - - - - -
    -

    Declared In

    -

    ASCollectionNode.h

    -
    - - -
    -
    -
    - -

    – shouldBatchFetchForCollectionView: -

    - -
    -
    - -
    - - -
    -

    Tell the collectionView if batch fetching should begin.

    -
    - - - -
    - (BOOL)shouldBatchFetchForCollectionView:(ASCollectionView *)collectionView
    - - - -
    -

    Parameters

    - - - - - - - -
    collectionView

    The sender.

    -
    - - - - - - - -
    -

    Discussion

    -

    Use this method to conditionally fetch batches. Example use cases are: limiting the total number of -objects that can be fetched or no network connection.

    - -

    If not implemented, the collectionView assumes that it should notify its asyncDelegate when batch fetching -should occur.

    -
    - - - - - - - -
    -

    Declared In

    -

    ASCollectionNode.h

    -
    - - -
    -
    -
    - -

    – collectionView:willDisplayNodeForItemAtIndexPath: -

    - -
    -
    - -
    - - -
    -

    Informs the delegate that the collection view will add the node -at the given index path to the view hierarchy.

    -
    - - - -
    - (void)collectionView:(ASCollectionView *)collectionView willDisplayNodeForItemAtIndexPath:(NSIndexPath *)indexPath
    - - - -
    -

    Parameters

    - - - - - - - - - - - - -
    collectionView

    The sender.

    indexPath

    The index path of the item that will be displayed.

    -
    - - - - - - - -
    -

    Discussion

    -

    Warning: AsyncDisplayKit processes collection view edits asynchronously. The index path -passed into this method may not correspond to the same item in your data source -if your data source has been updated since the last edit was processed.

    - -

    This method is deprecated. Use @c collectionView:willDisplayNode:forItemAtIndexPath: instead.

    -
    - - - - - - - -
    -

    Declared In

    -

    ASCollectionNode.h

    -
    - - -
    -
    -
    -
    - -
    - - - - - - -
    - -
    - -
    -
    -
    -
    - - - - \ No newline at end of file diff --git a/submodules/AsyncDisplayKit/docs/appledoc/Protocols/ASCollectionViewDelegateFlowLayout.html b/submodules/AsyncDisplayKit/docs/appledoc/Protocols/ASCollectionViewDelegateFlowLayout.html deleted file mode 100755 index 2185f480bd..0000000000 --- a/submodules/AsyncDisplayKit/docs/appledoc/Protocols/ASCollectionViewDelegateFlowLayout.html +++ /dev/null @@ -1,286 +0,0 @@ - - - - - - ASCollectionViewDelegateFlowLayout Protocol Reference - - - - - - -
    -
    - -

    - -

    - -

    - AsyncDisplayKit -

    - -
    -
    - - - -
    -
    -
    -
    -

    ASCollectionViewDelegateFlowLayout Protocol Reference

    - - -
    - - - - - - - -
    Conforms toASCollectionDelegate
    Declared inASCollectionView.h
    - - - - -
    - -

    Overview

    -

    Defines methods that let you coordinate with a UICollectionViewFlowLayout in combination with an ASCollectionView.

    -
    - - - - - -
    - - - - - - -
    -
    - -

    – collectionView:layout:insetForSectionAtIndex: -

    - -
    -
    - -
    - - -
    -

    This method is deprecated and does nothing from 1.9.7 and up -Previously it applies the section inset to every cells within the corresponding section. -The expected behavior is to apply the section inset to the whole section rather than -shrinking each cell individually. -If you want this behavior, you can integrate your insets calculation into -constrainedSizeForNodeAtIndexPath -please file a github issue if you would like this to be restored.

    -
    - - - -
    - (UIEdgeInsets)collectionView:(ASCollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout insetForSectionAtIndex:(NSInteger)section
    - - - - - - - - - -
    -

    Discussion

    -

    This method is deprecated and does nothing from 1.9.7 and up -Previously it applies the section inset to every cells within the corresponding section. -The expected behavior is to apply the section inset to the whole section rather than -shrinking each cell individually. -If you want this behavior, you can integrate your insets calculation into -constrainedSizeForNodeAtIndexPath -please file a github issue if you would like this to be restored.

    -
    - - - - - - - -
    -

    Declared In

    -

    ASCollectionView.h

    -
    - - -
    -
    -
    - -

    – collectionView:layout:referenceSizeForHeaderInSection: -

    - -
    -
    - -
    - - -
    -

    Asks the delegate for the size of the header in the specified section.

    -
    - - - -
    - (CGSize)collectionView:(ASCollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout referenceSizeForHeaderInSection:(NSInteger)section
    - - - - - - - - - - - - - - - -
    -

    Declared In

    -

    ASCollectionView.h

    -
    - - -
    -
    -
    - -

    – collectionView:layout:referenceSizeForFooterInSection: -

    - -
    -
    - -
    - - -
    -

    Asks the delegate for the size of the footer in the specified section.

    -
    - - - -
    - (CGSize)collectionView:(ASCollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout referenceSizeForFooterInSection:(NSInteger)section
    - - - - - - - - - - - - - - - -
    -

    Declared In

    -

    ASCollectionView.h

    -
    - - -
    -
    -
    -
    - -
    - - - - - - -
    - -
    - -
    -
    -
    -
    - - - - \ No newline at end of file diff --git a/submodules/AsyncDisplayKit/docs/appledoc/Protocols/ASCollectionViewLayoutFacilitatorProtocol.html b/submodules/AsyncDisplayKit/docs/appledoc/Protocols/ASCollectionViewLayoutFacilitatorProtocol.html deleted file mode 100755 index 946ec7bdcd..0000000000 --- a/submodules/AsyncDisplayKit/docs/appledoc/Protocols/ASCollectionViewLayoutFacilitatorProtocol.html +++ /dev/null @@ -1,308 +0,0 @@ - - - - - - ASCollectionViewLayoutFacilitatorProtocol Protocol Reference - - - - - - -
    -
    - -

    - -

    - -

    - AsyncDisplayKit -

    - -
    -
    - - - -
    -
    -
    -
    -

    ASCollectionViewLayoutFacilitatorProtocol Protocol Reference

    - - -
    - - - - - - - -
    Conforms toNSObject
    Declared inASCollectionViewLayoutFacilitatorProtocol.h
    - - - - -
    - -

    Overview

    -

    This facilitator protocol is intended to help Layout to better -gel with the CollectionView

    -
    - - - - - -
    - - - - - - -
    -
    - -

    – collectionViewWillEditCellsAtIndexPaths:batched: -required method

    - -
    -
    - -
    - - -
    -

    Inform that the collectionView is editing the cells at a list of indexPaths

    -
    - - - -
    - (void)collectionViewWillEditCellsAtIndexPaths:(NSArray *)indexPaths batched:(BOOL)isBatched
    - - - -
    -

    Parameters

    - - - - - - - - - - - - -
    indexPaths

    an array of NSIndexPath objects of cells being/will be edited.

    isBatched

    indicates whether the editing operation will be batched by the collectionView

    - -

    NOTE: when isBatched, used in combination with -collectionViewWillPerformBatchUpdates

    -
    - - - - - - - - - - - - - -
    -

    Declared In

    -

    ASCollectionViewLayoutFacilitatorProtocol.h

    -
    - - -
    -
    -
    - -

    – collectionViewWillEditSectionsAtIndexSet:batched: -required method

    - -
    -
    - -
    - - -
    -

    Inform that the collectionView is editing the sections at a set of indexes

    -
    - - - -
    - (void)collectionViewWillEditSectionsAtIndexSet:(NSIndexSet *)indexes batched:(BOOL)batched
    - - - -
    -

    Parameters

    - - - - - - - - - - - - -
    indexes

    an NSIndexSet of section indexes being/will be edited.

    batched

    indicates whether the editing operation will be batched by the collectionView

    - -

    NOTE: when batched, used in combination with -collectionViewWillPerformBatchUpdates

    -
    - - - - - - - - - - - - - -
    -

    Declared In

    -

    ASCollectionViewLayoutFacilitatorProtocol.h

    -
    - - -
    -
    -
    - -

    – collectionViewWillPerformBatchUpdates -required method

    - -
    -
    - -
    - - -
    -

    Informs the delegate that the collectionView is about to call performBatchUpdates

    -
    - - - -
    - (void)collectionViewWillPerformBatchUpdates
    - - - - - - - - - - - - - - - -
    -

    Declared In

    -

    ASCollectionViewLayoutFacilitatorProtocol.h

    -
    - - -
    -
    -
    -
    - -
    - - - - - - -
    - -
    - -
    -
    -
    -
    - - - - \ No newline at end of file diff --git a/submodules/AsyncDisplayKit/docs/appledoc/Protocols/ASCommonCollectionDataSource.html b/submodules/AsyncDisplayKit/docs/appledoc/Protocols/ASCommonCollectionDataSource.html deleted file mode 100755 index 0fef7a7747..0000000000 --- a/submodules/AsyncDisplayKit/docs/appledoc/Protocols/ASCommonCollectionDataSource.html +++ /dev/null @@ -1,121 +0,0 @@ - - - - - - ASCommonCollectionDataSource Protocol Reference - - - - - - -
    -
    - -

    - -

    - -

    - AsyncDisplayKit -

    - -
    -
    - - - -
    -
    -
    -
    -

    ASCommonCollectionDataSource Protocol Reference

    - - -
    - - - - - - - -
    Conforms toNSObject
    Declared inASCollectionViewProtocols.h
    - - - - -
    - -

    Overview

    -

    This is a subset of UICollectionViewDataSource.

    -
    - - - - - - - - - - -
    - -
    - -
    -
    -
    -
    - - - - \ No newline at end of file diff --git a/submodules/AsyncDisplayKit/docs/appledoc/Protocols/ASCommonCollectionDelegate.html b/submodules/AsyncDisplayKit/docs/appledoc/Protocols/ASCommonCollectionDelegate.html deleted file mode 100755 index 8901487e47..0000000000 --- a/submodules/AsyncDisplayKit/docs/appledoc/Protocols/ASCommonCollectionDelegate.html +++ /dev/null @@ -1,121 +0,0 @@ - - - - - - ASCommonCollectionDelegate Protocol Reference - - - - - - -
    -
    - -

    - -

    - -

    - AsyncDisplayKit -

    - -
    -
    - - - -
    -
    -
    -
    -

    ASCommonCollectionDelegate Protocol Reference

    - - -
    - - - - - - - -
    Conforms toNSObject
    UIScrollViewDelegate
    Declared inASCollectionViewProtocols.h
    - - - - -
    - -

    Overview

    -

    This is a subset of UICollectionViewDelegate.

    -
    - - - - - - - - - - -
    - -
    - -
    -
    -
    -
    - - - - \ No newline at end of file diff --git a/submodules/AsyncDisplayKit/docs/appledoc/Protocols/ASCommonTableDataSource.html b/submodules/AsyncDisplayKit/docs/appledoc/Protocols/ASCommonTableDataSource.html deleted file mode 100755 index 9068e3ecab..0000000000 --- a/submodules/AsyncDisplayKit/docs/appledoc/Protocols/ASCommonTableDataSource.html +++ /dev/null @@ -1,121 +0,0 @@ - - - - - - ASCommonTableDataSource Protocol Reference - - - - - - -
    -
    - -

    - -

    - -

    - AsyncDisplayKit -

    - -
    -
    - - - -
    -
    -
    -
    -

    ASCommonTableDataSource Protocol Reference

    - - -
    - - - - - - - -
    Conforms toNSObject
    Declared inASTableViewProtocols.h
    - - - - -
    - -

    Overview

    -

    This is a subset of UITableViewDataSource.

    -
    - - - - - - - - - - -
    - -
    - -
    -
    -
    -
    - - - - \ No newline at end of file diff --git a/submodules/AsyncDisplayKit/docs/appledoc/Protocols/ASCommonTableViewDelegate.html b/submodules/AsyncDisplayKit/docs/appledoc/Protocols/ASCommonTableViewDelegate.html deleted file mode 100755 index 4032159da3..0000000000 --- a/submodules/AsyncDisplayKit/docs/appledoc/Protocols/ASCommonTableViewDelegate.html +++ /dev/null @@ -1,121 +0,0 @@ - - - - - - ASCommonTableViewDelegate Protocol Reference - - - - - - -
    -
    - -

    - -

    - -

    - AsyncDisplayKit -

    - -
    -
    - - - -
    -
    -
    -
    -

    ASCommonTableViewDelegate Protocol Reference

    - - -
    - - - - - - - -
    Conforms toNSObject
    UIScrollViewDelegate
    Declared inASTableViewProtocols.h
    - - - - -
    - -

    Overview

    -

    This is a subset of UITableViewDelegate.

    -
    - - - - - - - - - - -
    - -
    - -
    -
    -
    -
    - - - - \ No newline at end of file diff --git a/submodules/AsyncDisplayKit/docs/appledoc/Protocols/ASContextTransitioning.html b/submodules/AsyncDisplayKit/docs/appledoc/Protocols/ASContextTransitioning.html deleted file mode 100755 index dde53dd1e5..0000000000 --- a/submodules/AsyncDisplayKit/docs/appledoc/Protocols/ASContextTransitioning.html +++ /dev/null @@ -1,532 +0,0 @@ - - - - - - ASContextTransitioning Protocol Reference - - - - - - -
    -
    - -

    - -

    - -

    - AsyncDisplayKit -

    - -
    -
    - - - -
    -
    -
    -
    -

    ASContextTransitioning Protocol Reference

    - - -
    - - - - - - - -
    Conforms toNSObject
    Declared inASContextTransitioning.h
    - - - - - - -
    - - - - - - -
    -
    - -

    – isAnimated -required method

    - -
    -
    - -
    - - -
    -

    Defines if the given transition is animated

    -
    - - - -
    - (BOOL)isAnimated
    - - - - - - - - - - - - - - - -
    -

    Declared In

    -

    ASContextTransitioning.h

    -
    - - -
    -
    -
    - -

    – layoutForKey: -required method

    - -
    -
    - -
    - - -
    -

    Retrieve either the “from” or “to” layout

    -
    - - - -
    - (nullable ASLayout *)layoutForKey:(NSString *)key
    - - - - - - - - - - - - - - - -
    -

    Declared In

    -

    ASContextTransitioning.h

    -
    - - -
    -
    -
    - -

    – constrainedSizeForKey: -required method

    - -
    -
    - -
    - - -
    -

    Retrieve either the “from” or “to” constrainedSize

    -
    - - - -
    - (ASSizeRange)constrainedSizeForKey:(NSString *)key
    - - - - - - - - - - - - - - - -
    -

    Declared In

    -

    ASContextTransitioning.h

    -
    - - -
    -
    -
    - -

    – subnodesForKey: -required method

    - -
    -
    - -
    - - -
    -

    Retrieve the subnodes from either the “from” or “to” layout

    -
    - - - -
    - (NSArray<ASDisplayNode*> *)subnodesForKey:(NSString *)key
    - - - - - - - - - - - - - - - -
    -

    Declared In

    -

    ASContextTransitioning.h

    -
    - - -
    -
    -
    - -

    – insertedSubnodes -required method

    - -
    -
    - -
    - - -
    -

    Subnodes that have been inserted in the layout transition

    -
    - - - -
    - (NSArray<ASDisplayNode*> *)insertedSubnodes
    - - - - - - - - - - - - - - - -
    -

    Declared In

    -

    ASContextTransitioning.h

    -
    - - -
    -
    -
    - -

    – removedSubnodes -required method

    - -
    -
    - -
    - - -
    -

    Subnodes that will be removed in the layout transition

    -
    - - - -
    - (NSArray<ASDisplayNode*> *)removedSubnodes
    - - - - - - - - - - - - - - - -
    -

    Declared In

    -

    ASContextTransitioning.h

    -
    - - -
    -
    -
    - -

    – initialFrameForNode: -required method

    - -
    -
    - -
    - - -
    -

    The frame for the given node before the transition began.

    -
    - - - -
    - (CGRect)initialFrameForNode:(ASDisplayNode *)node
    - - - - - - - - - -
    -

    Discussion

    -

    Returns CGRectNull if the node was not in the hierarchy before the transition.

    -
    - - - - - - - -
    -

    Declared In

    -

    ASContextTransitioning.h

    -
    - - -
    -
    -
    - -

    – finalFrameForNode: -required method

    - -
    -
    - -
    - - -
    -

    The frame for the given node when the transition completes.

    -
    - - - -
    - (CGRect)finalFrameForNode:(ASDisplayNode *)node
    - - - - - - - - - -
    -

    Discussion

    -

    Returns CGRectNull if the node is no longer in the hierarchy after the transition.

    -
    - - - - - - - -
    -

    Declared In

    -

    ASContextTransitioning.h

    -
    - - -
    -
    -
    - -

    – completeTransition: -required method

    - -
    -
    - -
    - - -
    -

    Invoke this method when the transition is completed in animateLayoutTransition:

    -
    - - - -
    - (void)completeTransition:(BOOL)didComplete
    - - - - - - - - - -
    -

    Discussion

    -

    Passing NO to didComplete will set the original layout as the new layout.

    -
    - - - - - - - -
    -

    Declared In

    -

    ASContextTransitioning.h

    -
    - - -
    -
    -
    -
    - -
    - - - - - - -
    - -
    - -
    -
    -
    -
    - - - - \ No newline at end of file diff --git a/submodules/AsyncDisplayKit/docs/appledoc/Protocols/ASEditableTextNodeDelegate.html b/submodules/AsyncDisplayKit/docs/appledoc/Protocols/ASEditableTextNodeDelegate.html deleted file mode 100755 index 9fed893533..0000000000 --- a/submodules/AsyncDisplayKit/docs/appledoc/Protocols/ASEditableTextNodeDelegate.html +++ /dev/null @@ -1,472 +0,0 @@ - - - - - - ASEditableTextNodeDelegate Protocol Reference - - - - - - -
    -
    - -

    - -

    - -

    - AsyncDisplayKit -

    - -
    -
    - - - -
    -
    -
    -
    -

    ASEditableTextNodeDelegate Protocol Reference

    - - -
    - - - - - - - -
    Conforms toNSObject
    Declared inASEditableTextNode.h
    - - - - -
    - -

    Overview

    -

    The methods declared by the ASEditableTextNodeDelegate protocol allow the adopting delegate to -respond to notifications such as began and finished editing, selection changed and text updated; -and manage whether a specified text should be replaced.

    -
    - - - - - -
    - - - - - - -
    -
    - -

    – editableTextNodeDidBeginEditing: -

    - -
    -
    - -
    - - -
    -

    Indicates to the delegate that the text node began editing.

    -
    - - - -
    - (void)editableTextNodeDidBeginEditing:(ASEditableTextNode *)editableTextNode
    - - - -
    -

    Parameters

    - - - - - - - -
    editableTextNode

    An editable text node.

    -
    - - - - - - - -
    -

    Discussion

    -

    The invocation of this method coincides with the keyboard animating to become visible.

    -
    - - - - - - - -
    -

    Declared In

    -

    ASEditableTextNode.h

    -
    - - -
    -
    -
    - -

    – editableTextNode:shouldChangeTextInRange:replacementText: -

    - -
    -
    - -
    - - -
    -

    Asks the delegate whether the specified text should be replaced in the editable text node.

    -
    - - - -
    - (BOOL)editableTextNode:(ASEditableTextNode *)editableTextNode shouldChangeTextInRange:(NSRange)range replacementText:(NSString *)text
    - - - -
    -

    Parameters

    - - - - - - - - - - - - - - - - - -
    editableTextNode

    An editable text node.

    range

    The current selection range. If the length of the range is 0, range reflects the current insertion point. If the user presses the Delete key, the length of the range is 1 and an empty string object replaces that single character.

    text

    The text to insert.

    -
    - - - -
    -

    Return Value

    -

    The text node calls this method whenever the user types a new character or deletes an existing character. Implementation of this method is optional – the default implementation returns YES.

    -
    - - - - - -
    -

    Discussion

    -

    YES if the old text should be replaced by the new text; NO if the replacement operation should be aborted.

    -
    - - - - - - - -
    -

    Declared In

    -

    ASEditableTextNode.h

    -
    - - -
    -
    -
    - -

    – editableTextNodeDidChangeSelection:fromSelectedRange:toSelectedRange:dueToEditing: -

    - -
    -
    - -
    - - -
    -

    Indicates to the delegate that the text node’s selection has changed.

    -
    - - - -
    - (void)editableTextNodeDidChangeSelection:(ASEditableTextNode *)editableTextNode fromSelectedRange:(NSRange)fromSelectedRange toSelectedRange:(NSRange)toSelectedRange dueToEditing:(BOOL)dueToEditing
    - - - -
    -

    Parameters

    - - - - - - - - - - - - - - - - - - - - - - -
    editableTextNode

    An editable text node.

    fromSelectedRange

    The previously selected range.

    toSelectedRange

    The current selected range. Equivalent to the property.

    dueToEditing

    YES if the selection change was due to editing; NO otherwise.

    -
    - - - - - - - -
    -

    Discussion

    -

    You can access the selection of the receiver via .

    -
    - - - - - - - -
    -

    Declared In

    -

    ASEditableTextNode.h

    -
    - - -
    -
    -
    - -

    – editableTextNodeDidUpdateText: -

    - -
    -
    - -
    - - -
    -

    Indicates to the delegate that the text node’s text was updated.

    -
    - - - -
    - (void)editableTextNodeDidUpdateText:(ASEditableTextNode *)editableTextNode
    - - - -
    -

    Parameters

    - - - - - - - -
    editableTextNode

    An editable text node.

    -
    - - - - - - - -
    -

    Discussion

    -

    This method is called each time the user updated the text node’s text. It is not called for programmatic changes made to the text via the property.

    -
    - - - - - - - -
    -

    Declared In

    -

    ASEditableTextNode.h

    -
    - - -
    -
    -
    - -

    – editableTextNodeDidFinishEditing: -

    - -
    -
    - -
    - - -
    -

    Indicates to the delegate that teh text node has finished editing.

    -
    - - - -
    - (void)editableTextNodeDidFinishEditing:(ASEditableTextNode *)editableTextNode
    - - - -
    -

    Parameters

    - - - - - - - -
    editableTextNode

    An editable text node.

    -
    - - - - - - - -
    -

    Discussion

    -

    The invocation of this method coincides with the keyboard animating to become hidden.

    -
    - - - - - - - -
    -

    Declared In

    -

    ASEditableTextNode.h

    -
    - - -
    -
    -
    -
    - -
    - - - - - - -
    - -
    - -
    -
    -
    -
    - - - - \ No newline at end of file diff --git a/submodules/AsyncDisplayKit/docs/appledoc/Protocols/ASLayoutElement.html b/submodules/AsyncDisplayKit/docs/appledoc/Protocols/ASLayoutElement.html deleted file mode 100755 index fc275151ba..0000000000 --- a/submodules/AsyncDisplayKit/docs/appledoc/Protocols/ASLayoutElement.html +++ /dev/null @@ -1,657 +0,0 @@ - - - - - - ASLayoutElement Protocol Reference - - - - - - -
    -
    - -

    - -

    - -

    - AsyncDisplayKit -

    - -
    -
    - - - -
    -
    -
    -
    -

    ASLayoutElement Protocol Reference

    - - -
    - - - - - - - -
    Conforms toASEnvironment
    ASLayoutElementExtensibility
    ASLayoutElementPrivate
    ASLayoutElementStylability
    NSFastEnumeration
    Declared inASLayoutElement.h
    - - - - -
    - -

    Overview

    -

    The ASLayoutElement protocol declares a method for measuring the layout of an object. A layout -is defined by an ASLayout return value, and must specify 1) the size (but not position) of the -layoutElement object, and 2) the size and position of all of its immediate child objects. The tree -recursion is driven by parents requesting layouts from their children in order to determine their -size, followed by the parents setting the position of the children once the size is known

    - -

    The protocol also implements a “family” of LayoutElement protocols. These protocols contain layout -options that can be used for specific layout specs. For example, ASStackLayoutSpec has options -defining how a layoutElement should shrink or grow based upon available space.

    - -

    These layout options are all stored in an ASLayoutOptions class (that is defined in ASLayoutElementPrivate). -Generally you needn’t worry about the layout options class, as the layoutElement protocols allow all direct -access to the options via convenience properties. If you are creating custom layout spec, then you can -extend the backing layout options class to accommodate any new layout options.

    -
    - - - - - -
    - - - - - - -
    -
    - -

      layoutElementType -required method

    - -
    -
    - -
    - - -
    -

    Returns type of layoutElement

    -
    - - - -
    @property (nonatomic, assign, readonly) ASLayoutElementType layoutElementType
    - - - - - - - - - - - - - - - -
    -

    Declared In

    -

    ASLayoutElement.h

    -
    - - -
    -
    -
    - -

      canLayoutAsynchronous -required method

    - -
    -
    - -
    - - -
    -

    Returns if the layoutElement can be used to layout in an asynchronous way on a background thread.

    -
    - - - -
    @property (nonatomic, assign, readonly) BOOL canLayoutAsynchronous
    - - - - - - - - - - - - - - - -
    -

    Declared In

    -

    ASLayoutElement.h

    -
    - - -
    -
    -
    - -

      style -required method

    - -
    -
    - -
    - - -
    -

    A size constraint that should apply to this ASLayoutElement.

    -
    - - - -
    @property (nonatomic, assign, readonly) ASLayoutElementStyle *style
    - - - - - - - - - - - - - - - -
    -

    Declared In

    -

    ASLayoutElement.h

    -
    - - -
    -
    -
    - -

      debugName -required method

    - -
    -
    - -
    - - -
    -

    Optional name that is printed by ascii art string and displayed in description.

    -
    - - - -
    @property (nullable, nonatomic, copy) NSString *debugName
    - - - - - - - - - - - - - - - -
    -

    Declared In

    -

    ASLayoutElement.h

    -
    - - -
    -
    -
    - -

    – layoutThatFits: -required method

    - -
    -
    - -
    - - -
    -

    Asks the node to return a layout based on given size range.

    -
    - - - -
    - (ASLayout *)layoutThatFits:(ASSizeRange)constrainedSize
    - - - -
    -

    Parameters

    - - - - - - - -
    constrainedSize

    The minimum and maximum sizes the receiver should fit in.

    -
    - - - -
    -

    Return Value

    -

    An ASLayout instance defining the layout of the receiver (and its children, if the box layout model is used).

    -
    - - - - - -
    -

    Discussion

    -

    Though this method does not set the bounds of the view, it does have side effects–caching both the -constraint and the result.

    Warning: Subclasses must not override this; it caches results from -calculateLayoutThatFits:. Calling this method may -be expensive if result is not cached.

    -
    - - - - - - - - - -
    -

    Declared In

    -

    ASLayoutElement.h

    -
    - - -
    -
    -
    - -

    – layoutThatFits:parentSize: -required method

    - -
    -
    - -
    - - -
    -

    Call this on children layoutElements to compute their layouts within your implementation of -calculateLayoutThatFits:.

    -
    - - - -
    - (ASLayout *)layoutThatFits:(ASSizeRange)constrainedSize parentSize:(CGSize)parentSize
    - - - -
    -

    Parameters

    - - - - - - - - - - - - -
    constrainedSize

    Specifies a minimum and maximum size. The receiver must choose a size that is in this range.

    parentSize

    The parent node’s size. If the parent component does not have a final size in a given dimension, -then it should be passed as ASLayoutElementParentDimensionUndefined (for example, if the parent’s width -depends on the child’s size).

    -
    - - - -
    -

    Return Value

    -

    An ASLayout instance defining the layout of the receiver (and its children, if the box layout model is used).

    -
    - - - - - -
    -

    Discussion

    -

    Warning: You may not override this method. Override -calculateLayoutThatFits: instead.

    Warning: In almost all cases, prefer the use of ASCalculateLayout in ASLayout

    Though this method does not set the bounds of the view, it does have side effects–caching both the -constraint and the result.

    -
    - - - - - - - -
    -

    Declared In

    -

    ASLayoutElement.h

    -
    - - -
    -
    -
    - -

    – calculateLayoutThatFits: -required method

    - -
    -
    - -
    - - -
    -

    Override this method to compute your layoutElement’s layout.

    -
    - - - -
    - (ASLayout *)calculateLayoutThatFits:(ASSizeRange)constrainedSize
    - - - -
    -

    Parameters

    - - - - - - - -
    constrainedSize

    A min and max size. This is computed as described in the description. The ASLayout you -return MUST have a size between these two sizes.

    -
    - - - - - - - -
    -

    Discussion

    -

    Why do you need to override -calculateLayoutThatFits: instead of -layoutThatFits:parentSize:? -The base implementation of -layoutThatFits:parentSize: does the following for you: -1. First, it uses the parentSize parameter to resolve the nodes’s size (the one assigned to the size property). -2. Then, it intersects the resolved size with the constrainedSize parameter. If the two don’t intersect, -constrainedSize wins. This allows a component to always override its childrens' sizes when computing its layout. -(The analogy for UIView: you might return a certain size from -sizeThatFits:, but a parent view can always override -that size and set your frame to any size.) -3. It caches it result for reuse

    -
    - - - - - - - -
    -

    Declared In

    -

    ASLayoutElement.h

    -
    - - -
    -
    -
    - -

    – calculateLayoutThatFits:restrictedToSize:relativeToParentSize: -required method

    - -
    -
    - -
    - - -
    -

    In certain advanced cases, you may want to override this method. Overriding this method allows you to receive the -layoutElement’s size, parentSize, and constrained size. With these values you could calculate the final constrained size -and call -calculateLayoutThatFits: with the result.

    -
    - - - -
    - (ASLayout *)calculateLayoutThatFits:(ASSizeRange)constrainedSize restrictedToSize:(ASLayoutElementSize)size relativeToParentSize:(CGSize)parentSize
    - - - - - - - - - -
    -

    Discussion

    -

    Warning: Overriding this method should be done VERY rarely.

    -
    - - - - - - - -
    -

    Declared In

    -

    ASLayoutElement.h

    -
    - - -
    -
    -
    - -

    – measureWithSizeRange: -required method

    - -
    -
    - -
    - - -
    -

    Calculate a layout based on given size range. (Deprecated: Deprecated in version 2.0: Use layoutThatFits: or layoutThatFits:parentSize: if used in -ASLayoutSpec subclasses)

    -
    - - - -
    - (nonnull ASLayout *)measureWithSizeRange:(ASSizeRange)constrainedSize
    - - - -
    -

    Parameters

    - - - - - - - -
    constrainedSize

    The minimum and maximum sizes the receiver should fit in.

    -
    - - - -
    -

    Return Value

    -

    An ASLayout instance defining the layout of the receiver and its children.

    -
    - - - - - - - - - - - -
    -

    Declared In

    -

    ASLayoutElement.h

    -
    - - -
    -
    -
    -
    - -
    - - - - - - -
    - -
    - -
    -
    -
    -
    - - - - \ No newline at end of file diff --git a/submodules/AsyncDisplayKit/docs/appledoc/Protocols/ASLayoutElementAsciiArtProtocol.html b/submodules/AsyncDisplayKit/docs/appledoc/Protocols/ASLayoutElementAsciiArtProtocol.html deleted file mode 100755 index c17c1fe76c..0000000000 --- a/submodules/AsyncDisplayKit/docs/appledoc/Protocols/ASLayoutElementAsciiArtProtocol.html +++ /dev/null @@ -1,225 +0,0 @@ - - - - - - ASLayoutElementAsciiArtProtocol Protocol Reference - - - - - - -
    -
    - -

    - -

    - -

    - AsyncDisplayKit -

    - -
    -
    - - - -
    -
    -
    -
    -

    ASLayoutElementAsciiArtProtocol Protocol Reference

    - - -
    - - - - - - - -
    Conforms toNSObject
    Declared inASAsciiArtBoxCreator.h
    - - - - - - -
    - - - - - - -
    -
    - -

    – asciiArtString -required method

    - -
    -
    - -
    - - -
    -

    Returns an ascii-art representation of this object and its children. -For example, an ASInsetSpec may return something like this:

    -
    - - - -
    - (NSString *)asciiArtString
    - - - - - - - - - -
    -

    Discussion

    -

    –ASInsetLayoutSpec–

    - -

    | ASTextNode |

    -
    - - - - - - - -
    -

    Declared In

    -

    ASAsciiArtBoxCreator.h

    -
    - - -
    -
    -
    - -

    – asciiArtName -required method

    - -
    -
    - -
    - - -
    -

    returns the name of this object that will display in the ascii art. Usually this can -simply be NSStringFromClass([self class]).

    -
    - - - -
    - (NSString *)asciiArtName
    - - - - - - - - - - - - - - - -
    -

    Declared In

    -

    ASAsciiArtBoxCreator.h

    -
    - - -
    -
    -
    -
    - -
    - - - - - - -
    - -
    - -
    -
    -
    -
    - - - - \ No newline at end of file diff --git a/submodules/AsyncDisplayKit/docs/appledoc/Protocols/ASLayoutElementPrivate.html b/submodules/AsyncDisplayKit/docs/appledoc/Protocols/ASLayoutElementPrivate.html deleted file mode 100755 index 01647a4d78..0000000000 --- a/submodules/AsyncDisplayKit/docs/appledoc/Protocols/ASLayoutElementPrivate.html +++ /dev/null @@ -1,243 +0,0 @@ - - - - - - ASLayoutElementPrivate Protocol Reference - - - - - - -
    -
    - -

    - -

    - -

    - AsyncDisplayKit -

    - -
    -
    - - - -
    -
    -
    -
    -

    ASLayoutElementPrivate Protocol Reference

    - - -
    - - - - - - - -
    Conforms toNSObject
    Declared inASLayoutElementPrivate.h
    - - - - -
    - -

    Overview

    -

    The base protocol for ASLayoutElement. Generally the methods/properties in this class do not need to be -called by the end user and are only called internally. However, there may be a case where the methods are useful.

    -
    - - - - - -
    - - - - - - -
    -
    - -

    – finalLayoutElement -required method

    - -
    -
    - -
    - - -
    -

    This method can be used to give the user a chance to wrap an ASLayoutElement in an ASLayoutSpec -just before it is added to a parent ASLayoutSpec. For example, if you wanted an ASTextNode that was always -inside of an ASInsetLayoutSpec, you could subclass ASTextNode and implement finalLayoutElement so that it wraps -itself in an inset spec.

    - -

    Note that any ASLayoutElement other than self that is returned MUST set isFinalLayoutElement to YES. Make sure -to do this BEFORE adding a child to the ASLayoutElement.

    -
    - - - -
    - (id<ASLayoutElement>)finalLayoutElement
    - - - - - -
    -

    Return Value

    -

    The layoutElement that will be added to the parent layout spec. Defaults to self.

    -
    - - - - - - - - - - - -
    -

    Declared In

    -

    ASLayoutElementPrivate.h

    -
    - - -
    -
    -
    - -

      isFinalLayoutElement -required method

    - -
    -
    - -
    - - -
    -

    A flag to indicate that this ASLayoutElement was created in finalLayoutElement. This MUST be set to YES -before adding a child to this layoutElement.

    -
    - - - -
    @property (nonatomic, assign) BOOL isFinalLayoutElement
    - - - - - - - - - - - - - - - -
    -

    Declared In

    -

    ASLayoutElementPrivate.h

    -
    - - -
    -
    -
    -
    - -
    - - - - - - -
    - -
    - -
    -
    -
    -
    - - - - \ No newline at end of file diff --git a/submodules/AsyncDisplayKit/docs/appledoc/Protocols/ASManagesChildVisibilityDepth.html b/submodules/AsyncDisplayKit/docs/appledoc/Protocols/ASManagesChildVisibilityDepth.html deleted file mode 100755 index 817097a2bd..0000000000 --- a/submodules/AsyncDisplayKit/docs/appledoc/Protocols/ASManagesChildVisibilityDepth.html +++ /dev/null @@ -1,200 +0,0 @@ - - - - - - ASManagesChildVisibilityDepth Protocol Reference - - - - - - -
    -
    - -

    - -

    - -

    - AsyncDisplayKit -

    - -
    -
    - - - -
    -
    -
    -
    -

    ASManagesChildVisibilityDepth Protocol Reference

    - - -
    - - - - - - - -
    Conforms toASVisibilityDepth
    Declared inASVisibilityProtocols.h
    - - - - -
    - -

    Overview

    -

    ASManagesChildVisibilityDepth

    A protocol which should be implemented by container view controllers to allow proper -propagation of visibility depth

    -
    - - - - - -
    - - - - - - -
    -
    - -

    – visibilityDepthOfChildViewController: -required method

    - -
    -
    - -
    - - -
    -

    Container view controllers should adopt this protocol to indicate that they will manage their child’s -visibilityDepth. For example, ASNavigationController adopts this protocol and manages its childrens visibility -depth.

    - -

    If you adopt this protocol, you must also emit visibilityDepthDidChange messages to child view controllers.

    -
    - - - -
    - (NSInteger)visibilityDepthOfChildViewController:(UIViewController *)childViewController
    - - - -
    -

    Parameters

    - - - - - - - -
    childViewController

    Expected to return the visibility depth of the child view controller.

    -
    - - - - - - - - - - - - - -
    -

    Declared In

    -

    ASVisibilityProtocols.h

    -
    - - -
    -
    -
    -
    - -
    - - - - - - -
    - -
    - -
    -
    -
    -
    - - - - \ No newline at end of file diff --git a/submodules/AsyncDisplayKit/docs/appledoc/Protocols/ASMultiplexImageNodeDataSource.html b/submodules/AsyncDisplayKit/docs/appledoc/Protocols/ASMultiplexImageNodeDataSource.html deleted file mode 100755 index b979e068fd..0000000000 --- a/submodules/AsyncDisplayKit/docs/appledoc/Protocols/ASMultiplexImageNodeDataSource.html +++ /dev/null @@ -1,364 +0,0 @@ - - - - - - ASMultiplexImageNodeDataSource Protocol Reference - - - - - - -
    -
    - -

    - -

    - -

    - AsyncDisplayKit -

    - -
    -
    - - - -
    -
    -
    -
    -

    ASMultiplexImageNodeDataSource Protocol Reference

    - - -
    - - - - - - - -
    Conforms toNSObject
    Declared inASMultiplexImageNode.h
    - - - - -
    - -

    Overview

    -

    The ASMultiplexImageNodeDataSource protocol is adopted by an object that provides the multiplex image node, -for each image identifier, an image or a URL the image node should load.

    -
    - - - - - -
    - - - - - - -
    -
    - -

    – multiplexImageNode:imageForImageIdentifier: -

    - -
    -
    - -
    - - -
    -

    An image for the specified identifier.

    -
    - - - -
    - (nullable UIImage *)multiplexImageNode:(ASMultiplexImageNode *)imageNode imageForImageIdentifier:(ASImageIdentifier)imageIdentifier
    - - - -
    -

    Parameters

    - - - - - - - - - - - - -
    imageNode

    The sender.

    imageIdentifier

    The identifier for the image that should be returned.

    -
    - - - -
    -

    Return Value

    -

    A UIImage corresponding to imageIdentifier, or nil if none is available.

    -
    - - - - - -
    -

    Discussion

    -

    If the image is already available to the data source, this method should be used in lieu of providing the -URL to the image via -multiplexImageNode:URLForImageIdentifier:.

    -
    - - - - - - - -
    -

    Declared In

    -

    ASMultiplexImageNode.h

    -
    - - -
    -
    -
    - -

    – multiplexImageNode:URLForImageIdentifier: -

    - -
    -
    - -
    - - -
    -

    An image URL for the specified identifier.

    -
    - - - -
    - (nullable NSURL *)multiplexImageNode:(ASMultiplexImageNode *)imageNode URLForImageIdentifier:(ASImageIdentifier)imageIdentifier
    - - - -
    -

    Parameters

    - - - - - - - - - - - - -
    imageNode

    The sender.

    imageIdentifier

    The identifier for the image that will be downloaded.

    -
    - - - -
    -

    Return Value

    -

    An NSURL for the image identified by imageIdentifier, or nil if none is available.

    -
    - - - - - -
    -

    Discussion

    -

    Supported URLs include HTTP, HTTPS, AssetsLibrary, and FTP URLs as well as Photos framework URLs (see note).

    - -

    If the image is already available to the data source, it should be provided via [ASMultiplexImageNodeDataSource multiplexImageNode:imageForImageIdentifier:] instead.

    -
    - - - - - -
    -

    See Also

    -
      - -
    • [NSURL URLWithAssetLocalIdentifier:targetSize:contentMode:options:] below.

    • - -
    -
    - - - -
    -

    Declared In

    -

    ASMultiplexImageNode.h

    -
    - - -
    -
    -
    - -

    – multiplexImageNode:assetForLocalIdentifier: -

    - -
    -
    - -
    - - -
    -

    A PHAsset for the specific asset local identifier

    -
    - - - -
    - (nullable PHAsset *)multiplexImageNode:(ASMultiplexImageNode *)imageNode assetForLocalIdentifier:(NSString *)assetLocalIdentifier
    - - - -
    -

    Parameters

    - - - - - - - - - - - - -
    imageNode

    The sender.

    assetLocalIdentifier

    The local identifier for a PHAsset that this image node is loading.

    -
    - - - -
    -

    Return Value

    -

    A PHAsset corresponding to assetLocalIdentifier, or nil if none is available.

    -
    - - - - - -
    -

    Discussion

    -

    This optional method can improve image performance if your data source already has the PHAsset available. -If this method is not implemented, or returns nil, the image node will request the asset from the Photos framework.

    Note: This method may be called from any thread.

    -
    - - - - - - - -
    -

    Declared In

    -

    ASMultiplexImageNode.h

    -
    - - -
    -
    -
    -
    - -
    - - - - - - -
    - -
    - -
    -
    -
    -
    - - - - \ No newline at end of file diff --git a/submodules/AsyncDisplayKit/docs/appledoc/Protocols/ASMultiplexImageNodeDelegate.html b/submodules/AsyncDisplayKit/docs/appledoc/Protocols/ASMultiplexImageNodeDelegate.html deleted file mode 100755 index 100ffd6038..0000000000 --- a/submodules/AsyncDisplayKit/docs/appledoc/Protocols/ASMultiplexImageNodeDelegate.html +++ /dev/null @@ -1,550 +0,0 @@ - - - - - - ASMultiplexImageNodeDelegate Protocol Reference - - - - - - -
    -
    - -

    - -

    - -

    - AsyncDisplayKit -

    - -
    -
    - - - -
    -
    -
    -
    -

    ASMultiplexImageNodeDelegate Protocol Reference

    - - -
    - - - - - - - -
    Conforms toNSObject
    Declared inASMultiplexImageNode.h
    - - - - -
    - -

    Overview

    -

    The methods declared by the ASMultiplexImageNodeDelegate protocol allow the adopting delegate to respond to -notifications such as began, progressed and finished downloading, updated and displayed an image.

    -
    - - - - - -
    - - - - - - -
    -
    - -

    – multiplexImageNode:didStartDownloadOfImageWithIdentifier: -

    - -
    -
    - -
    - - -
    -

    Notification that the image node began downloading an image.

    -
    - - - -
    - (void)multiplexImageNode:(ASMultiplexImageNode *)imageNode didStartDownloadOfImageWithIdentifier:(id)imageIdentifier
    - - - -
    -

    Parameters

    - - - - - - - - - - - - -
    imageNode

    The sender.

    imageIdentifier

    The identifier for the image that is downloading.

    -
    - - - - - - - - - - - - - -
    -

    Declared In

    -

    ASMultiplexImageNode.h

    -
    - - -
    -
    -
    - -

    – multiplexImageNode:didUpdateDownloadProgress:forImageWithIdentifier: -

    - -
    -
    - -
    - - -
    -

    Notification that the image node’s download progressed.

    -
    - - - -
    - (void)multiplexImageNode:(ASMultiplexImageNode *)imageNode didUpdateDownloadProgress:(CGFloat)downloadProgress forImageWithIdentifier:(ASImageIdentifier)imageIdentifier
    - - - -
    -

    Parameters

    - - - - - - - - - - - - - - - - - -
    imageNode

    The sender.

    downloadProgress

    The progress of the download. Value is between 0.0 and 1.0.

    imageIdentifier

    The identifier for the image that is downloading.

    -
    - - - - - - - - - - - - - -
    -

    Declared In

    -

    ASMultiplexImageNode.h

    -
    - - -
    -
    -
    - -

    – multiplexImageNode:didFinishDownloadingImageWithIdentifier:error: -

    - -
    -
    - -
    - - -
    -

    Notification that the image node’s download has finished.

    -
    - - - -
    - (void)multiplexImageNode:(ASMultiplexImageNode *)imageNode didFinishDownloadingImageWithIdentifier:(ASImageIdentifier)imageIdentifier error:(nullable NSError *)error
    - - - -
    -

    Parameters

    - - - - - - - - - - - - - - - - - -
    imageNode

    The sender.

    imageIdentifier

    The identifier for the image that finished downloading.

    error

    The error that occurred while downloading, if one occurred; nil otherwise.

    -
    - - - - - - - - - - - - - -
    -

    Declared In

    -

    ASMultiplexImageNode.h

    -
    - - -
    -
    -
    - -

    – multiplexImageNode:didUpdateImage:withIdentifier:fromImage:withIdentifier: -

    - -
    -
    - -
    - - -
    -

    Notification that the image node’s image was updated.

    -
    - - - -
    - (void)multiplexImageNode:(ASMultiplexImageNode *)imageNode didUpdateImage:(nullable UIImage *)image withIdentifier:(nullable ASImageIdentifier)imageIdentifier fromImage:(nullable UIImage *)previousImage withIdentifier:(nullable ASImageIdentifier)previousImageIdentifier
    - - - -
    -

    Parameters

    - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    imageNode

    The sender.

    image

    The new image, ready for display.

    imageIdentifier

    The identifier for image.

    previousImage

    The old, previously-loaded image.

    previousImageIdentifier

    The identifier for previousImage.

    -
    - - - - - - - -
    -

    Discussion

    -

    Note: This method does not indicate that image has been displayed.

    -
    - - - - - - - - - -
    -

    Declared In

    -

    ASMultiplexImageNode.h

    -
    - - -
    -
    -
    - -

    – multiplexImageNode:didDisplayUpdatedImage:withIdentifier: -

    - -
    -
    - -
    - - -
    -

    Notification that the image node displayed a new image.

    -
    - - - -
    - (void)multiplexImageNode:(ASMultiplexImageNode *)imageNode didDisplayUpdatedImage:(nullable UIImage *)image withIdentifier:(nullable ASImageIdentifier)imageIdentifier
    - - - -
    -

    Parameters

    - - - - - - - - - - - - - - - - - -
    imageNode

    The sender.

    image

    The new image, now being displayed.

    imageIdentifier

    The identifier for image.

    -
    - - - - - - - -
    -

    Discussion

    -

    This method is only called when image changes, and not on subsequent redisplays of the same image.

    -
    - - - - - - - -
    -

    Declared In

    -

    ASMultiplexImageNode.h

    -
    - - -
    -
    -
    - -

    – multiplexImageNodeDidFinishDisplay: -

    - -
    -
    - -
    - - -
    -

    Notification that the image node finished displaying an image.

    -
    - - - -
    - (void)multiplexImageNodeDidFinishDisplay:(ASMultiplexImageNode *)imageNode
    - - - -
    -

    Parameters

    - - - - - - - -
    imageNode

    The sender.

    -
    - - - - - - - -
    -

    Discussion

    -

    This method is called every time an image is displayed, whether or not it has changed.

    -
    - - - - - - - -
    -

    Declared In

    -

    ASMultiplexImageNode.h

    -
    - - -
    -
    -
    -
    - -
    - - - - - - -
    - -
    - -
    -
    -
    -
    - - - - \ No newline at end of file diff --git a/submodules/AsyncDisplayKit/docs/appledoc/Protocols/ASNetworkImageNodeDelegate.html b/submodules/AsyncDisplayKit/docs/appledoc/Protocols/ASNetworkImageNodeDelegate.html deleted file mode 100755 index 993331c3f7..0000000000 --- a/submodules/AsyncDisplayKit/docs/appledoc/Protocols/ASNetworkImageNodeDelegate.html +++ /dev/null @@ -1,386 +0,0 @@ - - - - - - ASNetworkImageNodeDelegate Protocol Reference - - - - - - -
    -
    - -

    - -

    - -

    - AsyncDisplayKit -

    - -
    -
    - - - -
    -
    -
    -
    -

    ASNetworkImageNodeDelegate Protocol Reference

    - - -
    - - - - - - - -
    Conforms toNSObject
    Declared inASNetworkImageNode.h
    - - - - -
    - -

    Overview

    -

    The methods declared by the ASNetworkImageNodeDelegate protocol allow the adopting delegate to respond to -notifications such as finished decoding and downloading an image.

    -
    - - - - - -
    - - - - - - -
    -
    - -

    – imageNode:didLoadImage: -

    - -
    -
    - -
    - - -
    -

    Notification that the image node finished downloading an image.

    -
    - - - -
    - (void)imageNode:(ASNetworkImageNode *)imageNode didLoadImage:(UIImage *)image
    - - - -
    -

    Parameters

    - - - - - - - - - - - - -
    imageNode

    The sender.

    image

    The newly-loaded image.

    -
    - - - - - - - -
    -

    Discussion

    -

    Called on a background queue.

    -
    - - - - - - - -
    -

    Declared In

    -

    ASNetworkImageNode.h

    -
    - - -
    -
    -
    - -

    – imageNodeDidStartFetchingData: -

    - -
    -
    - -
    - - -
    -

    Notification that the image node started to load

    -
    - - - -
    - (void)imageNodeDidStartFetchingData:(ASNetworkImageNode *)imageNode
    - - - -
    -

    Parameters

    - - - - - - - -
    imageNode

    The sender.

    -
    - - - - - - - -
    -

    Discussion

    -

    Called on a background queue.

    -
    - - - - - - - -
    -

    Declared In

    -

    ASNetworkImageNode.h

    -
    - - -
    -
    -
    - -

    – imageNode:didFailWithError: -

    - -
    -
    - -
    - - -
    -

    Notification that the image node failed to download the image.

    -
    - - - -
    - (void)imageNode:(ASNetworkImageNode *)imageNode didFailWithError:(NSError *)error
    - - - -
    -

    Parameters

    - - - - - - - - - - - - -
    imageNode

    The sender.

    error

    The error with details.

    -
    - - - - - - - -
    -

    Discussion

    -

    Called on a background queue.

    -
    - - - - - - - -
    -

    Declared In

    -

    ASNetworkImageNode.h

    -
    - - -
    -
    -
    - -

    – imageNodeDidFinishDecoding: -

    - -
    -
    - -
    - - -
    -

    Notification that the image node finished decoding an image.

    -
    - - - -
    - (void)imageNodeDidFinishDecoding:(ASNetworkImageNode *)imageNode
    - - - -
    -

    Parameters

    - - - - - - - -
    imageNode

    The sender.

    -
    - - - - - - - - - - - - - -
    -

    Declared In

    -

    ASNetworkImageNode.h

    -
    - - -
    -
    -
    -
    - -
    - - - - - - -
    - -
    - -
    -
    -
    -
    - - - - \ No newline at end of file diff --git a/submodules/AsyncDisplayKit/docs/appledoc/Protocols/ASPagerDataSource.html b/submodules/AsyncDisplayKit/docs/appledoc/Protocols/ASPagerDataSource.html deleted file mode 100755 index 6cea3bee54..0000000000 --- a/submodules/AsyncDisplayKit/docs/appledoc/Protocols/ASPagerDataSource.html +++ /dev/null @@ -1,325 +0,0 @@ - - - - - - ASPagerDataSource Protocol Reference - - - - - - -
    -
    - -

    - -

    - -

    - AsyncDisplayKit -

    - -
    -
    - - - -
    -
    -
    -
    -

    ASPagerDataSource Protocol Reference

    - - -
    - - - - - - - -
    Conforms toNSObject
    Declared inASPagerNode.h
    - - - - - - -
    - - - - - - -
    -
    - -

    – numberOfPagesInPagerNode: -required method

    - -
    -
    - -
    - - -
    -

    This method replaces -collectionView:numberOfItemsInSection:

    -
    - - - -
    - (NSInteger)numberOfPagesInPagerNode:(ASPagerNode *)pagerNode
    - - - -
    -

    Parameters

    - - - - - - - -
    pagerNode

    The sender.

    -
    - - - -
    -

    Return Value

    -

    The total number of pages that can display in the pagerNode.

    -
    - - - - - - - - - - - -
    -

    Declared In

    -

    ASPagerNode.h

    -
    - - -
    -
    -
    - -

    – pagerNode:nodeAtIndex: -

    - -
    -
    - -
    - - -
    -

    This method replaces -collectionView:nodeForItemAtIndexPath:

    -
    - - - -
    - (ASCellNode *)pagerNode:(ASPagerNode *)pagerNode nodeAtIndex:(NSInteger)index
    - - - -
    -

    Parameters

    - - - - - - - - - - - - -
    pagerNode

    The sender.

    index

    The index of the requested node.

    -
    - - - -
    -

    Return Value

    -

    a node for display at this index. This will be called on the main thread and should -not implement reuse (it will be called once per row). Unlike UICollectionView’s version, -this method is not called when the row is about to display.

    -
    - - - - - - - - - - - -
    -

    Declared In

    -

    ASPagerNode.h

    -
    - - -
    -
    -
    - -

    – pagerNode:nodeBlockAtIndex: -

    - -
    -
    - -
    - - -
    -

    This method replaces -collectionView:nodeBlockForItemAtIndexPath: -This method takes precedence over pagerNode:nodeAtIndex: if implemented.

    -
    - - - -
    - (ASCellNodeBlock)pagerNode:(ASPagerNode *)pagerNode nodeBlockAtIndex:(NSInteger)index
    - - - -
    -

    Parameters

    - - - - - - - - - - - - -
    pagerNode

    The sender.

    index

    The index of the requested node.

    -
    - - - -
    -

    Return Value

    -

    a block that creates the node for display at this index. -Must be thread-safe (can be called on the main thread or a background -queue) and should not implement reuse (it will be called once per row).

    -
    - - - - - - - - - - - -
    -

    Declared In

    -

    ASPagerNode.h

    -
    - - -
    -
    -
    -
    - -
    - - - - - - -
    - -
    - -
    -
    -
    -
    - - - - \ No newline at end of file diff --git a/submodules/AsyncDisplayKit/docs/appledoc/Protocols/ASPagerDelegate.html b/submodules/AsyncDisplayKit/docs/appledoc/Protocols/ASPagerDelegate.html deleted file mode 100755 index 6f7e47f1f7..0000000000 --- a/submodules/AsyncDisplayKit/docs/appledoc/Protocols/ASPagerDelegate.html +++ /dev/null @@ -1,195 +0,0 @@ - - - - - - ASPagerDelegate Protocol Reference - - - - - - -
    -
    - -

    - -

    - -

    - AsyncDisplayKit -

    - -
    -
    - - - -
    -
    -
    -
    -

    ASPagerDelegate Protocol Reference

    - - -
    - - - - - - - -
    Conforms toASCollectionDelegate
    Declared inASPagerNode.h
    - - - - - - -
    - - - - - - -
    -
    - -

    – pagerNode:constrainedSizeForNodeAtIndex: -

    - -
    -
    - -
    - - -
    -

    Provides the constrained size range for measuring the node at the index.

    -
    - - - -
    - (ASSizeRange)pagerNode:(ASPagerNode *)pagerNode constrainedSizeForNodeAtIndex:(NSInteger)index
    - - - -
    -

    Parameters

    - - - - - - - - - - - - -
    pagerNode

    The sender.

    index

    The index of the node.

    -
    - - - -
    -

    Return Value

    -

    A constrained size range for layout the node at this index.

    -
    - - - - - - - - - - - -
    -

    Declared In

    -

    ASPagerNode.h

    -
    - - -
    -
    -
    -
    - -
    - - - - - - -
    - -
    - -
    -
    -
    -
    - - - - \ No newline at end of file diff --git a/submodules/AsyncDisplayKit/docs/appledoc/Protocols/ASRangeControllerDataSource.html b/submodules/AsyncDisplayKit/docs/appledoc/Protocols/ASRangeControllerDataSource.html deleted file mode 100755 index 2aa1157e93..0000000000 --- a/submodules/AsyncDisplayKit/docs/appledoc/Protocols/ASRangeControllerDataSource.html +++ /dev/null @@ -1,385 +0,0 @@ - - - - - - ASRangeControllerDataSource Protocol Reference - - - - - - -
    -
    - -

    - -

    - -

    - AsyncDisplayKit -

    - -
    -
    - - - -
    -
    -
    -
    -

    ASRangeControllerDataSource Protocol Reference

    - - -
    - - - - - - - -
    Conforms toNSObject
    Declared inASRangeController.h
    - - - - -
    - -

    Overview

    -

    Data source for ASRangeController.

    - -

    Allows the range controller to perform external queries on the range. -Ex. range nodes, visible index paths, and viewport size.

    -
    - - - - - -
    - - - - - - -
    -
    - -

    – visibleNodeIndexPathsForRangeController: -required method

    - -
    -
    - -
    - - -
    -

    Sender.

    -
    - - - -
    - (NSArray<NSIndexPath*> *)visibleNodeIndexPathsForRangeController:(ASRangeController *)rangeController
    - - - -
    -

    Parameters

    - - - - - - - -
    rangeController

    Sender.

    -
    - - - -
    -

    Return Value

    -

    an array of index paths corresponding to the nodes currently visible onscreen (i.e., the visible range).

    -
    - - - - - - - - - - - -
    -

    Declared In

    -

    ASRangeController.h

    -
    - - -
    -
    -
    - -

    – scrollDirectionForRangeController: -required method

    - -
    -
    - -
    - - -
    -

    Sender.

    -
    - - - -
    - (ASScrollDirection)scrollDirectionForRangeController:(ASRangeController *)rangeController
    - - - -
    -

    Parameters

    - - - - - - - -
    rangeController

    Sender.

    -
    - - - -
    -

    Return Value

    -

    the current scroll direction of the view using this range controller.

    -
    - - - - - - - - - - - -
    -

    Declared In

    -

    ASRangeController.h

    -
    - - -
    -
    -
    - -

    – viewportSizeForRangeController: -required method

    - -
    -
    - -
    - - -
    -

    Sender.

    -
    - - - -
    - (CGSize)viewportSizeForRangeController:(ASRangeController *)rangeController
    - - - -
    -

    Parameters

    - - - - - - - -
    rangeController

    Sender.

    -
    - - - -
    -

    Return Value

    -

    the receiver’s viewport size (i.e., the screen space occupied by the visible range).

    -
    - - - - - - - - - - - -
    -

    Declared In

    -

    ASRangeController.h

    -
    - - -
    -
    -
    - -

    – interfaceStateForRangeController: -required method

    - -
    -
    - -
    - - -
    -

    Sender.

    -
    - - - -
    - (ASInterfaceState)interfaceStateForRangeController:(ASRangeController *)rangeController
    - - - -
    -

    Parameters

    - - - - - - - -
    rangeController

    Sender.

    -
    - - - -
    -

    Return Value

    -

    the ASInterfaceState of the node that this controller is powering. This allows nested range controllers -to collaborate with one another, as an outer controller may set bits in .interfaceState such as Visible. -If this controller is an orthogonally scrolling element, it waits until it is visible to preload outside the viewport.

    -
    - - - - - - - - - - - -
    -

    Declared In

    -

    ASRangeController.h

    -
    - - -
    -
    -
    -
    - -
    - - - - - - -
    - -
    - -
    -
    -
    -
    - - - - \ No newline at end of file diff --git a/submodules/AsyncDisplayKit/docs/appledoc/Protocols/ASRangeControllerDelegate.html b/submodules/AsyncDisplayKit/docs/appledoc/Protocols/ASRangeControllerDelegate.html deleted file mode 100755 index e97a5829f0..0000000000 --- a/submodules/AsyncDisplayKit/docs/appledoc/Protocols/ASRangeControllerDelegate.html +++ /dev/null @@ -1,585 +0,0 @@ - - - - - - ASRangeControllerDelegate Protocol Reference - - - - - - -
    -
    - -

    - -

    - -

    - AsyncDisplayKit -

    - -
    -
    - - - -
    -
    -
    -
    -

    ASRangeControllerDelegate Protocol Reference

    - - -
    - - - - - - - -
    Conforms toNSObject
    Declared inASRangeController.h
    - - - - -
    - -

    Overview

    -

    Delegate for ASRangeController.

    -
    - - - - - -
    - - - - - - -
    -
    - -

    – didBeginUpdatesInRangeController: -required method

    - -
    -
    - -
    - - -
    -

    Begin updates.

    -
    - - - -
    - (void)didBeginUpdatesInRangeController:(ASRangeController *)rangeController
    - - - -
    -

    Parameters

    - - - - - - - -
    rangeController

    Sender.

    -
    - - - - - - - - - - - - - -
    -

    Declared In

    -

    ASRangeController.h

    -
    - - -
    -
    -
    - -

    – rangeController:didEndUpdatesAnimated:completion: -required method

    - -
    -
    - -
    - - -
    -

    End updates.

    -
    - - - -
    - (void)rangeController:(ASRangeController *)rangeController didEndUpdatesAnimated:(BOOL)animated completion:(void ( ^ ) ( BOOL ))completion
    - - - -
    -

    Parameters

    - - - - - - - - - - - - - - - - - -
    rangeController

    Sender.

    animated

    NO if all animations are disabled. YES otherwise.

    completion

    Completion block.

    -
    - - - - - - - - - - - - - -
    -

    Declared In

    -

    ASRangeController.h

    -
    - - -
    -
    -
    - -

    – didCompleteUpdatesInRangeController: -required method

    - -
    -
    - -
    - - -
    -

    Completed updates to cell node addition and removal.

    -
    - - - -
    - (void)didCompleteUpdatesInRangeController:(ASRangeController *)rangeController
    - - - -
    -

    Parameters

    - - - - - - - -
    rangeController

    Sender.

    -
    - - - - - - - - - - - - - -
    -

    Declared In

    -

    ASRangeController.h

    -
    - - -
    -
    -
    - -

    – rangeController:didInsertNodes:atIndexPaths:withAnimationOptions: -required method

    - -
    -
    - -
    - - -
    -

    Called for nodes insertion.

    -
    - - - -
    - (void)rangeController:(ASRangeController *)rangeController didInsertNodes:(NSArray<ASCellNode*> *)nodes atIndexPaths:(NSArray<NSIndexPath*> *)indexPaths withAnimationOptions:(ASDataControllerAnimationOptions)animationOptions
    - - - -
    -

    Parameters

    - - - - - - - - - - - - - - - - - - - - - - -
    rangeController

    Sender.

    nodes

    Inserted nodes.

    indexPaths

    Index path of inserted nodes.

    animationOptions

    Animation options. See ASDataControllerAnimationOptions.

    -
    - - - - - - - - - - - - - -
    -

    Declared In

    -

    ASRangeController.h

    -
    - - -
    -
    -
    - -

    – rangeController:didDeleteNodes:atIndexPaths:withAnimationOptions: -required method

    - -
    -
    - -
    - - -
    -

    Called for nodes deletion.

    -
    - - - -
    - (void)rangeController:(ASRangeController *)rangeController didDeleteNodes:(NSArray<ASCellNode*> *)nodes atIndexPaths:(NSArray<NSIndexPath*> *)indexPaths withAnimationOptions:(ASDataControllerAnimationOptions)animationOptions
    - - - -
    -

    Parameters

    - - - - - - - - - - - - - - - - - - - - - - -
    rangeController

    Sender.

    nodes

    Deleted nodes.

    indexPaths

    Index path of deleted nodes.

    animationOptions

    Animation options. See ASDataControllerAnimationOptions.

    -
    - - - - - - - - - - - - - -
    -

    Declared In

    -

    ASRangeController.h

    -
    - - -
    -
    -
    - -

    – rangeController:didInsertSectionsAtIndexSet:withAnimationOptions: -required method

    - -
    -
    - -
    - - -
    -

    Called for section insertion.

    -
    - - - -
    - (void)rangeController:(ASRangeController *)rangeController didInsertSectionsAtIndexSet:(NSIndexSet *)indexSet withAnimationOptions:(ASDataControllerAnimationOptions)animationOptions
    - - - -
    -

    Parameters

    - - - - - - - - - - - - - - - - - -
    rangeController

    Sender.

    indexSet

    Index set of inserted sections.

    animationOptions

    Animation options. See ASDataControllerAnimationOptions.

    -
    - - - - - - - - - - - - - -
    -

    Declared In

    -

    ASRangeController.h

    -
    - - -
    -
    -
    - -

    – rangeController:didDeleteSectionsAtIndexSet:withAnimationOptions: -required method

    - -
    -
    - -
    - - -
    -

    Called for section deletion.

    -
    - - - -
    - (void)rangeController:(ASRangeController *)rangeController didDeleteSectionsAtIndexSet:(NSIndexSet *)indexSet withAnimationOptions:(ASDataControllerAnimationOptions)animationOptions
    - - - -
    -

    Parameters

    - - - - - - - - - - - - - - - - - -
    rangeController

    Sender.

    indexSet

    Index set of deleted sections.

    animationOptions

    Animation options. See ASDataControllerAnimationOptions.

    -
    - - - - - - - - - - - - - -
    -

    Declared In

    -

    ASRangeController.h

    -
    - - -
    -
    -
    -
    - -
    - - - - - - -
    - -
    - -
    -
    -
    -
    - - - - \ No newline at end of file diff --git a/submodules/AsyncDisplayKit/docs/appledoc/Protocols/ASStackLayoutElement.html b/submodules/AsyncDisplayKit/docs/appledoc/Protocols/ASStackLayoutElement.html deleted file mode 100755 index 97a44dd6a6..0000000000 --- a/submodules/AsyncDisplayKit/docs/appledoc/Protocols/ASStackLayoutElement.html +++ /dev/null @@ -1,493 +0,0 @@ - - - - - - ASStackLayoutElement Protocol Reference - - - - - - -
    -
    - -

    - -

    - -

    - AsyncDisplayKit -

    - -
    -
    - - - -
    -
    -
    -
    -

    ASStackLayoutElement Protocol Reference

    - - -
    - - - - - - - -
    Conforms toNSObject
    Declared inASStackLayoutElement.h
    - - - - -
    - -

    Overview

    -

    Layout options that can be defined for an ASLayoutElement being added to a ASStackLayoutSpec.

    -
    - - - - - -
    - - - - - - -
    -
    - -

      spacingBefore -required method

    - -
    -
    - -
    - - -
    -

    Additional space to place before this object in the stacking direction. -Used when attached to a stack layout.

    -
    - - - -
    @property (nonatomic, readwrite) CGFloat spacingBefore
    - - - - - - - - - - - - - - - -
    -

    Declared In

    -

    ASStackLayoutElement.h

    -
    - - -
    -
    -
    - -

      spacingAfter -required method

    - -
    -
    - -
    - - -
    -

    Additional space to place after this object in the stacking direction. -Used when attached to a stack layout.

    -
    - - - -
    @property (nonatomic, readwrite) CGFloat spacingAfter
    - - - - - - - - - - - - - - - -
    -

    Declared In

    -

    ASStackLayoutElement.h

    -
    - - -
    -
    -
    - -

      flexGrow -required method

    - -
    -
    - -
    - - -
    -

    If the sum of childrens' stack dimensions is less than the minimum size, how much should this component grow? -This value represents the “flex grow factor” and determines how much this component should grow in relation to any -other flexible children.

    -
    - - - -
    @property (nonatomic, readwrite) CGFloat flexGrow
    - - - - - - - - - - - - - - - -
    -

    Declared In

    -

    ASStackLayoutElement.h

    -
    - - -
    -
    -
    - -

      flexShrink -required method

    - -
    -
    - -
    - - -
    -

    If the sum of childrens' stack dimensions is greater than the maximum size, how much should this component shrink? -This value represents the “flex shrink factor” and determines how much this component should shink in relation to -other flexible children.

    -
    - - - -
    @property (nonatomic, readwrite) CGFloat flexShrink
    - - - - - - - - - - - - - - - -
    -

    Declared In

    -

    ASStackLayoutElement.h

    -
    - - -
    -
    -
    - -

      flexBasis -required method

    - -
    -
    - -
    - - -
    -

    Specifies the initial size in the stack dimension for this object. -Default to ASDimensionAuto -Used when attached to a stack layout.

    -
    - - - -
    @property (nonatomic, readwrite) ASDimension flexBasis
    - - - - - - - - - - - - - - - -
    -

    Declared In

    -

    ASStackLayoutElement.h

    -
    - - -
    -
    -
    - -

      alignSelf -required method

    - -
    -
    - -
    - - -
    -

    Orientation of the object along cross axis, overriding alignItems -Used when attached to a stack layout.

    -
    - - - -
    @property (nonatomic, readwrite) ASStackLayoutAlignSelf alignSelf
    - - - - - - - - - - - - - - - -
    -

    Declared In

    -

    ASStackLayoutElement.h

    -
    - - -
    -
    -
    - -

      ascender -required method

    - -
    -
    - -
    - - -
    -

    Used for baseline alignment. The distance from the top of the object to its baseline.

    -
    - - - -
    @property (nonatomic, readwrite) CGFloat ascender
    - - - - - - - - - - - - - - - -
    -

    Declared In

    -

    ASStackLayoutElement.h

    -
    - - -
    -
    -
    - -

      descender -required method

    - -
    -
    - -
    - - -
    -

    Used for baseline alignment. The distance from the baseline of the object to its bottom.

    -
    - - - -
    @property (nonatomic, readwrite) CGFloat descender
    - - - - - - - - - - - - - - - -
    -

    Declared In

    -

    ASStackLayoutElement.h

    -
    - - -
    -
    -
    -
    - -
    - - - - - - -
    - -
    - -
    -
    -
    -
    - - - - \ No newline at end of file diff --git a/submodules/AsyncDisplayKit/docs/appledoc/Protocols/ASTableDataSource.html b/submodules/AsyncDisplayKit/docs/appledoc/Protocols/ASTableDataSource.html deleted file mode 100755 index c6c4cc407c..0000000000 --- a/submodules/AsyncDisplayKit/docs/appledoc/Protocols/ASTableDataSource.html +++ /dev/null @@ -1,614 +0,0 @@ - - - - - - ASTableDataSource Protocol Reference - - - - - - -
    -
    - -

    - -

    - -

    - AsyncDisplayKit -

    - -
    -
    - - - -
    -
    -
    -
    -

    ASTableDataSource Protocol Reference

    - - -
    - - - - - - - -
    Conforms toASCommonTableDataSource
    NSObject
    Declared inASTableNode.h
    - - - - -
    - -

    Overview

    -

    This is a node-based UITableViewDataSource.

    -
    - - - - - -
    - - - - - - -
    -
    - -

    – numberOfSectionsInTableNode: -

    - -
    -
    - -
    - - -
    -

    Asks the data source for the number of sections in the table node.

    -
    - - - -
    - (NSInteger)numberOfSectionsInTableNode:(ASTableNode *)tableNode
    - - - - - - - - - - - - - - - -
    -

    Declared In

    -

    ASTableNode.h

    -
    - - -
    -
    -
    - -

    – tableNode:numberOfRowsInSection: -

    - -
    -
    - -
    - - -
    -

    Asks the data source for the number of rows in the given section of the table node.

    -
    - - - -
    - (NSInteger)tableNode:(ASTableNode *)tableNode numberOfRowsInSection:(NSInteger)section
    - - - - - - - - - - - - - - - -
    -

    Declared In

    -

    ASTableNode.h

    -
    - - -
    -
    -
    - -

    – tableNode:nodeBlockForRowAtIndexPath: -

    - -
    -
    - -
    - - -
    -

    Asks the data source for a block to create a node to represent the row at the given index path. -The block will be run by the table node concurrently in the background before the row is inserted -into the table view.

    -
    - - - -
    - (ASCellNodeBlock)tableNode:(ASTableNode *)tableNode nodeBlockForRowAtIndexPath:(NSIndexPath *)indexPath
    - - - -
    -

    Parameters

    - - - - - - - - - - - - -
    tableNode

    The sender.

    indexPath

    The index path of the row.

    -
    - - - -
    -

    Return Value

    -

    a block that creates the node for display at this indexpath. -Must be thread-safe (can be called on the main thread or a background -queue) and should not implement reuse (it will be called once per row).

    -
    - - - - - -
    -

    Discussion

    -

    Note: This method takes precedence over tableNode:nodeForRowAtIndexPath: if implemented.

    -
    - - - - - - - -
    -

    Declared In

    -

    ASTableNode.h

    -
    - - -
    -
    -
    - -

    – tableNode:nodeForRowAtIndexPath: -

    - -
    -
    - -
    - - -
    -

    Asks the data source for a node to represent the row at the given index path.

    -
    - - - -
    - (ASCellNode *)tableNode:(ASTableNode *)tableNode nodeForRowAtIndexPath:(NSIndexPath *)indexPath
    - - - -
    -

    Parameters

    - - - - - - - - - - - - -
    tableNode

    The sender.

    indexPath

    The index path of the row.

    -
    - - - -
    -

    Return Value

    -

    a node to display for this row. This will be called on the main thread and should not implement reuse (it will be called once per row). Unlike UITableView’s version, this method -is not called when the row is about to display.

    -
    - - - - - - - - - - - -
    -

    Declared In

    -

    ASTableNode.h

    -
    - - -
    -
    -
    - -

    – tableView:nodeForRowAtIndexPath: -

    - -
    -
    - -
    - - -
    -

    Similar to -tableView:cellForRowAtIndexPath:.

    -
    - - - -
    - (ASCellNode *)tableView:(ASTableView *)tableView nodeForRowAtIndexPath:(NSIndexPath *)indexPath
    - - - -
    -

    Parameters

    - - - - - - - - - - - - -
    indexPath

    The index path of the requested node.

    tableNode

    The sender.

    -
    - - - -
    -

    Return Value

    -

    a node for display at this indexpath. This will be called on the main thread and should not implement reuse (it will be called once per row). Unlike UITableView’s version, this method -is not called when the row is about to display.

    -
    - - - - - - - - - - - -
    -

    Declared In

    -

    ASTableNode.h

    -
    - - -
    -
    -
    - -

    – tableView:nodeBlockForRowAtIndexPath: -

    - -
    -
    - -
    - - -
    -

    Similar to -tableView:nodeForRowAtIndexPath: -This method takes precedence over tableView:nodeForRowAtIndexPath: if implemented.

    -
    - - - -
    - (ASCellNodeBlock)tableView:(ASTableView *)tableView nodeBlockForRowAtIndexPath:(NSIndexPath *)indexPath
    - - - -
    -

    Parameters

    - - - - - - - - - - - - -
    tableView

    The sender.

    indexPath

    The index path of the requested node.

    -
    - - - -
    -

    Return Value

    -

    a block that creates the node for display at this indexpath. -Must be thread-safe (can be called on the main thread or a background -queue) and should not implement reuse (it will be called once per row).

    -
    - - - - - - - - - - - -
    -

    Declared In

    -

    ASTableNode.h

    -
    - - -
    -
    -
    - -

    – tableViewLockDataSource: -

    - -
    -
    - -
    - - -
    -

    Indicator to lock the data source for data fetching in async mode. -We should not update the data source until the data source has been unlocked. Otherwise, it will incur data inconsistency or exception -due to the data access in async mode. (Deprecated: The data source is always accessed on the main thread, and this method will not be called.)

    -
    - - - -
    - (void)tableViewLockDataSource:(ASTableView *)tableView
    - - - -
    -

    Parameters

    - - - - - - - -
    tableView

    The sender.

    -
    - - - - - - - - - - - - - -
    -

    Declared In

    -

    ASTableNode.h

    -
    - - -
    -
    -
    - -

    – tableViewUnlockDataSource: -

    - -
    -
    - -
    - - -
    -

    Indicator to unlock the data source for data fetching in asyn mode. -We should not update the data source until the data source has been unlocked. Otherwise, it will incur data inconsistency or exception -due to the data access in async mode. (Deprecated: The data source is always accessed on the main thread, and this method will not be called.)

    -
    - - - -
    - (void)tableViewUnlockDataSource:(ASTableView *)tableView
    - - - -
    -

    Parameters

    - - - - - - - -
    tableView

    The sender.

    -
    - - - - - - - - - - - - - -
    -

    Declared In

    -

    ASTableNode.h

    -
    - - -
    -
    -
    -
    - -
    - - - - - - -
    - -
    - -
    -
    -
    -
    - - - - \ No newline at end of file diff --git a/submodules/AsyncDisplayKit/docs/appledoc/Protocols/ASTableDelegate.html b/submodules/AsyncDisplayKit/docs/appledoc/Protocols/ASTableDelegate.html deleted file mode 100755 index 993e7cac16..0000000000 --- a/submodules/AsyncDisplayKit/docs/appledoc/Protocols/ASTableDelegate.html +++ /dev/null @@ -1,758 +0,0 @@ - - - - - - ASTableDelegate Protocol Reference - - - - - - -
    -
    - -

    - -

    - -

    - AsyncDisplayKit -

    - -
    -
    - - - -
    -
    -
    -
    -

    ASTableDelegate Protocol Reference

    - - -
    - - - - - - - -
    Conforms toASCommonTableViewDelegate
    NSObject
    Declared inASTableNode.h
    - - - - -
    - -

    Overview

    -

    This is a node-based UITableViewDelegate.

    - -

    Note that -tableView:heightForRowAtIndexPath: has been removed; instead, your custom ASCellNode subclasses are -responsible for deciding their preferred onscreen height in -calculateSizeThatFits:.

    -
    - - - - - -
    - - - - - - -
    -
    - -

    – tableNode:constrainedSizeForRowAtIndexPath: -

    - -
    -
    - -
    - - -
    -

    Provides the constrained size range for measuring the row at the index path. -Note: the widths in the returned size range are ignored!

    -
    - - - -
    - (ASSizeRange)tableNode:(ASTableNode *)tableNode constrainedSizeForRowAtIndexPath:(NSIndexPath *)indexPath
    - - - -
    -

    Parameters

    - - - - - - - - - - - - -
    tableNode

    The sender.

    indexPath

    The index path of the node.

    -
    - - - -
    -

    Return Value

    -

    A constrained size range for layout the node at this index path.

    -
    - - - - - - - - - - - -
    -

    Declared In

    -

    ASTableNode.h

    -
    - - -
    -
    -
    - -

    – tableNode:willBeginBatchFetchWithContext: -

    - -
    -
    - -
    - - -
    -

    Receive a message that the tableView is near the end of its data set and more data should be fetched if necessary.

    -
    - - - -
    - (void)tableNode:(ASTableNode *)tableNode willBeginBatchFetchWithContext:(ASBatchContext *)context
    - - - -
    -

    Parameters

    - - - - - - - - - - - - -
    context

    A context object that must be notified when the batch fetch is completed.

    tableView

    The sender.

    -
    - - - - - - - -
    -

    Discussion

    -

    You must eventually call -completeBatchFetching: with an argument of YES in order to receive future -notifications to do batch fetches. This method is called on a background queue.

    - -

    ASTableView currently only supports batch events for tail loads. If you require a head load, consider implementing a -UIRefreshControl.

    -
    - - - - - - - -
    -

    Declared In

    -

    ASTableNode.h

    -
    - - -
    -
    -
    - -

    – shouldBatchFetchForTableNode: -

    - -
    -
    - -
    - - -
    -

    Tell the tableView if batch fetching should begin.

    -
    - - - -
    - (BOOL)shouldBatchFetchForTableNode:(ASTableNode *)tableNode
    - - - -
    -

    Parameters

    - - - - - - - -
    tableView

    The sender.

    -
    - - - - - - - -
    -

    Discussion

    -

    Use this method to conditionally fetch batches. Example use cases are: limiting the total number of -objects that can be fetched or no network connection.

    - -

    If not implemented, the tableView assumes that it should notify its asyncDelegate when batch fetching -should occur.

    -
    - - - - - - - -
    -

    Declared In

    -

    ASTableNode.h

    -
    - - -
    -
    -
    - -

    – tableView:willDisplayNode:forRowAtIndexPath: -

    - -
    -
    - -
    - - -
    -

    Informs the delegate that the table view will add the given node -at the given index path to the view hierarchy.

    -
    - - - -
    - (void)tableView:(ASTableView *)tableView willDisplayNode:(ASCellNode *)node forRowAtIndexPath:(NSIndexPath *)indexPath
    - - - -
    -

    Parameters

    - - - - - - - - - - - - - - - - - -
    tableView

    The sender.

    node

    The node that will be displayed.

    indexPath

    The index path of the row that will be displayed.

    -
    - - - - - - - -
    -

    Discussion

    -

    Warning: AsyncDisplayKit processes table view edits asynchronously. The index path -passed into this method may not correspond to the same item in your data source -if your data source has been updated since the last edit was processed.

    -
    - - - - - - - -
    -

    Declared In

    -

    ASTableNode.h

    -
    - - -
    -
    -
    - -

    – tableView:didEndDisplayingNode:forRowAtIndexPath: -

    - -
    -
    - -
    - - -
    -

    Informs the delegate that the table view did remove the provided node from the view hierarchy. -This may be caused by the node scrolling out of view, or by deleting the row -or its containing section with @c deleteRowsAtIndexPaths:withRowAnimation: or @c deleteSections:withRowAnimation: .

    -
    - - - -
    - (void)tableView:(ASTableView *)tableView didEndDisplayingNode:(ASCellNode *)node forRowAtIndexPath:(NSIndexPath *)indexPath
    - - - -
    -

    Parameters

    - - - - - - - - - - - - - - - - - -
    tableView

    The sender.

    node

    The node which was removed from the view hierarchy.

    indexPath

    The index path at which the node was located before the removal.

    -
    - - - - - - - -
    -

    Discussion

    -

    Warning: AsyncDisplayKit processes table view edits asynchronously. The index path -passed into this method may not correspond to the same item in your data source -if your data source has been updated since the last edit was processed.

    -
    - - - - - - - -
    -

    Declared In

    -

    ASTableNode.h

    -
    - - -
    -
    -
    - -

    – tableView:willBeginBatchFetchWithContext: -

    - -
    -
    - -
    - - -
    -

    Receive a message that the tableView is near the end of its data set and more data should be fetched if necessary.

    -
    - - - -
    - (void)tableView:(ASTableView *)tableView willBeginBatchFetchWithContext:(ASBatchContext *)context
    - - - -
    -

    Parameters

    - - - - - - - - - - - - -
    tableView

    The sender.

    context

    A context object that must be notified when the batch fetch is completed.

    -
    - - - - - - - -
    -

    Discussion

    -

    You must eventually call -completeBatchFetching: with an argument of YES in order to receive future -notifications to do batch fetches. This method is called on a background queue.

    - -

    ASTableView currently only supports batch events for tail loads. If you require a head load, consider implementing a -UIRefreshControl.

    -
    - - - - - - - -
    -

    Declared In

    -

    ASTableNode.h

    -
    - - -
    -
    -
    - -

    – shouldBatchFetchForTableView: -

    - -
    -
    - -
    - - -
    -

    Tell the tableView if batch fetching should begin.

    -
    - - - -
    - (BOOL)shouldBatchFetchForTableView:(ASTableView *)tableView
    - - - -
    -

    Parameters

    - - - - - - - -
    tableView

    The sender.

    -
    - - - - - - - -
    -

    Discussion

    -

    Use this method to conditionally fetch batches. Example use cases are: limiting the total number of -objects that can be fetched or no network connection.

    - -

    If not implemented, the tableView assumes that it should notify its asyncDelegate when batch fetching -should occur.

    -
    - - - - - - - -
    -

    Declared In

    -

    ASTableNode.h

    -
    - - -
    -
    -
    - -

    – tableView:constrainedSizeForRowAtIndexPath: -

    - -
    -
    - -
    - - -
    -

    Provides the constrained size range for measuring the row at the index path. -Note: the widths in the returned size range are ignored!

    -
    - - - -
    - (ASSizeRange)tableView:(ASTableView *)tableView constrainedSizeForRowAtIndexPath:(NSIndexPath *)indexPath
    - - - -
    -

    Parameters

    - - - - - - - - - - - - -
    tableView

    The sender.

    indexPath

    The index path of the node.

    -
    - - - -
    -

    Return Value

    -

    A constrained size range for layout the node at this index path.

    -
    - - - - - - - - - - - -
    -

    Declared In

    -

    ASTableNode.h

    -
    - - -
    -
    -
    - -

    – tableView:willDisplayNodeForRowAtIndexPath: -

    - -
    -
    - -
    - - -
    -

    Informs the delegate that the table view will add the node -at the given index path to the view hierarchy.

    -
    - - - -
    - (void)tableView:(ASTableView *)tableView willDisplayNodeForRowAtIndexPath:(NSIndexPath *)indexPath
    - - - -
    -

    Parameters

    - - - - - - - - - - - - -
    tableView

    The sender.

    indexPath

    The index path of the row that will be displayed.

    -
    - - - - - - - -
    -

    Discussion

    -

    Warning: AsyncDisplayKit processes table view edits asynchronously. The index path -passed into this method may not correspond to the same item in your data source -if your data source has been updated since the last edit was processed.

    - -

    This method is deprecated. Use @c tableView:willDisplayNode:forRowAtIndexPath: instead.

    -
    - - - - - - - -
    -

    Declared In

    -

    ASTableNode.h

    -
    - - -
    -
    -
    -
    - -
    - - - - - - -
    - -
    - -
    -
    -
    -
    - - - - \ No newline at end of file diff --git a/submodules/AsyncDisplayKit/docs/appledoc/Protocols/ASTextNodeDelegate.html b/submodules/AsyncDisplayKit/docs/appledoc/Protocols/ASTextNodeDelegate.html deleted file mode 100755 index a5945ed623..0000000000 --- a/submodules/AsyncDisplayKit/docs/appledoc/Protocols/ASTextNodeDelegate.html +++ /dev/null @@ -1,450 +0,0 @@ - - - - - - ASTextNodeDelegate Protocol Reference - - - - - - -
    -
    - -

    - -

    - -

    - AsyncDisplayKit -

    - -
    -
    - - - -
    -
    -
    -
    -

    ASTextNodeDelegate Protocol Reference

    - - -
    - - - - - - - -
    Conforms toNSObject
    Declared inASTextNode.h
    - - - - - - - - -
    - - - - - - -
    -
    - -

    – textNode:tappedLinkAttribute:value:atPoint:textRange: -

    - -
    -
    - -
    - - -
    -

    Indicates to the delegate that a link was tapped within a text node.

    -
    - - - -
    - (void)textNode:(ASTextNode *)textNode tappedLinkAttribute:(NSString *)attribute value:(id)value atPoint:(CGPoint)point textRange:(NSRange)textRange
    - - - -
    -

    Parameters

    - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    textNode

    The ASTextNode containing the link that was tapped.

    attribute

    The attribute that was tapped. Will not be nil.

    value

    The value of the tapped attribute.

    point

    The point within textNode, in textNode’s coordinate system, that was tapped.

    textRange

    The range of highlighted text.

    -
    - - - - - - - - - - - - - -
    -

    Declared In

    -

    ASTextNode.h

    -
    - - -
    -
    -
    - -

    – textNode:longPressedLinkAttribute:value:atPoint:textRange: -

    - -
    -
    - -
    - - -
    -

    Indicates to the delegate that a link was tapped within a text node.

    -
    - - - -
    - (void)textNode:(ASTextNode *)textNode longPressedLinkAttribute:(NSString *)attribute value:(id)value atPoint:(CGPoint)point textRange:(NSRange)textRange
    - - - -
    -

    Parameters

    - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    textNode

    The ASTextNode containing the link that was tapped.

    attribute

    The attribute that was tapped. Will not be nil.

    value

    The value of the tapped attribute.

    point

    The point within textNode, in textNode’s coordinate system, that was tapped.

    textRange

    The range of highlighted text.

    -
    - - - - - - - -
    -

    Discussion

    -

    In addition to implementing this method, the delegate must be set on the text - node before it is loaded (the recognizer is created in -didLoad)

    -
    - - - - - - - -
    -

    Declared In

    -

    ASTextNode.h

    -
    - - -
    -
    -
    - -

    – textNode:shouldHighlightLinkAttribute:value:atPoint: -

    - -
    -
    - -
    - - -
    -

    Indicates to the text node if an attribute should be considered a link.

    -
    - - - -
    - (BOOL)textNode:(ASTextNode *)textNode shouldHighlightLinkAttribute:(NSString *)attribute value:(id)value atPoint:(CGPoint)point
    - - - -
    -

    Parameters

    - - - - - - - - - - - - - - - - - - - - - - -
    textNode

    The text node containing the entity attribute.

    attribute

    The attribute that was tapped. Will not be nil.

    value

    The value of the tapped attribute.

    point

    The point within textNode, in textNode’s coordinate system, that was touched to trigger a highlight.

    -
    - - - -
    -

    Return Value

    -

    YES if the entity attribute should be a link, NO otherwise.

    -
    - - - - - -
    -

    Discussion

    -

    If not implemented, the default value is YES.

    -
    - - - - - - - -
    -

    Declared In

    -

    ASTextNode.h

    -
    - - -
    -
    -
    - -

    – textNode:shouldLongPressLinkAttribute:value:atPoint: -

    - -
    -
    - -
    - - -
    -

    Indicates to the text node if an attribute is a valid long-press target

    -
    - - - -
    - (BOOL)textNode:(ASTextNode *)textNode shouldLongPressLinkAttribute:(NSString *)attribute value:(id)value atPoint:(CGPoint)point
    - - - -
    -

    Parameters

    - - - - - - - - - - - - - - - - - - - - - - -
    textNode

    The text node containing the entity attribute.

    attribute

    The attribute that was tapped. Will not be nil.

    value

    The value of the tapped attribute.

    point

    The point within textNode, in textNode’s coordinate system, that was long-pressed.

    -
    - - - -
    -

    Return Value

    -

    YES if the entity attribute should be treated as a long-press target, NO otherwise.

    -
    - - - - - -
    -

    Discussion

    -

    If not implemented, the default value is NO.

    -
    - - - - - - - -
    -

    Declared In

    -

    ASTextNode.h

    -
    - - -
    -
    -
    -
    - -
    - - - - - - -
    - -
    - -
    -
    -
    -
    - - - - \ No newline at end of file diff --git a/submodules/AsyncDisplayKit/docs/appledoc/Protocols/ASVideoNodeDelegate.html b/submodules/AsyncDisplayKit/docs/appledoc/Protocols/ASVideoNodeDelegate.html deleted file mode 100755 index 10b8f8505f..0000000000 --- a/submodules/AsyncDisplayKit/docs/appledoc/Protocols/ASVideoNodeDelegate.html +++ /dev/null @@ -1,729 +0,0 @@ - - - - - - ASVideoNodeDelegate Protocol Reference - - - - - - -
    -
    - -

    - -

    - -

    - AsyncDisplayKit -

    - -
    -
    - - - -
    -
    -
    -
    -

    ASVideoNodeDelegate Protocol Reference

    - - -
    - - - - - - - -
    Conforms toASNetworkImageNodeDelegate
    Declared inASVideoNode.h
    - - - - - - -
    - - - - - - -
    -
    - -

    – videoDidPlayToEnd: -

    - -
    -
    - -
    - - -
    -

    Delegate method invoked when the node’s video has played to its end time.

    -
    - - - -
    - (void)videoDidPlayToEnd:(ASVideoNode *)videoNode
    - - - -
    -

    Parameters

    - - - - - - - -
    videoNode

    The video node has played to its end time.

    -
    - - - - - - - - - - - - - -
    -

    Declared In

    -

    ASVideoNode.h

    -
    - - -
    -
    -
    - -

    – didTapVideoNode: -

    - -
    -
    - -
    - - -
    -

    Delegate method invoked the node is tapped.

    -
    - - - -
    - (void)didTapVideoNode:(ASVideoNode *)videoNode
    - - - -
    -

    Parameters

    - - - - - - - -
    videoNode

    The video node that was tapped.

    -
    - - - - - - - -
    -

    Discussion

    -

    The video’s play state is toggled if this method is not implemented.

    -
    - - - - - - - -
    -

    Declared In

    -

    ASVideoNode.h

    -
    - - -
    -
    -
    - -

    – videoNode:willChangePlayerState:toState: -

    - -
    -
    - -
    - - -
    -

    Delegate method invoked when player changes state.

    -
    - - - -
    - (void)videoNode:(ASVideoNode *)videoNode willChangePlayerState:(ASVideoNodePlayerState)state toState:(ASVideoNodePlayerState)toState
    - - - -
    -

    Parameters

    - - - - - - - - - - - - - - - - - -
    videoNode

    The video node.

    state

    player state before this change.

    toState

    player new state.

    -
    - - - - - - - -
    -

    Discussion

    -

    This method is called after each state change

    -
    - - - - - - - -
    -

    Declared In

    -

    ASVideoNode.h

    -
    - - -
    -
    -
    - -

    – videoNode:shouldChangePlayerStateTo: -

    - -
    -
    - -
    - - -
    -

    Ssks delegate if state change is allowed -ASVideoNodePlayerStatePlaying or ASVideoNodePlayerStatePaused. -asks delegate if state change is allowed.

    -
    - - - -
    - (BOOL)videoNode:(ASVideoNode *)videoNode shouldChangePlayerStateTo:(ASVideoNodePlayerState)state
    - - - -
    -

    Parameters

    - - - - - - - - - - - - -
    videoNode

    The video node.

    state

    player state that is going to be set.

    -
    - - - - - - - -
    -

    Discussion

    -

    Delegate method invoked when player changes it’s state to -ASVideoNodePlayerStatePlaying or ASVideoNodePlayerStatePaused -and asks delegate if state change is valid

    -
    - - - - - - - -
    -

    Declared In

    -

    ASVideoNode.h

    -
    - - -
    -
    -
    - -

    – videoNode:didPlayToTimeInterval: -

    - -
    -
    - -
    - - -
    -

    Delegate method invoked when player playback time is updated.

    -
    - - - -
    - (void)videoNode:(ASVideoNode *)videoNode didPlayToTimeInterval:(NSTimeInterval)timeInterval
    - - - -
    -

    Parameters

    - - - - - - - - - - - - -
    videoNode

    The video node.

    second

    current playback time in seconds.

    -
    - - - - - - - - - - - - - -
    -

    Declared In

    -

    ASVideoNode.h

    -
    - - -
    -
    -
    - -

    – videoNode:didStallAtTimeInterval: -

    - -
    -
    - -
    - - -
    -

    Delegate method invoked when the video player stalls.

    -
    - - - -
    - (void)videoNode:(ASVideoNode *)videoNode didStallAtTimeInterval:(NSTimeInterval)timeInterval
    - - - -
    -

    Parameters

    - - - - - - - - - - - - -
    videoNode

    The video node that has experienced the stall

    second

    Current playback time when the stall happens

    -
    - - - - - - - - - - - - - -
    -

    Declared In

    -

    ASVideoNode.h

    -
    - - -
    -
    -
    - -

    – videoNodeDidStartInitialLoading: -

    - -
    -
    - -
    - - -
    -

    Delegate method invoked when the video player starts the inital asset loading

    -
    - - - -
    - (void)videoNodeDidStartInitialLoading:(ASVideoNode *)videoNode
    - - - -
    -

    Parameters

    - - - - - - - -
    videoNode

    The videoNode

    -
    - - - - - - - - - - - - - -
    -

    Declared In

    -

    ASVideoNode.h

    -
    - - -
    -
    -
    - -

    – videoNodeDidFinishInitialLoading: -

    - -
    -
    - -
    - - -
    -

    Delegate method invoked when the video is done loading the asset and can start the playback

    -
    - - - -
    - (void)videoNodeDidFinishInitialLoading:(ASVideoNode *)videoNode
    - - - -
    -

    Parameters

    - - - - - - - -
    videoNode

    The videoNode

    -
    - - - - - - - - - - - - - -
    -

    Declared In

    -

    ASVideoNode.h

    -
    - - -
    -
    -
    - -

    – videoNode:didSetCurrentItem: -

    - -
    -
    - -
    - - -
    -

    Delegate method invoked when the AVPlayerItem for the asset has been set up and can be accessed throught currentItem.

    -
    - - - -
    - (void)videoNode:(ASVideoNode *)videoNode didSetCurrentItem:(AVPlayerItem *)currentItem
    - - - -
    -

    Parameters

    - - - - - - - - - - - - -
    videoNode

    The videoNode.

    currentItem

    The AVPlayerItem that was constructed from the asset.

    -
    - - - - - - - - - - - - - -
    -

    Declared In

    -

    ASVideoNode.h

    -
    - - -
    -
    -
    - -

    – videoNodeDidRecoverFromStall: -

    - -
    -
    - -
    - - -
    -

    Delegate method invoked when the video node has recovered from the stall

    -
    - - - -
    - (void)videoNodeDidRecoverFromStall:(ASVideoNode *)videoNode
    - - - -
    -

    Parameters

    - - - - - - - -
    videoNode

    The videoNode

    -
    - - - - - - - - - - - - - -
    -

    Declared In

    -

    ASVideoNode.h

    -
    - - -
    -
    -
    -
    - -
    - - - - - - -
    - -
    - -
    -
    -
    -
    - - - - \ No newline at end of file diff --git a/submodules/AsyncDisplayKit/docs/appledoc/Protocols/ASVideoPlayerNodeDelegate.html b/submodules/AsyncDisplayKit/docs/appledoc/Protocols/ASVideoPlayerNodeDelegate.html deleted file mode 100755 index 89faa40314..0000000000 --- a/submodules/AsyncDisplayKit/docs/appledoc/Protocols/ASVideoPlayerNodeDelegate.html +++ /dev/null @@ -1,940 +0,0 @@ - - - - - - ASVideoPlayerNodeDelegate Protocol Reference - - - - - - -
    -
    - -

    - -

    - -

    - AsyncDisplayKit -

    - -
    -
    - - - -
    -
    -
    -
    -

    ASVideoPlayerNodeDelegate Protocol Reference

    - - -
    - - - - - - - -
    Conforms toNSObject
    Declared inASVideoPlayerNode.h
    - - - - - - -
    - - - - - - -
    -
    - -

    – videoPlayerNodeNeededDefaultControls: -

    - -
    -
    - -
    - - -
    -

    Delegate method invoked before creating controlbar controls -@param videoPlayer

    -
    - - - -
    - (NSArray *)videoPlayerNodeNeededDefaultControls:(ASVideoPlayerNode *)videoPlayer
    - - - - - - - - - - - - - - - -
    -

    Declared In

    -

    ASVideoPlayerNode.h

    -
    - - -
    -
    -
    - -

    – videoPlayerNodeCustomControls: -

    - -
    -
    - -
    - - -
    -

    Delegate method invoked before creating default controls, asks delegate for custom controls dictionary. -This dictionary must constain only ASDisplayNode subclass objects. -@param videoPlayer

    -
    - - - -
    - (NSDictionary *)videoPlayerNodeCustomControls:(ASVideoPlayerNode *)videoPlayer
    - - - - - - - - - -
    -

    Discussion

    -
      -
    • This method is invoked only when developer implements videoPlayerNodeLayoutSpec:forControls:forMaximumSize: -and gives ability to add custom constrols to ASVideoPlayerNode, for example mute button.
    • -
    - -
    - - - - - - - -
    -

    Declared In

    -

    ASVideoPlayerNode.h

    -
    - - -
    -
    -
    - -

    – videoPlayerNodeLayoutSpec:forControls:forMaximumSize: -

    - -
    -
    - -
    - - -
    -

    Delegate method invoked in layoutSpecThatFits: -@param videoPlayer

    -
    - - - -
    - (ASLayoutSpec *)videoPlayerNodeLayoutSpec:(ASVideoPlayerNode *)videoPlayer forControls:(NSDictionary *)controls forMaximumSize:(CGSize)maxSize
    - - - -
    -

    Parameters

    - - - - - - - - - - - - -
    controls
      -
    • Dictionary of controls which are used in videoPlayer; Dictionary keys are ASVideoPlayerNodeControlType
    • -
    -
    maxSize
      -
    • Maximum size for ASVideoPlayerNode
    • -
    -
    -
    - - - - - - - -
    -

    Discussion

    -
      -
    • Developer can layout whole ASVideoPlayerNode as he wants. ASVideoNode is locked and it can’t be changed
    • -
    - -
    - - - - - - - -
    -

    Declared In

    -

    ASVideoPlayerNode.h

    -
    - - -
    -
    -
    - -

    – videoPlayerNodeTimeLabelAttributes:timeLabelType: -

    - -
    -
    - -
    - - -
    -

    Delegate method invoked before creating ASVideoPlayerNodeControlTypeElapsedText and ASVideoPlayerNodeControlTypeDurationText -@param videoPlayer -@param timeLabelType

    -
    - - - -
    - (NSDictionary *)videoPlayerNodeTimeLabelAttributes:(ASVideoPlayerNode *)videoPlayerNode timeLabelType:(ASVideoPlayerNodeControlType)timeLabelType
    - - - - - - - - - - - - - - - -
    -

    Declared In

    -

    ASVideoPlayerNode.h

    -
    - - -
    -
    -
    - -

    – didTapVideoPlayerNode: -

    - -
    -
    - -
    - - -
    -

    Delegate method invoked when ASVideoPlayerNode is taped.

    -
    - - - -
    - (void)didTapVideoPlayerNode:(ASVideoPlayerNode *)videoPlayer
    - - - -
    -

    Parameters

    - - - - - - - -
    videoPlayerNode

    The ASVideoPlayerNode that was tapped.

    -
    - - - - - - - - - - - - - -
    -

    Declared In

    -

    ASVideoPlayerNode.h

    -
    - - -
    -
    -
    - -

    – videoPlayerNode:didPlayToTime: -

    - -
    -
    - -
    - - -
    -

    Delegate method invoked when ASVideoNode playback time is updated.

    -
    - - - -
    - (void)videoPlayerNode:(ASVideoPlayerNode *)videoPlayer didPlayToTime:(CMTime)time
    - - - -
    -

    Parameters

    - - - - - - - - - - - - -
    second

    current playback time.

    videoPlayerNode

    The video player node

    -
    - - - - - - - - - - - - - -
    -

    Declared In

    -

    ASVideoPlayerNode.h

    -
    - - -
    -
    -
    - -

    – videoPlayerNode:willChangeVideoNodeState:toVideoNodeState: -

    - -
    -
    - -
    - - -
    -

    Delegate method invoked when ASVideoNode changes state.

    -
    - - - -
    - (void)videoPlayerNode:(ASVideoPlayerNode *)videoPlayer willChangeVideoNodeState:(ASVideoNodePlayerState)state toVideoNodeState:(ASVideoNodePlayerState)toState
    - - - -
    -

    Parameters

    - - - - - - - - - - - - - - - - - -
    state

    ASVideoNode state before this change.

    videoPlayerNode

    The ASVideoPlayerNode whose ASVideoNode is changing state.

    toSate

    ASVideoNode new state.

    -
    - - - - - - - -
    -

    Discussion

    -

    This method is called after each state change

    -
    - - - - - - - -
    -

    Declared In

    -

    ASVideoPlayerNode.h

    -
    - - -
    -
    -
    - -

    – videoPlayerNode:shouldChangeVideoNodeStateTo: -

    - -
    -
    - -
    - - -
    -

    Delegate method is invoked when ASVideoNode decides to change state.

    -
    - - - -
    - (BOOL)videoPlayerNode:(ASVideoPlayerNode *)videoPlayer shouldChangeVideoNodeStateTo:(ASVideoNodePlayerState)state
    - - - -
    -

    Parameters

    - - - - - - - - - - - - -
    state

    ASVideoNode that is going to be set.

    videoPlayerNode

    The ASVideoPlayerNode whose ASVideoNode is changing state.

    -
    - - - - - - - -
    -

    Discussion

    -

    Delegate method invoked when player changes it’s state to -ASVideoNodePlayerStatePlaying or ASVideoNodePlayerStatePaused -and asks delegate if state change is valid

    -
    - - - - - - - -
    -

    Declared In

    -

    ASVideoPlayerNode.h

    -
    - - -
    -
    -
    - -

    – videoPlayerNodeDidPlayToEnd: -

    - -
    -
    - -
    - - -
    -

    Delegate method invoked when the ASVideoNode has played to its end time.

    -
    - - - -
    - (void)videoPlayerNodeDidPlayToEnd:(ASVideoPlayerNode *)videoPlayer
    - - - -
    -

    Parameters

    - - - - - - - -
    videoPlayer

    The video node has played to its end time.

    -
    - - - - - - - - - - - - - -
    -

    Declared In

    -

    ASVideoPlayerNode.h

    -
    - - -
    -
    -
    - -

    – videoPlayerNode:didSetCurrentItem: -

    - -
    -
    - -
    - - -
    -

    Delegate method invoked when the ASVideoNode has constructed its AVPlayerItem for the asset.

    -
    - - - -
    - (void)videoPlayerNode:(ASVideoPlayerNode *)videoPlayer didSetCurrentItem:(AVPlayerItem *)currentItem
    - - - -
    -

    Parameters

    - - - - - - - - - - - - -
    videoPlayer

    The video player node.

    currentItem

    The AVPlayerItem that was constructed from the asset.

    -
    - - - - - - - - - - - - - -
    -

    Declared In

    -

    ASVideoPlayerNode.h

    -
    - - -
    -
    -
    - -

    – videoPlayerNode:didStallAtTimeInterval: -

    - -
    -
    - -
    - - -
    -

    Delegate method invoked when the ASVideoNode stalls.

    -
    - - - -
    - (void)videoPlayerNode:(ASVideoPlayerNode *)videoPlayer didStallAtTimeInterval:(NSTimeInterval)timeInterval
    - - - -
    -

    Parameters

    - - - - - - - - - - - - -
    videoPlayer

    The video player node that has experienced the stall

    second

    Current playback time when the stall happens

    -
    - - - - - - - - - - - - - -
    -

    Declared In

    -

    ASVideoPlayerNode.h

    -
    - - -
    -
    -
    - -

    – videoPlayerNodeDidStartInitialLoading: -

    - -
    -
    - -
    - - -
    -

    Delegate method invoked when the ASVideoNode starts the inital asset loading

    -
    - - - -
    - (void)videoPlayerNodeDidStartInitialLoading:(ASVideoPlayerNode *)videoPlayer
    - - - -
    -

    Parameters

    - - - - - - - -
    videoPlayer

    The videoPlayer

    -
    - - - - - - - - - - - - - -
    -

    Declared In

    -

    ASVideoPlayerNode.h

    -
    - - -
    -
    -
    - -

    – videoPlayerNodeDidFinishInitialLoading: -

    - -
    -
    - -
    - - -
    -

    Delegate method invoked when the ASVideoNode is done loading the asset and can start the playback

    -
    - - - -
    - (void)videoPlayerNodeDidFinishInitialLoading:(ASVideoPlayerNode *)videoPlayer
    - - - -
    -

    Parameters

    - - - - - - - -
    videoPlayer

    The videoPlayer

    -
    - - - - - - - - - - - - - -
    -

    Declared In

    -

    ASVideoPlayerNode.h

    -
    - - -
    -
    -
    - -

    – videoPlayerNodeDidRecoverFromStall: -

    - -
    -
    - -
    - - -
    -

    Delegate method invoked when the ASVideoNode has recovered from the stall

    -
    - - - -
    - (void)videoPlayerNodeDidRecoverFromStall:(ASVideoPlayerNode *)videoPlayer
    - - - -
    -

    Parameters

    - - - - - - - -
    videoPlayer

    The videoplayer

    -
    - - - - - - - - - - - - - -
    -

    Declared In

    -

    ASVideoPlayerNode.h

    -
    - - -
    -
    -
    -
    - -
    - - - - - - -
    - -
    - -
    -
    -
    -
    - - - - \ No newline at end of file diff --git a/submodules/AsyncDisplayKit/docs/appledoc/Protocols/ASVisibilityDepth.html b/submodules/AsyncDisplayKit/docs/appledoc/Protocols/ASVisibilityDepth.html deleted file mode 100755 index 29597c887f..0000000000 --- a/submodules/AsyncDisplayKit/docs/appledoc/Protocols/ASVisibilityDepth.html +++ /dev/null @@ -1,269 +0,0 @@ - - - - - - ASVisibilityDepth Protocol Reference - - - - - - -
    -
    - -

    - -

    - -

    - Texture -

    - -
    -
    - - - -
    -
    -
    -
    -

    ASVisibilityDepth Protocol Reference

    - - -
    - - - - - - - -
    Conforms toNSObject
    Declared inASVisibilityProtocols.h
    - - - - -
    - -

    Overview

    -

    ASVisibilityDepth

    “Visibility Depth” represents the number of user actions required to make an ASDisplayNode or -ASViewController visibile. Texture uses this information to intelligently manage memory and focus -resources where they are most visible to the user.

    - -

    The ASVisibilityDepth protocol describes how custom view controllers can integrate with this system.

    - -

    Parent view controllers should also implement @c ASManagesChildVisibilityDepth

    -
    - - - - - -
    - - - - - - -
    -
    - -

    – visibilityDepth -required method

    - -
    -
    - -
    - - -
    -

    Visibility depth

    -
    - - - -
    - (NSInteger)visibilityDepth
    - - - - - - - - - -
    -

    Discussion

    -

    Represents the number of user actions necessary to reach the view controller. An increased visibility -depth indicates a higher number of user interactions for the view controller to be visible again. For example, -an onscreen navigation controller’s top view controller should have a visibility depth of 0. The view controller -one from the top should have a visibility deptch of 1 as should the root view controller in the stack (because -the user can hold the back button to pop to the root view controller).

    - -

    Visibility depth is used to automatically adjust ranges on range controllers (and thus free up memory) and can -be used to reduce memory usage of other items as well.

    -
    - - - - - - - -
    -

    Declared In

    -

    ASVisibilityProtocols.h

    -
    - - -
    -
    -
    - -

    – visibilityDepthDidChange -required method

    - -
    -
    - -
    - - -
    -

    Called when visibility depth changes

    -
    - - - -
    - (void)visibilityDepthDidChange
    - - - - - - - - - -
    -

    Discussion

    -

    @c visibilityDepthDidChange is called whenever the visibility depth of the represented view controller -has changed.

    - -

    If implemented by a view controller container, use this method to notify child view controllers that their view -depth has changed @see ASNavigationController.m

    - -

    If implemented on an ASViewController, use this method to reduce or increase the resources that your -view controller uses. A higher visibility depth view controller should decrease it’s resource usage, a lower -visibility depth controller should pre-warm resources in preperation for a display at 0 depth.

    - -

    ASViewController implements this method and reduces / increases range mode of supporting nodes (such as ASCollectionNode -and ASTableNode).

    -
    - - - - - -
    -

    See Also

    - -
    - - - -
    -

    Declared In

    -

    ASVisibilityProtocols.h

    -
    - - -
    -
    -
    -
    - -
    - - - - - - -
    - -
    - -
    -
    -
    -
    - - - - \ No newline at end of file diff --git a/submodules/AsyncDisplayKit/docs/appledoc/css/scss/_index.scss b/submodules/AsyncDisplayKit/docs/appledoc/css/scss/_index.scss deleted file mode 100755 index 6a57ec5dc3..0000000000 --- a/submodules/AsyncDisplayKit/docs/appledoc/css/scss/_index.scss +++ /dev/null @@ -1,17 +0,0 @@ -.index-container { - -webkit-flex-direction: column; - flex-direction: column; - - @media (min-width: $desktop-min-width) { - display: flex; - -webkit-flex-direction: row; - flex-direction: row; - -webkit-flex-wrap: wrap; - flex-wrap: wrap; - } - - .index-column { - -webkit-flex: 1 1 33%; - flex: 1 1 33%; - } -} diff --git a/submodules/AsyncDisplayKit/docs/appledoc/css/scss/_layout.scss b/submodules/AsyncDisplayKit/docs/appledoc/css/scss/_layout.scss deleted file mode 100755 index da46aef079..0000000000 --- a/submodules/AsyncDisplayKit/docs/appledoc/css/scss/_layout.scss +++ /dev/null @@ -1,302 +0,0 @@ -* { - box-sizing: border-box; -} - -.clear { - clear: both; -} - -.clearfix { - &:before, &:after { - clear: both; - display: table; - content: ""; - } -} - -.xcode .hide-in-xcode { - display: none; -} - -body { - font: 62.5% $body-font; - background: $body-background; - - @media (max-width: $mobile-max-width) { - background-color: $content-background; - } -} - -h1, h2, h3 { - font-weight: 300; - color: #808080; -} - -h1 { - font-size: 2em; - color: #000; -} - -h4 { - font-size: 13px; - line-height: 1.5; - margin: 21px 0 0 0; -} - -a { - color: $tint-color; - text-decoration: none; -} - -pre, code { - font-family: $code-font; - word-wrap: break-word; -} - -pre > code, .method-declaration code { - display: inline-block; - font-size: .85em; - padding: 4px 0 4px 10px; - border-left: 5px solid rgba(0, 155, 51, .2); - - &:before { - content: "Objective-C"; - display: block; - - font: 9px/1 $body-font; - color: #009b33; - text-transform: uppercase; - letter-spacing: 2px; - padding-bottom: 6px; - } -} - -pre > code { - font-size: inherit; -} - -table, th, td { - border: 1px solid #e9e9e9; -} - -table { - width: 100%; -} - -th, td { - padding: 7px; - - > :first-child { - margin-top: 0; - } - - > :last-child { - margin-bottom: 0; - } -} - -.container { - @extend .clearfix; - - max-width: 980px; - padding: 0 10px; - margin: 0 auto; - - @media (max-width: $mobile-max-width) { - padding: 0; - } -} - -header { - position: fixed; - top: 0; - left: 0; - width: 100%; - z-index: 2; - - background: #414141; - color: #fff; - font-size: 1.1em; - line-height: 25px; - letter-spacing: .05em; - - #library-title { - float: left; - } - - #developer-home { - float: right; - } - - h1 { - font-size: inherit; - font-weight: inherit; - margin: 0; - } - - p { - margin: 0; - } - - h1, a { - color: inherit; - } - - @media (max-width: $mobile-max-width) { - .container { - padding: 0 10px; - } - } -} - -aside { - position: fixed; - top: 25px; - left: 0; - width: 100%; - height: 25px; - z-index: 2; - - font-size: 1.1em; - - #header-buttons { - background: rgba(255, 255, 255, .8); - margin: 0 1px; - padding: 0; - list-style: none; - text-align: right; - line-height: 32px; - - li { - display: inline-block; - cursor: pointer; - padding: 0 10px; - } - - label, select { - cursor: inherit; - } - - #on-this-page { - position: relative; - - .chevron { - display: inline-block; - width: 14px; - height: 4px; - position: relative; - - .chevy { - background: #878787; - height: 2px; - position: absolute; - width: 10px; - - &.chevron-left { - left: 0; - transform: rotateZ(45deg) scale(0.6); - } - - &.chevron-right { - right: 0; - transform: rotateZ(-45deg) scale(0.6); - } - } - } - - #jump-to { - opacity: 0; - font-size: 16px; - - position: absolute; - top: 5px; - left: 0; - width: 100%; - height: 100%; - } - } - } -} - -article { - margin-top: 25px; - - #content { - @extend .clearfix; - - background: $content-background; - border: 1px solid $content-border; - padding: 15px 25px 30px 25px; - - font-size: 1.4em; - line-height: 1.45; - - position: relative; - - @media (max-width: $mobile-max-width) { - padding: 15px 10px 20px 10px; - border: none; - } - - .navigation-top { - position: absolute; - top: 15px; - right: 25px; - } - - .title { - margin: 21px 0 0 0; - padding: 15px 0; - } - - p { - color: #414141; - margin: 0 0 15px 0; - } - - th, td { - p:last-child { - margin-bottom: 0; - } - } - - main { - ul { - list-style: none; - margin-left: 24px; - margin-bottom: 12px; - padding: 0; - - li { - position: relative; - padding-left: 1.3em; - - &:before { - content: "\02022"; - - color: #414141; - font-size: 1.08em; - line-height: 1; - - position: absolute; - left: 0; - padding-top: 2px; - } - } - } - } - - footer { - @extend .clearfix; - - .footer-copyright { - margin: 70px 25px 10px 0; - } - - p { - font-size: .71em; - color: #a0a0a0; - } - } - } -} diff --git a/submodules/AsyncDisplayKit/docs/appledoc/css/scss/_normalize.scss b/submodules/AsyncDisplayKit/docs/appledoc/css/scss/_normalize.scss deleted file mode 100755 index 9b8848a5cf..0000000000 --- a/submodules/AsyncDisplayKit/docs/appledoc/css/scss/_normalize.scss +++ /dev/null @@ -1,581 +0,0 @@ -/* ========================================================================== - Normalize.scss settings - ========================================================================== */ -/** - * Includes legacy browser support IE6/7 - * - * Set to false if you want to drop support for IE6 and IE7 - */ - -$legacy_browser_support: false !default; - -/* Base - ========================================================================== */ - -/** - * 1. Set default font family to sans-serif. - * 2. Prevent iOS text size adjust after orientation change, without disabling - * user zoom. - * 3. Corrects text resizing oddly in IE 6/7 when body `font-size` is set using - * `em` units. - */ - -html { - font-family: sans-serif; /* 1 */ - -ms-text-size-adjust: 100%; /* 2 */ - -webkit-text-size-adjust: 100%; /* 2 */ - @if $legacy_browser_support { - *font-size: 100%; /* 3 */ - } -} - -/** - * Remove default margin. - */ - -body { - margin: 0; -} - -/* HTML5 display definitions - ========================================================================== */ - -/** - * Correct `block` display not defined for any HTML5 element in IE 8/9. - * Correct `block` display not defined for `details` or `summary` in IE 10/11 - * and Firefox. - * Correct `block` display not defined for `main` in IE 11. - */ - -article, -aside, -details, -figcaption, -figure, -footer, -header, -hgroup, -main, -menu, -nav, -section, -summary { - display: block; -} - -/** - * 1. Correct `inline-block` display not defined in IE 6/7/8/9 and Firefox 3. - * 2. Normalize vertical alignment of `progress` in Chrome, Firefox, and Opera. - */ - -audio, -canvas, -progress, -video { - display: inline-block; /* 1 */ - vertical-align: baseline; /* 2 */ - @if $legacy_browser_support { - *display: inline; - *zoom: 1; - } -} - -/** - * Prevents modern browsers from displaying `audio` without controls. - * Remove excess height in iOS 5 devices. - */ - -audio:not([controls]) { - display: none; - height: 0; -} - -/** - * Address `[hidden]` styling not present in IE 8/9/10. - * Hide the `template` element in IE 8/9/11, Safari, and Firefox < 22. - */ - -[hidden], -template { - display: none; -} - -/* Links - ========================================================================== */ - -/** - * Remove the gray background color from active links in IE 10. - */ - -a { - background-color: transparent; -} - -/** - * Improve readability when focused and also mouse hovered in all browsers. - */ - -a { - &:active, &:hover { - outline: 0; - }; -} - -/* Text-level semantics - ========================================================================== */ - -/** - * Address styling not present in IE 8/9/10/11, Safari, and Chrome. - */ - -abbr[title] { - border-bottom: 1px dotted; -} - -/** - * Address style set to `bolder` in Firefox 4+, Safari, and Chrome. - */ - -b, -strong { - font-weight: bold; -} - -@if $legacy_browser_support { - blockquote { - margin: 1em 40px; - } -} - -/** - * Address styling not present in Safari and Chrome. - */ - -dfn { - font-style: italic; -} - -/** - * Address variable `h1` font-size and margin within `section` and `article` - * contexts in Firefox 4+, Safari, and Chrome. - */ - -h1 { - font-size: 2em; - margin: 0.67em 0; -} - -@if $legacy_browser_support { - h2 { - font-size: 1.5em; - margin: 0.83em 0; - } - - h3 { - font-size: 1.17em; - margin: 1em 0; - } - - h4 { - font-size: 1em; - margin: 1.33em 0; - } - - h5 { - font-size: 0.83em; - margin: 1.67em 0; - } - - h6 { - font-size: 0.67em; - margin: 2.33em 0; - } -} - -/** - * Addresses styling not present in IE 8/9. - */ - -mark { - background: #ff0; - color: #000; -} - -@if $legacy_browser_support { - - /** - * Addresses margins set differently in IE 6/7. - */ - - p, - pre { - *margin: 1em 0; - } - - /* - * Addresses CSS quotes not supported in IE 6/7. - */ - - q { - *quotes: none; - } - - /* - * Addresses `quotes` property not supported in Safari 4. - */ - - q:before, - q:after { - content: ''; - content: none; - } -} - -/** - * Address inconsistent and variable font size in all browsers. - */ - -small { - font-size: 80%; -} - -/** - * Prevent `sub` and `sup` affecting `line-height` in all browsers. - */ - -sub, -sup { - font-size: 75%; - line-height: 0; - position: relative; - vertical-align: baseline; -} - -sup { - top: -0.5em; -} - -sub { - bottom: -0.25em; -} - -@if $legacy_browser_support { - - /* ========================================================================== - Lists - ========================================================================== */ - - /* - * Addresses margins set differently in IE 6/7. - */ - - dl, - menu, - ol, - ul { - *margin: 1em 0; - } - - dd { - *margin: 0 0 0 40px; - } - - /* - * Addresses paddings set differently in IE 6/7. - */ - - menu, - ol, - ul { - *padding: 0 0 0 40px; - } - - /* - * Corrects list images handled incorrectly in IE 7. - */ - - nav ul, - nav ol { - *list-style: none; - *list-style-image: none; - } - -} - -/* Embedded content - ========================================================================== */ - -/** - * 1. Remove border when inside `a` element in IE 8/9/10. - * 2. Improves image quality when scaled in IE 7. - */ - -img { - border: 0; - @if $legacy_browser_support { - *-ms-interpolation-mode: bicubic; /* 2 */ - } -} - -/** - * Correct overflow not hidden in IE 9/10/11. - */ - -svg:not(:root) { - overflow: hidden; -} - -/* Grouping content - ========================================================================== */ - -/** - * Address margin not present in IE 8/9 and Safari. - */ - -figure { - margin: 1em 40px; -} - -/** - * Address differences between Firefox and other browsers. - */ - -hr { - -moz-box-sizing: content-box; - box-sizing: content-box; - height: 0; -} - -/** - * Contain overflow in all browsers. - */ - -pre { - overflow: auto; -} - -/** - * Address odd `em`-unit font size rendering in all browsers. - * Correct font family set oddly in IE 6, Safari 4/5, and Chrome. - */ - -code, -kbd, -pre, -samp { - font-family: monospace, monospace; - @if $legacy_browser_support { - _font-family: 'courier new', monospace; - } - font-size: 1em; -} - -/* Forms - ========================================================================== */ - -/** - * Known limitation: by default, Chrome and Safari on OS X allow very limited - * styling of `select`, unless a `border` property is set. - */ - -/** - * 1. Correct color not being inherited. - * Known issue: affects color of disabled elements. - * 2. Correct font properties not being inherited. - * 3. Address margins set differently in Firefox 4+, Safari, and Chrome. - * 4. Improves appearance and consistency in all browsers. - */ - -button, -input, -optgroup, -select, -textarea { - color: inherit; /* 1 */ - font: inherit; /* 2 */ - margin: 0; /* 3 */ - @if $legacy_browser_support { - vertical-align: baseline; /* 3 */ - *vertical-align: middle; /* 3 */ - } -} - -/** - * Address `overflow` set to `hidden` in IE 8/9/10/11. - */ - -button { - overflow: visible; -} - -/** - * Address inconsistent `text-transform` inheritance for `button` and `select`. - * All other form control elements do not inherit `text-transform` values. - * Correct `button` style inheritance in Firefox, IE 8/9/10/11, and Opera. - * Correct `select` style inheritance in Firefox. - */ - -button, -select { - text-transform: none; -} - -/** - * 1. Avoid the WebKit bug in Android 4.0.* where (2) destroys native `audio` - * and `video` controls. - * 2. Correct inability to style clickable `input` types in iOS. - * 3. Improve usability and consistency of cursor style between image-type - * `input` and others. - * 4. Removes inner spacing in IE 7 without affecting normal text inputs. - * Known issue: inner spacing remains in IE 6. - */ - -button, -html input[type="button"], /* 1 */ -input[type="reset"], -input[type="submit"] { - -webkit-appearance: button; /* 2 */ - cursor: pointer; /* 3 */ - @if $legacy_browser_support { - *overflow: visible; /* 4 */ - } -} - -/** - * Re-set default cursor for disabled elements. - */ - -button[disabled], -html input[disabled] { - cursor: default; -} - -/** - * Remove inner padding and border in Firefox 4+. - */ - -button::-moz-focus-inner, -input::-moz-focus-inner { - border: 0; - padding: 0; -} - -/** - * Address Firefox 4+ setting `line-height` on `input` using `!important` in - * the UA stylesheet. - */ - -input { - line-height: normal; -} - -/** - * 1. Address box sizing set to `content-box` in IE 8/9/10. - * 2. Remove excess padding in IE 8/9/10. - * Known issue: excess padding remains in IE 6. - */ - -input[type="checkbox"], -input[type="radio"] { - box-sizing: border-box; /* 1 */ - padding: 0; /* 2 */ - @if $legacy_browser_support { - *height: 13px; /* 3 */ - *width: 13px; /* 3 */ - } -} - -/** - * Fix the cursor style for Chrome's increment/decrement buttons. For certain - * `font-size` values of the `input`, it causes the cursor style of the - * decrement button to change from `default` to `text`. - */ - -input[type="number"]::-webkit-inner-spin-button, -input[type="number"]::-webkit-outer-spin-button { - height: auto; -} - -/** - * 1. Address `appearance` set to `searchfield` in Safari and Chrome. - * 2. Address `box-sizing` set to `border-box` in Safari and Chrome - * (include `-moz` to future-proof). - */ - -input[type="search"] { - -webkit-appearance: textfield; /* 1 */ - -moz-box-sizing: content-box; - -webkit-box-sizing: content-box; /* 2 */ - box-sizing: content-box; -} - -/** - * Remove inner padding and search cancel button in Safari and Chrome on OS X. - * Safari (but not Chrome) clips the cancel button when the search input has - * padding (and `textfield` appearance). - */ - -input[type="search"]::-webkit-search-cancel-button, -input[type="search"]::-webkit-search-decoration { - -webkit-appearance: none; -} - -/** - * Define consistent border, margin, and padding. - */ - -fieldset { - border: 1px solid #c0c0c0; - margin: 0 2px; - padding: 0.35em 0.625em 0.75em; -} - -/** - * 1. Correct `color` not being inherited in IE 8/9/10/11. - * 2. Remove padding so people aren't caught out if they zero out fieldsets. - * 3. Corrects text not wrapping in Firefox 3. - * 4. Corrects alignment displayed oddly in IE 6/7. - */ - -legend { - border: 0; /* 1 */ - padding: 0; /* 2 */ - @if $legacy_browser_support { - white-space: normal; /* 3 */ - *margin-left: -7px; /* 4 */ - } -} - -/** - * Remove default vertical scrollbar in IE 8/9/10/11. - */ - -textarea { - overflow: auto; -} - -/** - * Don't inherit the `font-weight` (applied by a rule above). - * NOTE: the default cannot safely be changed in Chrome and Safari on OS X. - */ - -optgroup { - font-weight: bold; -} - -/* Tables - ========================================================================== */ - -/** - * Remove most spacing between table cells. - */ - -table { - border-collapse: collapse; - border-spacing: 0; -} - -td, -th { - padding: 0; -} diff --git a/submodules/AsyncDisplayKit/docs/appledoc/css/scss/_object.scss b/submodules/AsyncDisplayKit/docs/appledoc/css/scss/_object.scss deleted file mode 100755 index 22eebd87d0..0000000000 --- a/submodules/AsyncDisplayKit/docs/appledoc/css/scss/_object.scss +++ /dev/null @@ -1,89 +0,0 @@ -.section-specification { - table { - width: auto; - - th { - text-align: left; - } - } -} - -.method-title { - margin-left: -15px; - margin-bottom: 8px; - transition: margin-left .3s ease-out; - - .section-method.hide & { - margin-left: 0; - } - - code { - font-weight: 400; - font-size: .85em; - } -} - -.method-info { - background: $object-background; - border-bottom: 1px solid $object-border; - margin: 0 -25px; - padding: 20px 25px 0 25px; - transition: height .3s ease-out; - - position: relative; - - .pointy-thing { - background: $content-background; - height: 10px; - border-bottom: 1px solid $object-border; - margin: -20px -25px 16px -25px; - - &:before { - display: inline-block; - content: ""; - - background: $object-background; - border: 1px solid $object-border; - border-bottom: 0; - border-right: 0; - - position: absolute; - left: 21px; - top: 3px; - width: 12px; - height: 12px; - transform: rotate(45deg); - } - } - - .method-subsection { - margin-bottom: 15px; - - .argument-name { - width: 1px; - text-align: right; - - code { - color: #808080; - font-style: italic; - font-weight: 400; - } - } - } -} - -.section-method { - &.hide .method-info { - height: 0 !important; - overflow: hidden; - display: none; - } - - &.hide.animating .method-info { - display: block; - } - - &.animating .method-info { - overflow: hidden; - } -} diff --git a/submodules/AsyncDisplayKit/docs/appledoc/css/scss/_print.scss b/submodules/AsyncDisplayKit/docs/appledoc/css/scss/_print.scss deleted file mode 100755 index 61bdf99f86..0000000000 --- a/submodules/AsyncDisplayKit/docs/appledoc/css/scss/_print.scss +++ /dev/null @@ -1,42 +0,0 @@ -@media print { - body { - background: #fff; - padding: 8px; - } - - header { - position: static; - background: #fff; - color: #000; - } - - aside { - display: none; - } - - .container { - max-width: none; - padding: 0; - } - - article { - margin-top: 0; - - #content { - border: 0; - background: #fff; - padding: 15px 0 0 0; - - .title { - margin-top: 0; - padding-top: 0; - } - } - } - - .method-info { - &, & .pointy-thing { - background: #fff; - } - } -} diff --git a/submodules/AsyncDisplayKit/docs/appledoc/css/scss/_variables.scss b/submodules/AsyncDisplayKit/docs/appledoc/css/scss/_variables.scss deleted file mode 100755 index 38e072d310..0000000000 --- a/submodules/AsyncDisplayKit/docs/appledoc/css/scss/_variables.scss +++ /dev/null @@ -1,12 +0,0 @@ -$body-font: -apple-system-font, "Helvetica Neue", Helvetica, sans-serif; -$code-font: "Source Code Pro", Monaco, Menlo, Consolas, monospace; - -$body-background: #f2f2f2; -$content-background: #fff; -$content-border: #e9e9e9; -$tint-color: #08c; -$object-background: #f9f9f9; -$object-border: #e9e9e9; - -$mobile-max-width: 650px; -$desktop-min-width: 768px; \ No newline at end of file diff --git a/submodules/AsyncDisplayKit/docs/appledoc/css/scss/_xcode.scss b/submodules/AsyncDisplayKit/docs/appledoc/css/scss/_xcode.scss deleted file mode 100755 index 340b1f6b80..0000000000 --- a/submodules/AsyncDisplayKit/docs/appledoc/css/scss/_xcode.scss +++ /dev/null @@ -1,29 +0,0 @@ -.xcode { - header, aside { - display: none; - } - - .container { - padding: 0; - } - - article { - margin-top: 0; - - #content { - border: 0; - margin: 0; - } - } - - .method-info { - &, .section-method.hide & { - max-height: auto; - overflow: visible; - - &.hiding { - display: block; - } - } - } -} diff --git a/submodules/AsyncDisplayKit/docs/appledoc/css/scss/style.scss b/submodules/AsyncDisplayKit/docs/appledoc/css/scss/style.scss deleted file mode 100755 index 648a6086ba..0000000000 --- a/submodules/AsyncDisplayKit/docs/appledoc/css/scss/style.scss +++ /dev/null @@ -1 +0,0 @@ -@import "variables", "normalize", "layout", "index", "object", "print", "xcode"; diff --git a/submodules/AsyncDisplayKit/docs/appledoc/css/style.css b/submodules/AsyncDisplayKit/docs/appledoc/css/style.css deleted file mode 100755 index d9d59dd080..0000000000 --- a/submodules/AsyncDisplayKit/docs/appledoc/css/style.css +++ /dev/null @@ -1,2 +0,0 @@ -html{font-family:sans-serif;-ms-text-size-adjust:100%;-webkit-text-size-adjust:100%}body{margin:0}article,aside,details,figcaption,figure,footer,header,hgroup,main,menu,nav,section,summary{display:block}audio,canvas,progress,video{display:inline-block;vertical-align:baseline}audio:not([controls]){display:none;height:0}[hidden],template{display:none}a{background-color:transparent}a:active,a:hover{outline:0}abbr[title]{border-bottom:1px dotted}b,strong{font-weight:bold}dfn{font-style:italic}h1{font-size:2em;margin:0.67em 0}mark{background:#ff0;color:#000}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sup{top:-0.5em}sub{bottom:-0.25em}img{border:0}svg:not(:root){overflow:hidden}figure{margin:1em 40px}hr{-moz-box-sizing:content-box;box-sizing:content-box;height:0}pre{overflow:auto}code,kbd,pre,samp{font-family:monospace, monospace;font-size:1em}button,input,optgroup,select,textarea{color:inherit;font:inherit;margin:0}button{overflow:visible}button,select{text-transform:none}button,html input[type="button"],input[type="reset"],input[type="submit"]{-webkit-appearance:button;cursor:pointer}button[disabled],html input[disabled]{cursor:default}button::-moz-focus-inner,input::-moz-focus-inner{border:0;padding:0}input{line-height:normal}input[type="checkbox"],input[type="radio"]{box-sizing:border-box;padding:0}input[type="number"]::-webkit-inner-spin-button,input[type="number"]::-webkit-outer-spin-button{height:auto}input[type="search"]{-webkit-appearance:textfield;-moz-box-sizing:content-box;-webkit-box-sizing:content-box;box-sizing:content-box}input[type="search"]::-webkit-search-cancel-button,input[type="search"]::-webkit-search-decoration{-webkit-appearance:none}fieldset{border:1px solid #c0c0c0;margin:0 2px;padding:0.35em 0.625em 0.75em}legend{border:0;padding:0}textarea{overflow:auto}optgroup{font-weight:bold}table{border-collapse:collapse;border-spacing:0}td,th{padding:0}*{box-sizing:border-box}.clear{clear:both}.clearfix:before,.container:before,article #content:before,article #content footer:before,.clearfix:after,.container:after,article #content:after,article #content footer:after{clear:both;display:table;content:""}.xcode .hide-in-xcode{display:none}body{font:62.5% -apple-system-font,"Helvetica Neue",Helvetica,sans-serif;background:#f2f2f2}@media (max-width: 650px){body{background-color:#fff}}h1,h2,h3{font-weight:300;color:#808080}h1{font-size:2em;color:#000}h4{font-size:13px;line-height:1.5;margin:21px 0 0 0}a{color:#08c;text-decoration:none}pre,code{font-family:"Source Code Pro",Monaco,Menlo,Consolas,monospace;word-wrap:break-word}pre>code,.method-declaration code{display:inline-block;font-size:.85em;padding:4px 0 4px 10px;border-left:5px solid rgba(0,155,51,0.2)}pre>code:before,.method-declaration code:before{content:"Objective-C";display:block;font:9px/1 -apple-system-font,"Helvetica Neue",Helvetica,sans-serif;color:#009b33;text-transform:uppercase;letter-spacing:2px;padding-bottom:6px}pre>code{font-size:inherit}table,th,td{border:1px solid #e9e9e9}table{width:100%}th,td{padding:7px}th>:first-child,td>:first-child{margin-top:0}th>:last-child,td>:last-child{margin-bottom:0}.container{max-width:980px;padding:0 10px;margin:0 auto}@media (max-width: 650px){.container{padding:0}}header{position:fixed;top:0;left:0;width:100%;z-index:2;background:#414141;color:#fff;font-size:1.1em;line-height:25px;letter-spacing:.05em}header #library-title{float:left}header #developer-home{float:right}header h1{font-size:inherit;font-weight:inherit;margin:0}header p{margin:0}header h1,header a{color:inherit}@media (max-width: 650px){header .container{padding:0 10px}}aside{position:fixed;top:25px;left:0;width:100%;height:25px;z-index:2;font-size:1.1em}aside #header-buttons{background:rgba(255,255,255,0.8);margin:0 1px;padding:0;list-style:none;text-align:right;line-height:32px}aside #header-buttons li{display:inline-block;cursor:pointer;padding:0 10px}aside #header-buttons label,aside #header-buttons select{cursor:inherit}aside #header-buttons #on-this-page{position:relative}aside #header-buttons #on-this-page .chevron{display:inline-block;width:14px;height:4px;position:relative}aside #header-buttons #on-this-page .chevron .chevy{background:#878787;height:2px;position:absolute;width:10px}aside #header-buttons #on-this-page .chevron .chevy.chevron-left{left:0;transform:rotateZ(45deg) scale(0.6)}aside #header-buttons #on-this-page .chevron .chevy.chevron-right{right:0;transform:rotateZ(-45deg) scale(0.6)}aside #header-buttons #on-this-page #jump-to{opacity:0;font-size:16px;position:absolute;top:5px;left:0;width:100%;height:100%}article{margin-top:25px}article #content{background:#fff;border:1px solid #e9e9e9;padding:15px 25px 30px 25px;font-size:1.4em;line-height:1.45;position:relative}@media (max-width: 650px){article #content{padding:15px 10px 20px 10px;border:none}}article #content .navigation-top{position:absolute;top:15px;right:25px}article #content .title{margin:21px 0 0 0;padding:15px 0}article #content p{color:#414141;margin:0 0 15px 0}article #content th p:last-child,article #content td p:last-child{margin-bottom:0}article #content main ul{list-style:none;margin-left:24px;margin-bottom:12px;padding:0}article #content main ul li{position:relative;padding-left:1.3em}article #content main ul li:before{content:"\02022";color:#414141;font-size:1.08em;line-height:1;position:absolute;left:0;padding-top:2px}article #content footer .footer-copyright{margin:70px 25px 10px 0}article #content footer p{font-size:.71em;color:#a0a0a0}.index-container{-webkit-flex-direction:column;flex-direction:column}@media (min-width: 768px){.index-container{display:flex;-webkit-flex-direction:row;flex-direction:row;-webkit-flex-wrap:wrap;flex-wrap:wrap}}.index-container .index-column{-webkit-flex:1 1 33%;flex:1 1 33%}.section-specification table{width:auto}.section-specification table th{text-align:left}.method-title{margin-left:-15px;margin-bottom:8px;transition:margin-left .3s ease-out}.section-method.hide .method-title{margin-left:0}.method-title code{font-weight:400;font-size:.85em}.method-info{background:#f9f9f9;border-bottom:1px solid #e9e9e9;margin:0 -25px;padding:20px 25px 0 25px;transition:height .3s ease-out;position:relative}.method-info .pointy-thing{background:#fff;height:10px;border-bottom:1px solid #e9e9e9;margin:-20px -25px 16px -25px}.method-info .pointy-thing:before{display:inline-block;content:"";background:#f9f9f9;border:1px solid #e9e9e9;border-bottom:0;border-right:0;position:absolute;left:21px;top:3px;width:12px;height:12px;-webkit-transform:rotate(45deg);transform:rotate(45deg) }.method-info .method-subsection{margin-bottom:15px}.method-info .method-subsection .argument-name{width:1px;text-align:right}.method-info .method-subsection .argument-name code{color:#808080;font-style:italic;font-weight:400}.section-method.hide .method-info{height:0 !important;overflow:hidden;display:none}.section-method.hide.animating .method-info{display:block}.section-method.animating .method-info{overflow:hidden}@media print{body{background:#fff;padding:8px}header{position:static;background:#fff;color:#000}aside{display:none}.container{max-width:none;padding:0}article{margin-top:0}article #content{border:0;background:#fff;padding:15px 0 0 0}article #content .title{margin-top:0;padding-top:0}.method-info,.method-info .pointy-thing{background:#fff}}.xcode header,.xcode aside{display:none}.xcode .container{padding:0}.xcode article{margin-top:0}.xcode article #content{border:0;margin:0}.xcode .method-info,.section-method.hide .xcode .method-info{max-height:auto;overflow:visible}.xcode .method-info.hiding,.section-method.hide .xcode .method-info.hiding{display:block} - diff --git a/submodules/AsyncDisplayKit/docs/appledoc/hierarchy.html b/submodules/AsyncDisplayKit/docs/appledoc/hierarchy.html deleted file mode 100755 index f9eb61138c..0000000000 --- a/submodules/AsyncDisplayKit/docs/appledoc/hierarchy.html +++ /dev/null @@ -1,402 +0,0 @@ - - - - - - Hierarchy - - - - - - -
    -
    - -

    - -

    - -

    - AsyncDisplayKit -

    - -
    -
    - - - -
    -
    -
    -
    -

    Hierarchy

    - - -
    -

    Class Hierarchy

    - - - -
    - - - -
    - -

    Protocol References

    - - - -

    Constant References

    - - - -

    Category References

    - - -
    - - -
    - -
    -
    -
    -
    -
    - - - - \ No newline at end of file diff --git a/submodules/AsyncDisplayKit/docs/appledoc/img/button_bar_background.png b/submodules/AsyncDisplayKit/docs/appledoc/img/button_bar_background.png deleted file mode 100755 index 71d1019bc0..0000000000 Binary files a/submodules/AsyncDisplayKit/docs/appledoc/img/button_bar_background.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/docs/appledoc/img/disclosure.png b/submodules/AsyncDisplayKit/docs/appledoc/img/disclosure.png deleted file mode 100755 index 4c5cbf4456..0000000000 Binary files a/submodules/AsyncDisplayKit/docs/appledoc/img/disclosure.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/docs/appledoc/img/disclosure_open.png b/submodules/AsyncDisplayKit/docs/appledoc/img/disclosure_open.png deleted file mode 100755 index 82396fed29..0000000000 Binary files a/submodules/AsyncDisplayKit/docs/appledoc/img/disclosure_open.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/docs/appledoc/img/library_background.png b/submodules/AsyncDisplayKit/docs/appledoc/img/library_background.png deleted file mode 100755 index 3006248afe..0000000000 Binary files a/submodules/AsyncDisplayKit/docs/appledoc/img/library_background.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/docs/appledoc/img/title_background.png b/submodules/AsyncDisplayKit/docs/appledoc/img/title_background.png deleted file mode 100755 index 846e4968d0..0000000000 Binary files a/submodules/AsyncDisplayKit/docs/appledoc/img/title_background.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/docs/appledoc/index.html b/submodules/AsyncDisplayKit/docs/appledoc/index.html deleted file mode 100755 index 27076d4fb6..0000000000 --- a/submodules/AsyncDisplayKit/docs/appledoc/index.html +++ /dev/null @@ -1,340 +0,0 @@ - - - - - - Reference - - - - - - -
    -
    - -

    - -

    - -

    - AsyncDisplayKit -

    - -
    -
    - - - -
    -
    -
    -
    -

    Reference

    - - - -
    - - - - - - - -
    - -

    Protocol References

    - - - - -

    Constant References

    - - - - -

    Category References

    - - -
    - -
    - -
    - -
    -
    -
    -
    -
    - - - - \ No newline at end of file diff --git a/submodules/AsyncDisplayKit/docs/appledoc/js/script.js b/submodules/AsyncDisplayKit/docs/appledoc/js/script.js deleted file mode 100755 index 4074361c44..0000000000 --- a/submodules/AsyncDisplayKit/docs/appledoc/js/script.js +++ /dev/null @@ -1,59 +0,0 @@ -function $() { - return document.querySelector.apply(document, arguments); -} - -if (navigator.userAgent.indexOf("Xcode") != -1) { - document.documentElement.classList.add("xcode"); -} - -var jumpTo = $("#jump-to"); - -if (jumpTo) { - jumpTo.addEventListener("change", function(e) { - location.hash = this.options[this.selectedIndex].value; - }); -} - -function hashChanged() { - if (/^#\/\/api\//.test(location.hash)) { - var element = document.querySelector("a[name='" + location.hash.substring(1) + "']"); - - if (!element) { - return; - } - - element = element.parentNode; - - element.classList.remove("hide"); - fixScrollPosition(element); - } -} - -function fixScrollPosition(element) { - var scrollTop = element.offsetTop - 150; - document.documentElement.scrollTop = scrollTop; - document.body.scrollTop = scrollTop; -} - -[].forEach.call(document.querySelectorAll(".section-method"), function(element) { - element.classList.add("hide"); - - element.querySelector(".method-title a").addEventListener("click", function(e) { - var info = element.querySelector(".method-info"), - infoContainer = element.querySelector(".method-info-container"); - - element.classList.add("animating"); - info.style.height = (infoContainer.clientHeight + 40) + "px"; - fixScrollPosition(element); - element.classList.toggle("hide"); - if (element.classList.contains("hide")) { - e.preventDefault(); - } - setTimeout(function() { - element.classList.remove("animating"); - }, 300); - }); -}); - -window.addEventListener("hashchange", hashChanged); -hashChanged(); diff --git a/submodules/AsyncDisplayKit/docs/appledocs.md b/submodules/AsyncDisplayKit/docs/appledocs.md deleted file mode 100755 index 541ea17cfc..0000000000 --- a/submodules/AsyncDisplayKit/docs/appledocs.md +++ /dev/null @@ -1,7 +0,0 @@ ---- -title: api -layout: appledocs -permalink: /appledocs.html ---- - - diff --git a/submodules/AsyncDisplayKit/docs/index.md b/submodules/AsyncDisplayKit/docs/index.md deleted file mode 100755 index ad660777f4..0000000000 --- a/submodules/AsyncDisplayKit/docs/index.md +++ /dev/null @@ -1,23 +0,0 @@ ---- -layout: default -title: A UI Framework for Effortless Responsiveness -id: home ---- - -
    -
    -
    Keeps the most complex iOS user interfaces smooth and responsive.
    - Get Started - View on GitHub -
    -
    - -
    -
    -

    Texture is an iOS framework built on top of UIKit that keeps even the most complex user interfaces smooth and responsive. It was originally built to make Facebook's Paper possible, and goes hand-in-hand with pop's physics-based animations — but it's just as powerful with UIKit Dynamics and conventional app designs. More recently, it was used to power Pinterest's app rewrite.

    - -

    As the framework has grown, many features have been added that can save developers tons of time by eliminating common boilerplate style structures common in modern iOS apps. If you've ever dealt with cell reuse bugs, tried to performantly preload data for a page or scroll style interface or even just tried to keep your app from dropping too many frames you can benefit from integrating Texture.

    - -

    To learn more, check out our docs!

    -
    -
    diff --git a/submodules/AsyncDisplayKit/docs/showcase.md b/submodules/AsyncDisplayKit/docs/showcase.md deleted file mode 100755 index 57f9ca127f..0000000000 --- a/submodules/AsyncDisplayKit/docs/showcase.md +++ /dev/null @@ -1,290 +0,0 @@ ---- -title: Showcase -layout: default -permalink: /showcase.html ---- - -
    - -
    -

    Who's using Texture?

    -

    If you're curious to see what can be accomplished with Texture, check out these apps.

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - -
    - Facebook -
    - Introducing AsyncDisplayKit: For smooth and responsive apps on iOS -
    - -
    - Pinterest -
    - Re-architecting Pinterest's iOS app -
    - -
    - Buffer -
    - Smooth Scrolling in Buffer for iOS: How (and Why) We Implemented AsyncDisplayKit

    - Texture: What, Why and How -
    - -
    - Auxy -
    - 2016 Apple Design Award Winner -
    - -
    - NYT -
    - -
    - NFL -
    - -
    - Yahoo -
    - -
    - Kwaver Music -
    - -
    - This is Money -
    - -
    - JSwipe -
    - -
    - Peloton Cycle -
    - -
    - 即刻 - 不错过你惦记的每一件小事 -
    - -
    - Tripstr -
    - -
    - Fyuse -
    - -
    - ClassDojo -
    - Powering Class Story With Texture -
    - -
    - GitBucket -
    - -
    - Roposo -
    - -
    - Mishu -
    - -
    - InstaBuy -
    - -
    - Eniro -
    - -
    - Kayako -
    - -
    - Yep -
    - -
    - HakkerJobs -
    - -
    - TraceMe -
    - -
    - Pairs -
    - -
    - Sorted: Master Your Day -
    - -
    - Vingle -
    - Improvement feed performance with Texture -
    - -
    - Blendle -
    - -
    - MensXP -
    - -
    - iDiva -
    - -
    - Waplog -
    - -
    - Apollo for Reddit -
    - -
    - Wishpoke -
    - -
    - Bluebird -
    - -
    - -
    -

    If you built an app using Texture, we'd love to have your app in this showcase!

    -

    If you would like to have your app added or do not want your app featured on this page, please email textureframework@gmail.com.

    - -
    - -
    diff --git a/submodules/AsyncDisplayKit/docs/slack.md b/submodules/AsyncDisplayKit/docs/slack.md deleted file mode 100755 index 121dc4d51e..0000000000 --- a/submodules/AsyncDisplayKit/docs/slack.md +++ /dev/null @@ -1,10 +0,0 @@ ---- -title: slack -layout: slack -permalink: /slack.html ---- - - - - -If the auto-invite link above does not work for you, please email textureframework@gmail.com for an invite. diff --git a/submodules/AsyncDisplayKit/docs/static/images/1-shuffle-crop.png b/submodules/AsyncDisplayKit/docs/static/images/1-shuffle-crop.png deleted file mode 100755 index d1e0a83b0c..0000000000 Binary files a/submodules/AsyncDisplayKit/docs/static/images/1-shuffle-crop.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/docs/static/images/Texturelogo.png b/submodules/AsyncDisplayKit/docs/static/images/Texturelogo.png deleted file mode 100644 index cf669bef16..0000000000 Binary files a/submodules/AsyncDisplayKit/docs/static/images/Texturelogo.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/docs/static/images/Texturelogo@2x.png b/submodules/AsyncDisplayKit/docs/static/images/Texturelogo@2x.png deleted file mode 100644 index 3ad259d962..0000000000 Binary files a/submodules/AsyncDisplayKit/docs/static/images/Texturelogo@2x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/docs/static/images/basicMap.png b/submodules/AsyncDisplayKit/docs/static/images/basicMap.png deleted file mode 100755 index b387adc082..0000000000 Binary files a/submodules/AsyncDisplayKit/docs/static/images/basicMap.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/docs/static/images/catsButt.png b/submodules/AsyncDisplayKit/docs/static/images/catsButt.png deleted file mode 100755 index 0d442faf4d..0000000000 Binary files a/submodules/AsyncDisplayKit/docs/static/images/catsButt.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/docs/static/images/catsFace.png b/submodules/AsyncDisplayKit/docs/static/images/catsFace.png deleted file mode 100755 index 4be93671f9..0000000000 Binary files a/submodules/AsyncDisplayKit/docs/static/images/catsFace.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/docs/static/images/catsMiddle.png b/submodules/AsyncDisplayKit/docs/static/images/catsMiddle.png deleted file mode 100755 index f6526eebef..0000000000 Binary files a/submodules/AsyncDisplayKit/docs/static/images/catsMiddle.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/docs/static/images/clip-corners.png b/submodules/AsyncDisplayKit/docs/static/images/clip-corners.png deleted file mode 100755 index cc43a0a974..0000000000 Binary files a/submodules/AsyncDisplayKit/docs/static/images/clip-corners.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/docs/static/images/component-controllers.png b/submodules/AsyncDisplayKit/docs/static/images/component-controllers.png deleted file mode 100755 index e882cd1f7e..0000000000 Binary files a/submodules/AsyncDisplayKit/docs/static/images/component-controllers.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/docs/static/images/corner-rounding-flowchart-v2.png b/submodules/AsyncDisplayKit/docs/static/images/corner-rounding-flowchart-v2.png deleted file mode 100755 index 71b50848a1..0000000000 Binary files a/submodules/AsyncDisplayKit/docs/static/images/corner-rounding-flowchart-v2.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/docs/static/images/corner-rounding-movement.png b/submodules/AsyncDisplayKit/docs/static/images/corner-rounding-movement.png deleted file mode 100755 index 1749d6683c..0000000000 Binary files a/submodules/AsyncDisplayKit/docs/static/images/corner-rounding-movement.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/docs/static/images/corner-rounding-overlap.png b/submodules/AsyncDisplayKit/docs/static/images/corner-rounding-overlap.png deleted file mode 100755 index b69b3825e6..0000000000 Binary files a/submodules/AsyncDisplayKit/docs/static/images/corner-rounding-overlap.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/docs/static/images/corner-rounding-scrolling.png b/submodules/AsyncDisplayKit/docs/static/images/corner-rounding-scrolling.png deleted file mode 100755 index ef29151707..0000000000 Binary files a/submodules/AsyncDisplayKit/docs/static/images/corner-rounding-scrolling.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/docs/static/images/example-app-screenshots/ASCollectionView.png b/submodules/AsyncDisplayKit/docs/static/images/example-app-screenshots/ASCollectionView.png deleted file mode 100755 index 3aaff368e5..0000000000 Binary files a/submodules/AsyncDisplayKit/docs/static/images/example-app-screenshots/ASCollectionView.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/docs/static/images/example-app-screenshots/ASCornerLayoutSpec.png b/submodules/AsyncDisplayKit/docs/static/images/example-app-screenshots/ASCornerLayoutSpec.png deleted file mode 100644 index 2a3ac02101..0000000000 Binary files a/submodules/AsyncDisplayKit/docs/static/images/example-app-screenshots/ASCornerLayoutSpec.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/docs/static/images/example-app-screenshots/ASDKLayoutTransition.gif b/submodules/AsyncDisplayKit/docs/static/images/example-app-screenshots/ASDKLayoutTransition.gif deleted file mode 100755 index c75467164d..0000000000 Binary files a/submodules/AsyncDisplayKit/docs/static/images/example-app-screenshots/ASDKLayoutTransition.gif and /dev/null differ diff --git a/submodules/AsyncDisplayKit/docs/static/images/example-app-screenshots/ASDKTube.gif b/submodules/AsyncDisplayKit/docs/static/images/example-app-screenshots/ASDKTube.gif deleted file mode 100755 index 956a5c0440..0000000000 Binary files a/submodules/AsyncDisplayKit/docs/static/images/example-app-screenshots/ASDKTube.gif and /dev/null differ diff --git a/submodules/AsyncDisplayKit/docs/static/images/example-app-screenshots/ASDKgram.png b/submodules/AsyncDisplayKit/docs/static/images/example-app-screenshots/ASDKgram.png deleted file mode 100755 index 358dae3805..0000000000 Binary files a/submodules/AsyncDisplayKit/docs/static/images/example-app-screenshots/ASDKgram.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/docs/static/images/example-app-screenshots/ASMapNode.png b/submodules/AsyncDisplayKit/docs/static/images/example-app-screenshots/ASMapNode.png deleted file mode 100755 index aa605349fe..0000000000 Binary files a/submodules/AsyncDisplayKit/docs/static/images/example-app-screenshots/ASMapNode.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/docs/static/images/example-app-screenshots/ASTableViewStressTest.png b/submodules/AsyncDisplayKit/docs/static/images/example-app-screenshots/ASTableViewStressTest.png deleted file mode 100755 index cd7aae2d9d..0000000000 Binary files a/submodules/AsyncDisplayKit/docs/static/images/example-app-screenshots/ASTableViewStressTest.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/docs/static/images/example-app-screenshots/ASViewController.png b/submodules/AsyncDisplayKit/docs/static/images/example-app-screenshots/ASViewController.png deleted file mode 100755 index 545f3c8d63..0000000000 Binary files a/submodules/AsyncDisplayKit/docs/static/images/example-app-screenshots/ASViewController.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/docs/static/images/example-app-screenshots/AsyncDisplayKitOverview.png b/submodules/AsyncDisplayKit/docs/static/images/example-app-screenshots/AsyncDisplayKitOverview.png deleted file mode 100755 index 4941292c4b..0000000000 Binary files a/submodules/AsyncDisplayKit/docs/static/images/example-app-screenshots/AsyncDisplayKitOverview.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/docs/static/images/example-app-screenshots/BackgroundPropertySetting.gif b/submodules/AsyncDisplayKit/docs/static/images/example-app-screenshots/BackgroundPropertySetting.gif deleted file mode 100755 index e2655ef235..0000000000 Binary files a/submodules/AsyncDisplayKit/docs/static/images/example-app-screenshots/BackgroundPropertySetting.gif and /dev/null differ diff --git a/submodules/AsyncDisplayKit/docs/static/images/example-app-screenshots/CatDealsCollectionView.png b/submodules/AsyncDisplayKit/docs/static/images/example-app-screenshots/CatDealsCollectionView.png deleted file mode 100755 index 72f9179e94..0000000000 Binary files a/submodules/AsyncDisplayKit/docs/static/images/example-app-screenshots/CatDealsCollectionView.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/docs/static/images/example-app-screenshots/CollectionViewWithViewControllerCells.png b/submodules/AsyncDisplayKit/docs/static/images/example-app-screenshots/CollectionViewWithViewControllerCells.png deleted file mode 100755 index 078b7b945f..0000000000 Binary files a/submodules/AsyncDisplayKit/docs/static/images/example-app-screenshots/CollectionViewWithViewControllerCells.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/docs/static/images/example-app-screenshots/CustomCollectionView.gif b/submodules/AsyncDisplayKit/docs/static/images/example-app-screenshots/CustomCollectionView.gif deleted file mode 100755 index 8d8a2aed1e..0000000000 Binary files a/submodules/AsyncDisplayKit/docs/static/images/example-app-screenshots/CustomCollectionView.gif and /dev/null differ diff --git a/submodules/AsyncDisplayKit/docs/static/images/example-app-screenshots/EditableText.png b/submodules/AsyncDisplayKit/docs/static/images/example-app-screenshots/EditableText.png deleted file mode 100755 index 1aa8d6db9b..0000000000 Binary files a/submodules/AsyncDisplayKit/docs/static/images/example-app-screenshots/EditableText.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/docs/static/images/example-app-screenshots/HorizontalwithinVerticalScrolling.gif b/submodules/AsyncDisplayKit/docs/static/images/example-app-screenshots/HorizontalwithinVerticalScrolling.gif deleted file mode 100755 index fe722a308d..0000000000 Binary files a/submodules/AsyncDisplayKit/docs/static/images/example-app-screenshots/HorizontalwithinVerticalScrolling.gif and /dev/null differ diff --git a/submodules/AsyncDisplayKit/docs/static/images/example-app-screenshots/Kittens.png b/submodules/AsyncDisplayKit/docs/static/images/example-app-screenshots/Kittens.png deleted file mode 100755 index 91d9bf36fa..0000000000 Binary files a/submodules/AsyncDisplayKit/docs/static/images/example-app-screenshots/Kittens.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/docs/static/images/example-app-screenshots/LayoutSpecPlayground.png b/submodules/AsyncDisplayKit/docs/static/images/example-app-screenshots/LayoutSpecPlayground.png deleted file mode 100755 index 9ed4db7c55..0000000000 Binary files a/submodules/AsyncDisplayKit/docs/static/images/example-app-screenshots/LayoutSpecPlayground.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/docs/static/images/example-app-screenshots/Multiplex.gif b/submodules/AsyncDisplayKit/docs/static/images/example-app-screenshots/Multiplex.gif deleted file mode 100755 index fcb98cad62..0000000000 Binary files a/submodules/AsyncDisplayKit/docs/static/images/example-app-screenshots/Multiplex.gif and /dev/null differ diff --git a/submodules/AsyncDisplayKit/docs/static/images/example-app-screenshots/PagerNode.gif b/submodules/AsyncDisplayKit/docs/static/images/example-app-screenshots/PagerNode.gif deleted file mode 100755 index 8c13a0faea..0000000000 Binary files a/submodules/AsyncDisplayKit/docs/static/images/example-app-screenshots/PagerNode.gif and /dev/null differ diff --git a/submodules/AsyncDisplayKit/docs/static/images/example-app-screenshots/SocialAppLayout.png b/submodules/AsyncDisplayKit/docs/static/images/example-app-screenshots/SocialAppLayout.png deleted file mode 100755 index 33d6672102..0000000000 Binary files a/submodules/AsyncDisplayKit/docs/static/images/example-app-screenshots/SocialAppLayout.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/docs/static/images/example-app-screenshots/Swift.png b/submodules/AsyncDisplayKit/docs/static/images/example-app-screenshots/Swift.png deleted file mode 100755 index b099a17229..0000000000 Binary files a/submodules/AsyncDisplayKit/docs/static/images/example-app-screenshots/Swift.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/docs/static/images/example-app-screenshots/SynchronousConcurrency.png b/submodules/AsyncDisplayKit/docs/static/images/example-app-screenshots/SynchronousConcurrency.png deleted file mode 100755 index e0eac3788e..0000000000 Binary files a/submodules/AsyncDisplayKit/docs/static/images/example-app-screenshots/SynchronousConcurrency.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/docs/static/images/example-app-screenshots/VerticalWithinHorizontalScrolling.gif b/submodules/AsyncDisplayKit/docs/static/images/example-app-screenshots/VerticalWithinHorizontalScrolling.gif deleted file mode 100755 index c50474b19b..0000000000 Binary files a/submodules/AsyncDisplayKit/docs/static/images/example-app-screenshots/VerticalWithinHorizontalScrolling.gif and /dev/null differ diff --git a/submodules/AsyncDisplayKit/docs/static/images/example-app-screenshots/VideoTableView.png b/submodules/AsyncDisplayKit/docs/static/images/example-app-screenshots/VideoTableView.png deleted file mode 100755 index ddeefdc773..0000000000 Binary files a/submodules/AsyncDisplayKit/docs/static/images/example-app-screenshots/VideoTableView.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/docs/static/images/example-app-screenshots/Videos.gif b/submodules/AsyncDisplayKit/docs/static/images/example-app-screenshots/Videos.gif deleted file mode 100755 index 5e5c5f2ca9..0000000000 Binary files a/submodules/AsyncDisplayKit/docs/static/images/example-app-screenshots/Videos.gif and /dev/null differ diff --git a/submodules/AsyncDisplayKit/docs/static/images/favicon/android-icon-144x144.png b/submodules/AsyncDisplayKit/docs/static/images/favicon/android-icon-144x144.png deleted file mode 100755 index 68d4423f04..0000000000 Binary files a/submodules/AsyncDisplayKit/docs/static/images/favicon/android-icon-144x144.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/docs/static/images/favicon/android-icon-192x192.png b/submodules/AsyncDisplayKit/docs/static/images/favicon/android-icon-192x192.png deleted file mode 100755 index c7e107a2e3..0000000000 Binary files a/submodules/AsyncDisplayKit/docs/static/images/favicon/android-icon-192x192.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/docs/static/images/favicon/android-icon-36x36.png b/submodules/AsyncDisplayKit/docs/static/images/favicon/android-icon-36x36.png deleted file mode 100755 index b0da36b5b0..0000000000 Binary files a/submodules/AsyncDisplayKit/docs/static/images/favicon/android-icon-36x36.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/docs/static/images/favicon/android-icon-48x48.png b/submodules/AsyncDisplayKit/docs/static/images/favicon/android-icon-48x48.png deleted file mode 100755 index ed53510513..0000000000 Binary files a/submodules/AsyncDisplayKit/docs/static/images/favicon/android-icon-48x48.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/docs/static/images/favicon/android-icon-72x72.png b/submodules/AsyncDisplayKit/docs/static/images/favicon/android-icon-72x72.png deleted file mode 100755 index 97a2a20792..0000000000 Binary files a/submodules/AsyncDisplayKit/docs/static/images/favicon/android-icon-72x72.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/docs/static/images/favicon/android-icon-96x96.png b/submodules/AsyncDisplayKit/docs/static/images/favicon/android-icon-96x96.png deleted file mode 100755 index 1ea7ba4148..0000000000 Binary files a/submodules/AsyncDisplayKit/docs/static/images/favicon/android-icon-96x96.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/docs/static/images/favicon/apple-icon-114x114.png b/submodules/AsyncDisplayKit/docs/static/images/favicon/apple-icon-114x114.png deleted file mode 100755 index c4f63ca5cd..0000000000 Binary files a/submodules/AsyncDisplayKit/docs/static/images/favicon/apple-icon-114x114.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/docs/static/images/favicon/apple-icon-120x120.png b/submodules/AsyncDisplayKit/docs/static/images/favicon/apple-icon-120x120.png deleted file mode 100755 index 5e1cf1afe5..0000000000 Binary files a/submodules/AsyncDisplayKit/docs/static/images/favicon/apple-icon-120x120.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/docs/static/images/favicon/apple-icon-144x144.png b/submodules/AsyncDisplayKit/docs/static/images/favicon/apple-icon-144x144.png deleted file mode 100755 index 68d4423f04..0000000000 Binary files a/submodules/AsyncDisplayKit/docs/static/images/favicon/apple-icon-144x144.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/docs/static/images/favicon/apple-icon-152x152.png b/submodules/AsyncDisplayKit/docs/static/images/favicon/apple-icon-152x152.png deleted file mode 100755 index d9a225aaa4..0000000000 Binary files a/submodules/AsyncDisplayKit/docs/static/images/favicon/apple-icon-152x152.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/docs/static/images/favicon/apple-icon-180x180.png b/submodules/AsyncDisplayKit/docs/static/images/favicon/apple-icon-180x180.png deleted file mode 100755 index 6c40cd7b1c..0000000000 Binary files a/submodules/AsyncDisplayKit/docs/static/images/favicon/apple-icon-180x180.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/docs/static/images/favicon/apple-icon-57x57.png b/submodules/AsyncDisplayKit/docs/static/images/favicon/apple-icon-57x57.png deleted file mode 100755 index c9d74b6b30..0000000000 Binary files a/submodules/AsyncDisplayKit/docs/static/images/favicon/apple-icon-57x57.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/docs/static/images/favicon/apple-icon-60x60.png b/submodules/AsyncDisplayKit/docs/static/images/favicon/apple-icon-60x60.png deleted file mode 100755 index 7b440c6049..0000000000 Binary files a/submodules/AsyncDisplayKit/docs/static/images/favicon/apple-icon-60x60.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/docs/static/images/favicon/apple-icon-72x72.png b/submodules/AsyncDisplayKit/docs/static/images/favicon/apple-icon-72x72.png deleted file mode 100755 index 97a2a20792..0000000000 Binary files a/submodules/AsyncDisplayKit/docs/static/images/favicon/apple-icon-72x72.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/docs/static/images/favicon/apple-icon-76x76.png b/submodules/AsyncDisplayKit/docs/static/images/favicon/apple-icon-76x76.png deleted file mode 100755 index 0d5dd5f9f2..0000000000 Binary files a/submodules/AsyncDisplayKit/docs/static/images/favicon/apple-icon-76x76.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/docs/static/images/favicon/apple-icon-precomposed.png b/submodules/AsyncDisplayKit/docs/static/images/favicon/apple-icon-precomposed.png deleted file mode 100755 index 43549d71c3..0000000000 Binary files a/submodules/AsyncDisplayKit/docs/static/images/favicon/apple-icon-precomposed.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/docs/static/images/favicon/apple-icon.png b/submodules/AsyncDisplayKit/docs/static/images/favicon/apple-icon.png deleted file mode 100755 index 43549d71c3..0000000000 Binary files a/submodules/AsyncDisplayKit/docs/static/images/favicon/apple-icon.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/docs/static/images/favicon/browserconfig.xml b/submodules/AsyncDisplayKit/docs/static/images/favicon/browserconfig.xml deleted file mode 100755 index c554148223..0000000000 --- a/submodules/AsyncDisplayKit/docs/static/images/favicon/browserconfig.xml +++ /dev/null @@ -1,2 +0,0 @@ - -#ffffff \ No newline at end of file diff --git a/submodules/AsyncDisplayKit/docs/static/images/favicon/favicon-16x16.png b/submodules/AsyncDisplayKit/docs/static/images/favicon/favicon-16x16.png deleted file mode 100755 index 4dc8bcf4ae..0000000000 Binary files a/submodules/AsyncDisplayKit/docs/static/images/favicon/favicon-16x16.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/docs/static/images/favicon/favicon-32x32.png b/submodules/AsyncDisplayKit/docs/static/images/favicon/favicon-32x32.png deleted file mode 100755 index 3ebcbef1d8..0000000000 Binary files a/submodules/AsyncDisplayKit/docs/static/images/favicon/favicon-32x32.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/docs/static/images/favicon/favicon-96x96.png b/submodules/AsyncDisplayKit/docs/static/images/favicon/favicon-96x96.png deleted file mode 100755 index 1ea7ba4148..0000000000 Binary files a/submodules/AsyncDisplayKit/docs/static/images/favicon/favicon-96x96.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/docs/static/images/favicon/favicon.ico b/submodules/AsyncDisplayKit/docs/static/images/favicon/favicon.ico deleted file mode 100755 index ecafdea634..0000000000 Binary files a/submodules/AsyncDisplayKit/docs/static/images/favicon/favicon.ico and /dev/null differ diff --git a/submodules/AsyncDisplayKit/docs/static/images/favicon/manifest.json b/submodules/AsyncDisplayKit/docs/static/images/favicon/manifest.json deleted file mode 100755 index 013d4a6a53..0000000000 --- a/submodules/AsyncDisplayKit/docs/static/images/favicon/manifest.json +++ /dev/null @@ -1,41 +0,0 @@ -{ - "name": "App", - "icons": [ - { - "src": "\/android-icon-36x36.png", - "sizes": "36x36", - "type": "image\/png", - "density": "0.75" - }, - { - "src": "\/android-icon-48x48.png", - "sizes": "48x48", - "type": "image\/png", - "density": "1.0" - }, - { - "src": "\/android-icon-72x72.png", - "sizes": "72x72", - "type": "image\/png", - "density": "1.5" - }, - { - "src": "\/android-icon-96x96.png", - "sizes": "96x96", - "type": "image\/png", - "density": "2.0" - }, - { - "src": "\/android-icon-144x144.png", - "sizes": "144x144", - "type": "image\/png", - "density": "3.0" - }, - { - "src": "\/android-icon-192x192.png", - "sizes": "192x192", - "type": "image\/png", - "density": "4.0" - } - ] -} \ No newline at end of file diff --git a/submodules/AsyncDisplayKit/docs/static/images/favicon/ms-icon-144x144.png b/submodules/AsyncDisplayKit/docs/static/images/favicon/ms-icon-144x144.png deleted file mode 100755 index 68d4423f04..0000000000 Binary files a/submodules/AsyncDisplayKit/docs/static/images/favicon/ms-icon-144x144.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/docs/static/images/favicon/ms-icon-150x150.png b/submodules/AsyncDisplayKit/docs/static/images/favicon/ms-icon-150x150.png deleted file mode 100755 index 8c1fc25b26..0000000000 Binary files a/submodules/AsyncDisplayKit/docs/static/images/favicon/ms-icon-150x150.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/docs/static/images/favicon/ms-icon-310x310.png b/submodules/AsyncDisplayKit/docs/static/images/favicon/ms-icon-310x310.png deleted file mode 100755 index 8d43edcdc8..0000000000 Binary files a/submodules/AsyncDisplayKit/docs/static/images/favicon/ms-icon-310x310.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/docs/static/images/favicon/ms-icon-70x70.png b/submodules/AsyncDisplayKit/docs/static/images/favicon/ms-icon-70x70.png deleted file mode 100755 index 498e41ba17..0000000000 Binary files a/submodules/AsyncDisplayKit/docs/static/images/favicon/ms-icon-70x70.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/docs/static/images/flexbasis.png b/submodules/AsyncDisplayKit/docs/static/images/flexbasis.png deleted file mode 100755 index 28a9ad0b8b..0000000000 Binary files a/submodules/AsyncDisplayKit/docs/static/images/flexbasis.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/docs/static/images/intelligent-preloading-ranges-screenfuls.png b/submodules/AsyncDisplayKit/docs/static/images/intelligent-preloading-ranges-screenfuls.png deleted file mode 100755 index 07b08f25c6..0000000000 Binary files a/submodules/AsyncDisplayKit/docs/static/images/intelligent-preloading-ranges-screenfuls.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/docs/static/images/intelligent-preloading-ranges-with-names.png b/submodules/AsyncDisplayKit/docs/static/images/intelligent-preloading-ranges-with-names.png deleted file mode 100755 index b2ef62a767..0000000000 Binary files a/submodules/AsyncDisplayKit/docs/static/images/intelligent-preloading-ranges-with-names.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/docs/static/images/intelligent-preloading-ranges.png b/submodules/AsyncDisplayKit/docs/static/images/intelligent-preloading-ranges.png deleted file mode 100755 index de884a1390..0000000000 Binary files a/submodules/AsyncDisplayKit/docs/static/images/intelligent-preloading-ranges.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/docs/static/images/intelligent-preloading.png b/submodules/AsyncDisplayKit/docs/static/images/intelligent-preloading.png deleted file mode 100755 index a24f31c8ab..0000000000 Binary files a/submodules/AsyncDisplayKit/docs/static/images/intelligent-preloading.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/docs/static/images/kittenLink.png b/submodules/AsyncDisplayKit/docs/static/images/kittenLink.png deleted file mode 100755 index 1c46390e5e..0000000000 Binary files a/submodules/AsyncDisplayKit/docs/static/images/kittenLink.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/docs/static/images/layout-api-sizing-1.png b/submodules/AsyncDisplayKit/docs/static/images/layout-api-sizing-1.png deleted file mode 100755 index dd004c3a42..0000000000 Binary files a/submodules/AsyncDisplayKit/docs/static/images/layout-api-sizing-1.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/docs/static/images/layout-api-sizing-2.png b/submodules/AsyncDisplayKit/docs/static/images/layout-api-sizing-2.png deleted file mode 100755 index 20814d8425..0000000000 Binary files a/submodules/AsyncDisplayKit/docs/static/images/layout-api-sizing-2.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/docs/static/images/layout-example-1.png b/submodules/AsyncDisplayKit/docs/static/images/layout-example-1.png deleted file mode 100755 index aac85798e5..0000000000 Binary files a/submodules/AsyncDisplayKit/docs/static/images/layout-example-1.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/docs/static/images/layout-example-2.png b/submodules/AsyncDisplayKit/docs/static/images/layout-example-2.png deleted file mode 100755 index 673c16721b..0000000000 Binary files a/submodules/AsyncDisplayKit/docs/static/images/layout-example-2.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/docs/static/images/layout-example-3.png b/submodules/AsyncDisplayKit/docs/static/images/layout-example-3.png deleted file mode 100755 index 72f9179e94..0000000000 Binary files a/submodules/AsyncDisplayKit/docs/static/images/layout-example-3.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/docs/static/images/layout-examples-photo-with-inset-text-overlay-diagram.png b/submodules/AsyncDisplayKit/docs/static/images/layout-examples-photo-with-inset-text-overlay-diagram.png deleted file mode 100755 index dbf95847ed..0000000000 Binary files a/submodules/AsyncDisplayKit/docs/static/images/layout-examples-photo-with-inset-text-overlay-diagram.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/docs/static/images/layout-examples-photo-with-inset-text-overlay-photo.png b/submodules/AsyncDisplayKit/docs/static/images/layout-examples-photo-with-inset-text-overlay-photo.png deleted file mode 100755 index 2465aaa3cb..0000000000 Binary files a/submodules/AsyncDisplayKit/docs/static/images/layout-examples-photo-with-inset-text-overlay-photo.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/docs/static/images/layout-examples-photo-with-inset-text-overlay.png b/submodules/AsyncDisplayKit/docs/static/images/layout-examples-photo-with-inset-text-overlay.png deleted file mode 100755 index 020685ae10..0000000000 Binary files a/submodules/AsyncDisplayKit/docs/static/images/layout-examples-photo-with-inset-text-overlay.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/docs/static/images/layout-examples-photo-with-outset-icon-overlay-icon.png b/submodules/AsyncDisplayKit/docs/static/images/layout-examples-photo-with-outset-icon-overlay-icon.png deleted file mode 100755 index 22a1652b3f..0000000000 Binary files a/submodules/AsyncDisplayKit/docs/static/images/layout-examples-photo-with-outset-icon-overlay-icon.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/docs/static/images/layout-examples-photo-with-outset-icon-overlay-photo.png b/submodules/AsyncDisplayKit/docs/static/images/layout-examples-photo-with-outset-icon-overlay-photo.png deleted file mode 100755 index 7d7bef7e13..0000000000 Binary files a/submodules/AsyncDisplayKit/docs/static/images/layout-examples-photo-with-outset-icon-overlay-photo.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/docs/static/images/layout-examples-photo-with-outset-icon-overlay.png b/submodules/AsyncDisplayKit/docs/static/images/layout-examples-photo-with-outset-icon-overlay.png deleted file mode 100755 index 46669c860a..0000000000 Binary files a/submodules/AsyncDisplayKit/docs/static/images/layout-examples-photo-with-outset-icon-overlay.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/docs/static/images/layout-examples-simple-header-with-left-right-justified-text-diagram.png b/submodules/AsyncDisplayKit/docs/static/images/layout-examples-simple-header-with-left-right-justified-text-diagram.png deleted file mode 100755 index c81e6f5122..0000000000 Binary files a/submodules/AsyncDisplayKit/docs/static/images/layout-examples-simple-header-with-left-right-justified-text-diagram.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/docs/static/images/layout-examples-simple-header-with-left-right-justified-text.png b/submodules/AsyncDisplayKit/docs/static/images/layout-examples-simple-header-with-left-right-justified-text.png deleted file mode 100755 index 1296620146..0000000000 Binary files a/submodules/AsyncDisplayKit/docs/static/images/layout-examples-simple-header-with-left-right-justified-text.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/docs/static/images/layout-examples-simple-inset-text-cell-closeup.png b/submodules/AsyncDisplayKit/docs/static/images/layout-examples-simple-inset-text-cell-closeup.png deleted file mode 100755 index 1b5b0d55a3..0000000000 Binary files a/submodules/AsyncDisplayKit/docs/static/images/layout-examples-simple-inset-text-cell-closeup.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/docs/static/images/layout-examples-simple-inset-text-cell.png b/submodules/AsyncDisplayKit/docs/static/images/layout-examples-simple-inset-text-cell.png deleted file mode 100755 index b161af9eca..0000000000 Binary files a/submodules/AsyncDisplayKit/docs/static/images/layout-examples-simple-inset-text-cell.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/docs/static/images/layout-examples-top-bottom-separator-line-diagram.png b/submodules/AsyncDisplayKit/docs/static/images/layout-examples-top-bottom-separator-line-diagram.png deleted file mode 100755 index eac57973ce..0000000000 Binary files a/submodules/AsyncDisplayKit/docs/static/images/layout-examples-top-bottom-separator-line-diagram.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/docs/static/images/layout-examples-top-bottom-separator-line.png b/submodules/AsyncDisplayKit/docs/static/images/layout-examples-top-bottom-separator-line.png deleted file mode 100755 index 38f1fd9564..0000000000 Binary files a/submodules/AsyncDisplayKit/docs/static/images/layout-examples-top-bottom-separator-line.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/docs/static/images/layout-spec-relationship-1.png b/submodules/AsyncDisplayKit/docs/static/images/layout-spec-relationship-1.png deleted file mode 100755 index a6ca2945c8..0000000000 Binary files a/submodules/AsyncDisplayKit/docs/static/images/layout-spec-relationship-1.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/docs/static/images/layout-spec-relationship-2.png b/submodules/AsyncDisplayKit/docs/static/images/layout-spec-relationship-2.png deleted file mode 100755 index a21f052429..0000000000 Binary files a/submodules/AsyncDisplayKit/docs/static/images/layout-spec-relationship-2.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/docs/static/images/layout2-api-sizing.png b/submodules/AsyncDisplayKit/docs/static/images/layout2-api-sizing.png deleted file mode 100755 index 0a7f054365..0000000000 Binary files a/submodules/AsyncDisplayKit/docs/static/images/layout2-api-sizing.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/docs/static/images/layoutSpec-examples/layout-example-inset-overlay.png b/submodules/AsyncDisplayKit/docs/static/images/layoutSpec-examples/layout-example-inset-overlay.png deleted file mode 100755 index f10f8f0fe4..0000000000 Binary files a/submodules/AsyncDisplayKit/docs/static/images/layoutSpec-examples/layout-example-inset-overlay.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/docs/static/images/layoutSpec-types/ASBackgroundLayoutSpec-diagram.png b/submodules/AsyncDisplayKit/docs/static/images/layoutSpec-types/ASBackgroundLayoutSpec-diagram.png deleted file mode 100755 index 5b365c0211..0000000000 Binary files a/submodules/AsyncDisplayKit/docs/static/images/layoutSpec-types/ASBackgroundLayoutSpec-diagram.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/docs/static/images/layoutSpec-types/ASCenterLayoutSpec-diagram-text.png b/submodules/AsyncDisplayKit/docs/static/images/layoutSpec-types/ASCenterLayoutSpec-diagram-text.png deleted file mode 100755 index 7559e73d08..0000000000 Binary files a/submodules/AsyncDisplayKit/docs/static/images/layoutSpec-types/ASCenterLayoutSpec-diagram-text.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/docs/static/images/layoutSpec-types/ASCenterLayoutSpec-diagram.png b/submodules/AsyncDisplayKit/docs/static/images/layoutSpec-types/ASCenterLayoutSpec-diagram.png deleted file mode 100755 index 040b5ce86e..0000000000 Binary files a/submodules/AsyncDisplayKit/docs/static/images/layoutSpec-types/ASCenterLayoutSpec-diagram.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/docs/static/images/layoutSpec-types/ASInsetLayoutSpec-diagram-text.png b/submodules/AsyncDisplayKit/docs/static/images/layoutSpec-types/ASInsetLayoutSpec-diagram-text.png deleted file mode 100755 index f4e3810af4..0000000000 Binary files a/submodules/AsyncDisplayKit/docs/static/images/layoutSpec-types/ASInsetLayoutSpec-diagram-text.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/docs/static/images/layoutSpec-types/ASInsetLayoutSpec-diagram.png b/submodules/AsyncDisplayKit/docs/static/images/layoutSpec-types/ASInsetLayoutSpec-diagram.png deleted file mode 100755 index 6ee3642fb3..0000000000 Binary files a/submodules/AsyncDisplayKit/docs/static/images/layoutSpec-types/ASInsetLayoutSpec-diagram.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/docs/static/images/layoutSpec-types/ASInsetLayoutSpec-example-complex.png b/submodules/AsyncDisplayKit/docs/static/images/layoutSpec-types/ASInsetLayoutSpec-example-complex.png deleted file mode 100755 index ca08d0c9ec..0000000000 Binary files a/submodules/AsyncDisplayKit/docs/static/images/layoutSpec-types/ASInsetLayoutSpec-example-complex.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/docs/static/images/layoutSpec-types/ASOverlayLayouSpec-diagram.png b/submodules/AsyncDisplayKit/docs/static/images/layoutSpec-types/ASOverlayLayouSpec-diagram.png deleted file mode 100755 index 7bba2cf067..0000000000 Binary files a/submodules/AsyncDisplayKit/docs/static/images/layoutSpec-types/ASOverlayLayouSpec-diagram.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/docs/static/images/layoutSpec-types/ASOverlayLayoutSpec-example-diagram.png b/submodules/AsyncDisplayKit/docs/static/images/layoutSpec-types/ASOverlayLayoutSpec-example-diagram.png deleted file mode 100755 index deda779f3f..0000000000 Binary files a/submodules/AsyncDisplayKit/docs/static/images/layoutSpec-types/ASOverlayLayoutSpec-example-diagram.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/docs/static/images/layoutSpec-types/ASRatioLayoutSpec-diagram.png b/submodules/AsyncDisplayKit/docs/static/images/layoutSpec-types/ASRatioLayoutSpec-diagram.png deleted file mode 100755 index eac1fd3b1f..0000000000 Binary files a/submodules/AsyncDisplayKit/docs/static/images/layoutSpec-types/ASRatioLayoutSpec-diagram.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/docs/static/images/layoutable-types.png b/submodules/AsyncDisplayKit/docs/static/images/layoutable-types.png deleted file mode 100755 index 6ac3e9d11d..0000000000 Binary files a/submodules/AsyncDisplayKit/docs/static/images/layoutable-types.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/docs/static/images/liveMap.gif b/submodules/AsyncDisplayKit/docs/static/images/liveMap.gif deleted file mode 100755 index 633d1fb344..0000000000 Binary files a/submodules/AsyncDisplayKit/docs/static/images/liveMap.gif and /dev/null differ diff --git a/submodules/AsyncDisplayKit/docs/static/images/logo.png b/submodules/AsyncDisplayKit/docs/static/images/logo.png deleted file mode 100644 index d1e84d62c7..0000000000 Binary files a/submodules/AsyncDisplayKit/docs/static/images/logo.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/docs/static/images/logo.svg b/submodules/AsyncDisplayKit/docs/static/images/logo.svg deleted file mode 100644 index bc30fe6cdc..0000000000 --- a/submodules/AsyncDisplayKit/docs/static/images/logo.svg +++ /dev/null @@ -1,24 +0,0 @@ - - - - Texture Logo - Created with Sketch. - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/submodules/AsyncDisplayKit/docs/static/images/mapWithAnnotation.png b/submodules/AsyncDisplayKit/docs/static/images/mapWithAnnotation.png deleted file mode 100755 index e6316293d1..0000000000 Binary files a/submodules/AsyncDisplayKit/docs/static/images/mapWithAnnotation.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/docs/static/images/node-hierarchy.png b/submodules/AsyncDisplayKit/docs/static/images/node-hierarchy.png deleted file mode 100755 index 8f0c021b62..0000000000 Binary files a/submodules/AsyncDisplayKit/docs/static/images/node-hierarchy.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/docs/static/images/node-view-layer.png b/submodules/AsyncDisplayKit/docs/static/images/node-view-layer.png deleted file mode 100755 index 544294af8f..0000000000 Binary files a/submodules/AsyncDisplayKit/docs/static/images/node-view-layer.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/docs/static/images/overlay-vs-inset-spec.png b/submodules/AsyncDisplayKit/docs/static/images/overlay-vs-inset-spec.png deleted file mode 100755 index 2da1be2d80..0000000000 Binary files a/submodules/AsyncDisplayKit/docs/static/images/overlay-vs-inset-spec.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/docs/static/images/satelliteMap.png b/submodules/AsyncDisplayKit/docs/static/images/satelliteMap.png deleted file mode 100755 index 702f12b248..0000000000 Binary files a/submodules/AsyncDisplayKit/docs/static/images/satelliteMap.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/docs/static/images/synchronous-concurrency.jpg b/submodules/AsyncDisplayKit/docs/static/images/synchronous-concurrency.jpg deleted file mode 100644 index b49ea5d4c9..0000000000 Binary files a/submodules/AsyncDisplayKit/docs/static/images/synchronous-concurrency.jpg and /dev/null differ diff --git a/submodules/AsyncDisplayKit/docs/static/images/textNodeTruncation.png b/submodules/AsyncDisplayKit/docs/static/images/textNodeTruncation.png deleted file mode 100755 index a5125a8143..0000000000 Binary files a/submodules/AsyncDisplayKit/docs/static/images/textNodeTruncation.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/docs/static/images/video.gif b/submodules/AsyncDisplayKit/docs/static/images/video.gif deleted file mode 100755 index dd9bab6a78..0000000000 Binary files a/submodules/AsyncDisplayKit/docs/static/images/video.gif and /dev/null differ diff --git a/submodules/AsyncDisplayKit/docs/static/linkify.js b/submodules/AsyncDisplayKit/docs/static/linkify.js deleted file mode 100755 index b6adfbd5f9..0000000000 --- a/submodules/AsyncDisplayKit/docs/static/linkify.js +++ /dev/null @@ -1,22 +0,0 @@ -[].slice.apply( - document.querySelectorAll( - 'article h2, article h3, article h4' - ) -).forEach(function(header) { - var slug = header.innerText - .toLowerCase() - .replace(/[^a-z0-9]/g, '-') - .replace(/-+/g, '-') - .replace(/^-|-$/g, ''); - - var hashref = document.createElement('a'); - hashref.id = slug; - hashref.className = 'hashref'; - header.appendChild(hashref); - - var hash = document.createElement('a'); - hash.className = 'hash'; - hash.href = '#' + slug; - hash.innerText = '#'; - header.appendChild(hash); -}); diff --git a/submodules/AsyncDisplayKit/docs/static/talks/10_3_2016_ASCollectionNode_Sequence_Diagrams.pdf b/submodules/AsyncDisplayKit/docs/static/talks/10_3_2016_ASCollectionNode_Sequence_Diagrams.pdf deleted file mode 100755 index ce202e60be..0000000000 Binary files a/submodules/AsyncDisplayKit/docs/static/talks/10_3_2016_ASCollectionNode_Sequence_Diagrams.pdf and /dev/null differ diff --git a/submodules/AsyncDisplayKit/docs/static/talks/ASCollectionView.pdf b/submodules/AsyncDisplayKit/docs/static/talks/ASCollectionView.pdf deleted file mode 100755 index 43d834f1d9..0000000000 Binary files a/submodules/AsyncDisplayKit/docs/static/talks/ASCollectionView.pdf and /dev/null differ diff --git a/submodules/AsyncDisplayKit/docs/static/talks/UICollectionView.pdf b/submodules/AsyncDisplayKit/docs/static/talks/UICollectionView.pdf deleted file mode 100755 index da3691d049..0000000000 Binary files a/submodules/AsyncDisplayKit/docs/static/talks/UICollectionView.pdf and /dev/null differ diff --git a/submodules/AsyncDisplayKit/docs/static/toggle.js b/submodules/AsyncDisplayKit/docs/static/toggle.js deleted file mode 100755 index 65b9b5e2bd..0000000000 --- a/submodules/AsyncDisplayKit/docs/static/toggle.js +++ /dev/null @@ -1,27 +0,0 @@ -document.addEventListener("DOMContentLoaded", function() { - var swiftButtons = document.getElementsByClassName("swiftButton"); - var objectiveCButons = document.getElementsByClassName("objcButton"); - var objcCodes = document.getElementsByClassName("objcCode"); - var swiftCodes = document.getElementsByClassName("swiftCode"); - - var totalCodeSections = swiftButtons.length; - for(var i = 0; i < totalCodeSections; i++) { - swiftButtons[i].onclick = function () { - for (var i = 0; i < totalCodeSections; i++) { - swiftCodes[i].classList.remove("hidden"); - objcCodes[i].classList.add("hidden"); - objectiveCButons[i].classList.remove("active"); - swiftButtons[i].classList.add("active"); - }; - } - - objectiveCButons[i].onclick = function () { - for (var i = 0; i < totalCodeSections; i++) { - swiftCodes[i].classList.add("hidden"); - objcCodes[i].classList.remove("hidden"); - objectiveCButons[i].classList.add("active"); - swiftButtons[i].classList.remove("active"); - }; - } - } -}); \ No newline at end of file diff --git a/submodules/AsyncDisplayKit/docs/stylesheets/main.scss b/submodules/AsyncDisplayKit/docs/stylesheets/main.scss deleted file mode 100755 index ee270fa770..0000000000 --- a/submodules/AsyncDisplayKit/docs/stylesheets/main.scss +++ /dev/null @@ -1,338 +0,0 @@ ---- ---- - -@charset "utf-8"; - -* { - padding: 0; - margin: 0; - -webkit-box-sizing: border-box; - -moz-box-sizing: border-box; - box-sizing: border-box; - -webkit-text-size-adjust: 100%; -} - -html { - -webkit-font-smoothing: antialiased; - text-rendering: optimizeLegibility; - background-color: #FFFFFF; -} - -body { - font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; - font-family: proxima-nova, "Helvetica Neue", Helvetica, Arial, sans-serif; - font-weight: 400; - color: #444; - margin: 0; - line-height: 22px; -} - -h1, h2, h3, h4 { - font-weight: normal; - margin: 1.3em 0 0.2em; - line-height: 1.4em; - position: relative; -} - -td { - vertical-align: top; -} - -h1:first-child, h2:first-child, h3:first-child, h4:first-child { - margin-top: 0; -} - -h1 { - font-size: 2em; - font-weight: bold; -} - -h2 { - font-size: 1.5em; -} - -h3 { - font-size: 1.3em; -} - -h4 { - font-size: 1.1em; -} - -p, ul, ol { - margin: 0 0 1em 0; -} - -a { - color: #0484f2; - text-decoration: none; -} - -.btn { - padding: 10px 20px; - -webkit-border-radius: 5px; - -moz-border-radius: 5px; - border-radius: 5px; - background: #0f70dd; - color: #fff; - display: inline-block; - text-decoration: none; - font-weight: bold; -} - -.container { - width: 90%; - margin: 0 auto; - clear: both; - - &:after { content: ""; display: table; clear: both; } -} - -header { - padding: 30px 0 0 0; - background: #f8f8f8; - - h1 { - position: relative; - top: -5px; - } - - nav { - font-size: 18px; - - ul { - list-style: none; - - li { - float: left; - margin-right: 20px; - - a { - color: #0484f2; - text-decoration: none; - } - } - } - } -} - -#logo { - margin: 0; -} - -.hero { - background: #0f70dd; - margin-bottom: 30px; - padding: 30px 0; - - .hero-title { - font-size: 45px; - line-height: 110%; - color: #fff; - margin-bottom: 20px; - } - - .btn { - background: #fff; - color: #0f70dd; - border: 2px solid #fff; - margin-right: 10px; - } - - .btn.btn-outlined { - background: none; - border: 2px solid #fff; - -webkit-border-radius: 5px; - -moz-border-radius: 5px; - border-radius: 5px; - color: #fff; - } -} - -.container-margin { - margin-top: 30px; -} - -.container .sidebar { - font-size: 14px; - - ul { - list-style: none; - - li { - list-style: none; - } - } - - a.active { - font-weight: bold; - } -} - -.container tr > td { - padding-bottom: 30px; -} - -.container tr td img { - display: inline-block; - margin-bottom: 5px; -} - -.container tr td b { - padding-bottom: 5px; - display: inline-block; -} - -.roundrect { - border: 1px solid #f4f4f4; - -webkit-border-radius: 20px; - -moz-border-radius: 20px; - border-radius: 20px; -} - -.container .content ul, .container .content ol { - margin-left: 20px; - margin-bottom: 30px; -} - -.content p img { - display: block; - margin: 1em auto; - max-width: 100%; -} - -.edit-page-link { - font-size: 14px; -} - -@import "code"; - -.language-toggle { - border-bottom: 2px #0484f2 solid; - background: white; - display: block; - box-sizing: border-box; - font-size: 125%; - -webkit-font-smoothing: antialiased; - line-height: 1.5; - padding-right: 10px; - - a { - cursor: pointer; - display: block; - float: right; - padding-left: 1em; - - color: #a3a39e !important; - text-decoration: none; - transition: color 0.1s linear; - - &.active { - color: #222220 !important; - } - } - - &:after { - content: ""; - display: table; - clear: both; - } -} - -.highlight-group { - font-family: 'Inconsolata' !important; - margin: 0; - margin-top: 20px; - margin-bottom: 20px; - background: #f8f7f5; -} - -.hidden { - display: none; -} -.code { - padding: 15px; - overflow: auto; -} -pre { - font-family: 'Inconsolata' !important; - font-weight: 500; - color: #333333; -} - -.note { - padding: 10px; - border-radius: 3px; - background-color: #EFF7FF; - border: 1px solid #CCDDFF; - margin-bottom: 20px; - - p:before { - content: "NOTE:"; - font-weight: bold; - } - - p { - margin-bottom: 0px; - } -} - -.note-important { - padding: 10px; - border-radius: 3px; - background-color: #FFCCCC; - border: 1px solid #FF8899; - margin-bottom: 20px; - - p:before { - content: "IMPORTANT:"; - font-weight: bold; - } - - p { - margin-bottom: 0px; - } -} - -.right { - float: right; -} - -footer { - padding: 20px 0; - - p { - text-align: center; - } -} - -/** Banner */ -.texture-banner { - padding: 20px 0 20px 0; - width: 100%; - background-color: #0e1e28; - box-shadow: inset 0 -2px 20px 0 rgba(0,0,0,0.5); - text-align: center; - - .announcement { - font-stretch: normal; - font-size: 16px; - line-height: 1.75; - letter-spacing: 0.1px; - text-align: center; - color: #d7e2e9; - font-weight: bold; - margin: 0; - } - - .learn-more-link { - font-size: 12px; - font-weight: bold; - font-style: normal; - font-stretch: normal; - line-height: 1.17; - letter-spacing: 0.5px; - color: #0484f2; - margin-left: 10px; - } -} diff --git a/submodules/AsyncDisplayKit/docs/stylesheets/media.css b/submodules/AsyncDisplayKit/docs/stylesheets/media.css deleted file mode 100755 index 37235a7ceb..0000000000 --- a/submodules/AsyncDisplayKit/docs/stylesheets/media.css +++ /dev/null @@ -1,50 +0,0 @@ -/* Media queries */ -@media (min-width: 600px) { - header { - display: block; - } - - header nav { - line-height: 55px; - } - - header ul { - } - - header nav ul { - display: inline-block; - float: right; - margin: 0 auto; - } - - #logo { - float: left; - } - - .container .sidebar { - width: 19%; - float: left; - } - - .container .content { - width: 75%; - float: right; - } - -} - -@media (min-width: 950px) { - .container { - width: 900px; - } - - .container .sidebar { - width: 19%; - float: left; - } - - .container .content { - width: 75%; - float: right; - } -} diff --git a/submodules/AsyncDisplayKit/docs/stylesheets/pygments.css b/submodules/AsyncDisplayKit/docs/stylesheets/pygments.css deleted file mode 100755 index 91f27c87dd..0000000000 --- a/submodules/AsyncDisplayKit/docs/stylesheets/pygments.css +++ /dev/null @@ -1,61 +0,0 @@ -.hll { background-color: #ffffcc } -.c { color: #999988; font-style: italic } /* Comment */ -.err { color: #a61717; background-color: #e3d2d2 } /* Error */ -.k { color: #000000; font-weight: bold } /* Keyword */ -.o { color: #000000; } /* Operator */ -.cm { color: #666666; font-weight: bold; font-style: italic } /* Comment.Multiline */ -.cp { color: #666666; font-weight: bold; font-style: italic } /* Comment.Preproc */ -.c1 { color: #666666; font-weight: bold; font-style: italic } /* Comment.Single */ -.cs { color: #666666; font-weight: bold; font-style: italic } /* Comment.Special */ -.gd { color: #000000; background-color: #ffdddd } /* Generic.Deleted */ -.ge { color: #000000; font-style: italic } /* Generic.Emph */ -.gr { color: #aa0000 } /* Generic.Error */ -.gh { color: #999999 } /* Generic.Heading */ -.gi { color: #000000; background-color: #ddffdd } /* Generic.Inserted */ -.go { color: #888888 } /* Generic.Output */ -.gp { color: #555555 } /* Generic.Prompt */ -.gs { font-weight: bold } /* Generic.Strong */ -.gu { color: #aaaaaa } /* Generic.Subheading */ -.gt { color: #aa0000 } /* Generic.Traceback */ -.kc { color: #000000; font-weight: bold } /* Keyword.Constant */ -.kd { color: #000000; font-weight: bold } /* Keyword.Declaration */ -.kn { color: #000000; font-weight: bold } /* Keyword.Namespace */ -.kp { color: #000000; font-weight: bold } /* Keyword.Pseudo */ -.kr { color: #000000; font-weight: bold } /* Keyword.Reserved */ -.kt { color: #445588; font-weight: bold } /* Keyword.Type */ -.m { color: #009999 } /* Literal.Number */ -.s { color: #d01040 } /* Literal.String */ -.na { color: #008080 } /* Name.Attribute */ -.nb { } /* Name.Builtin */ -.nc { color: #445588; font-weight: bold } /* Name.Class */ -.no { color: #008080 } /* Name.Constant */ -.nd { color: #3c5d5d; font-weight: bold } /* Name.Decorator */ -.ni { color: #800080 } /* Name.Entity */ -.ne { color: #990000; font-weight: bold } /* Name.Exception */ -.nf { color: #990000; font-weight: bold } /* Name.Function */ -.nl { color: #990000; font-weight: bold } /* Name.Label */ -.nn { color: #555555 } /* Name.Namespace */ -.nt { color: #000080 } /* Name.Tag */ -.nv { color: #008080 } /* Name.Variable */ -.ow { color: #000000; font-weight: bold } /* Operator.Word */ -.w { color: #bbbbbb } /* Text.Whitespace */ -.mf { color: #009999 } /* Literal.Number.Float */ -.mh { color: #009999 } /* Literal.Number.Hex */ -.mi { color: #009999 } /* Literal.Number.Integer */ -.mo { color: #009999 } /* Literal.Number.Oct */ -.sb { color: #d01040 } /* Literal.String.Backtick */ -.sc { color: #d01040 } /* Literal.String.Char */ -.sd { color: #d01040 } /* Literal.String.Doc */ -.s2 { color: #d01040 } /* Literal.String.Double */ -.se { color: #d01040 } /* Literal.String.Escape */ -.sh { color: #d01040 } /* Literal.String.Heredoc */ -.si { color: #d01040 } /* Literal.String.Interpol */ -.sx { color: #d01040 } /* Literal.String.Other */ -.sr { color: #009926 } /* Literal.String.Regex */ -.s1 { color: #d01040 } /* Literal.String.Single */ -.ss { color: #990073 } /* Literal.String.Symbol */ -.bp { color: #999999 } /* Name.Builtin.Pseudo */ -.vc { color: #008080 } /* Name.Variable.Class */ -.vg { color: #008080 } /* Name.Variable.Global */ -.vi { color: #008080 } /* Name.Variable.Instance */ -.il { color: #009999 } /* Literal.Number.Integer.Long */ diff --git a/submodules/AsyncDisplayKit/examples/ASCollectionView/Podfile b/submodules/AsyncDisplayKit/examples/ASCollectionView/Podfile deleted file mode 100644 index 08d1b7add6..0000000000 --- a/submodules/AsyncDisplayKit/examples/ASCollectionView/Podfile +++ /dev/null @@ -1,6 +0,0 @@ -source 'https://github.com/CocoaPods/Specs.git' -platform :ios, '9.0' -target 'Sample' do - pod 'Texture', :path => '../..' -end - diff --git a/submodules/AsyncDisplayKit/examples/ASCollectionView/Sample.xcworkspace/contents.xcworkspacedata b/submodules/AsyncDisplayKit/examples/ASCollectionView/Sample.xcworkspace/contents.xcworkspacedata deleted file mode 100644 index 7b5a2f3050..0000000000 --- a/submodules/AsyncDisplayKit/examples/ASCollectionView/Sample.xcworkspace/contents.xcworkspacedata +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - diff --git a/submodules/AsyncDisplayKit/examples/ASCollectionView/Sample/AppDelegate.h b/submodules/AsyncDisplayKit/examples/ASCollectionView/Sample/AppDelegate.h deleted file mode 100644 index db20870a31..0000000000 --- a/submodules/AsyncDisplayKit/examples/ASCollectionView/Sample/AppDelegate.h +++ /dev/null @@ -1,18 +0,0 @@ -// -// AppDelegate.h -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -#define SIMULATE_WEB_RESPONSE 0 - -@interface AppDelegate : UIResponder - -@property (strong, nonatomic) UIWindow *window; - -@end diff --git a/submodules/AsyncDisplayKit/examples/ASCollectionView/Sample/AppDelegate.m b/submodules/AsyncDisplayKit/examples/ASCollectionView/Sample/AppDelegate.m deleted file mode 100644 index ad36676ae0..0000000000 --- a/submodules/AsyncDisplayKit/examples/ASCollectionView/Sample/AppDelegate.m +++ /dev/null @@ -1,49 +0,0 @@ -// -// AppDelegate.m -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import "AppDelegate.h" - -#import "PresentingViewController.h" -#import "ViewController.h" - -@implementation AppDelegate - -- (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] init]; - - [self pushNewViewControllerAnimated:NO]; - - [self.window makeKeyAndVisible]; - - return YES; -} - -- (void)pushNewViewControllerAnimated:(BOOL)animated -{ - UINavigationController *navController = (UINavigationController *)self.window.rootViewController; - -#if SIMULATE_WEB_RESPONSE - UIViewController *viewController = [[PresentingViewController alloc] init]; -#else - UIViewController *viewController = [[ViewController alloc] init]; - viewController.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:@"Push Another Copy" style:UIBarButtonItemStylePlain target:self action:@selector(pushNewViewController)]; -#endif - - [navController pushViewController:viewController animated:animated]; -} - -- (void)pushNewViewController -{ - [self pushNewViewControllerAnimated:YES]; -} - -@end diff --git a/submodules/AsyncDisplayKit/examples/ASCollectionView/Sample/Images.xcassets/LaunchImage.launchimage/Contents.json b/submodules/AsyncDisplayKit/examples/ASCollectionView/Sample/Images.xcassets/LaunchImage.launchimage/Contents.json deleted file mode 100644 index f0fce54771..0000000000 --- a/submodules/AsyncDisplayKit/examples/ASCollectionView/Sample/Images.xcassets/LaunchImage.launchimage/Contents.json +++ /dev/null @@ -1,39 +0,0 @@ -{ - "images" : [ - { - "orientation" : "portrait", - "idiom" : "iphone", - "filename" : "Default-568h@2x.png", - "minimum-system-version" : "7.0", - "subtype" : "retina4", - "scale" : "2x" - }, - { - "idiom" : "iphone", - "scale" : "1x", - "orientation" : "portrait" - }, - { - "idiom" : "iphone", - "scale" : "2x", - "orientation" : "portrait" - }, - { - "orientation" : "portrait", - "idiom" : "iphone", - "filename" : "Default-568h@2x.png", - "subtype" : "retina4", - "scale" : "2x" - }, - { - "orientation" : "portrait", - "idiom" : "iphone", - "minimum-system-version" : "7.0", - "scale" : "2x" - } - ], - "info" : { - "version" : 1, - "author" : "xcode" - } -} \ No newline at end of file diff --git a/submodules/AsyncDisplayKit/examples/ASCollectionView/Sample/Images.xcassets/LaunchImage.launchimage/Default-568h@2x.png b/submodules/AsyncDisplayKit/examples/ASCollectionView/Sample/Images.xcassets/LaunchImage.launchimage/Default-568h@2x.png deleted file mode 100644 index 1547a98454..0000000000 Binary files a/submodules/AsyncDisplayKit/examples/ASCollectionView/Sample/Images.xcassets/LaunchImage.launchimage/Default-568h@2x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/examples/ASCollectionView/Sample/Info.plist b/submodules/AsyncDisplayKit/examples/ASCollectionView/Sample/Info.plist deleted file mode 100644 index eeb71a8d35..0000000000 --- a/submodules/AsyncDisplayKit/examples/ASCollectionView/Sample/Info.plist +++ /dev/null @@ -1,49 +0,0 @@ - - - - - CFBundleDevelopmentRegion - en - CFBundleExecutable - $(EXECUTABLE_NAME) - CFBundleIcons - - CFBundleIcons~ipad - - CFBundleIdentifier - com.facebook.AsyncDisplayKit.$(PRODUCT_NAME:rfc1034identifier) - CFBundleInfoDictionaryVersion - 6.0 - CFBundleName - $(PRODUCT_NAME) - CFBundlePackageType - APPL - CFBundleShortVersionString - 1.0 - CFBundleSignature - ???? - CFBundleVersion - 1 - LSRequiresIPhoneOS - - UILaunchStoryboardName - Launchboard - UIRequiredDeviceCapabilities - - armv7 - - UISupportedInterfaceOrientations - - UIInterfaceOrientationPortrait - UIInterfaceOrientationLandscapeLeft - UIInterfaceOrientationLandscapeRight - - UISupportedInterfaceOrientations~ipad - - UIInterfaceOrientationPortrait - UIInterfaceOrientationPortraitUpsideDown - UIInterfaceOrientationLandscapeLeft - UIInterfaceOrientationLandscapeRight - - - diff --git a/submodules/AsyncDisplayKit/examples/ASCollectionView/Sample/ItemNode.h b/submodules/AsyncDisplayKit/examples/ASCollectionView/Sample/ItemNode.h deleted file mode 100644 index 73eb2629e6..0000000000 --- a/submodules/AsyncDisplayKit/examples/ASCollectionView/Sample/ItemNode.h +++ /dev/null @@ -1,16 +0,0 @@ -// -// ItemNode.h -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -@interface ItemNode : ASTextCellNode - -- (instancetype)initWithString:(NSString *)string; - -@end diff --git a/submodules/AsyncDisplayKit/examples/ASCollectionView/Sample/ItemNode.m b/submodules/AsyncDisplayKit/examples/ASCollectionView/Sample/ItemNode.m deleted file mode 100644 index b9850a4b9e..0000000000 --- a/submodules/AsyncDisplayKit/examples/ASCollectionView/Sample/ItemNode.m +++ /dev/null @@ -1,51 +0,0 @@ -// -// ItemNode.m -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import "ItemNode.h" - -@implementation ItemNode - -- (instancetype)initWithString:(NSString *)string -{ - self = [super init]; - - if (self != nil) { - self.text = string; - [self updateBackgroundColor]; - } - - return self; -} - -- (void)updateBackgroundColor -{ - if (self.highlighted) { - self.backgroundColor = [UIColor grayColor]; - } else if (self.selected) { - self.backgroundColor = [UIColor darkGrayColor]; - } else { - self.backgroundColor = [UIColor lightGrayColor]; - } -} - -- (void)setSelected:(BOOL)selected -{ - [super setSelected:selected]; - - [self updateBackgroundColor]; -} - -- (void)setHighlighted:(BOOL)highlighted -{ - [super setHighlighted:highlighted]; - - [self updateBackgroundColor]; -} - -@end diff --git a/submodules/AsyncDisplayKit/examples/ASCollectionView/Sample/Launchboard.storyboard b/submodules/AsyncDisplayKit/examples/ASCollectionView/Sample/Launchboard.storyboard deleted file mode 100644 index 673e0f7e68..0000000000 --- a/submodules/AsyncDisplayKit/examples/ASCollectionView/Sample/Launchboard.storyboard +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - diff --git a/submodules/AsyncDisplayKit/examples/ASCollectionView/Sample/PresentingViewController.h b/submodules/AsyncDisplayKit/examples/ASCollectionView/Sample/PresentingViewController.h deleted file mode 100644 index 44c07c6a76..0000000000 --- a/submodules/AsyncDisplayKit/examples/ASCollectionView/Sample/PresentingViewController.h +++ /dev/null @@ -1,14 +0,0 @@ -// -// PresentingViewController.h -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -@interface PresentingViewController : UIViewController - -@end diff --git a/submodules/AsyncDisplayKit/examples/ASCollectionView/Sample/PresentingViewController.m b/submodules/AsyncDisplayKit/examples/ASCollectionView/Sample/PresentingViewController.m deleted file mode 100644 index b2d1d5e812..0000000000 --- a/submodules/AsyncDisplayKit/examples/ASCollectionView/Sample/PresentingViewController.m +++ /dev/null @@ -1,35 +0,0 @@ -// -// PresentingViewController.m -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import "PresentingViewController.h" -#import "ViewController.h" - -@interface PresentingViewController () - -@end - -@implementation PresentingViewController - -- (void)viewDidLoad -{ - [super viewDidLoad]; - - self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:@"Push Details" - style:UIBarButtonItemStylePlain - target:self - action:@selector(pushNewViewController)]; -} - -- (void)pushNewViewController -{ - ViewController *controller = [[ViewController alloc] init]; - [self.navigationController pushViewController:controller animated:true]; -} - -@end diff --git a/submodules/AsyncDisplayKit/examples/ASCollectionView/Sample/SupplementaryNode.h b/submodules/AsyncDisplayKit/examples/ASCollectionView/Sample/SupplementaryNode.h deleted file mode 100644 index b29ec002b2..0000000000 --- a/submodules/AsyncDisplayKit/examples/ASCollectionView/Sample/SupplementaryNode.h +++ /dev/null @@ -1,16 +0,0 @@ -// -// SupplementaryNode.h -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -@interface SupplementaryNode : ASCellNode - -- (instancetype)initWithText:(NSString *)text; - -@end diff --git a/submodules/AsyncDisplayKit/examples/ASCollectionView/Sample/SupplementaryNode.m b/submodules/AsyncDisplayKit/examples/ASCollectionView/Sample/SupplementaryNode.m deleted file mode 100644 index f4847ff00b..0000000000 --- a/submodules/AsyncDisplayKit/examples/ASCollectionView/Sample/SupplementaryNode.m +++ /dev/null @@ -1,58 +0,0 @@ -// -// SupplementaryNode.m -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import "SupplementaryNode.h" - -#import -#import -#import - -static CGFloat kInsets = 15.0; - -@interface SupplementaryNode () -@property (nonatomic, strong) ASTextNode *textNode; -@end - -@implementation SupplementaryNode - -- (instancetype)initWithText:(NSString *)text -{ - self = [super init]; - - if (self != nil) { - _textNode = [[ASTextNode alloc] init]; - _textNode.attributedText = [[NSAttributedString alloc] initWithString:text - attributes:[self textAttributes]]; - [self addSubnode:_textNode]; - } - - return self; -} - -- (ASLayoutSpec *)layoutSpecThatFits:(ASSizeRange)constrainedSize -{ - ASCenterLayoutSpec *center = [[ASCenterLayoutSpec alloc] init]; - center.centeringOptions = ASCenterLayoutSpecCenteringXY; - center.child = self.textNode; - UIEdgeInsets insets = UIEdgeInsetsMake(kInsets, kInsets, kInsets, kInsets); - - return [ASInsetLayoutSpec insetLayoutSpecWithInsets:insets child:center]; -} - -#pragma mark - Text Formatting - -- (NSDictionary *)textAttributes -{ - return @{ - NSFontAttributeName: [UIFont systemFontOfSize:18.0], - NSForegroundColorAttributeName: [UIColor whiteColor], - }; -} - -@end diff --git a/submodules/AsyncDisplayKit/examples/ASCollectionView/Sample/ViewController.h b/submodules/AsyncDisplayKit/examples/ASCollectionView/Sample/ViewController.h deleted file mode 100644 index c8a0626291..0000000000 --- a/submodules/AsyncDisplayKit/examples/ASCollectionView/Sample/ViewController.h +++ /dev/null @@ -1,14 +0,0 @@ -// -// ViewController.h -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -@interface ViewController : UIViewController - -@end diff --git a/submodules/AsyncDisplayKit/examples/ASCollectionView/Sample/ViewController.m b/submodules/AsyncDisplayKit/examples/ASCollectionView/Sample/ViewController.m deleted file mode 100644 index 687635ee68..0000000000 --- a/submodules/AsyncDisplayKit/examples/ASCollectionView/Sample/ViewController.m +++ /dev/null @@ -1,193 +0,0 @@ -// -// ViewController.m -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import "ViewController.h" -#import "AppDelegate.h" -#import -#import "SupplementaryNode.h" -#import "ItemNode.h" - -#define ASYNC_COLLECTION_LAYOUT 0 - -static CGSize const kItemSize = (CGSize){180, 90}; - -@interface ViewController () - -@property (nonatomic, strong) ASCollectionNode *collectionNode; -@property (nonatomic, strong) NSMutableArray *> *data; -@property (nonatomic, strong) UILongPressGestureRecognizer *moveRecognizer; - -@end - -@implementation ViewController - -#pragma mark - Lifecycle - -- (void)viewDidLoad -{ - [super viewDidLoad]; - - self.moveRecognizer = [[UILongPressGestureRecognizer alloc] initWithTarget:self action:@selector(handleLongPress)]; - [self.view addGestureRecognizer:self.moveRecognizer]; - -#if ASYNC_COLLECTION_LAYOUT - ASCollectionGalleryLayoutDelegate *layoutDelegate = [[ASCollectionGalleryLayoutDelegate alloc] initWithScrollableDirections:ASScrollDirectionVerticalDirections]; - layoutDelegate.propertiesProvider = self; - self.collectionNode = [[ASCollectionNode alloc] initWithLayoutDelegate:layoutDelegate layoutFacilitator:nil]; -#else - UICollectionViewFlowLayout *layout = [[UICollectionViewFlowLayout alloc] init]; - layout.headerReferenceSize = CGSizeMake(50.0, 50.0); - layout.footerReferenceSize = CGSizeMake(50.0, 50.0); - layout.itemSize = kItemSize; - self.collectionNode = [[ASCollectionNode alloc] initWithFrame:self.view.bounds collectionViewLayout:layout]; - [self.collectionNode registerSupplementaryNodeOfKind:UICollectionElementKindSectionHeader]; - [self.collectionNode registerSupplementaryNodeOfKind:UICollectionElementKindSectionFooter]; -#endif - - self.collectionNode.dataSource = self; - self.collectionNode.delegate = self; - - self.collectionNode.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight; - self.collectionNode.backgroundColor = [UIColor whiteColor]; - - [self.view addSubnode:self.collectionNode]; - self.collectionNode.frame = self.view.bounds; - -#if !SIMULATE_WEB_RESPONSE - self.navigationItem.leftItemsSupplementBackButton = YES; - self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemRefresh - target:self - action:@selector(reloadTapped)]; - [self loadData]; -#else - __weak typeof(self) weakSelf = self; - dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(2 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ - [weakSelf handleSimulatedWebResponse]; - }); -#endif -} - -- (void)handleSimulatedWebResponse -{ - [self.collectionNode performBatchUpdates:^{ - [self loadData]; - [self.collectionNode insertSections:[NSIndexSet indexSetWithIndexesInRange:NSMakeRange(0, self.data.count)]]; - } completion:nil]; -} - -- (void)loadData -{ - // Form our data array - typeof(self.data) data = [NSMutableArray array]; - for (NSInteger s = 0; s < 100; s++) { - NSMutableArray *items = [NSMutableArray array]; - for (NSInteger i = 0; i < 10; i++) { - items[i] = [NSString stringWithFormat:@"[%zd.%zd] says hi", s, i]; - } - data[s] = items; - } - self.data = data; -} - -#pragma mark - Button Actions - -- (void)reloadTapped -{ - // This method is deprecated because we reccommend using ASCollectionNode instead of ASCollectionView. - // This functionality & example project remains for users who insist on using ASCollectionView. - [self.collectionNode reloadData]; -} - -#pragma mark - ASCollectionGalleryLayoutPropertiesProviding - -- (CGSize)galleryLayoutDelegate:(ASCollectionGalleryLayoutDelegate *)delegate sizeForElements:(ASElementMap *)elements -{ - ASDisplayNodeAssertMainThread(); - return kItemSize; -} - -- (void)handleLongPress -{ - UICollectionView *collectionView = self.collectionNode.view; - CGPoint location = [self.moveRecognizer locationInView:collectionView]; - switch (self.moveRecognizer.state) { - case UIGestureRecognizerStateBegan: { - NSIndexPath *indexPath = [collectionView indexPathForItemAtPoint:location]; - if (indexPath) { - [collectionView beginInteractiveMovementForItemAtIndexPath:indexPath]; - } - break; - } - case UIGestureRecognizerStateChanged: - [collectionView updateInteractiveMovementTargetPosition:location]; - break; - case UIGestureRecognizerStateEnded: - [collectionView endInteractiveMovement]; - break; - case UIGestureRecognizerStateFailed: - case UIGestureRecognizerStateCancelled: - [collectionView cancelInteractiveMovement]; - break; - case UIGestureRecognizerStatePossible: - // nop - break; - } -} - -#pragma mark - ASCollectionDataSource - -- (ASCellNodeBlock)collectionNode:(ASCollectionNode *)collectionNode nodeBlockForItemAtIndexPath:(NSIndexPath *)indexPath; -{ - NSString *text = self.data[indexPath.section][indexPath.item]; - return ^{ - return [[ItemNode alloc] initWithString:text]; - }; -} - -- (ASCellNode *)collectionNode:(ASCollectionNode *)collectionNode nodeForSupplementaryElementOfKind:(NSString *)kind atIndexPath:(NSIndexPath *)indexPath -{ - NSString *text = [kind isEqualToString:UICollectionElementKindSectionHeader] ? @"Header" : @"Footer"; - SupplementaryNode *node = [[SupplementaryNode alloc] initWithText:text]; - BOOL isHeaderSection = [kind isEqualToString:UICollectionElementKindSectionHeader]; - node.backgroundColor = isHeaderSection ? [UIColor blueColor] : [UIColor redColor]; - return node; -} - -- (NSInteger)collectionNode:(ASCollectionNode *)collectionNode numberOfItemsInSection:(NSInteger)section -{ - return self.data[section].count; -} - -- (NSInteger)numberOfSectionsInCollectionNode:(ASCollectionNode *)collectionNode -{ - return self.data.count; -} - -- (BOOL)collectionNode:(ASCollectionNode *)collectionNode canMoveItemWithNode:(ASCellNode *)node -{ - return YES; -} - -- (void)collectionNode:(ASCollectionNode *)collectionNode moveItemAtIndexPath:(NSIndexPath *)sourceIndexPath toIndexPath:(NSIndexPath *)destinationIndexPath -{ - __auto_type sectionArray = self.data[sourceIndexPath.section]; - __auto_type object = sectionArray[sourceIndexPath.item]; - [sectionArray removeObjectAtIndex:sourceIndexPath.item]; - [self.data[destinationIndexPath.section] insertObject:object atIndex:destinationIndexPath.item]; -} - -#pragma mark - ASCollectionDelegate - -- (void)collectionNode:(ASCollectionNode *)collectionNode willBeginBatchFetchWithContext:(ASBatchContext *)context -{ - NSLog(@"fetch additional content"); - [context completeBatchFetching:YES]; -} - -@end diff --git a/submodules/AsyncDisplayKit/examples/ASCollectionView/Sample/main.m b/submodules/AsyncDisplayKit/examples/ASCollectionView/Sample/main.m deleted file mode 100644 index 65850400e4..0000000000 --- a/submodules/AsyncDisplayKit/examples/ASCollectionView/Sample/main.m +++ /dev/null @@ -1,17 +0,0 @@ -// -// main.m -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import -#import "AppDelegate.h" - -int main(int argc, char * argv[]) { - @autoreleasepool { - return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); - } -} diff --git a/submodules/AsyncDisplayKit/examples/ASDKLayoutTransition/Default-568h@2x.png b/submodules/AsyncDisplayKit/examples/ASDKLayoutTransition/Default-568h@2x.png deleted file mode 100644 index 6ee80b9393..0000000000 Binary files a/submodules/AsyncDisplayKit/examples/ASDKLayoutTransition/Default-568h@2x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/examples/ASDKLayoutTransition/Default-667h@2x.png b/submodules/AsyncDisplayKit/examples/ASDKLayoutTransition/Default-667h@2x.png deleted file mode 100644 index e7b975e21b..0000000000 Binary files a/submodules/AsyncDisplayKit/examples/ASDKLayoutTransition/Default-667h@2x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/examples/ASDKLayoutTransition/Default-736h@3x.png b/submodules/AsyncDisplayKit/examples/ASDKLayoutTransition/Default-736h@3x.png deleted file mode 100644 index c8949cae16..0000000000 Binary files a/submodules/AsyncDisplayKit/examples/ASDKLayoutTransition/Default-736h@3x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/examples/ASDKLayoutTransition/Podfile b/submodules/AsyncDisplayKit/examples/ASDKLayoutTransition/Podfile deleted file mode 100644 index 0fbf4c9524..0000000000 --- a/submodules/AsyncDisplayKit/examples/ASDKLayoutTransition/Podfile +++ /dev/null @@ -1,6 +0,0 @@ -source 'https://github.com/CocoaPods/Specs.git' -platform :ios, '9.0' -target 'Sample' do - pod 'Texture', :path => '../..' - pod 'Texture/Yoga', :path => '../..' -end diff --git a/submodules/AsyncDisplayKit/examples/ASDKLayoutTransition/Sample/AppDelegate.h b/submodules/AsyncDisplayKit/examples/ASDKLayoutTransition/Sample/AppDelegate.h deleted file mode 100644 index 19db03c153..0000000000 --- a/submodules/AsyncDisplayKit/examples/ASDKLayoutTransition/Sample/AppDelegate.h +++ /dev/null @@ -1,16 +0,0 @@ -// -// AppDelegate.h -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -@interface AppDelegate : UIResponder - -@property (strong, nonatomic) UIWindow *window; - -@end diff --git a/submodules/AsyncDisplayKit/examples/ASDKLayoutTransition/Sample/AppDelegate.m b/submodules/AsyncDisplayKit/examples/ASDKLayoutTransition/Sample/AppDelegate.m deleted file mode 100644 index d0fd66f775..0000000000 --- a/submodules/AsyncDisplayKit/examples/ASDKLayoutTransition/Sample/AppDelegate.m +++ /dev/null @@ -1,25 +0,0 @@ -// -// AppDelegate.m -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import "AppDelegate.h" - -#import "ViewController.h" - -@implementation AppDelegate - -- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions -{ - self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; - self.window.backgroundColor = [UIColor whiteColor]; - self.window.rootViewController = [[ViewController alloc] init]; - [self.window makeKeyAndVisible]; - return YES; -} - -@end diff --git a/submodules/AsyncDisplayKit/examples/ASDKLayoutTransition/Sample/Info.plist b/submodules/AsyncDisplayKit/examples/ASDKLayoutTransition/Sample/Info.plist deleted file mode 100644 index fb4115c84c..0000000000 --- a/submodules/AsyncDisplayKit/examples/ASDKLayoutTransition/Sample/Info.plist +++ /dev/null @@ -1,36 +0,0 @@ - - - - - CFBundleDevelopmentRegion - en - CFBundleExecutable - $(EXECUTABLE_NAME) - CFBundleIdentifier - $(PRODUCT_BUNDLE_IDENTIFIER) - CFBundleInfoDictionaryVersion - 6.0 - CFBundleName - $(PRODUCT_NAME) - CFBundlePackageType - APPL - CFBundleShortVersionString - 1.0 - CFBundleSignature - ???? - CFBundleVersion - 1 - LSRequiresIPhoneOS - - UIRequiredDeviceCapabilities - - armv7 - - UISupportedInterfaceOrientations - - UIInterfaceOrientationPortrait - UIInterfaceOrientationLandscapeLeft - UIInterfaceOrientationLandscapeRight - - - diff --git a/submodules/AsyncDisplayKit/examples/ASDKLayoutTransition/Sample/ViewController.h b/submodules/AsyncDisplayKit/examples/ASDKLayoutTransition/Sample/ViewController.h deleted file mode 100644 index c8a0626291..0000000000 --- a/submodules/AsyncDisplayKit/examples/ASDKLayoutTransition/Sample/ViewController.h +++ /dev/null @@ -1,14 +0,0 @@ -// -// ViewController.h -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -@interface ViewController : UIViewController - -@end diff --git a/submodules/AsyncDisplayKit/examples/ASDKLayoutTransition/Sample/ViewController.m b/submodules/AsyncDisplayKit/examples/ASDKLayoutTransition/Sample/ViewController.m deleted file mode 100644 index e5d019b1d1..0000000000 --- a/submodules/AsyncDisplayKit/examples/ASDKLayoutTransition/Sample/ViewController.m +++ /dev/null @@ -1,187 +0,0 @@ -// -// ViewController.m -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import "ViewController.h" - -#import - -#pragma mark - TransitionNode - -#define USE_CUSTOM_LAYOUT_TRANSITION 0 - -@interface TransitionNode : ASDisplayNode -@property (nonatomic, assign) BOOL enabled; -@property (nonatomic, strong) ASButtonNode *buttonNode; -@property (nonatomic, strong) ASTextNode *textNodeOne; -@property (nonatomic, strong) ASTextNode *textNodeTwo; -@end - -@implementation TransitionNode - - -#pragma mark - Lifecycle - -- (instancetype)init -{ - self = [super init]; - if (self == nil) { return self; } - - self.automaticallyManagesSubnodes = YES; - - // Define the layout transition duration for the default transition - self.defaultLayoutTransitionDuration = 1.0; - - _enabled = NO; - - // Setup text nodes - _textNodeOne = [[ASTextNode alloc] init]; - _textNodeOne.attributedText = [[NSAttributedString alloc] initWithString:@"Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled"]; - - _textNodeTwo = [[ASTextNode alloc] init]; - _textNodeTwo.attributedText = [[NSAttributedString alloc] initWithString:@"It is a long established fact that a reader will be distracted by the readable content of a page when looking at its layout. The point of using Lorem Ipsum is that it has a more-or-less normal distribution of letters, as opposed to using 'Content here, content here', making it look like readable English."]; - ASSetDebugNames(_textNodeOne, _textNodeTwo); - - // Setup button - NSString *buttonTitle = @"Start Layout Transition"; - UIFont *buttonFont = [UIFont systemFontOfSize:16.0]; - UIColor *buttonColor = [UIColor blueColor]; - - _buttonNode = [[ASButtonNode alloc] init]; - [_buttonNode setTitle:buttonTitle withFont:buttonFont withColor:buttonColor forState:UIControlStateNormal]; - [_buttonNode setTitle:buttonTitle withFont:buttonFont withColor:[buttonColor colorWithAlphaComponent:0.5] forState:UIControlStateHighlighted]; - - - // Some debug colors - _textNodeOne.backgroundColor = [UIColor orangeColor]; - _textNodeTwo.backgroundColor = [UIColor greenColor]; - - - return self; -} - -- (void)didLoad -{ - [super didLoad]; - - [self.buttonNode addTarget:self action:@selector(buttonPressed:) forControlEvents:ASControlNodeEventTouchUpInside]; -} - -#pragma mark - Actions - -- (void)buttonPressed:(id)sender -{ - self.enabled = !self.enabled; - [self transitionLayoutWithAnimation:YES shouldMeasureAsync:NO measurementCompletion:nil]; -} - - -#pragma mark - Layout - -- (ASLayoutSpec *)layoutSpecThatFits:(ASSizeRange)constrainedSize -{ - ASTextNode *nextTextNode = self.enabled ? self.textNodeTwo : self.textNodeOne; - nextTextNode.style.flexGrow = 1.0; - nextTextNode.style.flexShrink = 1.0; - - ASStackLayoutSpec *horizontalStackLayout = [ASStackLayoutSpec horizontalStackLayoutSpec]; - horizontalStackLayout.children = @[nextTextNode]; - - self.buttonNode.style.alignSelf = ASStackLayoutAlignSelfCenter; - - ASStackLayoutSpec *verticalStackLayout = [ASStackLayoutSpec verticalStackLayoutSpec]; - verticalStackLayout.spacing = 10.0; - verticalStackLayout.children = @[horizontalStackLayout, self.buttonNode]; - - return [ASInsetLayoutSpec insetLayoutSpecWithInsets:UIEdgeInsetsMake(15.0, 15.0, 15.0, 15.0) child:verticalStackLayout]; -} - - -#pragma mark - Transition - -#if USE_CUSTOM_LAYOUT_TRANSITION - -- (void)animateLayoutTransition:(id)context -{ - ASDisplayNode *fromNode = [[context removedSubnodes] objectAtIndex:0]; - ASDisplayNode *toNode = [[context insertedSubnodes] objectAtIndex:0]; - - ASButtonNode *buttonNode = nil; - for (ASDisplayNode *node in [context subnodesForKey:ASTransitionContextToLayoutKey]) { - if ([node isKindOfClass:[ASButtonNode class]]) { - buttonNode = (ASButtonNode *)node; - break; - } - } - - CGRect toNodeFrame = [context finalFrameForNode:toNode]; - toNodeFrame.origin.x += (self.enabled ? toNodeFrame.size.width : -toNodeFrame.size.width); - toNode.frame = toNodeFrame; - toNode.alpha = 0.0; - - CGRect fromNodeFrame = fromNode.frame; - fromNodeFrame.origin.x += (self.enabled ? -fromNodeFrame.size.width : fromNodeFrame.size.width); - - // We will use the same transition duration as the default transition - [UIView animateWithDuration:self.defaultLayoutTransitionDuration animations:^{ - toNode.frame = [context finalFrameForNode:toNode]; - toNode.alpha = 1.0; - - fromNode.frame = fromNodeFrame; - fromNode.alpha = 0.0; - - // Update frame of self - CGSize fromSize = [context layoutForKey:ASTransitionContextFromLayoutKey].size; - CGSize toSize = [context layoutForKey:ASTransitionContextToLayoutKey].size; - BOOL isResized = (CGSizeEqualToSize(fromSize, toSize) == NO); - if (isResized == YES) { - CGPoint position = self.frame.origin; - self.frame = CGRectMake(position.x, position.y, toSize.width, toSize.height); - } - - buttonNode.frame = [context finalFrameForNode:buttonNode]; - } completion:^(BOOL finished) { - [context completeTransition:finished]; - }]; -} - -#endif - -@end - - -#pragma mark - ViewController - -@interface ViewController () -@property (nonatomic, strong) TransitionNode *transitionNode; -@end - -@implementation ViewController - -#pragma mark - UIViewController - -- (void)viewDidLoad -{ - [super viewDidLoad]; - - _transitionNode = [TransitionNode new]; - [self.view addSubnode:_transitionNode]; - - // Some debug colors - _transitionNode.backgroundColor = [UIColor grayColor]; -} - -- (void)viewDidLayoutSubviews -{ - [super viewDidLayoutSubviews]; - - CGSize size = [self.transitionNode layoutThatFits:ASSizeRangeMake(CGSizeZero, self.view.frame.size)].size; - self.transitionNode.frame = CGRectMake(0, 20, size.width, size.height); -} - -@end diff --git a/submodules/AsyncDisplayKit/examples/ASDKLayoutTransition/Sample/main.m b/submodules/AsyncDisplayKit/examples/ASDKLayoutTransition/Sample/main.m deleted file mode 100644 index 511cd1a7ac..0000000000 --- a/submodules/AsyncDisplayKit/examples/ASDKLayoutTransition/Sample/main.m +++ /dev/null @@ -1,18 +0,0 @@ -// -// main.m -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -#import "AppDelegate.h" - -int main(int argc, char * argv[]) { - @autoreleasepool { - return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); - } -} diff --git a/submodules/AsyncDisplayKit/examples/ASDKTube/Default-568h@2x.png b/submodules/AsyncDisplayKit/examples/ASDKTube/Default-568h@2x.png deleted file mode 100644 index 6ee80b9393..0000000000 Binary files a/submodules/AsyncDisplayKit/examples/ASDKTube/Default-568h@2x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/examples/ASDKTube/Default-667h@2x.png b/submodules/AsyncDisplayKit/examples/ASDKTube/Default-667h@2x.png deleted file mode 100644 index e7b975e21b..0000000000 Binary files a/submodules/AsyncDisplayKit/examples/ASDKTube/Default-667h@2x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/examples/ASDKTube/Default-736h@3x.png b/submodules/AsyncDisplayKit/examples/ASDKTube/Default-736h@3x.png deleted file mode 100644 index c8949cae16..0000000000 Binary files a/submodules/AsyncDisplayKit/examples/ASDKTube/Default-736h@3x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/examples/ASDKTube/Podfile b/submodules/AsyncDisplayKit/examples/ASDKTube/Podfile deleted file mode 100644 index 71a7f2c4b2..0000000000 --- a/submodules/AsyncDisplayKit/examples/ASDKTube/Podfile +++ /dev/null @@ -1,5 +0,0 @@ -source 'https://github.com/CocoaPods/Specs.git' -platform :ios, '9.0' -target 'Sample' do - pod 'Texture', :path => '../..' -end diff --git a/submodules/AsyncDisplayKit/examples/ASDKTube/Sample/AppDelegate.h b/submodules/AsyncDisplayKit/examples/ASDKTube/Sample/AppDelegate.h deleted file mode 100644 index 19db03c153..0000000000 --- a/submodules/AsyncDisplayKit/examples/ASDKTube/Sample/AppDelegate.h +++ /dev/null @@ -1,16 +0,0 @@ -// -// AppDelegate.h -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -@interface AppDelegate : UIResponder - -@property (strong, nonatomic) UIWindow *window; - -@end diff --git a/submodules/AsyncDisplayKit/examples/ASDKTube/Sample/AppDelegate.m b/submodules/AsyncDisplayKit/examples/ASDKTube/Sample/AppDelegate.m deleted file mode 100644 index 9ceabb213e..0000000000 --- a/submodules/AsyncDisplayKit/examples/ASDKTube/Sample/AppDelegate.m +++ /dev/null @@ -1,43 +0,0 @@ -// -// AppDelegate.m -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import "AppDelegate.h" -#import "WindowWithStatusBarUnderlay.h" -#import "Utilities.h" -#import "VideoFeedNodeController.h" - - -@implementation AppDelegate - -- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { - - // this UIWindow subclass is neccessary to make the status bar opaque - _window = [[WindowWithStatusBarUnderlay alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; - _window.backgroundColor = [UIColor whiteColor]; - - - VideoFeedNodeController *asdkHomeFeedVC = [[VideoFeedNodeController alloc] init]; - UINavigationController *asdkHomeFeedNavCtrl = [[UINavigationController alloc] initWithRootViewController:asdkHomeFeedVC]; - - - _window.rootViewController = asdkHomeFeedNavCtrl; - [_window makeKeyAndVisible]; - - // Nav Bar appearance - NSDictionary *attributes = @{NSForegroundColorAttributeName:[UIColor whiteColor]}; - [[UINavigationBar appearance] setTitleTextAttributes:attributes]; - [[UINavigationBar appearance] setBarTintColor:[UIColor lighOrangeColor]]; - [[UINavigationBar appearance] setTranslucent:NO]; - - [application setStatusBarStyle:UIStatusBarStyleLightContent]; - - - return YES; -} -@end diff --git a/submodules/AsyncDisplayKit/examples/ASDKTube/Sample/Controller/VideoFeedNodeController.h b/submodules/AsyncDisplayKit/examples/ASDKTube/Sample/Controller/VideoFeedNodeController.h deleted file mode 100644 index 131bb38ef7..0000000000 --- a/submodules/AsyncDisplayKit/examples/ASDKTube/Sample/Controller/VideoFeedNodeController.h +++ /dev/null @@ -1,14 +0,0 @@ -// -// VideoFeedNodeController.h -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -@interface VideoFeedNodeController : ASViewController - -@end diff --git a/submodules/AsyncDisplayKit/examples/ASDKTube/Sample/Controller/VideoFeedNodeController.m b/submodules/AsyncDisplayKit/examples/ASDKTube/Sample/Controller/VideoFeedNodeController.m deleted file mode 100644 index b6e53ba7a5..0000000000 --- a/submodules/AsyncDisplayKit/examples/ASDKTube/Sample/Controller/VideoFeedNodeController.m +++ /dev/null @@ -1,77 +0,0 @@ -// -// VideoFeedNodeController.m -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import "VideoFeedNodeController.h" -#import -#import "VideoModel.h" -#import "VideoContentCell.h" - -@interface VideoFeedNodeController () - -@end - -@implementation VideoFeedNodeController -{ - ASTableNode *_tableNode; - NSMutableArray *_videoFeedData; -} - -- (instancetype)init -{ - _tableNode = [[ASTableNode alloc] init]; - _tableNode.delegate = self; - _tableNode.dataSource = self; - - if (!(self = [super initWithNode:_tableNode])) { - return nil; - } - - [self generateFeedData]; - self.navigationItem.title = @"Home"; - - return self; -} - -- (void)viewDidLoad -{ - [super viewDidLoad]; - - [_tableNode reloadData]; -} - -- (void)generateFeedData -{ - _videoFeedData = [[NSMutableArray alloc] init]; - - for (int i = 0; i < 30; i++) { - [_videoFeedData addObject:[[VideoModel alloc] init]]; - } -} - -#pragma mark - ASCollectionDelegate - ASCollectionDataSource - -- (NSInteger)numberOfSectionsInTableNode:(ASTableNode *)tableNode -{ - return 1; -} - -- (NSInteger)tableNode:(ASTableNode *)tableNode numberOfRowsInSection:(NSInteger)section -{ - return _videoFeedData.count; -} - -- (ASCellNode *)tableNode:(ASTableNode *)tableNode nodeForRowAtIndexPath:(NSIndexPath *)indexPath -{ - VideoModel *videoObject = [_videoFeedData objectAtIndex:indexPath.row]; - VideoContentCell *cellNode = [[VideoContentCell alloc] initWithVideoObject:videoObject]; - - return cellNode; -} - -@end diff --git a/submodules/AsyncDisplayKit/examples/ASDKTube/Sample/Icons/ico-mute.png b/submodules/AsyncDisplayKit/examples/ASDKTube/Sample/Icons/ico-mute.png deleted file mode 100644 index 1f700e3a5d..0000000000 Binary files a/submodules/AsyncDisplayKit/examples/ASDKTube/Sample/Icons/ico-mute.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/examples/ASDKTube/Sample/Icons/ico-mute@2x.png b/submodules/AsyncDisplayKit/examples/ASDKTube/Sample/Icons/ico-mute@2x.png deleted file mode 100644 index 025f1386a4..0000000000 Binary files a/submodules/AsyncDisplayKit/examples/ASDKTube/Sample/Icons/ico-mute@2x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/examples/ASDKTube/Sample/Icons/ico-mute@3x.png b/submodules/AsyncDisplayKit/examples/ASDKTube/Sample/Icons/ico-mute@3x.png deleted file mode 100644 index a4815608b9..0000000000 Binary files a/submodules/AsyncDisplayKit/examples/ASDKTube/Sample/Icons/ico-mute@3x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/examples/ASDKTube/Sample/Icons/ico-unmute.png b/submodules/AsyncDisplayKit/examples/ASDKTube/Sample/Icons/ico-unmute.png deleted file mode 100644 index 52d15943f7..0000000000 Binary files a/submodules/AsyncDisplayKit/examples/ASDKTube/Sample/Icons/ico-unmute.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/examples/ASDKTube/Sample/Icons/ico-unmute@2x.png b/submodules/AsyncDisplayKit/examples/ASDKTube/Sample/Icons/ico-unmute@2x.png deleted file mode 100644 index e671374d47..0000000000 Binary files a/submodules/AsyncDisplayKit/examples/ASDKTube/Sample/Icons/ico-unmute@2x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/examples/ASDKTube/Sample/Icons/ico-unmute@3x.png b/submodules/AsyncDisplayKit/examples/ASDKTube/Sample/Icons/ico-unmute@3x.png deleted file mode 100644 index 2fa2462d98..0000000000 Binary files a/submodules/AsyncDisplayKit/examples/ASDKTube/Sample/Icons/ico-unmute@3x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/examples/ASDKTube/Sample/Info.plist b/submodules/AsyncDisplayKit/examples/ASDKTube/Sample/Info.plist deleted file mode 100644 index 3b4c6c7839..0000000000 --- a/submodules/AsyncDisplayKit/examples/ASDKTube/Sample/Info.plist +++ /dev/null @@ -1,38 +0,0 @@ - - - - - UIViewControllerBasedStatusBarAppearance - - CFBundleDevelopmentRegion - en - CFBundleExecutable - $(EXECUTABLE_NAME) - CFBundleIdentifier - com.facebook.AsyncDisplayKit.$(PRODUCT_NAME:rfc1034identifier) - CFBundleInfoDictionaryVersion - 6.0 - CFBundleName - $(PRODUCT_NAME) - CFBundlePackageType - APPL - CFBundleShortVersionString - 1.0 - CFBundleSignature - ???? - CFBundleVersion - 1 - LSRequiresIPhoneOS - - UIRequiredDeviceCapabilities - - armv7 - - UIStatusBarStyle - UIStatusBarStyleLightContent - UISupportedInterfaceOrientations - - UIInterfaceOrientationPortrait - - - diff --git a/submodules/AsyncDisplayKit/examples/ASDKTube/Sample/Models/Utilities.h b/submodules/AsyncDisplayKit/examples/ASDKTube/Sample/Models/Utilities.h deleted file mode 100644 index 4fd689f18b..0000000000 --- a/submodules/AsyncDisplayKit/examples/ASDKTube/Sample/Models/Utilities.h +++ /dev/null @@ -1,41 +0,0 @@ -// -// Utilities.h -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// -#include -@interface UIColor (Additions) - -+ (UIColor *)lighOrangeColor; -+ (UIColor *)darkBlueColor; -+ (UIColor *)lightBlueColor; - -@end - -@interface UIImage (Additions) - -+ (UIImage *)followingButtonStretchableImageForCornerRadius:(CGFloat)cornerRadius following:(BOOL)followingEnabled; -+ (void)downloadImageForURL:(NSURL *)url completion:(void (^)(UIImage *))block; - -- (UIImage *)makeCircularImageWithSize:(CGSize)size; - -@end - -@interface NSString (Additions) - -// returns a user friendly elapsed time such as '50s', '6m' or '3w' -+ (NSString *)elapsedTimeStringSinceDate:(NSString *)uploadDateString; - -@end - -@interface NSAttributedString (Additions) - -+ (NSAttributedString *)attributedStringWithString:(NSString *)string - fontSize:(CGFloat)size - color:(UIColor *)color - firstWordColor:(UIColor *)firstWordColor; - -@end diff --git a/submodules/AsyncDisplayKit/examples/ASDKTube/Sample/Models/Utilities.m b/submodules/AsyncDisplayKit/examples/ASDKTube/Sample/Models/Utilities.m deleted file mode 100644 index c9998154c8..0000000000 --- a/submodules/AsyncDisplayKit/examples/ASDKTube/Sample/Models/Utilities.m +++ /dev/null @@ -1,231 +0,0 @@ -// -// Utilities.m -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import "Utilities.h" - -#define StrokeRoundedImages 0 - -@implementation UIColor (Additions) - -+ (UIColor *)lighOrangeColor -{ - return [UIColor colorWithRed:1 green:0.506 blue:0.384 alpha:1]; -} - -+ (UIColor *)darkBlueColor -{ - return [UIColor colorWithRed:70.0/255.0 green:102.0/255.0 blue:118.0/255.0 alpha:1.0]; -} - -+ (UIColor *)lightBlueColor -{ - return [UIColor colorWithRed:70.0/255.0 green:165.0/255.0 blue:196.0/255.0 alpha:1.0]; -} - -@end - -@implementation UIImage (Additions) - -+ (UIImage *)followingButtonStretchableImageForCornerRadius:(CGFloat)cornerRadius following:(BOOL)followingEnabled -{ - CGSize unstretchedSize = CGSizeMake(2 * cornerRadius + 1, 2 * cornerRadius + 1); - CGRect rect = (CGRect) {CGPointZero, unstretchedSize}; - UIBezierPath *path = [UIBezierPath bezierPathWithRoundedRect:rect cornerRadius:cornerRadius]; - - // create a graphics context for the following status button - UIGraphicsBeginImageContextWithOptions(unstretchedSize, NO, 0); - - [path addClip]; - - if (followingEnabled) { - - [[UIColor whiteColor] setFill]; - [path fill]; - - path.lineWidth = 3; - [[UIColor lightBlueColor] setStroke]; - [path stroke]; - - } else { - - [[UIColor lightBlueColor] setFill]; - [path fill]; - } - - UIImage *followingBtnImage = UIGraphicsGetImageFromCurrentImageContext(); - UIGraphicsEndImageContext(); - - UIImage *followingBtnImageStretchable = [followingBtnImage stretchableImageWithLeftCapWidth:cornerRadius - topCapHeight:cornerRadius]; - return followingBtnImageStretchable; -} - -+ (void)downloadImageForURL:(NSURL *)url completion:(void (^)(UIImage *))block -{ - static NSCache *simpleImageCache = nil; - static dispatch_once_t onceToken; - dispatch_once(&onceToken, ^{ - simpleImageCache = [[NSCache alloc] init]; - simpleImageCache.countLimit = 10; - }); - - if (!block) { - return; - } - - // check if image is cached - UIImage *image = [simpleImageCache objectForKey:url]; - if (image) { - dispatch_async(dispatch_get_main_queue(), ^{ - block(image); - }); - } else { - // else download image - NSURLSession *session = [NSURLSession sessionWithConfiguration:[NSURLSessionConfiguration ephemeralSessionConfiguration]]; - NSURLSessionDataTask *task = [session dataTaskWithURL:url completionHandler:^(NSData * _Nullable data, NSURLResponse * _Nullable response, NSError * _Nullable error) { - if (data) { - UIImage *image = [UIImage imageWithData:data]; - dispatch_async(dispatch_get_main_queue(), ^{ - block(image); - }); - } - }]; - [task resume]; - } -} - -- (UIImage *)makeCircularImageWithSize:(CGSize)size -{ - // make a CGRect with the image's size - CGRect circleRect = (CGRect) {CGPointZero, size}; - - // begin the image context since we're not in a drawRect: - UIGraphicsBeginImageContextWithOptions(circleRect.size, NO, 0); - - // create a UIBezierPath circle - UIBezierPath *circle = [UIBezierPath bezierPathWithRoundedRect:circleRect cornerRadius:circleRect.size.width/2]; - - // clip to the circle - [circle addClip]; - - // draw the image in the circleRect *AFTER* the context is clipped - [self drawInRect:circleRect]; - - // create a border (for white background pictures) -#if StrokeRoundedImages - circle.lineWidth = 1; - [[UIColor darkGrayColor] set]; - [circle stroke]; -#endif - - // get an image from the image context - UIImage *roundedImage = UIGraphicsGetImageFromCurrentImageContext(); - - // end the image context since we're not in a drawRect: - UIGraphicsEndImageContext(); - - return roundedImage; -} - -@end - -@implementation NSString (Additions) - -// Returns a user-visible date time string that corresponds to the -// specified RFC 3339 date time string. Note that this does not handle -// all possible RFC 3339 date time strings, just one of the most common -// styles. -+ (NSDate *)userVisibleDateTimeStringForRFC3339DateTimeString:(NSString *)rfc3339DateTimeString -{ - NSDateFormatter * rfc3339DateFormatter; - NSLocale * enUSPOSIXLocale; - - // Convert the RFC 3339 date time string to an NSDate. - - rfc3339DateFormatter = [[NSDateFormatter alloc] init]; - - enUSPOSIXLocale = [NSLocale localeWithLocaleIdentifier:@"en_US_POSIX"]; - - [rfc3339DateFormatter setLocale:enUSPOSIXLocale]; - [rfc3339DateFormatter setDateFormat:@"yyyy'-'MM'-'dd'T'HH':'mm':'ssZ'"]; - [rfc3339DateFormatter setTimeZone:[NSTimeZone timeZoneForSecondsFromGMT:0]]; - - return [rfc3339DateFormatter dateFromString:rfc3339DateTimeString]; -} - -+ (NSString *)elapsedTimeStringSinceDate:(NSString *)uploadDateString -{ - // early return if no post date string - if (!uploadDateString) - { - return @"NO POST DATE"; - } - - NSDate *postDate = [self userVisibleDateTimeStringForRFC3339DateTimeString:uploadDateString]; - - if (!postDate) { - return @"DATE CONVERSION ERROR"; - } - - NSDate *currentDate = [NSDate date]; - - NSCalendar *calendar = [NSCalendar currentCalendar]; - - NSUInteger seconds = [[calendar components:NSCalendarUnitSecond fromDate:postDate toDate:currentDate options:0] second]; - NSUInteger minutes = [[calendar components:NSCalendarUnitMinute fromDate:postDate toDate:currentDate options:0] minute]; - NSUInteger hours = [[calendar components:NSCalendarUnitHour fromDate:postDate toDate:currentDate options:0] hour]; - NSUInteger days = [[calendar components:NSCalendarUnitDay fromDate:postDate toDate:currentDate options:0] day]; - - NSString *elapsedTime; - - if (days > 7) { - elapsedTime = [NSString stringWithFormat:@"%luw", (long)ceil(days/7.0)]; - } else if (days > 0) { - elapsedTime = [NSString stringWithFormat:@"%lud", (long)days]; - } else if (hours > 0) { - elapsedTime = [NSString stringWithFormat:@"%luh", (long)hours]; - } else if (minutes > 0) { - elapsedTime = [NSString stringWithFormat:@"%lum", (long)minutes]; - } else if (seconds > 0) { - elapsedTime = [NSString stringWithFormat:@"%lus", (long)seconds]; - } else if (seconds == 0) { - elapsedTime = @"1s"; - } else { - elapsedTime = @"ERROR"; - } - - return elapsedTime; -} - -@end - -@implementation NSAttributedString (Additions) - -+ (NSAttributedString *)attributedStringWithString:(NSString *)string fontSize:(CGFloat)size - color:(nullable UIColor *)color firstWordColor:(nullable UIColor *)firstWordColor -{ - NSMutableAttributedString *attributedString = [[NSMutableAttributedString alloc] init]; - - if (string) { - NSDictionary *attributes = @{NSForegroundColorAttributeName: color ? : [UIColor blackColor], - NSFontAttributeName: [UIFont systemFontOfSize:size]}; - attributedString = [[NSMutableAttributedString alloc] initWithString:string]; - [attributedString addAttributes:attributes range:NSMakeRange(0, string.length)]; - - if (firstWordColor) { - NSRange firstSpaceRange = [string rangeOfCharacterFromSet:[NSCharacterSet whitespaceCharacterSet]]; - NSRange firstWordRange = NSMakeRange(0, firstSpaceRange.location); - [attributedString addAttribute:NSForegroundColorAttributeName value:firstWordColor range:firstWordRange]; - } - } - - return attributedString; -} - -@end diff --git a/submodules/AsyncDisplayKit/examples/ASDKTube/Sample/Models/VideoModel.h b/submodules/AsyncDisplayKit/examples/ASDKTube/Sample/Models/VideoModel.h deleted file mode 100644 index c912ab45fe..0000000000 --- a/submodules/AsyncDisplayKit/examples/ASDKTube/Sample/Models/VideoModel.h +++ /dev/null @@ -1,17 +0,0 @@ -// -// VideoModel.h -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -@interface VideoModel : NSObject -@property (nonatomic, strong, readonly) NSString* title; -@property (nonatomic, strong, readonly) NSURL *url; -@property (nonatomic, strong, readonly) NSString *userName; -@property (nonatomic, strong, readonly) NSURL *avatarUrl; -@end diff --git a/submodules/AsyncDisplayKit/examples/ASDKTube/Sample/Models/VideoModel.m b/submodules/AsyncDisplayKit/examples/ASDKTube/Sample/Models/VideoModel.m deleted file mode 100644 index 46cd7f3da1..0000000000 --- a/submodules/AsyncDisplayKit/examples/ASDKTube/Sample/Models/VideoModel.m +++ /dev/null @@ -1,28 +0,0 @@ -// -// VideoModel.m -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import "VideoModel.h" - -@implementation VideoModel -- (instancetype)init -{ - self = [super init]; - if (self) { - NSString *videoUrlString = @"https://www.w3schools.com/html/mov_bbb.mp4"; - NSString *avatarUrlString = [NSString stringWithFormat:@"https://api.adorable.io/avatars/50/%@",[[NSProcessInfo processInfo] globallyUniqueString]]; - - _title = @"Demo title"; - _url = [NSURL URLWithString:videoUrlString]; - _userName = @"Random User"; - _avatarUrl = [NSURL URLWithString:avatarUrlString]; - } - - return self; -} -@end diff --git a/submodules/AsyncDisplayKit/examples/ASDKTube/Sample/Nodes/VideoContentCell.h b/submodules/AsyncDisplayKit/examples/ASDKTube/Sample/Nodes/VideoContentCell.h deleted file mode 100644 index 2a386f9241..0000000000 --- a/submodules/AsyncDisplayKit/examples/ASDKTube/Sample/Nodes/VideoContentCell.h +++ /dev/null @@ -1,15 +0,0 @@ -// -// VideoContentCell.h -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import -#import "VideoModel.h" - -@interface VideoContentCell : ASCellNode -- (instancetype)initWithVideoObject:(VideoModel *)video; -@end diff --git a/submodules/AsyncDisplayKit/examples/ASDKTube/Sample/Nodes/VideoContentCell.m b/submodules/AsyncDisplayKit/examples/ASDKTube/Sample/Nodes/VideoContentCell.m deleted file mode 100644 index fac4e389db..0000000000 --- a/submodules/AsyncDisplayKit/examples/ASDKTube/Sample/Nodes/VideoContentCell.m +++ /dev/null @@ -1,229 +0,0 @@ -// -// VideoContentCell.m -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import "VideoContentCell.h" - -#import - -#import "Utilities.h" - -#define AVATAR_IMAGE_HEIGHT 30 -#define HORIZONTAL_BUFFER 10 -#define VERTICAL_BUFFER 5 - -@interface VideoContentCell () - -@end - -@implementation VideoContentCell -{ - VideoModel *_videoModel; - ASTextNode *_titleNode; - ASNetworkImageNode *_avatarNode; - ASVideoPlayerNode *_videoPlayerNode; - ASControlNode *_likeButtonNode; - ASButtonNode *_muteButtonNode; -} - -- (instancetype)initWithVideoObject:(VideoModel *)video -{ - self = [super init]; - if (self) { - _videoModel = video; - - _titleNode = [[ASTextNode alloc] init]; - _titleNode.attributedText = [[NSAttributedString alloc] initWithString:_videoModel.title attributes:[self titleNodeStringOptions]]; - _titleNode.style.flexGrow = 1.0; - [self addSubnode:_titleNode]; - - _avatarNode = [[ASNetworkImageNode alloc] init]; - _avatarNode.URL = _videoModel.avatarUrl; - - [_avatarNode setImageModificationBlock:^UIImage *(UIImage *image) { - CGSize profileImageSize = CGSizeMake(AVATAR_IMAGE_HEIGHT, AVATAR_IMAGE_HEIGHT); - return [image makeCircularImageWithSize:profileImageSize]; - }]; - - [self addSubnode:_avatarNode]; - - _likeButtonNode = [[ASControlNode alloc] init]; - _likeButtonNode.backgroundColor = [UIColor redColor]; - [self addSubnode:_likeButtonNode]; - - _muteButtonNode = [[ASButtonNode alloc] init]; - _muteButtonNode.style.width = ASDimensionMakeWithPoints(16.0); - _muteButtonNode.style.height = ASDimensionMakeWithPoints(22.0); - [_muteButtonNode addTarget:self action:@selector(didTapMuteButton) forControlEvents:ASControlNodeEventTouchUpInside]; - - _videoPlayerNode = [[ASVideoPlayerNode alloc] initWithURL:_videoModel.url]; - _videoPlayerNode.delegate = self; - _videoPlayerNode.backgroundColor = [UIColor blackColor]; - [self addSubnode:_videoPlayerNode]; - - [self setMuteButtonIcon]; - } - return self; -} - -- (NSDictionary*)titleNodeStringOptions -{ - return @{ - NSFontAttributeName : [UIFont systemFontOfSize:14.0], - NSForegroundColorAttributeName: [UIColor blackColor] - }; -} - -- (ASLayoutSpec *)layoutSpecThatFits:(ASSizeRange)constrainedSize -{ - CGFloat fullWidth = [UIScreen mainScreen].bounds.size.width; - - _videoPlayerNode.style.width = ASDimensionMakeWithPoints(fullWidth); - _videoPlayerNode.style.height = ASDimensionMakeWithPoints(fullWidth * 9 / 16); - - _avatarNode.style.width = ASDimensionMakeWithPoints(AVATAR_IMAGE_HEIGHT); - _avatarNode.style.height = ASDimensionMakeWithPoints(AVATAR_IMAGE_HEIGHT); - - _likeButtonNode.style.width = ASDimensionMakeWithPoints(50.0); - _likeButtonNode.style.height = ASDimensionMakeWithPoints(26.0); - - ASStackLayoutSpec *headerStack = [ASStackLayoutSpec horizontalStackLayoutSpec]; - headerStack.spacing = HORIZONTAL_BUFFER; - headerStack.alignItems = ASStackLayoutAlignItemsCenter; - [headerStack setChildren:@[ _avatarNode, _titleNode]]; - - UIEdgeInsets headerInsets = UIEdgeInsetsMake(HORIZONTAL_BUFFER, HORIZONTAL_BUFFER, HORIZONTAL_BUFFER, HORIZONTAL_BUFFER); - ASInsetLayoutSpec *headerInset = [ASInsetLayoutSpec insetLayoutSpecWithInsets:headerInsets child:headerStack]; - - ASStackLayoutSpec *bottomControlsStack = [ASStackLayoutSpec horizontalStackLayoutSpec]; - bottomControlsStack.spacing = HORIZONTAL_BUFFER; - bottomControlsStack.alignItems = ASStackLayoutAlignItemsCenter; - bottomControlsStack.children = @[_likeButtonNode]; - - UIEdgeInsets bottomControlsInsets = UIEdgeInsetsMake(HORIZONTAL_BUFFER, HORIZONTAL_BUFFER, HORIZONTAL_BUFFER, HORIZONTAL_BUFFER); - ASInsetLayoutSpec *bottomControlsInset = [ASInsetLayoutSpec insetLayoutSpecWithInsets:bottomControlsInsets child:bottomControlsStack]; - - - ASStackLayoutSpec *verticalStack = [ASStackLayoutSpec verticalStackLayoutSpec]; - verticalStack.alignItems = ASStackLayoutAlignItemsStretch; - verticalStack.children = @[headerInset, _videoPlayerNode, bottomControlsInset]; - return verticalStack; -} - -- (void)setMuteButtonIcon -{ - if (_videoPlayerNode.muted) { - [_muteButtonNode setImage:[UIImage imageNamed:@"ico-mute"] forState:UIControlStateNormal]; - } else { - [_muteButtonNode setImage:[UIImage imageNamed:@"ico-unmute"] forState:UIControlStateNormal]; - } -} - -- (void)didTapMuteButton -{ - _videoPlayerNode.muted = !_videoPlayerNode.muted; - [self setMuteButtonIcon]; -} - -#pragma mark - ASVideoPlayerNodeDelegate -- (void)didTapVideoPlayerNode:(ASVideoPlayerNode *)videoPlayer -{ - if (_videoPlayerNode.playerState == ASVideoNodePlayerStatePlaying) { - _videoPlayerNode.controlsDisabled = !_videoPlayerNode.controlsDisabled; - [_videoPlayerNode pause]; - } else { - [_videoPlayerNode play]; - } -} - -- (NSDictionary *)videoPlayerNodeCustomControls:(ASVideoPlayerNode *)videoPlayer -{ - return @{ - @"muteControl" : _muteButtonNode - }; -} - -- (NSArray *)controlsForControlBar:(NSDictionary *)availableControls -{ - NSMutableArray *controls = [[NSMutableArray alloc] init]; - - if (availableControls[ @(ASVideoPlayerNodeControlTypePlaybackButton) ]) { - [controls addObject:availableControls[ @(ASVideoPlayerNodeControlTypePlaybackButton) ]]; - } - - if (availableControls[ @(ASVideoPlayerNodeControlTypeElapsedText) ]) { - [controls addObject:availableControls[ @(ASVideoPlayerNodeControlTypeElapsedText) ]]; - } - - if (availableControls[ @(ASVideoPlayerNodeControlTypeScrubber) ]) { - [controls addObject:availableControls[ @(ASVideoPlayerNodeControlTypeScrubber) ]]; - } - - if (availableControls[ @(ASVideoPlayerNodeControlTypeDurationText) ]) { - [controls addObject:availableControls[ @(ASVideoPlayerNodeControlTypeDurationText) ]]; - } - - return controls; -} - -#pragma mark - Layout -- (ASLayoutSpec*)videoPlayerNodeLayoutSpec:(ASVideoPlayerNode *)videoPlayer forControls:(NSDictionary *)controls forMaximumSize:(CGSize)maxSize -{ - ASLayoutSpec *spacer = [[ASLayoutSpec alloc] init]; - spacer.style.flexGrow = 1.0; - - UIEdgeInsets insets = UIEdgeInsetsMake(10.0, 10.0, 10.0, 10.0); - - if (controls[ @(ASVideoPlayerNodeControlTypeScrubber) ]) { - ASDisplayNode *scrubber = controls[ @(ASVideoPlayerNodeControlTypeScrubber) ]; - scrubber.style.height = ASDimensionMakeWithPoints(44.0); - scrubber.style.minWidth = ASDimensionMakeWithPoints(0.0); - scrubber.style.maxWidth = ASDimensionMakeWithPoints(maxSize.width); - scrubber.style.flexGrow = 1.0; - } - - NSArray *controlBarControls = [self controlsForControlBar:controls]; - NSMutableArray *topBarControls = [[NSMutableArray alloc] init]; - - //Our custom control - if (controls[@"muteControl"]) { - [topBarControls addObject:controls[@"muteControl"]]; - } - - - ASStackLayoutSpec *topBarSpec = [ASStackLayoutSpec stackLayoutSpecWithDirection:ASStackLayoutDirectionHorizontal - spacing:10.0 - justifyContent:ASStackLayoutJustifyContentStart - alignItems:ASStackLayoutAlignItemsCenter - children:topBarControls]; - - ASInsetLayoutSpec *topBarInsetSpec = [ASInsetLayoutSpec insetLayoutSpecWithInsets:insets child:topBarSpec]; - - ASStackLayoutSpec *controlbarSpec = [ASStackLayoutSpec stackLayoutSpecWithDirection:ASStackLayoutDirectionHorizontal - spacing:10.0 - justifyContent:ASStackLayoutJustifyContentStart - alignItems:ASStackLayoutAlignItemsCenter - children: controlBarControls ]; - controlbarSpec.style.alignSelf = ASStackLayoutAlignSelfStretch; - - - - ASInsetLayoutSpec *controlbarInsetSpec = [ASInsetLayoutSpec insetLayoutSpecWithInsets:insets child:controlbarSpec]; - - controlbarInsetSpec.style.alignSelf = ASStackLayoutAlignSelfStretch; - - ASStackLayoutSpec *mainVerticalStack = [ASStackLayoutSpec stackLayoutSpecWithDirection:ASStackLayoutDirectionVertical - spacing:0.0 - justifyContent:ASStackLayoutJustifyContentStart - alignItems:ASStackLayoutAlignItemsStart - children:@[topBarInsetSpec, spacer, controlbarInsetSpec]]; - - return mainVerticalStack; - -} -@end diff --git a/submodules/AsyncDisplayKit/examples/ASDKTube/Sample/ViewController.h b/submodules/AsyncDisplayKit/examples/ASDKTube/Sample/ViewController.h deleted file mode 100644 index 560b6a2d03..0000000000 --- a/submodules/AsyncDisplayKit/examples/ASDKTube/Sample/ViewController.h +++ /dev/null @@ -1,14 +0,0 @@ -// -// ViewController.h -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -@interface ViewController : ASViewController - -@end diff --git a/submodules/AsyncDisplayKit/examples/ASDKTube/Sample/ViewController.m b/submodules/AsyncDisplayKit/examples/ASDKTube/Sample/ViewController.m deleted file mode 100644 index 0fe3274501..0000000000 --- a/submodules/AsyncDisplayKit/examples/ASDKTube/Sample/ViewController.m +++ /dev/null @@ -1,209 +0,0 @@ -// -// ViewController.m -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import "ViewController.h" -#import -#import -#import "VideoModel.h" -#import "VideoContentCell.h" - -@interface ViewController() -@property (nonatomic, strong) ASVideoPlayerNode *videoPlayerNode; -@end - -@implementation ViewController -{ - ASTableNode *_tableNode; - NSMutableArray *_videoFeedData; -} - -- (instancetype)init -{ - _tableNode = [[ASTableNode alloc] init]; - _tableNode.delegate = self; - _tableNode.dataSource = self; - - if (!(self = [super initWithNode:_tableNode])) { - return nil; - } - - return self; -} - -- (void)loadView -{ - [super loadView]; - - _videoFeedData = [[NSMutableArray alloc] initWithObjects:[[VideoModel alloc] init], [[VideoModel alloc] init], nil]; - - [_tableNode reloadData]; -} - -- (void)viewWillAppear:(BOOL)animated -{ - [super viewWillAppear:animated]; - - //[self.view addSubnode:self.videoPlayerNode]; - - //[self.videoPlayerNode setNeedsLayout]; -} - -#pragma mark - ASCollectionDelegate - ASCollectionDataSource - -- (NSInteger)numberOfSectionsInTableNode:(ASTableNode *)tableNode -{ - return 1; -} - -- (NSInteger)tableNode:(ASTableNode *)tableNode numberOfRowsInSection:(NSInteger)section -{ - return _videoFeedData.count; -} - -- (ASCellNode *)tableNode:(ASTableNode *)tableNode nodeForRowAtIndexPath:(NSIndexPath *)indexPath -{ - VideoModel *videoObject = [_videoFeedData objectAtIndex:indexPath.row]; - VideoContentCell *cellNode = [[VideoContentCell alloc] initWithVideoObject:videoObject]; - return cellNode; -} - -- (ASVideoPlayerNode *)videoPlayerNode; -{ - if (_videoPlayerNode) { - return _videoPlayerNode; - } - - NSURL *fileUrl = [NSURL URLWithString:@"https://www.w3schools.com/html/mov_bbb.mp4"]; - - _videoPlayerNode = [[ASVideoPlayerNode alloc] initWithURL:fileUrl]; - _videoPlayerNode.delegate = self; -// _videoPlayerNode.disableControls = YES; -// -// dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(10.0 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ -// _videoPlayerNode.disableControls = NO; -// }); - - _videoPlayerNode.backgroundColor = [UIColor blackColor]; - - return _videoPlayerNode; -} - -#pragma mark - ASVideoPlayerNodeDelegate -//- (NSArray *)videoPlayerNodeNeededControls:(ASVideoPlayerNode *)videoPlayer -//{ -// return @[ @(ASVideoPlayerNodeControlTypePlaybackButton), -// @(ASVideoPlayerNodeControlTypeElapsedText), -// @(ASVideoPlayerNodeControlTypeScrubber), -// @(ASVideoPlayerNodeControlTypeDurationText) ]; -//} -// -//- (UIColor *)videoPlayerNodeScrubberMaximumTrackTint:(ASVideoPlayerNode *)videoPlayer -//{ -// return [UIColor colorWithRed:1 green:1 blue:1 alpha:0.3]; -//} -// -//- (UIColor *)videoPlayerNodeScrubberMinimumTrackTint:(ASVideoPlayerNode *)videoPlayer -//{ -// return [UIColor whiteColor]; -//} -// -//- (UIColor *)videoPlayerNodeScrubberThumbTint:(ASVideoPlayerNode *)videoPlayer -//{ -// return [UIColor whiteColor]; -//} -// -//- (NSDictionary *)videoPlayerNodeTimeLabelAttributes:(ASVideoPlayerNode *)videoPlayerNode timeLabelType:(ASVideoPlayerNodeControlType)timeLabelType -//{ -// NSDictionary *options; -// -// if (timeLabelType == ASVideoPlayerNodeControlTypeElapsedText) { -// options = @{ -// NSFontAttributeName : [UIFont fontWithName:@"HelveticaNeue-Medium" size:16.0], -// NSForegroundColorAttributeName: [UIColor orangeColor] -// }; -// } else if (timeLabelType == ASVideoPlayerNodeControlTypeDurationText) { -// options = @{ -// NSFontAttributeName : [UIFont fontWithName:@"HelveticaNeue-Medium" size:16.0], -// NSForegroundColorAttributeName: [UIColor redColor] -// }; -// } -// -// return options; -//} - -/*- (ASLayoutSpec *)videoPlayerNodeLayoutSpec:(ASVideoPlayerNode *)videoPlayer - forControls:(NSDictionary *)controls - forConstrainedSize:(ASSizeRange)constrainedSize -{ - - NSMutableArray *bottomControls = [[NSMutableArray alloc] init]; - NSMutableArray *topControls = [[NSMutableArray alloc] init]; - - ASDisplayNode *scrubberNode = controls[@(ASVideoPlayerNodeControlTypeScrubber)]; - ASDisplayNode *playbackButtonNode = controls[@(ASVideoPlayerNodeControlTypePlaybackButton)]; - ASTextNode *elapsedTexNode = controls[@(ASVideoPlayerNodeControlTypeElapsedText)]; - ASTextNode *durationTexNode = controls[@(ASVideoPlayerNodeControlTypeDurationText)]; - - if (playbackButtonNode) { - [bottomControls addObject:playbackButtonNode]; - } - - if (scrubberNode) { - scrubberNode.preferredFrameSize = CGSizeMake(constrainedSize.max.width, 44.0); - [bottomControls addObject:scrubberNode]; - } - - if (elapsedTexNode) { - [topControls addObject:elapsedTexNode]; - } - - if (durationTexNode) { - [topControls addObject:durationTexNode]; - } - - ASLayoutSpec *spacer = [[ASLayoutSpec alloc] init]; - spacer.flexGrow = 1.0; - - ASStackLayoutSpec *topBarSpec = [ASStackLayoutSpec stackLayoutSpecWithDirection:ASStackLayoutDirectionHorizontal - spacing:10.0 - justifyContent:ASStackLayoutJustifyContentCenter - alignItems:ASStackLayoutAlignItemsCenter - children:topControls]; - - - - UIEdgeInsets topBarSpecInsets = UIEdgeInsetsMake(20.0, 10.0, 0.0, 10.0); - - ASInsetLayoutSpec *topBarSpecInsetSpec = [ASInsetLayoutSpec insetLayoutSpecWithInsets:topBarSpecInsets child:topBarSpec]; - topBarSpecInsetSpec.alignSelf = ASStackLayoutAlignSelfStretch; - - ASStackLayoutSpec *controlbarSpec = [ASStackLayoutSpec stackLayoutSpecWithDirection:ASStackLayoutDirectionHorizontal - spacing:10.0 - justifyContent:ASStackLayoutJustifyContentStart - alignItems:ASStackLayoutAlignItemsCenter - children:bottomControls]; - controlbarSpec.alignSelf = ASStackLayoutAlignSelfStretch; - - UIEdgeInsets insets = UIEdgeInsetsMake(10.0, 10.0, 10.0, 10.0); - - ASInsetLayoutSpec *controlbarInsetSpec = [ASInsetLayoutSpec insetLayoutSpecWithInsets:insets child:controlbarSpec]; - - controlbarInsetSpec.alignSelf = ASStackLayoutAlignSelfStretch; - - ASStackLayoutSpec *mainVerticalStack = [ASStackLayoutSpec stackLayoutSpecWithDirection:ASStackLayoutDirectionVertical - spacing:0.0 - justifyContent:ASStackLayoutJustifyContentStart - alignItems:ASStackLayoutAlignItemsStart - children:@[ topBarSpecInsetSpec, spacer, controlbarInsetSpec ]]; - - - return mainVerticalStack; -}*/ - -@end diff --git a/submodules/AsyncDisplayKit/examples/ASDKTube/Sample/WindowWithStatusBarUnderlay.h b/submodules/AsyncDisplayKit/examples/ASDKTube/Sample/WindowWithStatusBarUnderlay.h deleted file mode 100644 index 025f3ba4fe..0000000000 --- a/submodules/AsyncDisplayKit/examples/ASDKTube/Sample/WindowWithStatusBarUnderlay.h +++ /dev/null @@ -1,14 +0,0 @@ -// -// WindowWithStatusBarUnderlay.h -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -@interface WindowWithStatusBarUnderlay : UIWindow - -@end diff --git a/submodules/AsyncDisplayKit/examples/ASDKTube/Sample/WindowWithStatusBarUnderlay.m b/submodules/AsyncDisplayKit/examples/ASDKTube/Sample/WindowWithStatusBarUnderlay.m deleted file mode 100644 index 944e5307b5..0000000000 --- a/submodules/AsyncDisplayKit/examples/ASDKTube/Sample/WindowWithStatusBarUnderlay.m +++ /dev/null @@ -1,40 +0,0 @@ -// -// WindowWithStatusBarUnderlay.m -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import "WindowWithStatusBarUnderlay.h" -#import "Utilities.h" - -@implementation WindowWithStatusBarUnderlay -{ - UIView *_statusBarOpaqueUnderlayView; -} - --(instancetype)initWithFrame:(CGRect)frame -{ - self = [super initWithFrame:frame]; - if (self) { - _statusBarOpaqueUnderlayView = [[UIView alloc] init]; - _statusBarOpaqueUnderlayView.backgroundColor = [UIColor lighOrangeColor]; - [self addSubview:_statusBarOpaqueUnderlayView]; - } - return self; -} - --(void)layoutSubviews -{ - [super layoutSubviews]; - - [self bringSubviewToFront:_statusBarOpaqueUnderlayView]; - - CGRect statusBarFrame = CGRectZero; - statusBarFrame.size.width = [[UIScreen mainScreen] bounds].size.width; - statusBarFrame.size.height = [[UIApplication sharedApplication] statusBarFrame].size.height; - _statusBarOpaqueUnderlayView.frame = statusBarFrame; -} -@end diff --git a/submodules/AsyncDisplayKit/examples/ASDKTube/Sample/main.m b/submodules/AsyncDisplayKit/examples/ASDKTube/Sample/main.m deleted file mode 100644 index 511cd1a7ac..0000000000 --- a/submodules/AsyncDisplayKit/examples/ASDKTube/Sample/main.m +++ /dev/null @@ -1,18 +0,0 @@ -// -// main.m -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -#import "AppDelegate.h" - -int main(int argc, char * argv[]) { - @autoreleasepool { - return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); - } -} diff --git a/submodules/AsyncDisplayKit/examples/ASDKgram/Default-568h@2x.png b/submodules/AsyncDisplayKit/examples/ASDKgram/Default-568h@2x.png deleted file mode 100644 index 6ee80b9393..0000000000 Binary files a/submodules/AsyncDisplayKit/examples/ASDKgram/Default-568h@2x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/examples/ASDKgram/Default-667h@2x.png b/submodules/AsyncDisplayKit/examples/ASDKgram/Default-667h@2x.png deleted file mode 100644 index e7b975e21b..0000000000 Binary files a/submodules/AsyncDisplayKit/examples/ASDKgram/Default-667h@2x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/examples/ASDKgram/Default-736h@3x.png b/submodules/AsyncDisplayKit/examples/ASDKgram/Default-736h@3x.png deleted file mode 100644 index c8949cae16..0000000000 Binary files a/submodules/AsyncDisplayKit/examples/ASDKgram/Default-736h@3x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/examples/ASDKgram/Podfile b/submodules/AsyncDisplayKit/examples/ASDKgram/Podfile deleted file mode 100644 index 8611fa11f2..0000000000 --- a/submodules/AsyncDisplayKit/examples/ASDKgram/Podfile +++ /dev/null @@ -1,9 +0,0 @@ -source 'https://github.com/CocoaPods/Specs.git' -platform :ios, '9.0' -target 'Sample' do - pod 'Texture/IGListKit', :path => '../..' - pod 'Texture/PINRemoteImage', :path => '../..' - pod 'Texture/Yoga', :path => '../..' - pod 'Texture/Video', :path => '../..' - pod 'Weaver', :git => 'git@github.com:TextureGroup/Weaver.git', :branch => 'master' -end diff --git a/submodules/AsyncDisplayKit/examples/ASDKgram/Sample.xcworkspace/contents.xcworkspacedata b/submodules/AsyncDisplayKit/examples/ASDKgram/Sample.xcworkspace/contents.xcworkspacedata deleted file mode 100644 index 7b5a2f3050..0000000000 --- a/submodules/AsyncDisplayKit/examples/ASDKgram/Sample.xcworkspace/contents.xcworkspacedata +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - diff --git a/submodules/AsyncDisplayKit/examples/ASDKgram/Sample.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/submodules/AsyncDisplayKit/examples/ASDKgram/Sample.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist deleted file mode 100644 index 18d981003d..0000000000 --- a/submodules/AsyncDisplayKit/examples/ASDKgram/Sample.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +++ /dev/null @@ -1,8 +0,0 @@ - - - - - IDEDidComputeMac32BitWarning - - - diff --git a/submodules/AsyncDisplayKit/examples/ASDKgram/Sample/ASCollectionSectionController.h b/submodules/AsyncDisplayKit/examples/ASDKgram/Sample/ASCollectionSectionController.h deleted file mode 100644 index 1a3a8443c9..0000000000 --- a/submodules/AsyncDisplayKit/examples/ASDKgram/Sample/ASCollectionSectionController.h +++ /dev/null @@ -1,28 +0,0 @@ -// -// ASCollectionSectionController.h -// Texture -// -// Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -NS_ASSUME_NONNULL_BEGIN - -@interface ASCollectionSectionController : IGListSectionController - -/** - * The items managed by this section controller. - */ -@property (nonatomic, strong, readonly) NSArray> *items; - -- (void)setItems:(NSArray> *)newItems - animated:(BOOL)animated - completion:(nullable void(^)())completion; - -- (NSInteger)numberOfItems; - -@end - -NS_ASSUME_NONNULL_END diff --git a/submodules/AsyncDisplayKit/examples/ASDKgram/Sample/ASCollectionSectionController.m b/submodules/AsyncDisplayKit/examples/ASDKgram/Sample/ASCollectionSectionController.m deleted file mode 100644 index c1ddb42d41..0000000000 --- a/submodules/AsyncDisplayKit/examples/ASDKgram/Sample/ASCollectionSectionController.m +++ /dev/null @@ -1,73 +0,0 @@ -// -// ASCollectionSectionController.m -// Texture -// -// Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import "ASCollectionSectionController.h" -#import - -@interface ASCollectionSectionController () -@property (nonatomic, strong, readonly) dispatch_queue_t diffingQueue; - -/// The items that have been diffed and are waiting to be submitted to the collection view. -/// Should always be accessed on the diffing queue, and should never be accessed -/// before the initial items are read (in -numberOfItems). -@property (nonatomic, copy) NSArray *pendingItems; - -@property (nonatomic) BOOL initialItemsRead; -@end - -@implementation ASCollectionSectionController -@synthesize diffingQueue = _diffingQueue; - -- (NSInteger)numberOfItems -{ - if (_initialItemsRead == NO) { - _pendingItems = self.items; - _initialItemsRead = YES; - } - return self.items.count; -} - -- (dispatch_queue_t)diffingQueue -{ - if (_diffingQueue == nil) { - _diffingQueue = dispatch_queue_create("ASCollectionSectionController.diffingQueue", DISPATCH_QUEUE_SERIAL); - } - return _diffingQueue; -} - -- (void)setItems:(NSArray *)newItems animated:(BOOL)animated completion:(void(^)())completion -{ - ASDisplayNodeAssertMainThread(); - newItems = [newItems copy]; - if (!self.initialItemsRead) { - _items = newItems; - if (completion) { - completion(); - } - return; - } - - dispatch_async(self.diffingQueue, ^{ - IGListIndexSetResult *result = IGListDiff(self.pendingItems, newItems, IGListDiffPointerPersonality); - self.pendingItems = newItems; - dispatch_async(dispatch_get_main_queue(), ^{ - id ctx = self.collectionContext; - [ctx performBatchAnimated:animated updates:^(id _Nonnull batchContext) { - [batchContext insertInSectionController:(id)self atIndexes:result.inserts]; - [batchContext deleteInSectionController:(id)self atIndexes:result.deletes]; - _items = newItems; - } completion:^(BOOL finished) { - if (completion) { - completion(); - } - }]; - }); - }); -} - -@end diff --git a/submodules/AsyncDisplayKit/examples/ASDKgram/Sample/AppDelegate.h b/submodules/AsyncDisplayKit/examples/ASDKgram/Sample/AppDelegate.h deleted file mode 100644 index 169cc651b5..0000000000 --- a/submodules/AsyncDisplayKit/examples/ASDKgram/Sample/AppDelegate.h +++ /dev/null @@ -1,13 +0,0 @@ -// -// AppDelegate.h -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -@interface AppDelegate : UIResponder - -@end - diff --git a/submodules/AsyncDisplayKit/examples/ASDKgram/Sample/AppDelegate.m b/submodules/AsyncDisplayKit/examples/ASDKgram/Sample/AppDelegate.m deleted file mode 100644 index 9058c8f100..0000000000 --- a/submodules/AsyncDisplayKit/examples/ASDKgram/Sample/AppDelegate.m +++ /dev/null @@ -1,101 +0,0 @@ -// -// AppDelegate.m -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import "AppDelegate.h" -#import "PhotoFeedViewController.h" -#import "PhotoFeedNodeController.h" -#import "PhotoFeedListKitViewController.h" -#import "WindowWithStatusBarUnderlay.h" -#import "Utilities.h" - -#import - -#define WEAVER 0 - -#if WEAVER -#import -#endif - -@interface AppDelegate () -@end - -@implementation AppDelegate -{ - WindowWithStatusBarUnderlay *_window; -} - -- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { - - // this UIWindow subclass is neccessary to make the status bar opaque - _window = [[WindowWithStatusBarUnderlay alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; - _window.backgroundColor = [UIColor whiteColor]; - - // ASDK Home Feed viewController & navController - PhotoFeedNodeController *asdkHomeFeedVC = [[PhotoFeedNodeController alloc] init]; - UINavigationController *asdkHomeFeedNavCtrl = [[UINavigationController alloc] initWithRootViewController:asdkHomeFeedVC]; - asdkHomeFeedNavCtrl.navigationBar.barStyle = UIBarStyleBlack; - asdkHomeFeedNavCtrl.tabBarItem = [[UITabBarItem alloc] initWithTitle:@"ASDK" image:[UIImage imageNamed:@"home"] tag:0]; - asdkHomeFeedNavCtrl.hidesBarsOnSwipe = YES; - - // ListKit Home Feed viewController & navController - PhotoFeedListKitViewController *listKitHomeFeedVC = [[PhotoFeedListKitViewController alloc] init]; - UINavigationController *listKitHomeFeedNavCtrl = [[UINavigationController alloc] initWithRootViewController:listKitHomeFeedVC]; - listKitHomeFeedNavCtrl.navigationBar.barStyle = UIBarStyleBlack; - listKitHomeFeedNavCtrl.tabBarItem = [[UITabBarItem alloc] initWithTitle:@"ListKit" image:[UIImage imageNamed:@"home"] tag:0]; - listKitHomeFeedNavCtrl.hidesBarsOnSwipe = YES; - - - - // UIKit Home Feed viewController & navController - PhotoFeedViewController *uikitHomeFeedVC = [[PhotoFeedViewController alloc] init]; - UINavigationController *uikitHomeFeedNavCtrl = [[UINavigationController alloc] initWithRootViewController:uikitHomeFeedVC]; - uikitHomeFeedNavCtrl.navigationBar.barStyle = UIBarStyleBlack; - uikitHomeFeedNavCtrl.tabBarItem = [[UITabBarItem alloc] initWithTitle:@"UIKit" image:[UIImage imageNamed:@"home"] tag:0]; - uikitHomeFeedNavCtrl.hidesBarsOnSwipe = YES; - - // UITabBarController - UITabBarController *tabBarController = [[UITabBarController alloc] init]; - tabBarController.viewControllers = @[uikitHomeFeedNavCtrl, asdkHomeFeedNavCtrl, listKitHomeFeedNavCtrl]; - tabBarController.selectedViewController = asdkHomeFeedNavCtrl; - tabBarController.delegate = self; - [[UITabBar appearance] setTintColor:[UIColor darkBlueColor]]; - - _window.rootViewController = tabBarController; - [_window makeKeyAndVisible]; - - // Nav Bar appearance - NSDictionary *attributes = @{NSForegroundColorAttributeName:[UIColor whiteColor]}; - [[UINavigationBar appearance] setTitleTextAttributes:attributes]; - [[UINavigationBar appearance] setBarTintColor:[UIColor darkBlueColor]]; - [[UINavigationBar appearance] setTranslucent:NO]; - -#if WEAVER - WVDebugger *debugger = [WVDebugger defaultInstance]; - [debugger enableLayoutElementDebuggingWithApplication:application]; - [debugger autoConnect]; -#endif - - return YES; -} - -#pragma mark - UITabBarControllerDelegate - -- (void)tabBarController:(UITabBarController *)tabBarController didSelectViewController:(UIViewController *)viewController -{ - if ([viewController isKindOfClass:[UINavigationController class]]) { - NSArray *viewControllers = [(UINavigationController *)viewController viewControllers]; - UIViewController *rootViewController = viewControllers[0]; - if ([rootViewController conformsToProtocol:@protocol(PhotoFeedControllerProtocol)]) { - // FIXME: the dataModel does not currently handle clearing data during loading properly -// [(id )rootViewController resetAllData]; - } - } -} - -@end diff --git a/submodules/AsyncDisplayKit/examples/ASDKgram/Sample/Assets.xcassets/AppIcon.appiconset/Contents.json b/submodules/AsyncDisplayKit/examples/ASDKgram/Sample/Assets.xcassets/AppIcon.appiconset/Contents.json deleted file mode 100644 index eeea76c2db..0000000000 --- a/submodules/AsyncDisplayKit/examples/ASDKgram/Sample/Assets.xcassets/AppIcon.appiconset/Contents.json +++ /dev/null @@ -1,73 +0,0 @@ -{ - "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" - } -} \ No newline at end of file diff --git a/submodules/AsyncDisplayKit/examples/ASDKgram/Sample/Assets.xcassets/Contents.json b/submodules/AsyncDisplayKit/examples/ASDKgram/Sample/Assets.xcassets/Contents.json deleted file mode 100644 index da4a164c91..0000000000 --- a/submodules/AsyncDisplayKit/examples/ASDKgram/Sample/Assets.xcassets/Contents.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "info" : { - "version" : 1, - "author" : "xcode" - } -} \ No newline at end of file diff --git a/submodules/AsyncDisplayKit/examples/ASDKgram/Sample/Assets.xcassets/Tab Bar Icons/Contents.json b/submodules/AsyncDisplayKit/examples/ASDKgram/Sample/Assets.xcassets/Tab Bar Icons/Contents.json deleted file mode 100644 index da4a164c91..0000000000 --- a/submodules/AsyncDisplayKit/examples/ASDKgram/Sample/Assets.xcassets/Tab Bar Icons/Contents.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "info" : { - "version" : 1, - "author" : "xcode" - } -} \ No newline at end of file diff --git a/submodules/AsyncDisplayKit/examples/ASDKgram/Sample/Assets.xcassets/Tab Bar Icons/camera.imageset/Contents.json b/submodules/AsyncDisplayKit/examples/ASDKgram/Sample/Assets.xcassets/Tab Bar Icons/camera.imageset/Contents.json deleted file mode 100644 index 07252697c8..0000000000 --- a/submodules/AsyncDisplayKit/examples/ASDKgram/Sample/Assets.xcassets/Tab Bar Icons/camera.imageset/Contents.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "images" : [ - { - "idiom" : "universal", - "filename" : "camera.png", - "scale" : "1x" - }, - { - "idiom" : "universal", - "filename" : "camera@2x.png", - "scale" : "2x" - }, - { - "idiom" : "universal", - "scale" : "3x" - } - ], - "info" : { - "version" : 1, - "author" : "xcode" - } -} \ No newline at end of file diff --git a/submodules/AsyncDisplayKit/examples/ASDKgram/Sample/Assets.xcassets/Tab Bar Icons/camera.imageset/camera.png b/submodules/AsyncDisplayKit/examples/ASDKgram/Sample/Assets.xcassets/Tab Bar Icons/camera.imageset/camera.png deleted file mode 100644 index 2eeecba825..0000000000 Binary files a/submodules/AsyncDisplayKit/examples/ASDKgram/Sample/Assets.xcassets/Tab Bar Icons/camera.imageset/camera.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/examples/ASDKgram/Sample/Assets.xcassets/Tab Bar Icons/camera.imageset/camera@2x.png b/submodules/AsyncDisplayKit/examples/ASDKgram/Sample/Assets.xcassets/Tab Bar Icons/camera.imageset/camera@2x.png deleted file mode 100644 index c1ea4ab857..0000000000 Binary files a/submodules/AsyncDisplayKit/examples/ASDKgram/Sample/Assets.xcassets/Tab Bar Icons/camera.imageset/camera@2x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/examples/ASDKgram/Sample/Assets.xcassets/Tab Bar Icons/crosshairs.imageset/Contents.json b/submodules/AsyncDisplayKit/examples/ASDKgram/Sample/Assets.xcassets/Tab Bar Icons/crosshairs.imageset/Contents.json deleted file mode 100644 index 66e65dc03e..0000000000 --- a/submodules/AsyncDisplayKit/examples/ASDKgram/Sample/Assets.xcassets/Tab Bar Icons/crosshairs.imageset/Contents.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "images" : [ - { - "idiom" : "universal", - "filename" : "crosshair.png", - "scale" : "1x" - }, - { - "idiom" : "universal", - "scale" : "2x" - }, - { - "idiom" : "universal", - "scale" : "3x" - } - ], - "info" : { - "version" : 1, - "author" : "xcode" - } -} \ No newline at end of file diff --git a/submodules/AsyncDisplayKit/examples/ASDKgram/Sample/Assets.xcassets/Tab Bar Icons/crosshairs.imageset/crosshair.png b/submodules/AsyncDisplayKit/examples/ASDKgram/Sample/Assets.xcassets/Tab Bar Icons/crosshairs.imageset/crosshair.png deleted file mode 100644 index ea3c5e27ba..0000000000 Binary files a/submodules/AsyncDisplayKit/examples/ASDKgram/Sample/Assets.xcassets/Tab Bar Icons/crosshairs.imageset/crosshair.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/examples/ASDKgram/Sample/Assets.xcassets/Tab Bar Icons/earth.imageset/Contents.json b/submodules/AsyncDisplayKit/examples/ASDKgram/Sample/Assets.xcassets/Tab Bar Icons/earth.imageset/Contents.json deleted file mode 100644 index 37e4afe0e2..0000000000 --- a/submodules/AsyncDisplayKit/examples/ASDKgram/Sample/Assets.xcassets/Tab Bar Icons/earth.imageset/Contents.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "images" : [ - { - "idiom" : "universal", - "filename" : "earth.png", - "scale" : "1x" - }, - { - "idiom" : "universal", - "filename" : "earth@2x.png", - "scale" : "2x" - }, - { - "idiom" : "universal", - "scale" : "3x" - } - ], - "info" : { - "version" : 1, - "author" : "xcode" - } -} \ No newline at end of file diff --git a/submodules/AsyncDisplayKit/examples/ASDKgram/Sample/Assets.xcassets/Tab Bar Icons/earth.imageset/earth.png b/submodules/AsyncDisplayKit/examples/ASDKgram/Sample/Assets.xcassets/Tab Bar Icons/earth.imageset/earth.png deleted file mode 100644 index c182ea5565..0000000000 Binary files a/submodules/AsyncDisplayKit/examples/ASDKgram/Sample/Assets.xcassets/Tab Bar Icons/earth.imageset/earth.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/examples/ASDKgram/Sample/Assets.xcassets/Tab Bar Icons/earth.imageset/earth@2x.png b/submodules/AsyncDisplayKit/examples/ASDKgram/Sample/Assets.xcassets/Tab Bar Icons/earth.imageset/earth@2x.png deleted file mode 100644 index b8049a5004..0000000000 Binary files a/submodules/AsyncDisplayKit/examples/ASDKgram/Sample/Assets.xcassets/Tab Bar Icons/earth.imageset/earth@2x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/examples/ASDKgram/Sample/Assets.xcassets/Tab Bar Icons/home.imageset/Contents.json b/submodules/AsyncDisplayKit/examples/ASDKgram/Sample/Assets.xcassets/Tab Bar Icons/home.imageset/Contents.json deleted file mode 100644 index ce48b1b641..0000000000 --- a/submodules/AsyncDisplayKit/examples/ASDKgram/Sample/Assets.xcassets/Tab Bar Icons/home.imageset/Contents.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "images" : [ - { - "idiom" : "universal", - "filename" : "home.png", - "scale" : "1x" - }, - { - "idiom" : "universal", - "filename" : "home@2x.png", - "scale" : "2x" - }, - { - "idiom" : "universal", - "scale" : "3x" - } - ], - "info" : { - "version" : 1, - "author" : "xcode" - } -} \ No newline at end of file diff --git a/submodules/AsyncDisplayKit/examples/ASDKgram/Sample/Assets.xcassets/Tab Bar Icons/home.imageset/home.png b/submodules/AsyncDisplayKit/examples/ASDKgram/Sample/Assets.xcassets/Tab Bar Icons/home.imageset/home.png deleted file mode 100644 index b88cd66a4b..0000000000 Binary files a/submodules/AsyncDisplayKit/examples/ASDKgram/Sample/Assets.xcassets/Tab Bar Icons/home.imageset/home.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/examples/ASDKgram/Sample/Assets.xcassets/Tab Bar Icons/home.imageset/home@2x.png b/submodules/AsyncDisplayKit/examples/ASDKgram/Sample/Assets.xcassets/Tab Bar Icons/home.imageset/home@2x.png deleted file mode 100644 index 838e660097..0000000000 Binary files a/submodules/AsyncDisplayKit/examples/ASDKgram/Sample/Assets.xcassets/Tab Bar Icons/home.imageset/home@2x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/examples/ASDKgram/Sample/Assets.xcassets/Tab Bar Icons/profile.imageset/Contents.json b/submodules/AsyncDisplayKit/examples/ASDKgram/Sample/Assets.xcassets/Tab Bar Icons/profile.imageset/Contents.json deleted file mode 100644 index ecb5bbebcf..0000000000 --- a/submodules/AsyncDisplayKit/examples/ASDKgram/Sample/Assets.xcassets/Tab Bar Icons/profile.imageset/Contents.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "images" : [ - { - "idiom" : "universal", - "filename" : "profile.png", - "scale" : "1x" - }, - { - "idiom" : "universal", - "filename" : "profile@2x.png", - "scale" : "2x" - }, - { - "idiom" : "universal", - "scale" : "3x" - } - ], - "info" : { - "version" : 1, - "author" : "xcode" - } -} \ No newline at end of file diff --git a/submodules/AsyncDisplayKit/examples/ASDKgram/Sample/Assets.xcassets/Tab Bar Icons/profile.imageset/profile.png b/submodules/AsyncDisplayKit/examples/ASDKgram/Sample/Assets.xcassets/Tab Bar Icons/profile.imageset/profile.png deleted file mode 100644 index d885b3aedf..0000000000 Binary files a/submodules/AsyncDisplayKit/examples/ASDKgram/Sample/Assets.xcassets/Tab Bar Icons/profile.imageset/profile.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/examples/ASDKgram/Sample/Assets.xcassets/Tab Bar Icons/profile.imageset/profile@2x.png b/submodules/AsyncDisplayKit/examples/ASDKgram/Sample/Assets.xcassets/Tab Bar Icons/profile.imageset/profile@2x.png deleted file mode 100644 index 81352fe0cb..0000000000 Binary files a/submodules/AsyncDisplayKit/examples/ASDKgram/Sample/Assets.xcassets/Tab Bar Icons/profile.imageset/profile@2x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/examples/ASDKgram/Sample/Availability.h b/submodules/AsyncDisplayKit/examples/ASDKgram/Sample/Availability.h deleted file mode 100644 index 27c8f82ceb..0000000000 --- a/submodules/AsyncDisplayKit/examples/ASDKgram/Sample/Availability.h +++ /dev/null @@ -1,18 +0,0 @@ -// -// Availability.h -// Texture -// -// Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -/** - * Enable Yoga layout engine in Texture cells - */ -#define YOGA_LAYOUT 0 - -/** - * There are many ways to format ASLayoutSpec code. In this example, we offer two different formats: - * A flatter, more ordinary Objective-C style; or a more structured, "visually" declarative style. - */ -#define FLAT_LAYOUT 0 diff --git a/submodules/AsyncDisplayKit/examples/ASDKgram/Sample/Base.lproj/LaunchScreen.storyboard b/submodules/AsyncDisplayKit/examples/ASDKgram/Sample/Base.lproj/LaunchScreen.storyboard deleted file mode 100644 index 8326657f7a..0000000000 --- a/submodules/AsyncDisplayKit/examples/ASDKgram/Sample/Base.lproj/LaunchScreen.storyboard +++ /dev/null @@ -1,27 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/submodules/AsyncDisplayKit/examples/ASDKgram/Sample/FeedHeaderNode.h b/submodules/AsyncDisplayKit/examples/ASDKgram/Sample/FeedHeaderNode.h deleted file mode 100644 index 13e6b16d6f..0000000000 --- a/submodules/AsyncDisplayKit/examples/ASDKgram/Sample/FeedHeaderNode.h +++ /dev/null @@ -1,13 +0,0 @@ -// -// FeedHeaderNode.h -// Texture -// -// Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -@interface FeedHeaderNode : ASCellNode - -@end diff --git a/submodules/AsyncDisplayKit/examples/ASDKgram/Sample/FeedHeaderNode.m b/submodules/AsyncDisplayKit/examples/ASDKgram/Sample/FeedHeaderNode.m deleted file mode 100644 index f6d922c27c..0000000000 --- a/submodules/AsyncDisplayKit/examples/ASDKgram/Sample/FeedHeaderNode.m +++ /dev/null @@ -1,55 +0,0 @@ -// -// FeedHeaderNode.m -// Texture -// -// Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import "FeedHeaderNode.h" - -#import "Availability.h" -#import "Utilities.h" - -#define YOGA_LAYOUT 0 - -static UIEdgeInsets kFeedHeaderInset = { .top = 20, .bottom = 20, .left = 10, .right = 10 }; - -@interface FeedHeaderNode () -@property (nonatomic, strong, readonly) ASTextNode *textNode; -@end - -@implementation FeedHeaderNode - -- (instancetype)init -{ - if (self = [super init]) { - self.automaticallyManagesSubnodes = YES; - - _textNode = [[ASTextNode alloc] init]; - _textNode.attributedText = [NSAttributedString attributedStringWithString:@"Latest Posts" fontSize:18 color:[UIColor darkGrayColor] firstWordColor:nil]; - - [self setupYogaLayoutIfNeeded]; - } - return self; -} - -#if !YOGA_LAYOUT -- (ASLayoutSpec *)layoutSpecThatFits:(ASSizeRange)constrainedSize -{ - return [ASInsetLayoutSpec insetLayoutSpecWithInsets:kFeedHeaderInset child:_textNode]; -} -#endif - -- (void)setupYogaLayoutIfNeeded -{ -#if YOGA_LAYOUT - [self.style yogaNodeCreateIfNeeded]; - [self.textNode.style yogaNodeCreateIfNeeded]; - [self addYogaChild:self.textNode]; - - self.style.padding = ASEdgeInsetsMake(kFeedHeaderInset); -#endif -} - -@end diff --git a/submodules/AsyncDisplayKit/examples/ASDKgram/Sample/ImageURLModel.h b/submodules/AsyncDisplayKit/examples/ASDKgram/Sample/ImageURLModel.h deleted file mode 100644 index 16828a2dac..0000000000 --- a/submodules/AsyncDisplayKit/examples/ASDKgram/Sample/ImageURLModel.h +++ /dev/null @@ -1,14 +0,0 @@ -// -// ImageURLModel.h -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -@interface ImageURLModel : NSObject - -+ (NSString *)imageParameterForClosestImageSize:(CGSize)size; - -@end diff --git a/submodules/AsyncDisplayKit/examples/ASDKgram/Sample/ImageURLModel.m b/submodules/AsyncDisplayKit/examples/ASDKgram/Sample/ImageURLModel.m deleted file mode 100644 index 671027db5e..0000000000 --- a/submodules/AsyncDisplayKit/examples/ASDKgram/Sample/ImageURLModel.m +++ /dev/null @@ -1,50 +0,0 @@ -// -// ImageURLModel.m -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import "ImageURLModel.h" - -@implementation ImageURLModel - -+ (NSString *)imageParameterForClosestImageSize:(CGSize)size -{ - BOOL squareImageRequested = (size.width == size.height) ? YES : NO; - - if (squareImageRequested) { - NSUInteger imageParameterID = [self imageParameterForSquareCroppedSize:size]; - return [NSString stringWithFormat:@"&image_size=%lu", (long)imageParameterID]; - } else { - return @""; - } -} - -// 500px standard cropped image sizes -+ (NSUInteger)imageParameterForSquareCroppedSize:(CGSize)size -{ - NSUInteger imageParameterID; - - if (size.height <= 70) { - imageParameterID = 1; - } else if (size.height <= 100) { - imageParameterID = 100; - } else if (size.height <= 140) { - imageParameterID = 2; - } else if (size.height <= 200) { - imageParameterID = 200; - } else if (size.height <= 280) { - imageParameterID = 3; - } else if (size.height <= 400) { - imageParameterID = 400; - } else { - imageParameterID = 600; - } - - return imageParameterID; -} - -@end diff --git a/submodules/AsyncDisplayKit/examples/ASDKgram/Sample/Info.plist b/submodules/AsyncDisplayKit/examples/ASDKgram/Sample/Info.plist deleted file mode 100644 index 7641b2f1a3..0000000000 --- a/submodules/AsyncDisplayKit/examples/ASDKgram/Sample/Info.plist +++ /dev/null @@ -1,49 +0,0 @@ - - - - - CFBundleDevelopmentRegion - en - CFBundleExecutable - $(EXECUTABLE_NAME) - CFBundleIdentifier - $(PRODUCT_BUNDLE_IDENTIFIER) - CFBundleInfoDictionaryVersion - 6.0 - CFBundleName - $(PRODUCT_NAME) - CFBundlePackageType - APPL - CFBundleShortVersionString - 1.0 - CFBundleSignature - ???? - CFBundleVersion - 1 - LSRequiresIPhoneOS - - NSLocationWhenInUseUsageDescription - - UILaunchStoryboardName - LaunchScreen - UIRequiredDeviceCapabilities - - armv7 - - UISupportedInterfaceOrientations - - UIInterfaceOrientationPortrait - UIInterfaceOrientationLandscapeLeft - UIInterfaceOrientationLandscapeRight - - UISupportedInterfaceOrientations~ipad - - UIInterfaceOrientationPortrait - UIInterfaceOrientationPortraitUpsideDown - UIInterfaceOrientationLandscapeLeft - UIInterfaceOrientationLandscapeRight - - UIViewControllerBasedStatusBarAppearance - - - diff --git a/submodules/AsyncDisplayKit/examples/ASDKgram/Sample/PhotoCellNode.h b/submodules/AsyncDisplayKit/examples/ASDKgram/Sample/PhotoCellNode.h deleted file mode 100644 index 7724970252..0000000000 --- a/submodules/AsyncDisplayKit/examples/ASDKgram/Sample/PhotoCellNode.h +++ /dev/null @@ -1,19 +0,0 @@ -// -// PhotoCellNode.h -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import "PhotoModel.h" -#import -#import "PhotoTableViewCell.h" // PhotoTableViewCellProtocol - - -@interface PhotoCellNode : ASCellNode - -- (instancetype)initWithPhotoObject:(PhotoModel *)photo; - -@end diff --git a/submodules/AsyncDisplayKit/examples/ASDKgram/Sample/PhotoCellNode.m b/submodules/AsyncDisplayKit/examples/ASDKgram/Sample/PhotoCellNode.m deleted file mode 100644 index eef2bb06be..0000000000 --- a/submodules/AsyncDisplayKit/examples/ASDKgram/Sample/PhotoCellNode.m +++ /dev/null @@ -1,341 +0,0 @@ -// -// PhotoCellNode.m -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import "PhotoCellNode.h" - -#import -#import - -#import "Availability.h" -#import "PINImageView+PINRemoteImage.h" -#import "PINButton+PINRemoteImage.h" -#import "Utilities.h" - -#define DEBUG_PHOTOCELL_LAYOUT 0 - -#define HEADER_HEIGHT 50 -#define USER_IMAGE_HEIGHT 30 -#define HORIZONTAL_BUFFER 10 -#define VERTICAL_BUFFER 5 -#define FONT_SIZE 14 - -#define InsetForAvatar UIEdgeInsetsMake(HORIZONTAL_BUFFER, 0, HORIZONTAL_BUFFER, HORIZONTAL_BUFFER) -#define InsetForHeader UIEdgeInsetsMake(0, HORIZONTAL_BUFFER, 0, HORIZONTAL_BUFFER) -#define InsetForFooter UIEdgeInsetsMake(VERTICAL_BUFFER, HORIZONTAL_BUFFER, VERTICAL_BUFFER, HORIZONTAL_BUFFER) - -@interface PhotoCellNode () -@end - -@implementation PhotoCellNode -{ - PhotoModel *_photoModel; - ASNetworkImageNode *_userAvatarImageNode; - ASNetworkImageNode *_photoImageNode; - ASTextNode *_userNameLabel; - ASTextNode *_photoLocationLabel; - ASTextNode *_photoTimeIntervalSincePostLabel; - ASTextNode *_photoLikesLabel; - ASTextNode *_photoDescriptionLabel; -} - -#pragma mark - Lifecycle - -- (instancetype)initWithPhotoObject:(PhotoModel *)photo; -{ - self = [super init]; - - if (self) { - - _photoModel = photo; - - _userAvatarImageNode = [[ASNetworkImageNode alloc] init]; - _userAvatarImageNode.URL = photo.ownerUserProfile.userPicURL; // FIXME: make round - - // FIXME: autocomplete for this line seems broken - [_userAvatarImageNode setImageModificationBlock:^UIImage *(UIImage *image) { - CGSize profileImageSize = CGSizeMake(USER_IMAGE_HEIGHT, USER_IMAGE_HEIGHT); - return [image makeCircularImageWithSize:profileImageSize]; - }]; - - _photoImageNode = [[ASNetworkImageNode alloc] init]; - _photoImageNode.delegate = self; - _photoImageNode.URL = photo.URL; - _photoImageNode.layerBacked = YES; - - _userNameLabel = [[ASTextNode alloc] init]; - _userNameLabel.attributedText = [photo.ownerUserProfile usernameAttributedStringWithFontSize:FONT_SIZE]; - - _photoLocationLabel = [[ASTextNode alloc] init]; - _photoLocationLabel.maximumNumberOfLines = 1; - _photoLocationLabel.attributedText = [photo locationAttributedStringWithFontSize:FONT_SIZE]; - - _photoTimeIntervalSincePostLabel = [self createLayerBackedTextNodeWithString:[photo uploadDateAttributedStringWithFontSize:FONT_SIZE]]; - _photoLikesLabel = [self createLayerBackedTextNodeWithString:[photo likesAttributedStringWithFontSize:FONT_SIZE]]; - _photoDescriptionLabel = [self createLayerBackedTextNodeWithString:[photo descriptionAttributedStringWithFontSize:FONT_SIZE]]; - _photoDescriptionLabel.maximumNumberOfLines = 3; - - // instead of adding everything addSubnode: - self.automaticallyManagesSubnodes = YES; - - [self setupYogaLayoutIfNeeded]; - -#if DEBUG_PHOTOCELL_LAYOUT - _userAvatarImageNode.backgroundColor = [UIColor greenColor]; - _userNameLabel.backgroundColor = [UIColor greenColor]; - _photoLocationLabel.backgroundColor = [UIColor greenColor]; - _photoTimeIntervalSincePostLabel.backgroundColor = [UIColor greenColor]; - _photoCommentsNode.backgroundColor = [UIColor greenColor]; - _photoDescriptionLabel.backgroundColor = [UIColor greenColor]; - _photoLikesLabel.backgroundColor = [UIColor greenColor]; -#endif - } - - return self; -} - -#if !YOGA_LAYOUT -- (ASLayoutSpec *)layoutSpecThatFits:(ASSizeRange)constrainedSize -{ - // There are many ways to format ASLayoutSpec code. In this example, we offer two different formats: - // A flatter, more ordinary Objective-C style; or a more structured, "visually" declarative style. - if (FLAT_LAYOUT) { - // This layout has a horizontal stack of header items at the top, set within a vertical stack of items. - NSMutableArray *headerChildren = [NSMutableArray array]; - NSMutableArray *verticalChildren = [NSMutableArray array]; - - // Header stack - ASStackLayoutSpec *headerStack = [ASStackLayoutSpec horizontalStackLayoutSpec]; - headerStack.alignItems = ASStackLayoutAlignItemsCenter; - - // Avatar Image, with inset - first thing in the header stack. - _userAvatarImageNode.style.preferredSize = CGSizeMake(USER_IMAGE_HEIGHT, USER_IMAGE_HEIGHT); - [headerChildren addObject:[ASInsetLayoutSpec insetLayoutSpecWithInsets:InsetForAvatar child:_userAvatarImageNode]]; - - // User Name and Photo Location stack is next - ASStackLayoutSpec *userPhotoLocationStack = [ASStackLayoutSpec verticalStackLayoutSpec]; - userPhotoLocationStack.style.flexShrink = 1.0; - [headerChildren addObject:userPhotoLocationStack]; - - // Setup the inside of the User Name and Photo Location stack. - _userNameLabel.style.flexShrink = 1.0; - [userPhotoLocationStack setChildren:@[_userNameLabel]]; - - if (_photoLocationLabel.attributedText) { - _photoLocationLabel.style.flexShrink = 1.0; - [userPhotoLocationStack setChildren:[userPhotoLocationStack.children arrayByAddingObject:_photoLocationLabel]]; - } - - // Add a spacer to allow a flexible space between the User Name / Location stack, and the Timestamp. - ASLayoutSpec *spacer = [ASLayoutSpec new]; - spacer.style.flexGrow = 1.0; - [headerChildren addObject:spacer]; - - // Photo Timestamp Label. - _photoTimeIntervalSincePostLabel.style.spacingBefore = HORIZONTAL_BUFFER; - [headerChildren addObject:_photoTimeIntervalSincePostLabel]; - - // Add all of the above items to the horizontal header stack - headerStack.children = headerChildren; - - // Create the last stack before assembling everything: the Footer Stack contains the description and comments. - ASStackLayoutSpec *footerStack = [ASStackLayoutSpec verticalStackLayoutSpec]; - footerStack.spacing = VERTICAL_BUFFER; - footerStack.children = @[_photoLikesLabel, _photoDescriptionLabel]; - - // Main Vertical Stack: contains header, large main photo with fixed aspect ratio, and footer. - ASStackLayoutSpec *verticalStack = [ASStackLayoutSpec verticalStackLayoutSpec]; - - [verticalChildren addObject:[ASInsetLayoutSpec insetLayoutSpecWithInsets:InsetForHeader child:headerStack]]; - [verticalChildren addObject:[ASRatioLayoutSpec ratioLayoutSpecWithRatio :1.0 child:_photoImageNode]]; - [verticalChildren addObject:[ASInsetLayoutSpec insetLayoutSpecWithInsets:InsetForFooter child:footerStack]]; - - verticalStack.children = verticalChildren; - - return verticalStack; - - } else { // The style below is the more structured, visual, and declarative style. It is functionally identical. - - return - // Main stack - [ASStackLayoutSpec - stackLayoutSpecWithDirection:ASStackLayoutDirectionVertical - spacing:0 - justifyContent:ASStackLayoutJustifyContentStart - alignItems:ASStackLayoutAlignItemsStretch - children:@[ - - // Header stack with inset - [ASInsetLayoutSpec - insetLayoutSpecWithInsets:InsetForHeader - child: - // Header stack - [ASStackLayoutSpec - stackLayoutSpecWithDirection:ASStackLayoutDirectionHorizontal - spacing:0.0 - justifyContent:ASStackLayoutJustifyContentStart - alignItems:ASStackLayoutAlignItemsCenter - children:@[ - // Avatar image with inset - [ASInsetLayoutSpec - insetLayoutSpecWithInsets:InsetForAvatar - child: - [_userAvatarImageNode styledWithBlock:^(ASLayoutElementStyle *style) { - style.preferredSize = CGSizeMake(USER_IMAGE_HEIGHT, USER_IMAGE_HEIGHT); - }] - ], - // User and photo location stack - [[ASStackLayoutSpec - stackLayoutSpecWithDirection:ASStackLayoutDirectionVertical - spacing:0.0 - justifyContent:ASStackLayoutJustifyContentStart - alignItems:ASStackLayoutAlignItemsStretch - children:_photoLocationLabel.attributedText ? @[ - [_userNameLabel styledWithBlock:^(ASLayoutElementStyle *style) { - style.flexShrink = 1.0; - }], - [_photoLocationLabel styledWithBlock:^(ASLayoutElementStyle *style) { - style.flexShrink = 1.0; - }] - ] : - @[ - [_userNameLabel styledWithBlock:^(ASLayoutElementStyle *style) { - style.flexShrink = 1.0; - }] - ]] - styledWithBlock:^(ASLayoutElementStyle *style) { - style.flexShrink = 1.0; - }], - // Spacer between user / photo location and photo time inverval - [[ASLayoutSpec new] styledWithBlock:^(ASLayoutElementStyle *style) { - style.flexGrow = 1.0; - }], - // Photo and time interval node - [_photoTimeIntervalSincePostLabel styledWithBlock:^(ASLayoutElementStyle *style) { - // to remove double spaces around spacer - style.spacingBefore = HORIZONTAL_BUFFER; - }] - ]] - ], - - // Center photo with ratio - [ASRatioLayoutSpec - ratioLayoutSpecWithRatio:1.0 - child:_photoImageNode], - - // Footer stack with inset - [ASInsetLayoutSpec - insetLayoutSpecWithInsets:InsetForFooter - child: - [ASStackLayoutSpec - stackLayoutSpecWithDirection:ASStackLayoutDirectionVertical - spacing:VERTICAL_BUFFER - justifyContent:ASStackLayoutJustifyContentStart - alignItems:ASStackLayoutAlignItemsStretch - children:@[ - _photoLikesLabel, - _photoDescriptionLabel - ]] - ] - ]]; - } -} -#endif - -#pragma mark - Instance Methods - -- (void)didEnterPreloadState -{ - [super didEnterPreloadState]; -} - -#pragma mark - Network Image Delegate - -- (void)imageNode:(ASNetworkImageNode *)imageNode didLoadImage:(UIImage *)image info:(ASNetworkImageLoadInfo *)info -{ - // Docs say method is called from bg but right now it's called from main. - // Save main thread time by shunting this. - if (info.sourceType == ASNetworkImageSourceDownload) { - ASPerformBlockOnBackgroundThread(^{ - NSLog(@"Received image %@ from %@ with userInfo %@", image, info.url.path, ASObjectDescriptionMakeTiny(info.userInfo)); - }); - } -} - -#pragma mark - Helper Methods - -- (ASTextNode *)createLayerBackedTextNodeWithString:(NSAttributedString *)attributedString -{ - ASTextNode *textNode = [[ASTextNode alloc] init]; - textNode.layerBacked = YES; - textNode.attributedText = attributedString; - return textNode; -} - -- (void)setupYogaLayoutIfNeeded -{ -#if YOGA_LAYOUT - [self.style yogaNodeCreateIfNeeded]; - [_userAvatarImageNode.style yogaNodeCreateIfNeeded]; - [_userNameLabel.style yogaNodeCreateIfNeeded]; - [_photoImageNode.style yogaNodeCreateIfNeeded]; - [_photoLikesLabel.style yogaNodeCreateIfNeeded]; - [_photoDescriptionLabel.style yogaNodeCreateIfNeeded]; - [_photoLocationLabel.style yogaNodeCreateIfNeeded]; - [_photoTimeIntervalSincePostLabel.style yogaNodeCreateIfNeeded]; - - ASDisplayNode *headerStack = [ASDisplayNode yogaHorizontalStack]; - headerStack.style.margin = ASEdgeInsetsMake(InsetForHeader); - headerStack.style.alignItems = ASStackLayoutAlignItemsCenter; - headerStack.style.flexGrow = 1.0; - - // Avatar Image, with inset - first thing in the header stack. - _userAvatarImageNode.style.preferredSize = CGSizeMake(USER_IMAGE_HEIGHT, USER_IMAGE_HEIGHT); - _userAvatarImageNode.style.margin = ASEdgeInsetsMake(InsetForAvatar); - [headerStack addYogaChild:_userAvatarImageNode]; - - // User Name and Photo Location stack is next - ASDisplayNode *userPhotoLocationStack = [ASDisplayNode yogaVerticalStack]; - userPhotoLocationStack.style.flexShrink = 1.0; - [headerStack addYogaChild:userPhotoLocationStack]; - - // Setup the inside of the User Name and Photo Location stack. - _userNameLabel.style.flexShrink = 1.0; - [userPhotoLocationStack addYogaChild:_userNameLabel]; - - if (_photoLocationLabel.attributedText) { - _photoLocationLabel.style.flexShrink = 1.0; - [userPhotoLocationStack addYogaChild:_photoLocationLabel]; - } - - // Add a spacer to allow a flexible space between the User Name / Location stack, and the Timestamp. - [headerStack addYogaChild:[ASDisplayNode yogaSpacerNode]]; - - // Photo Timestamp Label. - _photoTimeIntervalSincePostLabel.style.spacingBefore = HORIZONTAL_BUFFER; - [headerStack addYogaChild:_photoTimeIntervalSincePostLabel]; - - // Create the last stack before assembling everything: the Footer Stack contains the description and comments. - ASDisplayNode *footerStack = [ASDisplayNode yogaVerticalStack]; - footerStack.style.margin = ASEdgeInsetsMake(InsetForFooter); - footerStack.style.padding = ASEdgeInsetsMake(UIEdgeInsetsMake(0.0, 0.0, VERTICAL_BUFFER, 0.0)); - footerStack.yogaChildren = @[_photoLikesLabel, _photoDescriptionLabel]; - - // Main Vertical Stack: contains header, large main photo with fixed aspect ratio, and footer. - _photoImageNode.style.aspectRatio = 1.0; - - ASDisplayNode *verticalStack = self; - self.style.flexDirection = ASStackLayoutDirectionVertical; - - [verticalStack addYogaChild:headerStack]; - [verticalStack addYogaChild:_photoImageNode]; - [verticalStack addYogaChild:footerStack]; -#endif -} - -@end diff --git a/submodules/AsyncDisplayKit/examples/ASDKgram/Sample/PhotoCollectionViewCell.h b/submodules/AsyncDisplayKit/examples/ASDKgram/Sample/PhotoCollectionViewCell.h deleted file mode 100644 index d277b5a571..0000000000 --- a/submodules/AsyncDisplayKit/examples/ASDKgram/Sample/PhotoCollectionViewCell.h +++ /dev/null @@ -1,16 +0,0 @@ -// -// PhotoCollectionViewCell.h -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import "PhotoModel.h" - -@interface PhotoCollectionViewCell : UICollectionViewCell - -- (void)updateCellWithPhotoObject:(PhotoModel *)photo; - -@end diff --git a/submodules/AsyncDisplayKit/examples/ASDKgram/Sample/PhotoCollectionViewCell.m b/submodules/AsyncDisplayKit/examples/ASDKgram/Sample/PhotoCollectionViewCell.m deleted file mode 100644 index d04fe1ca5d..0000000000 --- a/submodules/AsyncDisplayKit/examples/ASDKgram/Sample/PhotoCollectionViewCell.m +++ /dev/null @@ -1,58 +0,0 @@ -// -// PhotoCollectionViewCell.m -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import "PhotoCollectionViewCell.h" -#import "PINImageView+PINRemoteImage.h" -#import "PINButton+PINRemoteImage.h" - -@implementation PhotoCollectionViewCell -{ - UIImageView *_photoImageView; -} - -#pragma mark - Lifecycle - -- (instancetype)initWithFrame:(CGRect)frame -{ - self = [super initWithFrame:frame]; - - if (self) { - - _photoImageView = [[UIImageView alloc] init]; - [_photoImageView setPin_updateWithProgress:YES]; - [self.contentView addSubview:_photoImageView]; - } - - return self; -} - -- (void)layoutSubviews -{ - [super layoutSubviews]; - - _photoImageView.frame = self.bounds; -} - -- (void)prepareForReuse -{ - [super prepareForReuse]; - - // remove images so that the old content doesn't appear before the new content is loaded - _photoImageView.image = nil; -} - -#pragma mark - Instance Methods - -- (void)updateCellWithPhotoObject:(PhotoModel *)photo -{ - // async download of photo using PINRemoteImage - [_photoImageView pin_setImageFromURL:photo.URL]; -} - -@end diff --git a/submodules/AsyncDisplayKit/examples/ASDKgram/Sample/PhotoFeedBaseController.h b/submodules/AsyncDisplayKit/examples/ASDKgram/Sample/PhotoFeedBaseController.h deleted file mode 100644 index b40a5946c8..0000000000 --- a/submodules/AsyncDisplayKit/examples/ASDKgram/Sample/PhotoFeedBaseController.h +++ /dev/null @@ -1,28 +0,0 @@ -// -// PhotoFeedBaseController.h -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import -#import "PhotoFeedControllerProtocol.h" - -@protocol PhotoFeedControllerProtocol; -@class PhotoFeedModel; - -@interface PhotoFeedBaseController : ASViewController - -@property (nonatomic, strong, readonly) PhotoFeedModel *photoFeed; -@property (nonatomic, strong, readonly) UITableView *tableView; - -- (void)refreshFeed; -- (void)insertNewRows:(NSArray *)newPhotos; - -#pragma mark - Subclasses must override these methods - -- (void)loadPage; - -@end diff --git a/submodules/AsyncDisplayKit/examples/ASDKgram/Sample/PhotoFeedBaseController.m b/submodules/AsyncDisplayKit/examples/ASDKgram/Sample/PhotoFeedBaseController.m deleted file mode 100644 index d94a34e922..0000000000 --- a/submodules/AsyncDisplayKit/examples/ASDKgram/Sample/PhotoFeedBaseController.m +++ /dev/null @@ -1,112 +0,0 @@ -// -// PhotoFeedBaseController.m -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import "PhotoFeedBaseController.h" -#import "PhotoFeedModel.h" - -@implementation PhotoFeedBaseController -{ - UIActivityIndicatorView *_activityIndicatorView; -} - -// -loadView is guaranteed to be called on the main thread and is the appropriate place to -// set up an UIKit objects you may be using. -- (void)loadView -{ - [super loadView]; - - _activityIndicatorView = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleGray]; - - _photoFeed = [[PhotoFeedModel alloc] initWithPhotoFeedModelType:PhotoFeedModelTypePopular imageSize:[self imageSizeForScreenWidth]]; - [self refreshFeed]; - - CGSize boundSize = self.view.bounds.size; - [_activityIndicatorView sizeToFit]; - CGRect refreshRect = _activityIndicatorView.frame; - refreshRect.origin = CGPointMake((boundSize.width - _activityIndicatorView.frame.size.width) / 2.0, - (boundSize.height - _activityIndicatorView.frame.size.height) / 2.0); - _activityIndicatorView.frame = refreshRect; - [self.view addSubview:_activityIndicatorView]; - - self.tableView.allowsSelection = NO; - self.tableView.separatorStyle = UITableViewCellSeparatorStyleNone; - - self.view.backgroundColor = [UIColor whiteColor]; -} - -- (void)refreshFeed -{ - [_activityIndicatorView startAnimating]; - // small first batch - [_photoFeed refreshFeedWithCompletionBlock:^(NSArray *newPhotos){ - - [_activityIndicatorView stopAnimating]; - - [self.tableView reloadData]; - - // immediately start second larger fetch - [self loadPage]; - - } numResultsToReturn:4]; -} - -- (void)insertNewRows:(NSArray *)newPhotos -{ - NSInteger section = 0; - NSMutableArray *indexPaths = [NSMutableArray array]; - - NSInteger newTotalNumberOfPhotos = [_photoFeed numberOfItemsInFeed]; - NSInteger existingNumberOfPhotos = newTotalNumberOfPhotos - newPhotos.count; - for (NSInteger row = existingNumberOfPhotos; row < newTotalNumberOfPhotos; row++) { - NSIndexPath *path = [NSIndexPath indexPathForRow:row inSection:section]; - [indexPaths addObject:path]; - } - [self.tableView insertRowsAtIndexPaths:indexPaths withRowAnimation:UITableViewRowAnimationNone]; -} - -- (UIStatusBarStyle)preferredStatusBarStyle -{ - return UIStatusBarStyleLightContent; -} - -- (BOOL)prefersStatusBarHidden -{ - return NO; -} - -- (CGSize)imageSizeForScreenWidth -{ - CGRect screenRect = [[UIScreen mainScreen] bounds]; - CGFloat screenScale = [[UIScreen mainScreen] scale]; - return CGSizeMake(screenRect.size.width * screenScale, screenRect.size.width * screenScale); -} - -#pragma mark - PhotoFeedViewControllerProtocol - -- (void)resetAllData -{ - [_photoFeed clearFeed]; - [self.tableView reloadData]; - [self refreshFeed]; -} - -#pragma mark - Subclassing - -- (UITableView *)tableView -{ - NSAssert(NO, @"Subclasses must override this method"); - return nil; -} - -- (void)loadPage -{ - NSAssert(NO, @"Subclasses must override this method"); -} - -@end diff --git a/submodules/AsyncDisplayKit/examples/ASDKgram/Sample/PhotoFeedControllerProtocol.h b/submodules/AsyncDisplayKit/examples/ASDKgram/Sample/PhotoFeedControllerProtocol.h deleted file mode 100644 index df5832939b..0000000000 --- a/submodules/AsyncDisplayKit/examples/ASDKgram/Sample/PhotoFeedControllerProtocol.h +++ /dev/null @@ -1,13 +0,0 @@ -// -// PhotoFeedControllerProtocol.h -// Texture -// -// Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -@protocol PhotoFeedControllerProtocol -- (void)resetAllData; -@end diff --git a/submodules/AsyncDisplayKit/examples/ASDKgram/Sample/PhotoFeedListKitViewController.h b/submodules/AsyncDisplayKit/examples/ASDKgram/Sample/PhotoFeedListKitViewController.h deleted file mode 100644 index a1e3e6a338..0000000000 --- a/submodules/AsyncDisplayKit/examples/ASDKgram/Sample/PhotoFeedListKitViewController.h +++ /dev/null @@ -1,14 +0,0 @@ -// -// PhotoFeedListKitViewController.h -// Texture -// -// Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import -#import "PhotoFeedControllerProtocol.h" - -@interface PhotoFeedListKitViewController : ASViewController - -@end diff --git a/submodules/AsyncDisplayKit/examples/ASDKgram/Sample/PhotoFeedListKitViewController.m b/submodules/AsyncDisplayKit/examples/ASDKgram/Sample/PhotoFeedListKitViewController.m deleted file mode 100644 index 997e9451b8..0000000000 --- a/submodules/AsyncDisplayKit/examples/ASDKgram/Sample/PhotoFeedListKitViewController.m +++ /dev/null @@ -1,118 +0,0 @@ -// -// PhotoFeedListKitViewController.m -// Texture -// -// Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import "PhotoFeedListKitViewController.h" -#import -#import "PhotoFeedModel.h" -#import "PhotoFeedSectionController.h" -#import "RefreshingSectionControllerType.h" - -@interface PhotoFeedListKitViewController () -@property (nonatomic, strong) IGListAdapter *listAdapter; -@property (nonatomic, strong) PhotoFeedModel *photoFeed; -@property (nonatomic, strong, readonly) ASCollectionNode *collectionNode; -@property (nonatomic, strong, readonly) UIActivityIndicatorView *spinner; -@property (nonatomic, strong, readonly) UIRefreshControl *refreshCtrl; -@end - -@implementation PhotoFeedListKitViewController -@synthesize spinner = _spinner; - -- (instancetype)init -{ - UICollectionViewFlowLayout *layout = [[UICollectionViewFlowLayout alloc] init]; - ASCollectionNode *node = [[ASCollectionNode alloc] initWithCollectionViewLayout:layout]; - if (self = [super initWithNode:node]) { - self.navigationItem.title = @"ListKit"; - - CGRect screenRect = [[UIScreen mainScreen] bounds]; - CGFloat screenScale = [[UIScreen mainScreen] scale]; - CGSize screenWidthImageSize = CGSizeMake(screenRect.size.width * screenScale, screenRect.size.width * screenScale); - _photoFeed = [[PhotoFeedModel alloc] initWithPhotoFeedModelType:PhotoFeedModelTypePopular imageSize:screenWidthImageSize]; - - IGListAdapterUpdater *updater = [[IGListAdapterUpdater alloc] init]; - _listAdapter = [[IGListAdapter alloc] initWithUpdater:updater viewController:self workingRangeSize:0]; - _listAdapter.dataSource = self; - [_listAdapter setASDKCollectionNode:self.collectionNode]; - } - return self; -} - -- (void)viewDidLoad -{ - [super viewDidLoad]; - self.collectionNode.view.alwaysBounceVertical = YES; - _refreshCtrl = [[UIRefreshControl alloc] init]; - [_refreshCtrl addTarget:self action:@selector(refreshFeed) forControlEvents:UIControlEventValueChanged]; - [self.collectionNode.view addSubview:_refreshCtrl]; - _spinner = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleGray]; -} - -- (ASCollectionNode *)collectionNode -{ - return self.node; -} - -- (void)resetAllData -{ - // nop, not used currently -} - -- (void)refreshFeed -{ - // Ask the first section controller to do the refreshing. - id secCtrl = [self.listAdapter sectionControllerForObject:self.photoFeed]; - if ([(NSObject*)secCtrl conformsToProtocol:@protocol(RefreshingSectionControllerType)]) { - [secCtrl refreshContentWithCompletion:^{ - [self.refreshCtrl endRefreshing]; - }]; - } -} - -- (UIActivityIndicatorView *)spinner -{ - if (_spinner == nil) { - _spinner = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleGray]; - [_spinner startAnimating]; - } - return _spinner; -} - -- (UIStatusBarStyle)preferredStatusBarStyle -{ - return UIStatusBarStyleLightContent; -} - -- (BOOL)prefersStatusBarHidden -{ - return NO; -} - -#pragma mark - IGListAdapterDataSource - -- (NSArray> *)objectsForListAdapter:(IGListAdapter *)listAdapter -{ - return @[ self.photoFeed ]; -} - -- (UIView *)emptyViewForListAdapter:(IGListAdapter *)listAdapter -{ - return self.spinner; -} - -- (IGListSectionController *)listAdapter:(IGListAdapter *)listAdapter sectionControllerForObject:(id)object -{ - if ([object isKindOfClass:[PhotoFeedModel class]]) { - return [[PhotoFeedSectionController alloc] init]; - } else { - ASDisplayNodeFailAssert(@"Only supports objects of class PhotoFeedModel."); - return nil; - } -} - -@end diff --git a/submodules/AsyncDisplayKit/examples/ASDKgram/Sample/PhotoFeedModel.h b/submodules/AsyncDisplayKit/examples/ASDKgram/Sample/PhotoFeedModel.h deleted file mode 100644 index a71b830b37..0000000000 --- a/submodules/AsyncDisplayKit/examples/ASDKgram/Sample/PhotoFeedModel.h +++ /dev/null @@ -1,37 +0,0 @@ -// -// PhotoFeedModel.h -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import "PhotoModel.h" -#import - -typedef NS_ENUM(NSInteger, PhotoFeedModelType) { - PhotoFeedModelTypePopular, - PhotoFeedModelTypeLocation, - PhotoFeedModelTypeUserPhotos -}; - -@interface PhotoFeedModel : NSObject - -- (instancetype)init NS_UNAVAILABLE; -- (instancetype)initWithPhotoFeedModelType:(PhotoFeedModelType)type imageSize:(CGSize)size NS_DESIGNATED_INITIALIZER; - -@property (nonatomic, readonly) NSArray *photos; - -- (NSUInteger)totalNumberOfPhotos; -- (NSUInteger)numberOfItemsInFeed; -- (PhotoModel *)objectAtIndex:(NSUInteger)index; -- (NSInteger)indexOfPhotoModel:(PhotoModel *)photoModel; - -- (void)updatePhotoFeedModelTypeUserId:(NSUInteger)userID; - -- (void)clearFeed; -- (void)requestPageWithCompletionBlock:(void (^)(NSArray *))block numResultsToReturn:(NSUInteger)numResults; -- (void)refreshFeedWithCompletionBlock:(void (^)(NSArray *))block numResultsToReturn:(NSUInteger)numResults; - -@end diff --git a/submodules/AsyncDisplayKit/examples/ASDKgram/Sample/PhotoFeedModel.m b/submodules/AsyncDisplayKit/examples/ASDKgram/Sample/PhotoFeedModel.m deleted file mode 100644 index 6548f9d373..0000000000 --- a/submodules/AsyncDisplayKit/examples/ASDKgram/Sample/PhotoFeedModel.m +++ /dev/null @@ -1,251 +0,0 @@ -// -// PhotoFeedModel.m -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import "PhotoFeedModel.h" -#import "ImageURLModel.h" - -#define unsplash_ENDPOINT_HOST @"https://api.unsplash.com/" -#define unsplash_ENDPOINT_POPULAR @"photos?order_by=popular" -#define unsplash_ENDPOINT_SEARCH @"photos/search?geo=" //latitude,longitude,radius -#define unsplash_ENDPOINT_USER @"photos?user_id=" -#define unsplash_CONSUMER_KEY_PARAM @"&client_id=3b99a69cee09770a4a0bbb870b437dbda53efb22f6f6de63714b71c4df7c9642" // PLEASE REQUEST YOUR OWN UNSPLASH CONSUMER KEY -#define unsplash_IMAGES_PER_PAGE 30 - -@implementation PhotoFeedModel -{ - PhotoFeedModelType _feedType; - - NSMutableArray *_photos; // array of PhotoModel objects - NSMutableArray *_ids; - - CGSize _imageSize; - NSString *_urlString; - NSUInteger _currentPage; - NSUInteger _totalPages; - NSUInteger _totalItems; - BOOL _fetchPageInProgress; - BOOL _refreshFeedInProgress; - NSURLSessionDataTask *_task; - - NSUInteger _userID; -} - -#pragma mark - Lifecycle - -- (instancetype)initWithPhotoFeedModelType:(PhotoFeedModelType)type imageSize:(CGSize)size -{ - self = [super init]; - - if (self) { - _feedType = type; - _imageSize = size; - _photos = [[NSMutableArray alloc] init]; - _ids = [[NSMutableArray alloc] init]; - _currentPage = 0; - - NSString *apiEndpointString; - switch (type) { - case (PhotoFeedModelTypePopular): - apiEndpointString = unsplash_ENDPOINT_POPULAR; - break; - - case (PhotoFeedModelTypeLocation): - apiEndpointString = unsplash_ENDPOINT_SEARCH; - break; - - case (PhotoFeedModelTypeUserPhotos): - apiEndpointString = unsplash_ENDPOINT_USER; - break; - - default: - break; - } - _urlString = [[unsplash_ENDPOINT_HOST stringByAppendingString:apiEndpointString] stringByAppendingString:unsplash_CONSUMER_KEY_PARAM]; - } - - return self; -} - -#pragma mark - Instance Methods - -- (NSArray *)photos -{ - return [_photos copy]; -} - -- (NSUInteger)totalNumberOfPhotos -{ - return _totalItems; -} - -- (NSUInteger)numberOfItemsInFeed -{ - return [_photos count]; -} - -- (PhotoModel *)objectAtIndex:(NSUInteger)index -{ - return [_photos objectAtIndex:index]; -} - -- (NSInteger)indexOfPhotoModel:(PhotoModel *)photoModel -{ - return [_photos indexOfObjectIdenticalTo:photoModel]; -} - -- (void)updatePhotoFeedModelTypeUserId:(NSUInteger)userID -{ - _userID = userID; - - NSString *userString = [NSString stringWithFormat:@"%lu", (long)userID]; - _urlString = [unsplash_ENDPOINT_HOST stringByAppendingString:unsplash_ENDPOINT_USER]; - _urlString = [[_urlString stringByAppendingString:userString] stringByAppendingString:@"&sort=created_at&image_size=3&include_store=store_download&include_states=voted"]; - _urlString = [_urlString stringByAppendingString:unsplash_CONSUMER_KEY_PARAM]; -} - -- (void)clearFeed -{ - _photos = [[NSMutableArray alloc] init]; - _ids = [[NSMutableArray alloc] init]; - _currentPage = 0; - _fetchPageInProgress = NO; - _refreshFeedInProgress = NO; - [_task cancel]; - _task = nil; -} - -- (void)requestPageWithCompletionBlock:(void (^)(NSArray *))block numResultsToReturn:(NSUInteger)numResults -{ - // only one fetch at a time - if (_fetchPageInProgress) { - return; - } else { - _fetchPageInProgress = YES; - [self fetchPageWithCompletionBlock:block numResultsToReturn:numResults]; - } -} - -- (void)refreshFeedWithCompletionBlock:(void (^)(NSArray *))block numResultsToReturn:(NSUInteger)numResults -{ - // only one fetch at a time - if (_refreshFeedInProgress) { - return; - - } else { - _refreshFeedInProgress = YES; - _currentPage = 0; - - // FIXME: blow away any other requests in progress - [self fetchPageWithCompletionBlock:^(NSArray *newPhotos) { - if (block) { - block(newPhotos); - } - _refreshFeedInProgress = NO; - } numResultsToReturn:numResults replaceData:YES]; - } -} - -#pragma mark - Helper Methods - -- (void)fetchPageWithCompletionBlock:(void (^)(NSArray *))block numResultsToReturn:(NSUInteger)numResults -{ - [self fetchPageWithCompletionBlock:block numResultsToReturn:numResults replaceData:NO]; -} - -- (void)fetchPageWithCompletionBlock:(void (^)(NSArray *))block numResultsToReturn:(NSUInteger)numResults replaceData:(BOOL)replaceData -{ - // early return if reached end of pages - if (_totalPages) { - if (_currentPage == _totalPages) { - dispatch_async(dispatch_get_main_queue(), ^{ - if (block) { - block(@[]); - } - }); - return; - } - } - - NSUInteger numPhotos = (numResults < unsplash_IMAGES_PER_PAGE) ? numResults : unsplash_IMAGES_PER_PAGE; - - dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{ - NSMutableArray *newPhotos = [NSMutableArray array]; - NSMutableArray *newIDs = [NSMutableArray array]; - - @synchronized(self) { - NSUInteger nextPage = _currentPage + 1; - NSString *imageSizeParam = [ImageURLModel imageParameterForClosestImageSize:_imageSize]; - NSString *urlAdditions = [NSString stringWithFormat:@"&page=%lu&per_page=%lu%@", (unsigned long)nextPage, (long)numPhotos, imageSizeParam]; - NSURL *url = [NSURL URLWithString:[_urlString stringByAppendingString:urlAdditions]]; - NSURLSession *session = [NSURLSession sessionWithConfiguration:[NSURLSessionConfiguration ephemeralSessionConfiguration]]; - _task = [session dataTaskWithURL:url completionHandler:^(NSData * _Nullable data, NSURLResponse * _Nullable response, NSError * _Nullable error) { - @synchronized(self) { - NSHTTPURLResponse *httpResponse = nil; - if (data && [response isKindOfClass:[NSHTTPURLResponse class]]) { - httpResponse = (NSHTTPURLResponse *)response; - NSArray *objects = [NSJSONSerialization JSONObjectWithData:data options:0 error:NULL]; - - if ([objects isKindOfClass:[NSArray class]]) { - _currentPage = nextPage; - _totalItems = [[httpResponse allHeaderFields][@"x-total"] integerValue]; - _totalPages = _totalItems / unsplash_IMAGES_PER_PAGE; // default per page is 10 - if (_totalItems % unsplash_IMAGES_PER_PAGE != 0) { - _totalPages += 1; - } - - NSArray *photos = objects; - for (NSDictionary *photoDictionary in photos) { - if ([photoDictionary isKindOfClass:[NSDictionary class]]) { - PhotoModel *photo = [[PhotoModel alloc] initWithUnsplashPhoto:photoDictionary]; - if (photo) { - if (replaceData || ![_ids containsObject:photo.photoID]) { - [newPhotos addObject:photo]; - [newIDs addObject:photo.photoID]; - } - } - } - } - } - } - } - - dispatch_async(dispatch_get_main_queue(), ^{ - @synchronized(self) { - if (replaceData) { - _photos = [newPhotos mutableCopy]; - _ids = [newIDs mutableCopy]; - } else { - [_photos addObjectsFromArray:newPhotos]; - [_ids addObjectsFromArray:newIDs]; - } - if (block) { - block(newPhotos); - } - _fetchPageInProgress = NO; - } - }); - }]; - [_task resume]; - } - }); -} - -#pragma mark - IGListDiffable - -- (id)diffIdentifier -{ - return self; -} - -- (BOOL)isEqualToDiffableObject:(id)object -{ - return self == object; -} - -@end diff --git a/submodules/AsyncDisplayKit/examples/ASDKgram/Sample/PhotoFeedNodeController.h b/submodules/AsyncDisplayKit/examples/ASDKgram/Sample/PhotoFeedNodeController.h deleted file mode 100644 index e4b8553c08..0000000000 --- a/submodules/AsyncDisplayKit/examples/ASDKgram/Sample/PhotoFeedNodeController.h +++ /dev/null @@ -1,14 +0,0 @@ -// -// PhotoFeedNodeController.h -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import "PhotoFeedBaseController.h" - -@interface PhotoFeedNodeController : PhotoFeedBaseController - -@end diff --git a/submodules/AsyncDisplayKit/examples/ASDKgram/Sample/PhotoFeedNodeController.m b/submodules/AsyncDisplayKit/examples/ASDKgram/Sample/PhotoFeedNodeController.m deleted file mode 100644 index 8abc80bb53..0000000000 --- a/submodules/AsyncDisplayKit/examples/ASDKgram/Sample/PhotoFeedNodeController.m +++ /dev/null @@ -1,105 +0,0 @@ -// -// PhotoFeedNodeController.m -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import "PhotoFeedNodeController.h" -#import -#import "Utilities.h" -#import "PhotoModel.h" -#import "PhotoCellNode.h" -#import "PhotoFeedModel.h" - -#define AUTO_TAIL_LOADING_NUM_SCREENFULS 2.5 - -@interface PhotoFeedNodeController () -@property (nonatomic, strong) ASTableNode *tableNode; -@end - -@implementation PhotoFeedNodeController - -#pragma mark - Lifecycle - -// -init is often called off the main thread in ASDK. Therefore it is imperative that no UIKit objects are accessed. -// Examples of common errors include accessing the node’s view or creating a gesture recognizer. -- (instancetype)init -{ - _tableNode = [[ASTableNode alloc] init]; - self = [super initWithNode:_tableNode]; - - if (self) { - self.navigationItem.title = @"ASDK"; - [self.navigationController setNavigationBarHidden:YES]; - - _tableNode.dataSource = self; - _tableNode.delegate = self; - } - - return self; -} - -// -loadView is guaranteed to be called on the main thread and is the appropriate place to -// set up an UIKit objects you may be using. -- (void)loadView -{ - [super loadView]; - - self.tableNode.leadingScreensForBatching = AUTO_TAIL_LOADING_NUM_SCREENFULS; // overriding default of 2.0 -} - -- (void)loadPageWithContext:(ASBatchContext *)context -{ - [self.photoFeed requestPageWithCompletionBlock:^(NSArray *newPhotos){ - - [self insertNewRows:newPhotos]; - if (context) { - [context completeBatchFetching:YES]; - } - } numResultsToReturn:20]; -} - -#pragma mark - Subclassing - -- (UITableView *)tableView -{ - return _tableNode.view; -} - -- (void)loadPage -{ - [self loadPageWithContext:nil]; -} - -#pragma mark - ASTableDataSource methods - -- (NSInteger)tableNode:(ASTableNode *)tableNode numberOfRowsInSection:(NSInteger)section -{ - return [self.photoFeed numberOfItemsInFeed]; -} - -- (ASCellNodeBlock)tableNode:(ASTableNode *)tableNode nodeBlockForRowAtIndexPath:(NSIndexPath *)indexPath -{ - PhotoModel *photoModel = [self.photoFeed objectAtIndex:indexPath.row]; - // this will be executed on a background thread - important to make sure it's thread safe - ASCellNode *(^ASCellNodeBlock)() = ^ASCellNode *() { - PhotoCellNode *cellNode = [[PhotoCellNode alloc] initWithPhotoObject:photoModel]; - return cellNode; - }; - - return ASCellNodeBlock; -} - -#pragma mark - ASTableDelegate methods - -// Receive a message that the tableView is near the end of its data set and more data should be fetched if necessary. -- (void)tableNode:(ASTableNode *)tableNode willBeginBatchFetchWithContext:(ASBatchContext *)context -{ - [context beginBatchFetching]; - [self loadPageWithContext:context]; -} - -@end diff --git a/submodules/AsyncDisplayKit/examples/ASDKgram/Sample/PhotoFeedSectionController.h b/submodules/AsyncDisplayKit/examples/ASDKgram/Sample/PhotoFeedSectionController.h deleted file mode 100644 index f7d820d6e5..0000000000 --- a/submodules/AsyncDisplayKit/examples/ASDKgram/Sample/PhotoFeedSectionController.h +++ /dev/null @@ -1,24 +0,0 @@ -// -// PhotoFeedSectionController.h -// Texture -// -// Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import -#import -#import "RefreshingSectionControllerType.h" -#import "ASCollectionSectionController.h" - -@class PhotoFeedModel; - -NS_ASSUME_NONNULL_BEGIN - -@interface PhotoFeedSectionController : ASCollectionSectionController - -@property (nonatomic, strong, nullable) PhotoFeedModel *photoFeed; - -@end - -NS_ASSUME_NONNULL_END diff --git a/submodules/AsyncDisplayKit/examples/ASDKgram/Sample/PhotoFeedSectionController.m b/submodules/AsyncDisplayKit/examples/ASDKgram/Sample/PhotoFeedSectionController.m deleted file mode 100644 index 25e1a1b613..0000000000 --- a/submodules/AsyncDisplayKit/examples/ASDKgram/Sample/PhotoFeedSectionController.m +++ /dev/null @@ -1,144 +0,0 @@ -// -// PhotoFeedSectionController.m -// Texture -// -// Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import "PhotoFeedSectionController.h" -#import "PhotoFeedModel.h" -#import "PhotoModel.h" -#import "PhotoCellNode.h" -#import "TailLoadingNode.h" -#import "FeedHeaderNode.h" - -@interface PhotoFeedSectionController () -@property (nonatomic, strong) NSString *paginatingSpinner; -@end - -@implementation PhotoFeedSectionController - -- (instancetype)init -{ - if (self = [super init]) { - _paginatingSpinner = @"Paginating Spinner"; - self.supplementaryViewSource = self; - } - return self; -} - -#pragma mark - IGListSectionType - -- (void)didUpdateToObject:(id)object -{ - _photoFeed = object; - [self setItems:_photoFeed.photos animated:NO completion:nil]; -} - -- (__kindof UICollectionViewCell *)cellForItemAtIndex:(NSInteger)index -{ - return [ASIGListSectionControllerMethods cellForItemAtIndex:index sectionController:self]; -} - -- (CGSize)sizeForItemAtIndex:(NSInteger)index -{ - return [ASIGListSectionControllerMethods sizeForItemAtIndex:index]; -} - -- (void)didSelectItemAtIndex:(NSInteger)index -{ - // nop -} - -#pragma mark - ASSectionController - -- (ASCellNodeBlock)nodeBlockForItemAtIndex:(NSInteger)index -{ - id object = self.items[index]; - // this will be executed on a background thread - important to make sure it's thread safe - ASCellNode *(^nodeBlock)() = nil; - if (object == _paginatingSpinner) { - nodeBlock = ^{ - return [[TailLoadingNode alloc] init]; - }; - } else if ([object isKindOfClass:[PhotoModel class]]) { - PhotoModel *photoModel = object; - nodeBlock = ^{ - PhotoCellNode *cellNode = [[PhotoCellNode alloc] initWithPhotoObject:photoModel]; - return cellNode; - }; - } - - return nodeBlock; -} - -- (void)beginBatchFetchWithContext:(ASBatchContext *)context -{ - dispatch_async(dispatch_get_main_queue(), ^{ - // Immediately add the loading spinner if needed. - if (self.items.count > 0) { - NSArray *newItems = [self.items arrayByAddingObject:_paginatingSpinner]; - [self setItems:newItems animated:NO completion:nil]; - } - - // Push to next runloop to give time to insert the spinner - dispatch_async(dispatch_get_main_queue(), ^{ - dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(2.0 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ - // Start the fetch, then update the items (removing the spinner) when they are loaded. - [_photoFeed requestPageWithCompletionBlock:^(NSArray *newPhotos){ - [self setItems:_photoFeed.photos animated:NO completion:^{ - [context completeBatchFetching:YES]; - }]; - } numResultsToReturn:20]; - }); - }); - }); -} - -#pragma mark - RefreshingSectionControllerType - -- (void)refreshContentWithCompletion:(void(^)())completion -{ - [_photoFeed refreshFeedWithCompletionBlock:^(NSArray *addedItems) { - [self setItems:_photoFeed.photos animated:YES completion:completion]; - } numResultsToReturn:4]; -} - -#pragma mark - ASSupplementaryNodeSource - -- (ASCellNodeBlock)nodeBlockForSupplementaryElementOfKind:(NSString *)elementKind atIndex:(NSInteger)index -{ - ASDisplayNodeAssert([elementKind isEqualToString:UICollectionElementKindSectionHeader], nil); - return ^{ - return [[FeedHeaderNode alloc] init]; - }; -} - -- (ASSizeRange)sizeRangeForSupplementaryElementOfKind:(NSString *)elementKind atIndex:(NSInteger)index -{ - if ([elementKind isEqualToString:UICollectionElementKindSectionHeader]) { - return ASSizeRangeUnconstrained; - } else { - return ASSizeRangeZero; - } -} - -#pragma mark - IGListSupplementaryViewSource - -- (NSArray *)supportedElementKinds -{ - return @[ UICollectionElementKindSectionHeader ]; -} - -- (__kindof UICollectionReusableView *)viewForSupplementaryElementOfKind:(NSString *)elementKind atIndex:(NSInteger)index -{ - return [ASIGListSupplementaryViewSourceMethods viewForSupplementaryElementOfKind:elementKind atIndex:index sectionController:self]; -} - -- (CGSize)sizeForSupplementaryViewOfKind:(NSString *)elementKind atIndex:(NSInteger)index -{ - return [ASIGListSupplementaryViewSourceMethods sizeForSupplementaryViewOfKind:elementKind atIndex:index]; -} - -@end diff --git a/submodules/AsyncDisplayKit/examples/ASDKgram/Sample/PhotoFeedViewController.h b/submodules/AsyncDisplayKit/examples/ASDKgram/Sample/PhotoFeedViewController.h deleted file mode 100644 index 14295d0bbc..0000000000 --- a/submodules/AsyncDisplayKit/examples/ASDKgram/Sample/PhotoFeedViewController.h +++ /dev/null @@ -1,14 +0,0 @@ -// -// PhotoFeedViewController.h -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import "PhotoFeedBaseController.h" - -@interface PhotoFeedViewController : PhotoFeedBaseController - -@end diff --git a/submodules/AsyncDisplayKit/examples/ASDKgram/Sample/PhotoFeedViewController.m b/submodules/AsyncDisplayKit/examples/ASDKgram/Sample/PhotoFeedViewController.m deleted file mode 100644 index c3f9a4aefe..0000000000 --- a/submodules/AsyncDisplayKit/examples/ASDKgram/Sample/PhotoFeedViewController.m +++ /dev/null @@ -1,104 +0,0 @@ -// -// PhotoFeedViewController.m -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import "PhotoFeedViewController.h" -#import "Utilities.h" -#import "PhotoTableViewCell.h" -#import "PhotoFeedModel.h" - -#define AUTO_TAIL_LOADING_NUM_SCREENFULS 2.5 - -@interface PhotoFeedViewController () -@end - -@implementation PhotoFeedViewController -{ - UITableView *_tableView; -} - -#pragma mark - Lifecycle - -- (instancetype)init -{ - self = [super initWithNibName:nil bundle:nil]; - - if (self) { - self.navigationItem.title = @"UIKit"; - [self.navigationController setNavigationBarHidden:YES]; - - _tableView = [[UITableView alloc] initWithFrame:CGRectZero style:UITableViewStylePlain]; - _tableView.autoresizingMask = UIViewAutoresizingFlexibleWidth; - _tableView.delegate = self; - _tableView.dataSource = self; - } - - return self; -} - -// anything involving the view should go here, not init -- (void)viewDidLoad -{ - [super viewDidLoad]; - - [self.view addSubview:_tableView]; - _tableView.frame = self.view.bounds; - [_tableView registerClass:[PhotoTableViewCell class] forCellReuseIdentifier:@"photoCell"]; -} - -#pragma mark - Subclassing - -- (UITableView *)tableView -{ - return _tableView; -} - -- (void)loadPage -{ - [self.photoFeed requestPageWithCompletionBlock:^(NSArray *newPhotos){ - [self insertNewRows:newPhotos]; - } numResultsToReturn:20]; -} - -#pragma mark - UITableViewDataSource methods - -- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section -{ - return [self.photoFeed numberOfItemsInFeed]; -} - -- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath -{ - PhotoTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"photoCell" forIndexPath:indexPath]; - [cell updateCellWithPhotoObject:[self.photoFeed objectAtIndex:indexPath.row]]; - - return cell; -} - -- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(nonnull NSIndexPath *)indexPath -{ - PhotoModel *photo = [self.photoFeed objectAtIndex:indexPath.row]; - return [PhotoTableViewCell heightForPhotoModel:photo withWidth:self.view.bounds.size.width]; -} - -#pragma mark - UITableViewDelegate methods - -// table automatic tail loading --(void)scrollViewDidScroll:(UIScrollView *)scrollView -{ - CGFloat currentOffSetY = scrollView.contentOffset.y; - CGFloat contentHeight = scrollView.contentSize.height; - CGFloat screenHeight = [UIScreen mainScreen].bounds.size.height; - - CGFloat screenfullsBeforeBottom = (contentHeight - currentOffSetY) / screenHeight; - if (screenfullsBeforeBottom < AUTO_TAIL_LOADING_NUM_SCREENFULS) { - [self loadPage]; - } -} - -@end diff --git a/submodules/AsyncDisplayKit/examples/ASDKgram/Sample/PhotoModel.h b/submodules/AsyncDisplayKit/examples/ASDKgram/Sample/PhotoModel.h deleted file mode 100644 index 95c1a8130c..0000000000 --- a/submodules/AsyncDisplayKit/examples/ASDKgram/Sample/PhotoModel.h +++ /dev/null @@ -1,33 +0,0 @@ -// -// PhotoModel.h -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import "UserModel.h" -#import - -@interface PhotoModel : NSObject - -@property (nonatomic, strong, readonly) NSURL *URL; -@property (nonatomic, strong, readonly) NSString *photoID; -@property (nonatomic, strong, readonly) NSString *uploadDateString; -@property (nonatomic, strong, readonly) NSString *descriptionText; -@property (nonatomic, assign, readonly) NSUInteger likesCount; -@property (nonatomic, strong, readonly) NSString *location; -@property (nonatomic, strong, readonly) UserModel *ownerUserProfile; -@property (nonatomic, assign, readonly) NSUInteger width; -@property (nonatomic, assign, readonly) NSUInteger height; - -- (instancetype)init NS_UNAVAILABLE; -- (instancetype)initWithUnsplashPhoto:(NSDictionary *)photoDictionary NS_DESIGNATED_INITIALIZER; - -- (NSAttributedString *)descriptionAttributedStringWithFontSize:(CGFloat)size; -- (NSAttributedString *)uploadDateAttributedStringWithFontSize:(CGFloat)size; -- (NSAttributedString *)likesAttributedStringWithFontSize:(CGFloat)size; -- (NSAttributedString *)locationAttributedStringWithFontSize:(CGFloat)size; - -@end diff --git a/submodules/AsyncDisplayKit/examples/ASDKgram/Sample/PhotoModel.m b/submodules/AsyncDisplayKit/examples/ASDKgram/Sample/PhotoModel.m deleted file mode 100644 index 0662e71ae5..0000000000 --- a/submodules/AsyncDisplayKit/examples/ASDKgram/Sample/PhotoModel.m +++ /dev/null @@ -1,90 +0,0 @@ -// -// PhotoModel.m -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import "PhotoModel.h" -#import "Utilities.h" - -@implementation PhotoModel -{ - NSDictionary *_dictionaryRepresentation; - NSString *_uploadDateRaw; -} - -#pragma mark - Lifecycle - -- (instancetype)initWithUnsplashPhoto:(NSDictionary *)photoDictionary -{ - self = [super init]; - - if (self) { - _dictionaryRepresentation = photoDictionary; - _uploadDateRaw = [photoDictionary objectForKey:@"created_at"]; - _photoID = [photoDictionary objectForKey:@"id"]; - _descriptionText = [photoDictionary valueForKeyPath:@"description"]; - _likesCount = [[photoDictionary objectForKey:@"likes"] integerValue]; - _location = [photoDictionary objectForKey:@"location"]; - - NSString *urlString = [photoDictionary objectForKey:@"urls"][@"regular"]; - _URL = urlString ? [NSURL URLWithString:urlString] : nil; - - _ownerUserProfile = [[UserModel alloc] initWithUnsplashPhoto:photoDictionary]; - _uploadDateString = [NSString elapsedTimeStringSinceDate:_uploadDateRaw]; - - _height = [[photoDictionary objectForKey:@"height"] integerValue]; - _width = [[photoDictionary objectForKey:@"width"] integerValue]; - } - - return self; -} - -#pragma mark - Instance Methods - -- (NSAttributedString *)descriptionAttributedStringWithFontSize:(CGFloat)size -{ - NSString *string = [NSString stringWithFormat:@"%@ %@", self.ownerUserProfile.username, self.descriptionText]; - NSAttributedString *attrString = [NSAttributedString attributedStringWithString:string - fontSize:size - color:[UIColor darkGrayColor] - firstWordColor:[UIColor darkBlueColor]]; - return attrString; -} - -- (NSAttributedString *)uploadDateAttributedStringWithFontSize:(CGFloat)size -{ - return [NSAttributedString attributedStringWithString:self.uploadDateString fontSize:size color:[UIColor lightGrayColor] firstWordColor:nil]; -} - -- (NSAttributedString *)likesAttributedStringWithFontSize:(CGFloat)size -{ - NSString *likesString = [NSString stringWithFormat:@"♥︎ %lu likes", (unsigned long)_likesCount]; - - return [NSAttributedString attributedStringWithString:likesString fontSize:size color:[UIColor darkBlueColor] firstWordColor:nil]; -} - -- (NSAttributedString *)locationAttributedStringWithFontSize:(CGFloat)size -{ - return [NSAttributedString attributedStringWithString:self.location fontSize:size color:[UIColor lightBlueColor] firstWordColor:nil]; -} - -- (NSString *)description -{ - return [NSString stringWithFormat:@"%@ - %@", _photoID, _descriptionText]; -} - -- (id)diffIdentifier -{ - return self.photoID; -} - -- (BOOL)isEqualToDiffableObject:(id)object -{ - return [self isEqual:object]; -} - -@end diff --git a/submodules/AsyncDisplayKit/examples/ASDKgram/Sample/PhotoTableViewCell.h b/submodules/AsyncDisplayKit/examples/ASDKgram/Sample/PhotoTableViewCell.h deleted file mode 100644 index 47e8e913f7..0000000000 --- a/submodules/AsyncDisplayKit/examples/ASDKgram/Sample/PhotoTableViewCell.h +++ /dev/null @@ -1,18 +0,0 @@ -// -// PhotoTableViewCell.h -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import "PhotoModel.h" - -@interface PhotoTableViewCell : UITableViewCell - -+ (CGFloat)heightForPhotoModel:(PhotoModel *)photo withWidth:(CGFloat)width; - -- (void)updateCellWithPhotoObject:(PhotoModel *)photo; - -@end diff --git a/submodules/AsyncDisplayKit/examples/ASDKgram/Sample/PhotoTableViewCell.m b/submodules/AsyncDisplayKit/examples/ASDKgram/Sample/PhotoTableViewCell.m deleted file mode 100644 index 9cc5fa785b..0000000000 --- a/submodules/AsyncDisplayKit/examples/ASDKgram/Sample/PhotoTableViewCell.m +++ /dev/null @@ -1,425 +0,0 @@ -// -// PhotoTableViewCell.m -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import "PhotoTableViewCell.h" -#import "Utilities.h" -#import "PINImageView+PINRemoteImage.h" -#import "PINButton+PINRemoteImage.h" - -#define DEBUG_PHOTOCELL_LAYOUT 0 -#define USE_UIKIT_AUTOLAYOUT 1 -#define USE_UIKIT_MANUAL_LAYOUT !USE_UIKIT_AUTOLAYOUT - -#define HEADER_HEIGHT 50 -#define USER_IMAGE_HEIGHT 30 -#define HORIZONTAL_BUFFER 10 -#define VERTICAL_BUFFER 5 -#define FONT_SIZE 14 - -@implementation PhotoTableViewCell -{ - PhotoModel *_photoModel; - - UIImageView *_userAvatarImageView; - UIImageView *_photoImageView; - UILabel *_userNameLabel; - UILabel *_photoLocationLabel; - UILabel *_photoTimeIntervalSincePostLabel; - UILabel *_photoLikesLabel; - UILabel *_photoDescriptionLabel; - - NSLayoutConstraint *_userNameYPositionWithPhotoLocation; - NSLayoutConstraint *_userNameYPositionWithoutPhotoLocation; - NSLayoutConstraint *_photoLocationYPosition; -} - -#pragma mark - Class Methods - -+ (CGFloat)heightForPhotoModel:(PhotoModel *)photo withWidth:(CGFloat)width; -{ - CGFloat photoHeight = width; - - UIFont *font = [UIFont systemFontOfSize:FONT_SIZE]; - CGFloat likesHeight = roundf([font lineHeight]); - - NSAttributedString *descriptionAttrString = [photo descriptionAttributedStringWithFontSize:FONT_SIZE]; - CGFloat availableWidth = (width - HORIZONTAL_BUFFER * 2); - CGFloat descriptionHeight = [descriptionAttrString boundingRectWithSize:CGSizeMake(availableWidth, CGFLOAT_MAX) - options:NSStringDrawingUsesLineFragmentOrigin - context:nil].size.height; - - return HEADER_HEIGHT + photoHeight + likesHeight + descriptionHeight + (4 * VERTICAL_BUFFER); -} - -#pragma mark - Lifecycle - -- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier -{ - self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]; - - if (self) { - _userAvatarImageView = [[UIImageView alloc] init]; - _photoImageView = [[UIImageView alloc] init]; - _photoImageView.contentMode = UIViewContentModeScaleAspectFill; - _userNameLabel = [[UILabel alloc] init]; - _photoLocationLabel = [[UILabel alloc] init]; - _photoTimeIntervalSincePostLabel = [[UILabel alloc] init]; - _photoLikesLabel = [[UILabel alloc] init]; - _photoDescriptionLabel = [[UILabel alloc] init]; - _photoDescriptionLabel.numberOfLines = 3; - - [self addSubview:_userAvatarImageView]; - [self addSubview:_photoImageView]; - [self addSubview:_userNameLabel]; - [self addSubview:_photoLocationLabel]; - [self addSubview:_photoTimeIntervalSincePostLabel]; - [self addSubview:_photoLikesLabel]; - [self addSubview:_photoDescriptionLabel]; - -#if USE_UIKIT_AUTOLAYOUT - [_userAvatarImageView setTranslatesAutoresizingMaskIntoConstraints:NO]; - [_photoImageView setTranslatesAutoresizingMaskIntoConstraints:NO]; - [_userNameLabel setTranslatesAutoresizingMaskIntoConstraints:NO]; - [_photoLocationLabel setTranslatesAutoresizingMaskIntoConstraints:NO]; - [_photoTimeIntervalSincePostLabel setTranslatesAutoresizingMaskIntoConstraints:NO]; - [_photoLikesLabel setTranslatesAutoresizingMaskIntoConstraints:NO]; - [_photoDescriptionLabel setTranslatesAutoresizingMaskIntoConstraints:NO]; - - [self setupConstraints]; - [self updateConstraints]; -#endif - -#if DEBUG_PHOTOCELL_LAYOUT - _userAvatarImageView.backgroundColor = [UIColor greenColor]; - _userNameLabel.backgroundColor = [UIColor greenColor]; - _photoLocationLabel.backgroundColor = [UIColor greenColor]; - _photoTimeIntervalSincePostLabel.backgroundColor = [UIColor greenColor]; - _photoDescriptionLabel.backgroundColor = [UIColor greenColor]; - _photoLikesLabel.backgroundColor = [UIColor greenColor]; -#endif - } - - return self; -} - --(void)setFrame:(CGRect)frame -{ - [super setFrame:frame]; -} - -- (void)setupConstraints -{ - // _userAvatarImageView - [self addConstraint:[NSLayoutConstraint constraintWithItem:_userAvatarImageView - attribute:NSLayoutAttributeLeft - relatedBy:NSLayoutRelationEqual - toItem:_userAvatarImageView.superview - attribute:NSLayoutAttributeLeft - multiplier:1.0 - constant:HORIZONTAL_BUFFER]]; - - [self addConstraint:[NSLayoutConstraint constraintWithItem:_userAvatarImageView - attribute:NSLayoutAttributeTop - relatedBy:NSLayoutRelationEqual - toItem:_userAvatarImageView.superview - attribute:NSLayoutAttributeTop - multiplier:1.0 - constant:HORIZONTAL_BUFFER]]; - - [self addConstraint:[NSLayoutConstraint constraintWithItem:_userAvatarImageView - attribute:NSLayoutAttributeWidth - relatedBy:NSLayoutRelationEqual - toItem:nil - attribute:NSLayoutAttributeNotAnAttribute - multiplier:0.0 - constant:USER_IMAGE_HEIGHT]]; - - [self addConstraint:[NSLayoutConstraint constraintWithItem:_userAvatarImageView - attribute:NSLayoutAttributeHeight - relatedBy:NSLayoutRelationEqual - toItem:_userAvatarImageView - attribute:NSLayoutAttributeWidth - multiplier:1.0 - constant:0.0]]; - - // _userNameLabel - [self addConstraint:[NSLayoutConstraint constraintWithItem:_userNameLabel - attribute:NSLayoutAttributeLeft - relatedBy:NSLayoutRelationEqual - toItem:_userAvatarImageView - attribute:NSLayoutAttributeRight - multiplier:1.0 - constant:HORIZONTAL_BUFFER]]; - - [self addConstraint:[NSLayoutConstraint constraintWithItem:_userNameLabel - attribute:NSLayoutAttributeRight - relatedBy:NSLayoutRelationLessThanOrEqual - toItem:_photoTimeIntervalSincePostLabel - attribute:NSLayoutAttributeLeft - multiplier:1.0 - constant:-HORIZONTAL_BUFFER]]; - - _userNameYPositionWithoutPhotoLocation = [NSLayoutConstraint constraintWithItem:_userNameLabel - attribute:NSLayoutAttributeCenterY - relatedBy:NSLayoutRelationEqual - toItem:_userAvatarImageView - attribute:NSLayoutAttributeCenterY - multiplier:1.0 - constant:0.0]; - [self addConstraint:_userNameYPositionWithoutPhotoLocation]; - - _userNameYPositionWithPhotoLocation = [NSLayoutConstraint constraintWithItem:_userNameLabel - attribute:NSLayoutAttributeTop - relatedBy:NSLayoutRelationEqual - toItem:_userAvatarImageView - attribute:NSLayoutAttributeTop - multiplier:1.0 - constant:-2]; - _userNameYPositionWithPhotoLocation.active = NO; - [self addConstraint:_userNameYPositionWithPhotoLocation]; - - // _photoLocationLabel - [self addConstraint:[NSLayoutConstraint constraintWithItem:_photoLocationLabel - attribute:NSLayoutAttributeLeft - relatedBy:NSLayoutRelationEqual - toItem:_userAvatarImageView - attribute:NSLayoutAttributeRight - multiplier:1.0 - constant:HORIZONTAL_BUFFER]]; - - [self addConstraint:[NSLayoutConstraint constraintWithItem:_photoLocationLabel - attribute:NSLayoutAttributeRight - relatedBy:NSLayoutRelationLessThanOrEqual - toItem:_photoTimeIntervalSincePostLabel - attribute:NSLayoutAttributeLeft - multiplier:1.0 - constant:-HORIZONTAL_BUFFER]]; - - _photoLocationYPosition = [NSLayoutConstraint constraintWithItem:_photoLocationLabel - attribute:NSLayoutAttributeBottom - relatedBy:NSLayoutRelationEqual - toItem:_userAvatarImageView - attribute:NSLayoutAttributeBottom - multiplier:1.0 - constant:2]; - _photoLocationYPosition.active = NO; - [self addConstraint:_photoLocationYPosition]; - - // _photoTimeIntervalSincePostLabel - [self addConstraint:[NSLayoutConstraint constraintWithItem:_photoTimeIntervalSincePostLabel - attribute:NSLayoutAttributeRight - relatedBy:NSLayoutRelationEqual - toItem:_photoTimeIntervalSincePostLabel.superview - attribute:NSLayoutAttributeRight - multiplier:1.0 - constant:-HORIZONTAL_BUFFER]]; - - [self addConstraint:[NSLayoutConstraint constraintWithItem:_photoTimeIntervalSincePostLabel - attribute:NSLayoutAttributeCenterY - relatedBy:NSLayoutRelationEqual - toItem:_userAvatarImageView - attribute:NSLayoutAttributeCenterY - multiplier:1.0 - constant:0.0]]; - - // _photoImageView - [self addConstraint:[NSLayoutConstraint constraintWithItem:_photoImageView - attribute:NSLayoutAttributeTop - relatedBy:NSLayoutRelationEqual - toItem:_photoImageView.superview - attribute:NSLayoutAttributeTop - multiplier:1.0 - constant:HEADER_HEIGHT]]; - - [self addConstraint:[NSLayoutConstraint constraintWithItem:_photoImageView - attribute:NSLayoutAttributeWidth - relatedBy:NSLayoutRelationEqual - toItem:self - attribute:NSLayoutAttributeWidth - multiplier:1.0 - constant:0.0]]; - - [self addConstraint:[NSLayoutConstraint constraintWithItem:_photoImageView - attribute:NSLayoutAttributeHeight - relatedBy:NSLayoutRelationEqual - toItem:_photoImageView - attribute:NSLayoutAttributeWidth - multiplier:1.0 - constant:0.0]]; - - // _photoLikesLabel - [self addConstraint:[NSLayoutConstraint constraintWithItem:_photoLikesLabel - attribute:NSLayoutAttributeTop - relatedBy:NSLayoutRelationEqual - toItem:_photoImageView - attribute:NSLayoutAttributeBottom - multiplier:1.0 - constant:VERTICAL_BUFFER]]; - - [self addConstraint:[NSLayoutConstraint constraintWithItem:_photoLikesLabel - attribute:NSLayoutAttributeLeft - relatedBy:NSLayoutRelationEqual - toItem:_photoLikesLabel.superview - attribute:NSLayoutAttributeLeft - multiplier:1.0 - constant:HORIZONTAL_BUFFER]]; - - // _photoDescriptionLabel - [self addConstraint:[NSLayoutConstraint constraintWithItem:_photoDescriptionLabel - attribute:NSLayoutAttributeTop - relatedBy:NSLayoutRelationEqual - toItem:_photoLikesLabel - attribute:NSLayoutAttributeBottom - multiplier:1.0 - constant:VERTICAL_BUFFER]]; - - [self addConstraint:[NSLayoutConstraint constraintWithItem:_photoDescriptionLabel - attribute:NSLayoutAttributeLeft - relatedBy:NSLayoutRelationEqual - toItem:_photoDescriptionLabel.superview - attribute:NSLayoutAttributeLeft - multiplier:1.0 - constant:HORIZONTAL_BUFFER]]; - - [self addConstraint:[NSLayoutConstraint constraintWithItem:_photoDescriptionLabel - attribute:NSLayoutAttributeWidth - relatedBy:NSLayoutRelationEqual - toItem:_photoDescriptionLabel.superview - attribute:NSLayoutAttributeWidth - multiplier:1.0 - constant:-HORIZONTAL_BUFFER]]; -} - -- (void)updateConstraints -{ - [super updateConstraints]; - - if (_photoLocationLabel.attributedText) { - _userNameYPositionWithoutPhotoLocation.active = NO; - _userNameYPositionWithPhotoLocation.active = YES; - _photoLocationYPosition.active = YES; - } else { - _userNameYPositionWithoutPhotoLocation.active = YES; - _userNameYPositionWithPhotoLocation.active = NO; - _photoLocationYPosition.active = NO; - } -} - -- (void)layoutSubviews -{ - [super layoutSubviews]; - -#if USE_UIKIT_PROGRAMMATIC_LAYOUT - CGSize boundsSize = self.bounds.size; - - CGRect rect = CGRectMake(HORIZONTAL_BUFFER, (HEADER_HEIGHT - USER_IMAGE_HEIGHT) / 2.0, - USER_IMAGE_HEIGHT, USER_IMAGE_HEIGHT); - _userAvatarImageView.frame = rect; - - rect.size = _photoTimeIntervalSincePostLabel.bounds.size; - rect.origin.x = boundsSize.width - HORIZONTAL_BUFFER - rect.size.width; - rect.origin.y = (HEADER_HEIGHT - rect.size.height) / 2.0; - _photoTimeIntervalSincePostLabel.frame = rect; - - CGFloat availableWidth = CGRectGetMinX(_photoTimeIntervalSincePostLabel.frame) - HORIZONTAL_BUFFER; - rect.size = _userNameLabel.bounds.size; - rect.size.width = MIN(availableWidth, rect.size.width); - - rect.origin.x = HORIZONTAL_BUFFER + USER_IMAGE_HEIGHT + HORIZONTAL_BUFFER; - - if (_photoLocationLabel.attributedText) { - CGSize locationSize = _photoLocationLabel.bounds.size; - locationSize.width = MIN(availableWidth, locationSize.width); - - rect.origin.y = (HEADER_HEIGHT - rect.size.height - locationSize.height) / 2.0; - _userNameLabel.frame = rect; - - // FIXME: Name rects at least for this sub-condition - rect.origin.y += rect.size.height; - rect.size = locationSize; - _photoLocationLabel.frame = rect; - } else { - rect.origin.y = (HEADER_HEIGHT - rect.size.height) / 2.0; - _userNameLabel.frame = rect; - } - - _photoImageView.frame = CGRectMake(0, HEADER_HEIGHT, boundsSize.width, boundsSize.width); - - // FIXME: Make PhotoCellFooterView - rect.size = _photoLikesLabel.bounds.size; - rect.origin = CGPointMake(HORIZONTAL_BUFFER, CGRectGetMaxY(_photoImageView.frame) + VERTICAL_BUFFER); - _photoLikesLabel.frame = rect; - - rect.size = _photoDescriptionLabel.bounds.size; - rect.size.width = MIN(boundsSize.width - HORIZONTAL_BUFFER * 2, rect.size.width); - rect.origin.y = CGRectGetMaxY(_photoLikesLabel.frame) + VERTICAL_BUFFER; - _photoDescriptionLabel.frame = rect; -#endif -} - -- (void)prepareForReuse -{ - [super prepareForReuse]; - - _userAvatarImageView.image = nil; - _photoImageView.image = nil; - _userNameLabel.attributedText = nil; - _photoLocationLabel.attributedText = nil; - _photoLocationLabel.frame = CGRectZero; // next cell might not have a _photoLocationLabel - _photoTimeIntervalSincePostLabel.attributedText = nil; - _photoLikesLabel.attributedText = nil; - _photoDescriptionLabel.attributedText = nil; -} - -#pragma mark - Instance Methods - -- (void)updateCellWithPhotoObject:(PhotoModel *)photo -{ - _photoModel = photo; - _userNameLabel.attributedText = [photo.ownerUserProfile usernameAttributedStringWithFontSize:FONT_SIZE]; - _photoTimeIntervalSincePostLabel.attributedText = [photo uploadDateAttributedStringWithFontSize:FONT_SIZE]; - _photoLikesLabel.attributedText = [photo likesAttributedStringWithFontSize:FONT_SIZE]; - _photoDescriptionLabel.attributedText = [photo descriptionAttributedStringWithFontSize:FONT_SIZE]; - - [_userNameLabel sizeToFit]; - [_photoTimeIntervalSincePostLabel sizeToFit]; - [_photoLikesLabel sizeToFit]; - [_photoDescriptionLabel sizeToFit]; - CGRect rect = _photoDescriptionLabel.frame; - CGFloat availableWidth = (self.bounds.size.width - HORIZONTAL_BUFFER * 2); - rect.size = [_photoDescriptionLabel sizeThatFits:CGSizeMake(availableWidth, CGFLOAT_MAX)]; - _photoDescriptionLabel.frame = rect; - - [UIImage downloadImageForURL:photo.URL completion:^(UIImage *image) { - _photoImageView.image = image; - }]; - - [self downloadAndProcessUserAvatarForPhoto:photo]; - - //update location - _photoLocationLabel.attributedText = [photo locationAttributedStringWithFontSize:FONT_SIZE]; - [_photoLocationLabel sizeToFit]; - - dispatch_async(dispatch_get_main_queue(), ^{ - [self updateConstraints]; - [self setNeedsLayout]; - }); -} - -#pragma mark - Helper Methods - -- (void)downloadAndProcessUserAvatarForPhoto:(PhotoModel *)photo -{ - [UIImage downloadImageForURL:photo.URL completion:^(UIImage *image) { - CGSize profileImageSize = CGSizeMake(USER_IMAGE_HEIGHT, USER_IMAGE_HEIGHT); - _userAvatarImageView.image = [image makeCircularImageWithSize:profileImageSize]; - }]; -} - -@end diff --git a/submodules/AsyncDisplayKit/examples/ASDKgram/Sample/RefreshingSectionControllerType.h b/submodules/AsyncDisplayKit/examples/ASDKgram/Sample/RefreshingSectionControllerType.h deleted file mode 100644 index 169a996012..0000000000 --- a/submodules/AsyncDisplayKit/examples/ASDKgram/Sample/RefreshingSectionControllerType.h +++ /dev/null @@ -1,19 +0,0 @@ -// -// RefreshingSectionControllerType.h -// Texture -// -// Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -NS_ASSUME_NONNULL_BEGIN - -@protocol RefreshingSectionControllerType - -- (void)refreshContentWithCompletion:(nullable void(^)())completion; - -@end - -NS_ASSUME_NONNULL_END diff --git a/submodules/AsyncDisplayKit/examples/ASDKgram/Sample/Sample.pch b/submodules/AsyncDisplayKit/examples/ASDKgram/Sample/Sample.pch deleted file mode 100644 index 8c35575c9b..0000000000 --- a/submodules/AsyncDisplayKit/examples/ASDKgram/Sample/Sample.pch +++ /dev/null @@ -1,15 +0,0 @@ -// -// ASDKgram.pch -// ASDKgram -// -// Created by Hannah Troisi on 2/26/16. -// Copyright © 2016 Hannah Troisi. All rights reserved. -// - -#ifndef Flickrgram_pch -#define Flickrgram_pch - -#import -#import - -#endif /* Flickrgram_pch */ diff --git a/submodules/AsyncDisplayKit/examples/ASDKgram/Sample/TailLoadingNode.h b/submodules/AsyncDisplayKit/examples/ASDKgram/Sample/TailLoadingNode.h deleted file mode 100644 index ae514231f6..0000000000 --- a/submodules/AsyncDisplayKit/examples/ASDKgram/Sample/TailLoadingNode.h +++ /dev/null @@ -1,17 +0,0 @@ -// -// TailLoadingNode.h -// Texture -// -// Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -/** - * A node that shows a UIActivityIndicatorView, useful for putting at the end of a - * list while the next page is loading. - */ -@interface TailLoadingNode : ASCellNode - -@end diff --git a/submodules/AsyncDisplayKit/examples/ASDKgram/Sample/TailLoadingNode.m b/submodules/AsyncDisplayKit/examples/ASDKgram/Sample/TailLoadingNode.m deleted file mode 100644 index 63c462ab98..0000000000 --- a/submodules/AsyncDisplayKit/examples/ASDKgram/Sample/TailLoadingNode.m +++ /dev/null @@ -1,54 +0,0 @@ -// -// TailLoadingNode.m -// Texture -// -// Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import "TailLoadingNode.h" - -#import "Availability.h" - -@interface TailLoadingNode () -@property (nonatomic, strong) ASDisplayNode *activityIndicatorNode; -@end - -@implementation TailLoadingNode - -- (instancetype)init -{ - if (self = [super init]) { - self.automaticallyManagesSubnodes = YES; - - _activityIndicatorNode = [[ASDisplayNode alloc] initWithViewBlock:^{ - UIActivityIndicatorView *v = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleGray]; - [v startAnimating]; - return v; - }]; - self.style.height = ASDimensionMake(100); - - [self setupYogaLayoutIfNeeded]; - } - return self; -} -#if !YOGA_LAYOUT -- (ASLayoutSpec *)layoutSpecThatFits:(ASSizeRange)constrainedSize -{ - return [ASCenterLayoutSpec centerLayoutSpecWithCenteringOptions:ASCenterLayoutSpecCenteringXY sizingOptions:ASCenterLayoutSpecSizingOptionMinimumXY child:self.activityIndicatorNode]; -} -#endif - -- (void)setupYogaLayoutIfNeeded -{ -#if YOGA_LAYOUT - [self.style yogaNodeCreateIfNeeded]; - [self.activityIndicatorNode.style yogaNodeCreateIfNeeded]; - [self addYogaChild:self.activityIndicatorNode]; - - self.style.justifyContent = ASStackLayoutJustifyContentCenter; - self.style.alignItems = ASStackLayoutAlignItemsCenter; -#endif -} - -@end diff --git a/submodules/AsyncDisplayKit/examples/ASDKgram/Sample/TextureConfigDelegate.m b/submodules/AsyncDisplayKit/examples/ASDKgram/Sample/TextureConfigDelegate.m deleted file mode 100644 index b6a2ae9717..0000000000 --- a/submodules/AsyncDisplayKit/examples/ASDKgram/Sample/TextureConfigDelegate.m +++ /dev/null @@ -1,37 +0,0 @@ -// -// TextureConfigDelegate.m -// Texture -// -// Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -@interface TextureConfigDelegate : NSObject - -@end - -@implementation ASConfiguration (UserProvided) - -+ (ASConfiguration *)textureConfiguration -{ - ASConfiguration *config = [[ASConfiguration alloc] init]; - config.experimentalFeatures = ASExperimentalGraphicsContexts | ASExperimentalTextNode; - config.delegate = [[TextureConfigDelegate alloc] init]; - return config; -} - -@end - -@implementation TextureConfigDelegate - -- (void)textureDidActivateExperimentalFeatures:(ASExperimentalFeatures)features -{ - if (features & ASExperimentalGraphicsContexts) { - NSLog(@"Texture activated experimental graphics contexts."); - } -} - -@end - diff --git a/submodules/AsyncDisplayKit/examples/ASDKgram/Sample/UserModel.h b/submodules/AsyncDisplayKit/examples/ASDKgram/Sample/UserModel.h deleted file mode 100644 index 299ddb1869..0000000000 --- a/submodules/AsyncDisplayKit/examples/ASDKgram/Sample/UserModel.h +++ /dev/null @@ -1,38 +0,0 @@ -// -// UserModel.h -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -@interface UserModel : NSObject - -@property (nonatomic, strong, readonly) NSDictionary *dictionaryRepresentation; -@property (nonatomic, assign, readonly) NSString *userID; -@property (nonatomic, strong, readonly) NSString *username; -@property (nonatomic, strong, readonly) NSString *firstName; -@property (nonatomic, strong, readonly) NSString *lastName; -@property (nonatomic, strong, readonly) NSString *fullName; -@property (nonatomic, strong, readonly) NSString *location; -@property (nonatomic, strong, readonly) NSString *about; -@property (nonatomic, strong, readonly) NSURL *userPicURL; -@property (nonatomic, assign, readonly) NSUInteger photoCount; -@property (nonatomic, assign, readonly) NSUInteger galleriesCount; -@property (nonatomic, assign, readonly) NSUInteger affection; -@property (nonatomic, assign, readonly) NSUInteger friendsCount; -@property (nonatomic, assign, readonly) NSUInteger followersCount; -@property (nonatomic, assign, readonly) BOOL following; - -- (instancetype)init NS_UNAVAILABLE; -- (instancetype)initWithUnsplashPhoto:(NSDictionary *)dictionary NS_DESIGNATED_INITIALIZER; - -- (NSAttributedString *)usernameAttributedStringWithFontSize:(CGFloat)size; -- (NSAttributedString *)fullNameAttributedStringWithFontSize:(CGFloat)size; - -- (void)fetchAvatarImageWithCompletionBlock:(void(^)(UserModel *, UIImage *))block; - -- (void)downloadCompleteUserDataWithCompletionBlock:(void(^)(UserModel *))block; - -@end diff --git a/submodules/AsyncDisplayKit/examples/ASDKgram/Sample/UserModel.m b/submodules/AsyncDisplayKit/examples/ASDKgram/Sample/UserModel.m deleted file mode 100644 index 53e3626026..0000000000 --- a/submodules/AsyncDisplayKit/examples/ASDKgram/Sample/UserModel.m +++ /dev/null @@ -1,167 +0,0 @@ -// -// UserModel.m -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import "UserModel.h" -#import "Utilities.h" - -@implementation UserModel -{ - BOOL _fullUserInfoFetchRequested; - BOOL _fullUserInfoFetchDone; - void (^_fullUserInfoCompletionBlock)(UserModel *); -} - -#pragma mark - Lifecycle - -- (instancetype)initWithUnsplashPhoto:(NSDictionary *)dictionary -{ - self = [super init]; - - if (self) { - _fullUserInfoFetchRequested = NO; - _fullUserInfoFetchDone = NO; - - [self loadUserDataFromDictionary:dictionary]; - } - - return self; -} - -#pragma mark - Instance Methods - -- (NSAttributedString *)usernameAttributedStringWithFontSize:(CGFloat)size -{ - return [NSAttributedString attributedStringWithString:self.username fontSize:size color:[UIColor darkBlueColor] firstWordColor:nil]; -} - -- (NSAttributedString *)fullNameAttributedStringWithFontSize:(CGFloat)size -{ - return [NSAttributedString attributedStringWithString:self.fullName fontSize:size color:[UIColor lightGrayColor] firstWordColor:nil]; -} - -- (void)fetchAvatarImageWithCompletionBlock:(void(^)(UserModel *, UIImage *))block -{ - dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{ - - NSURLSession *session = [NSURLSession sessionWithConfiguration:[NSURLSessionConfiguration ephemeralSessionConfiguration]]; - NSURLSessionDataTask *task = [session dataTaskWithURL:_userPicURL completionHandler:^(NSData * _Nullable data, NSURLResponse * _Nullable response, NSError * _Nullable error) { - if (data) { - UIImage *image = [UIImage imageWithData:data]; - - dispatch_async(dispatch_get_main_queue(), ^{ - if (block) { - block(self, image); - } - }); - } - }]; - [task resume]; - }); -} - -- (void)downloadCompleteUserDataWithCompletionBlock:(void(^)(UserModel *))block; -{ - if (_fullUserInfoFetchDone) { - NSAssert(!_fullUserInfoCompletionBlock, @"Should not have a waiting block at this point"); - // complete user info fetch complete - excute completion block - if (block) { - block(self); - } - - } else { - NSAssert(!_fullUserInfoCompletionBlock, @"Should not have a waiting block at this point"); - // set completion block - _fullUserInfoCompletionBlock = block; - - if (!_fullUserInfoFetchRequested) { - // if fetch not in progress, beging - [self fetchCompleteUserData]; - } - } -} - -- (NSString *)description -{ - return [NSString stringWithFormat:@"%@", self.dictionaryRepresentation]; -} - -#pragma mark - Helper Methods - -- (void)fetchCompleteUserData -{ - _fullUserInfoFetchRequested = YES; - - dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{ - - // fetch JSON data from server - NSString *urlString = [NSString stringWithFormat:@"https://api.500px.com/v1/users/show?id=%@&consumer_key=Fi13GVb8g53sGvHICzlram7QkKOlSDmAmp9s9aqC", _userID]; - - NSURL *url = [NSURL URLWithString:urlString]; - NSURLSession *session = [NSURLSession sessionWithConfiguration:[NSURLSessionConfiguration ephemeralSessionConfiguration]]; - NSURLSessionDataTask *task = [session dataTaskWithURL:url completionHandler:^(NSData * _Nullable data, NSURLResponse * _Nullable response, NSError * _Nullable error) { - if (data) { - NSDictionary *response = [NSJSONSerialization JSONObjectWithData:data options:0 error:nil]; - - // parse JSON data - if ([response isKindOfClass:[NSDictionary class]]) { - [self loadUserDataFromDictionary:response]; - } - - dispatch_async(dispatch_get_main_queue(), ^{ - _fullUserInfoFetchDone = YES; - - if (_fullUserInfoCompletionBlock) { - _fullUserInfoCompletionBlock(self); - - // IT IS ESSENTIAL to nil the block, as it retains a view controller BECAUSE it uses an instance variable which - // means that self is retained. It could continue to live on forever - // If we don't release this. - _fullUserInfoCompletionBlock = nil; - } - }); - } - }]; - [task resume]; - }); -} - -- (void)loadUserDataFromDictionary:(NSDictionary *)dictionary -{ - NSDictionary *userDictionary = [dictionary objectForKey:@"user"]; - if (![userDictionary isKindOfClass:[NSDictionary class]]) { - return; - } - - _userID = [self guardJSONElement:[userDictionary objectForKey:@"id"]]; - _username = [[self guardJSONElement:[userDictionary objectForKey:@"username"]] lowercaseString]; - - if (_username == nil) { - _username = @"Anonymous"; - } - - _firstName = [self guardJSONElement:[userDictionary objectForKey:@"first_name"]]; - _lastName = [self guardJSONElement:[userDictionary objectForKey:@"last_name"]]; - _fullName = [self guardJSONElement:[userDictionary objectForKey:@"name"]]; - _location = [self guardJSONElement:[userDictionary objectForKey:@"location"]]; - _about = [self guardJSONElement:[userDictionary objectForKey:@"bio"]]; - _photoCount = [[self guardJSONElement:[userDictionary objectForKey:@"total_photos"]] integerValue]; - _galleriesCount = [[self guardJSONElement:[userDictionary objectForKey:@"total_collections"]] integerValue]; - _dictionaryRepresentation = userDictionary; - - NSString *urlString = [self guardJSONElement:[userDictionary objectForKey:@"profile_image"][@"medium"]]; - _userPicURL = urlString ? [NSURL URLWithString:urlString] : nil; - -} - -- (id)guardJSONElement:(id)element -{ - return (element == [NSNull null]) ? nil : element; -} - -@end diff --git a/submodules/AsyncDisplayKit/examples/ASDKgram/Sample/Utilities.h b/submodules/AsyncDisplayKit/examples/ASDKgram/Sample/Utilities.h deleted file mode 100644 index 63f2ab0553..0000000000 --- a/submodules/AsyncDisplayKit/examples/ASDKgram/Sample/Utilities.h +++ /dev/null @@ -1,40 +0,0 @@ -// -// Utilities.h -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -@interface UIColor (Additions) - -+ (UIColor *)darkBlueColor; -+ (UIColor *)lightBlueColor; - -@end - -@interface UIImage (Additions) - -+ (UIImage *)followingButtonStretchableImageForCornerRadius:(CGFloat)cornerRadius following:(BOOL)followingEnabled; -+ (void)downloadImageForURL:(NSURL *)url completion:(void (^)(UIImage *))block; - -- (UIImage *)makeCircularImageWithSize:(CGSize)size; - -@end - -@interface NSString (Additions) - -// returns a user friendly elapsed time such as '50s', '6m' or '3w' -+ (NSString *)elapsedTimeStringSinceDate:(NSString *)uploadDateString; - -@end - -@interface NSAttributedString (Additions) - -+ (NSAttributedString *)attributedStringWithString:(NSString *)string - fontSize:(CGFloat)size - color:(UIColor *)color - firstWordColor:(UIColor *)firstWordColor; - -@end diff --git a/submodules/AsyncDisplayKit/examples/ASDKgram/Sample/Utilities.m b/submodules/AsyncDisplayKit/examples/ASDKgram/Sample/Utilities.m deleted file mode 100644 index 732c5f8171..0000000000 --- a/submodules/AsyncDisplayKit/examples/ASDKgram/Sample/Utilities.m +++ /dev/null @@ -1,294 +0,0 @@ -// -// Utilities.m -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import "Utilities.h" - -#define StrokeRoundedImages 0 - -#define IsDigit(v) (v >= '0' && v <= '9') - -static time_t parseRfc3339ToTimeT(const char *string) -{ - int dy, dm, dd; - int th, tm, ts; - int oh, om, osign; - char current; - - if (!string) - return (time_t)0; - - // date - if (sscanf(string, "%04d-%02d-%02d", &dy, &dm, &dd) == 3) { - string += 10; - - if (*string++ != 'T') - return (time_t)0; - - // time - if (sscanf(string, "%02d:%02d:%02d", &th, &tm, &ts) == 3) { - string += 8; - - current = *string; - - // optional: second fraction - if (current == '.') { - ++string; - while(IsDigit(*string)) - ++string; - - current = *string; - } - - if (current == 'Z') { - oh = om = 0; - osign = 1; - } else if (current == '-') { - ++string; - if (sscanf(string, "%02d:%02d", &oh, &om) != 2) - return (time_t)0; - osign = -1; - } else if (current == '+') { - ++string; - if (sscanf(string, "%02d:%02d", &oh, &om) != 2) - return (time_t)0; - osign = 1; - } else { - return (time_t)0; - } - - struct tm timeinfo; - timeinfo.tm_wday = timeinfo.tm_yday = 0; - timeinfo.tm_zone = NULL; - timeinfo.tm_isdst = -1; - - timeinfo.tm_year = dy - 1900; - timeinfo.tm_mon = dm - 1; - timeinfo.tm_mday = dd; - - timeinfo.tm_hour = th; - timeinfo.tm_min = tm; - timeinfo.tm_sec = ts; - - // convert to utc - return timegm(&timeinfo) - (((oh * 60 * 60) + (om * 60)) * osign); - } - } - - return (time_t)0; -} - -static NSDate *parseRfc3339ToNSDate(NSString *rfc3339DateTimeString) -{ - time_t t = parseRfc3339ToTimeT([rfc3339DateTimeString cStringUsingEncoding:NSUTF8StringEncoding]); - return [NSDate dateWithTimeIntervalSince1970:t]; -} - - -@implementation UIColor (Additions) - -+ (UIColor *)darkBlueColor -{ - return [UIColor colorWithRed:70.0/255.0 green:102.0/255.0 blue:118.0/255.0 alpha:1.0]; -} - -+ (UIColor *)lightBlueColor -{ - return [UIColor colorWithRed:70.0/255.0 green:165.0/255.0 blue:196.0/255.0 alpha:1.0]; -} - -@end - -@implementation UIImage (Additions) - -+ (UIImage *)followingButtonStretchableImageForCornerRadius:(CGFloat)cornerRadius following:(BOOL)followingEnabled -{ - CGSize unstretchedSize = CGSizeMake(2 * cornerRadius + 1, 2 * cornerRadius + 1); - CGRect rect = (CGRect) {CGPointZero, unstretchedSize}; - UIBezierPath *path = [UIBezierPath bezierPathWithRoundedRect:rect cornerRadius:cornerRadius]; - - // create a graphics context for the following status button - UIGraphicsBeginImageContextWithOptions(unstretchedSize, NO, 0); - - [path addClip]; - - if (followingEnabled) { - - [[UIColor whiteColor] setFill]; - [path fill]; - - path.lineWidth = 3; - [[UIColor lightBlueColor] setStroke]; - [path stroke]; - - } else { - - [[UIColor lightBlueColor] setFill]; - [path fill]; - } - - UIImage *followingBtnImage = UIGraphicsGetImageFromCurrentImageContext(); - UIGraphicsEndImageContext(); - - UIImage *followingBtnImageStretchable = [followingBtnImage stretchableImageWithLeftCapWidth:cornerRadius - topCapHeight:cornerRadius]; - return followingBtnImageStretchable; -} - -+ (void)downloadImageForURL:(NSURL *)url completion:(void (^)(UIImage *))block -{ - static NSCache *simpleImageCache = nil; - static dispatch_once_t onceToken; - dispatch_once(&onceToken, ^{ - simpleImageCache = [[NSCache alloc] init]; - simpleImageCache.countLimit = 10; - }); - - if (!block) { - return; - } - - // check if image is cached - UIImage *image = [simpleImageCache objectForKey:url]; - if (image) { - dispatch_async(dispatch_get_main_queue(), ^{ - block(image); - }); - } else { - // else download image - NSURLSession *session = [NSURLSession sessionWithConfiguration:[NSURLSessionConfiguration ephemeralSessionConfiguration]]; - NSURLSessionDataTask *task = [session dataTaskWithURL:url completionHandler:^(NSData * _Nullable data, NSURLResponse * _Nullable response, NSError * _Nullable error) { - if (data) { - UIImage *image = [UIImage imageWithData:data]; - dispatch_async(dispatch_get_main_queue(), ^{ - block(image); - }); - } - }]; - [task resume]; - } -} - -- (UIImage *)makeCircularImageWithSize:(CGSize)size -{ - // make a CGRect with the image's size - CGRect circleRect = (CGRect) {CGPointZero, size}; - - // begin the image context since we're not in a drawRect: - UIGraphicsBeginImageContextWithOptions(circleRect.size, NO, 0); - - // create a UIBezierPath circle - UIBezierPath *circle = [UIBezierPath bezierPathWithRoundedRect:circleRect cornerRadius:circleRect.size.width/2]; - - // clip to the circle - [circle addClip]; - - // draw the image in the circleRect *AFTER* the context is clipped - [self drawInRect:circleRect]; - - // create a border (for white background pictures) -#if StrokeRoundedImages - circle.lineWidth = 1; - [[UIColor darkGrayColor] set]; - [circle stroke]; -#endif - - // get an image from the image context - UIImage *roundedImage = UIGraphicsGetImageFromCurrentImageContext(); - - // end the image context since we're not in a drawRect: - UIGraphicsEndImageContext(); - - return roundedImage; -} - -@end - -@implementation NSString (Additions) - -/* - * Returns a user-visible date time string that corresponds to the - * specified RFC 3339 date time string. Note that this does not handle - * all possible RFC 3339 date time strings, just one of the most common - * styles. - */ -+ (NSDate *)userVisibleDateTimeStringForRFC3339DateTimeString:(NSString *)rfc3339DateTimeString -{ - return parseRfc3339ToNSDate(rfc3339DateTimeString); -} - -+ (NSString *)elapsedTimeStringSinceDate:(NSString *)uploadDateString -{ - // early return if no post date string - if (!uploadDateString) - { - return @"NO POST DATE"; - } - - NSDate *postDate = [self userVisibleDateTimeStringForRFC3339DateTimeString:uploadDateString]; - - if (!postDate) { - return @"DATE CONVERSION ERROR"; - } - - NSDate *currentDate = [NSDate date]; - - NSCalendar *calendar = [NSCalendar currentCalendar]; - - NSUInteger seconds = [[calendar components:NSCalendarUnitSecond fromDate:postDate toDate:currentDate options:0] second]; - NSUInteger minutes = [[calendar components:NSCalendarUnitMinute fromDate:postDate toDate:currentDate options:0] minute]; - NSUInteger hours = [[calendar components:NSCalendarUnitHour fromDate:postDate toDate:currentDate options:0] hour]; - NSUInteger days = [[calendar components:NSCalendarUnitDay fromDate:postDate toDate:currentDate options:0] day]; - - NSString *elapsedTime; - - if (days > 7) { - elapsedTime = [NSString stringWithFormat:@"%luw", (long)ceil(days/7.0)]; - } else if (days > 0) { - elapsedTime = [NSString stringWithFormat:@"%lud", (long)days]; - } else if (hours > 0) { - elapsedTime = [NSString stringWithFormat:@"%luh", (long)hours]; - } else if (minutes > 0) { - elapsedTime = [NSString stringWithFormat:@"%lum", (long)minutes]; - } else if (seconds > 0) { - elapsedTime = [NSString stringWithFormat:@"%lus", (long)seconds]; - } else if (seconds == 0) { - elapsedTime = @"1s"; - } else { - elapsedTime = @"ERROR"; - } - - return elapsedTime; -} - -@end - -@implementation NSAttributedString (Additions) - -+ (NSAttributedString *)attributedStringWithString:(NSString *)string fontSize:(CGFloat)size - color:(nullable UIColor *)color firstWordColor:(nullable UIColor *)firstWordColor -{ - NSMutableAttributedString *attributedString = [[NSMutableAttributedString alloc] init]; - - if (string) { - NSDictionary *attributes = @{NSForegroundColorAttributeName: color ? : [UIColor blackColor], - NSFontAttributeName: [UIFont systemFontOfSize:size]}; - attributedString = [[NSMutableAttributedString alloc] initWithString:string]; - [attributedString addAttributes:attributes range:NSMakeRange(0, string.length)]; - - if (firstWordColor) { - NSRange firstSpaceRange = [string rangeOfCharacterFromSet:[NSCharacterSet whitespaceCharacterSet]]; - NSRange firstWordRange = NSMakeRange(0, firstSpaceRange.location); - [attributedString addAttribute:NSForegroundColorAttributeName value:firstWordColor range:firstWordRange]; - } - } - - return attributedString; -} - -@end diff --git a/submodules/AsyncDisplayKit/examples/ASDKgram/Sample/WindowWithStatusBarUnderlay.h b/submodules/AsyncDisplayKit/examples/ASDKgram/Sample/WindowWithStatusBarUnderlay.h deleted file mode 100644 index d9fb31778d..0000000000 --- a/submodules/AsyncDisplayKit/examples/ASDKgram/Sample/WindowWithStatusBarUnderlay.h +++ /dev/null @@ -1,14 +0,0 @@ -// -// WindowWithStatusBarUnderlay.h -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - - -// this subclass is neccessary to make the status bar have an opaque, colored background -@interface WindowWithStatusBarUnderlay : UIWindow - -@end diff --git a/submodules/AsyncDisplayKit/examples/ASDKgram/Sample/WindowWithStatusBarUnderlay.m b/submodules/AsyncDisplayKit/examples/ASDKgram/Sample/WindowWithStatusBarUnderlay.m deleted file mode 100644 index 91670c2985..0000000000 --- a/submodules/AsyncDisplayKit/examples/ASDKgram/Sample/WindowWithStatusBarUnderlay.m +++ /dev/null @@ -1,41 +0,0 @@ -// -// WindowWithStatusBarUnderlay.m -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import "WindowWithStatusBarUnderlay.h" -#import "Utilities.h" - -@implementation WindowWithStatusBarUnderlay -{ - UIView *_statusBarOpaqueUnderlayView; -} - --(instancetype)initWithFrame:(CGRect)frame -{ - self = [super initWithFrame:frame]; - if (self) { - _statusBarOpaqueUnderlayView = [[UIView alloc] init]; - _statusBarOpaqueUnderlayView.backgroundColor = [UIColor darkBlueColor]; - [self addSubview:_statusBarOpaqueUnderlayView]; - } - return self; -} - --(void)layoutSubviews -{ - [super layoutSubviews]; - - [self bringSubviewToFront:_statusBarOpaqueUnderlayView]; - - CGRect statusBarFrame = CGRectZero; - statusBarFrame.size.width = [[UIScreen mainScreen] bounds].size.width; - statusBarFrame.size.height = [[UIApplication sharedApplication] statusBarFrame].size.height; - _statusBarOpaqueUnderlayView.frame = statusBarFrame; -} - -@end diff --git a/submodules/AsyncDisplayKit/examples/ASDKgram/Sample/main.m b/submodules/AsyncDisplayKit/examples/ASDKgram/Sample/main.m deleted file mode 100644 index fb6be69952..0000000000 --- a/submodules/AsyncDisplayKit/examples/ASDKgram/Sample/main.m +++ /dev/null @@ -1,16 +0,0 @@ -// -// main.m -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import "AppDelegate.h" - -int main(int argc, char * argv[]) { - @autoreleasepool { - return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); - } -} diff --git a/submodules/AsyncDisplayKit/examples/ASDKgram/Sample/tabBarIcons/camera.png b/submodules/AsyncDisplayKit/examples/ASDKgram/Sample/tabBarIcons/camera.png deleted file mode 100644 index 2eeecba825..0000000000 Binary files a/submodules/AsyncDisplayKit/examples/ASDKgram/Sample/tabBarIcons/camera.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/examples/ASDKgram/Sample/tabBarIcons/camera@2x.png b/submodules/AsyncDisplayKit/examples/ASDKgram/Sample/tabBarIcons/camera@2x.png deleted file mode 100644 index c1ea4ab857..0000000000 Binary files a/submodules/AsyncDisplayKit/examples/ASDKgram/Sample/tabBarIcons/camera@2x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/examples/ASDKgram/Sample/tabBarIcons/cameraRaw.png b/submodules/AsyncDisplayKit/examples/ASDKgram/Sample/tabBarIcons/cameraRaw.png deleted file mode 100644 index dbf13aa13d..0000000000 Binary files a/submodules/AsyncDisplayKit/examples/ASDKgram/Sample/tabBarIcons/cameraRaw.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/examples/ASDKgram/Sample/tabBarIcons/earth.png b/submodules/AsyncDisplayKit/examples/ASDKgram/Sample/tabBarIcons/earth.png deleted file mode 100644 index c182ea5565..0000000000 Binary files a/submodules/AsyncDisplayKit/examples/ASDKgram/Sample/tabBarIcons/earth.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/examples/ASDKgram/Sample/tabBarIcons/earth@2x.png b/submodules/AsyncDisplayKit/examples/ASDKgram/Sample/tabBarIcons/earth@2x.png deleted file mode 100644 index b8049a5004..0000000000 Binary files a/submodules/AsyncDisplayKit/examples/ASDKgram/Sample/tabBarIcons/earth@2x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/examples/ASDKgram/Sample/tabBarIcons/home.png b/submodules/AsyncDisplayKit/examples/ASDKgram/Sample/tabBarIcons/home.png deleted file mode 100644 index b88cd66a4b..0000000000 Binary files a/submodules/AsyncDisplayKit/examples/ASDKgram/Sample/tabBarIcons/home.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/examples/ASDKgram/Sample/tabBarIcons/home@2x.png b/submodules/AsyncDisplayKit/examples/ASDKgram/Sample/tabBarIcons/home@2x.png deleted file mode 100644 index 838e660097..0000000000 Binary files a/submodules/AsyncDisplayKit/examples/ASDKgram/Sample/tabBarIcons/home@2x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/examples/ASDKgram/Sample/tabBarIcons/homeRaw.png b/submodules/AsyncDisplayKit/examples/ASDKgram/Sample/tabBarIcons/homeRaw.png deleted file mode 100644 index 09aa24c157..0000000000 Binary files a/submodules/AsyncDisplayKit/examples/ASDKgram/Sample/tabBarIcons/homeRaw.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/examples/ASDKgram/Sample/tabBarIcons/profile.png b/submodules/AsyncDisplayKit/examples/ASDKgram/Sample/tabBarIcons/profile.png deleted file mode 100644 index d885b3aedf..0000000000 Binary files a/submodules/AsyncDisplayKit/examples/ASDKgram/Sample/tabBarIcons/profile.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/examples/ASDKgram/Sample/tabBarIcons/profile@2x.png b/submodules/AsyncDisplayKit/examples/ASDKgram/Sample/tabBarIcons/profile@2x.png deleted file mode 100644 index 81352fe0cb..0000000000 Binary files a/submodules/AsyncDisplayKit/examples/ASDKgram/Sample/tabBarIcons/profile@2x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/examples/ASDKgram/Sample/tabBarIcons/profileRaw.png b/submodules/AsyncDisplayKit/examples/ASDKgram/Sample/tabBarIcons/profileRaw.png deleted file mode 100644 index 0d2894d0ab..0000000000 Binary files a/submodules/AsyncDisplayKit/examples/ASDKgram/Sample/tabBarIcons/profileRaw.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/examples/ASDKgram/tabBarIcons/camera.png b/submodules/AsyncDisplayKit/examples/ASDKgram/tabBarIcons/camera.png deleted file mode 100644 index 2eeecba825..0000000000 Binary files a/submodules/AsyncDisplayKit/examples/ASDKgram/tabBarIcons/camera.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/examples/ASDKgram/tabBarIcons/camera@2x.png b/submodules/AsyncDisplayKit/examples/ASDKgram/tabBarIcons/camera@2x.png deleted file mode 100644 index c1ea4ab857..0000000000 Binary files a/submodules/AsyncDisplayKit/examples/ASDKgram/tabBarIcons/camera@2x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/examples/ASDKgram/tabBarIcons/cameraRaw.png b/submodules/AsyncDisplayKit/examples/ASDKgram/tabBarIcons/cameraRaw.png deleted file mode 100644 index dbf13aa13d..0000000000 Binary files a/submodules/AsyncDisplayKit/examples/ASDKgram/tabBarIcons/cameraRaw.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/examples/ASDKgram/tabBarIcons/earth.png b/submodules/AsyncDisplayKit/examples/ASDKgram/tabBarIcons/earth.png deleted file mode 100644 index c182ea5565..0000000000 Binary files a/submodules/AsyncDisplayKit/examples/ASDKgram/tabBarIcons/earth.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/examples/ASDKgram/tabBarIcons/earth@2x.png b/submodules/AsyncDisplayKit/examples/ASDKgram/tabBarIcons/earth@2x.png deleted file mode 100644 index b8049a5004..0000000000 Binary files a/submodules/AsyncDisplayKit/examples/ASDKgram/tabBarIcons/earth@2x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/examples/ASDKgram/tabBarIcons/home.png b/submodules/AsyncDisplayKit/examples/ASDKgram/tabBarIcons/home.png deleted file mode 100644 index b88cd66a4b..0000000000 Binary files a/submodules/AsyncDisplayKit/examples/ASDKgram/tabBarIcons/home.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/examples/ASDKgram/tabBarIcons/home@2x.png b/submodules/AsyncDisplayKit/examples/ASDKgram/tabBarIcons/home@2x.png deleted file mode 100644 index 838e660097..0000000000 Binary files a/submodules/AsyncDisplayKit/examples/ASDKgram/tabBarIcons/home@2x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/examples/ASDKgram/tabBarIcons/homeRaw.png b/submodules/AsyncDisplayKit/examples/ASDKgram/tabBarIcons/homeRaw.png deleted file mode 100644 index 09aa24c157..0000000000 Binary files a/submodules/AsyncDisplayKit/examples/ASDKgram/tabBarIcons/homeRaw.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/examples/ASDKgram/tabBarIcons/profile.png b/submodules/AsyncDisplayKit/examples/ASDKgram/tabBarIcons/profile.png deleted file mode 100644 index d885b3aedf..0000000000 Binary files a/submodules/AsyncDisplayKit/examples/ASDKgram/tabBarIcons/profile.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/examples/ASDKgram/tabBarIcons/profile@2x.png b/submodules/AsyncDisplayKit/examples/ASDKgram/tabBarIcons/profile@2x.png deleted file mode 100644 index 81352fe0cb..0000000000 Binary files a/submodules/AsyncDisplayKit/examples/ASDKgram/tabBarIcons/profile@2x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/examples/ASDKgram/tabBarIcons/profileRaw.png b/submodules/AsyncDisplayKit/examples/ASDKgram/tabBarIcons/profileRaw.png deleted file mode 100644 index 0d2894d0ab..0000000000 Binary files a/submodules/AsyncDisplayKit/examples/ASDKgram/tabBarIcons/profileRaw.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/examples/ASMapNode/Podfile b/submodules/AsyncDisplayKit/examples/ASMapNode/Podfile deleted file mode 100644 index 08d1b7add6..0000000000 --- a/submodules/AsyncDisplayKit/examples/ASMapNode/Podfile +++ /dev/null @@ -1,6 +0,0 @@ -source 'https://github.com/CocoaPods/Specs.git' -platform :ios, '9.0' -target 'Sample' do - pod 'Texture', :path => '../..' -end - diff --git a/submodules/AsyncDisplayKit/examples/ASMapNode/Sample/AppDelegate.h b/submodules/AsyncDisplayKit/examples/ASMapNode/Sample/AppDelegate.h deleted file mode 100644 index 8d58a13cbe..0000000000 --- a/submodules/AsyncDisplayKit/examples/ASMapNode/Sample/AppDelegate.h +++ /dev/null @@ -1,18 +0,0 @@ -// -// AppDelegate.h -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -@interface AppDelegate : UIResponder - -@property (strong, nonatomic) UIWindow *window; - - -@end - diff --git a/submodules/AsyncDisplayKit/examples/ASMapNode/Sample/AppDelegate.m b/submodules/AsyncDisplayKit/examples/ASMapNode/Sample/AppDelegate.m deleted file mode 100644 index cae730c64e..0000000000 --- a/submodules/AsyncDisplayKit/examples/ASMapNode/Sample/AppDelegate.m +++ /dev/null @@ -1,30 +0,0 @@ -// -// AppDelegate.m -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import "AppDelegate.h" -#import "ViewController.h" - -@interface AppDelegate () - -@end - -@implementation AppDelegate - -- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions -{ - // Override point for customization after application launch. - self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; - self.window.backgroundColor = [UIColor whiteColor]; - self.window.rootViewController = [[UINavigationController alloc] initWithRootViewController:[ViewController new]]; - [self.window makeKeyAndVisible]; - - return YES; -} - -@end diff --git a/submodules/AsyncDisplayKit/examples/ASMapNode/Sample/Assets.xcassets/AppIcon.appiconset/Contents.json b/submodules/AsyncDisplayKit/examples/ASMapNode/Sample/Assets.xcassets/AppIcon.appiconset/Contents.json deleted file mode 100644 index 118c98f746..0000000000 --- a/submodules/AsyncDisplayKit/examples/ASMapNode/Sample/Assets.xcassets/AppIcon.appiconset/Contents.json +++ /dev/null @@ -1,38 +0,0 @@ -{ - "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" - } -} \ No newline at end of file diff --git a/submodules/AsyncDisplayKit/examples/ASMapNode/Sample/Assets.xcassets/Contents.json b/submodules/AsyncDisplayKit/examples/ASMapNode/Sample/Assets.xcassets/Contents.json deleted file mode 100644 index da4a164c91..0000000000 --- a/submodules/AsyncDisplayKit/examples/ASMapNode/Sample/Assets.xcassets/Contents.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "info" : { - "version" : 1, - "author" : "xcode" - } -} \ No newline at end of file diff --git a/submodules/AsyncDisplayKit/examples/ASMapNode/Sample/Assets.xcassets/Hill.imageset/Contents.json b/submodules/AsyncDisplayKit/examples/ASMapNode/Sample/Assets.xcassets/Hill.imageset/Contents.json deleted file mode 100644 index 273884cba6..0000000000 --- a/submodules/AsyncDisplayKit/examples/ASMapNode/Sample/Assets.xcassets/Hill.imageset/Contents.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "images" : [ - { - "idiom" : "universal", - "filename" : "hill.png", - "scale" : "1x" - }, - { - "idiom" : "universal", - "filename" : "hill@2x.png", - "scale" : "2x" - }, - { - "idiom" : "universal", - "filename" : "hill@3x.png", - "scale" : "3x" - } - ], - "info" : { - "version" : 1, - "author" : "xcode" - } -} \ No newline at end of file diff --git a/submodules/AsyncDisplayKit/examples/ASMapNode/Sample/Assets.xcassets/Hill.imageset/hill.png b/submodules/AsyncDisplayKit/examples/ASMapNode/Sample/Assets.xcassets/Hill.imageset/hill.png deleted file mode 100644 index 8998668eb0..0000000000 Binary files a/submodules/AsyncDisplayKit/examples/ASMapNode/Sample/Assets.xcassets/Hill.imageset/hill.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/examples/ASMapNode/Sample/Assets.xcassets/Hill.imageset/hill@2x.png b/submodules/AsyncDisplayKit/examples/ASMapNode/Sample/Assets.xcassets/Hill.imageset/hill@2x.png deleted file mode 100644 index d64af0dd9d..0000000000 Binary files a/submodules/AsyncDisplayKit/examples/ASMapNode/Sample/Assets.xcassets/Hill.imageset/hill@2x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/examples/ASMapNode/Sample/Assets.xcassets/Hill.imageset/hill@3x.png b/submodules/AsyncDisplayKit/examples/ASMapNode/Sample/Assets.xcassets/Hill.imageset/hill@3x.png deleted file mode 100644 index 761c66684a..0000000000 Binary files a/submodules/AsyncDisplayKit/examples/ASMapNode/Sample/Assets.xcassets/Hill.imageset/hill@3x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/examples/ASMapNode/Sample/Assets.xcassets/Water.imageset/Contents.json b/submodules/AsyncDisplayKit/examples/ASMapNode/Sample/Assets.xcassets/Water.imageset/Contents.json deleted file mode 100644 index f54c1c3b60..0000000000 --- a/submodules/AsyncDisplayKit/examples/ASMapNode/Sample/Assets.xcassets/Water.imageset/Contents.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "images" : [ - { - "idiom" : "universal", - "filename" : "water.png", - "scale" : "1x" - }, - { - "idiom" : "universal", - "filename" : "water@2x.png", - "scale" : "2x" - }, - { - "idiom" : "universal", - "filename" : "water@3x.png", - "scale" : "3x" - } - ], - "info" : { - "version" : 1, - "author" : "xcode" - } -} \ No newline at end of file diff --git a/submodules/AsyncDisplayKit/examples/ASMapNode/Sample/Assets.xcassets/Water.imageset/water.png b/submodules/AsyncDisplayKit/examples/ASMapNode/Sample/Assets.xcassets/Water.imageset/water.png deleted file mode 100644 index cdff6fd035..0000000000 Binary files a/submodules/AsyncDisplayKit/examples/ASMapNode/Sample/Assets.xcassets/Water.imageset/water.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/examples/ASMapNode/Sample/Assets.xcassets/Water.imageset/water@2x.png b/submodules/AsyncDisplayKit/examples/ASMapNode/Sample/Assets.xcassets/Water.imageset/water@2x.png deleted file mode 100644 index 2cd019f20c..0000000000 Binary files a/submodules/AsyncDisplayKit/examples/ASMapNode/Sample/Assets.xcassets/Water.imageset/water@2x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/examples/ASMapNode/Sample/Assets.xcassets/Water.imageset/water@3x.png b/submodules/AsyncDisplayKit/examples/ASMapNode/Sample/Assets.xcassets/Water.imageset/water@3x.png deleted file mode 100644 index e45cd67f2d..0000000000 Binary files a/submodules/AsyncDisplayKit/examples/ASMapNode/Sample/Assets.xcassets/Water.imageset/water@3x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/examples/ASMapNode/Sample/Base.lproj/LaunchScreen.storyboard b/submodules/AsyncDisplayKit/examples/ASMapNode/Sample/Base.lproj/LaunchScreen.storyboard deleted file mode 100644 index f4fc7f7736..0000000000 --- a/submodules/AsyncDisplayKit/examples/ASMapNode/Sample/Base.lproj/LaunchScreen.storyboard +++ /dev/null @@ -1,27 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/submodules/AsyncDisplayKit/examples/ASMapNode/Sample/CustomMapAnnotation.h b/submodules/AsyncDisplayKit/examples/ASMapNode/Sample/CustomMapAnnotation.h deleted file mode 100644 index 22e62ab7e4..0000000000 --- a/submodules/AsyncDisplayKit/examples/ASMapNode/Sample/CustomMapAnnotation.h +++ /dev/null @@ -1,20 +0,0 @@ -// -// CustomMapAnnotation.h -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import -#import - -@interface CustomMapAnnotation : NSObject - -@property (assign, nonatomic) CLLocationCoordinate2D coordinate; -@property (copy, nonatomic, nullable) UIImage *image; -@property (copy, nonatomic, nullable) NSString *title; -@property (copy, nonatomic, nullable) NSString *subtitle; - -@end diff --git a/submodules/AsyncDisplayKit/examples/ASMapNode/Sample/CustomMapAnnotation.m b/submodules/AsyncDisplayKit/examples/ASMapNode/Sample/CustomMapAnnotation.m deleted file mode 100644 index c6843dcc3c..0000000000 --- a/submodules/AsyncDisplayKit/examples/ASMapNode/Sample/CustomMapAnnotation.m +++ /dev/null @@ -1,14 +0,0 @@ -// -// CustomMapAnnotation.m -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import "CustomMapAnnotation.h" - -@implementation CustomMapAnnotation - -@end diff --git a/submodules/AsyncDisplayKit/examples/ASMapNode/Sample/Info.plist b/submodules/AsyncDisplayKit/examples/ASMapNode/Sample/Info.plist deleted file mode 100644 index 6105445463..0000000000 --- a/submodules/AsyncDisplayKit/examples/ASMapNode/Sample/Info.plist +++ /dev/null @@ -1,43 +0,0 @@ - - - - - CFBundleDevelopmentRegion - en - CFBundleExecutable - $(EXECUTABLE_NAME) - CFBundleIdentifier - $(PRODUCT_BUNDLE_IDENTIFIER) - CFBundleInfoDictionaryVersion - 6.0 - CFBundleName - $(PRODUCT_NAME) - CFBundlePackageType - APPL - CFBundleShortVersionString - 1.0 - CFBundleSignature - ???? - CFBundleVersion - 1 - LSRequiresIPhoneOS - - NSAppTransportSecurity - - NSAllowsArbitraryLoads - - - UILaunchStoryboardName - LaunchScreen - UIRequiredDeviceCapabilities - - armv7 - - UISupportedInterfaceOrientations - - UIInterfaceOrientationPortrait - UIInterfaceOrientationLandscapeLeft - UIInterfaceOrientationLandscapeRight - - - diff --git a/submodules/AsyncDisplayKit/examples/ASMapNode/Sample/MapHandlerNode.h b/submodules/AsyncDisplayKit/examples/ASMapNode/Sample/MapHandlerNode.h deleted file mode 100644 index 46a4d74686..0000000000 --- a/submodules/AsyncDisplayKit/examples/ASMapNode/Sample/MapHandlerNode.h +++ /dev/null @@ -1,16 +0,0 @@ -// -// MapHandlerNode.h -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -@interface MapHandlerNode : ASDisplayNode - - -@end - diff --git a/submodules/AsyncDisplayKit/examples/ASMapNode/Sample/MapHandlerNode.m b/submodules/AsyncDisplayKit/examples/ASMapNode/Sample/MapHandlerNode.m deleted file mode 100644 index 9226253a10..0000000000 --- a/submodules/AsyncDisplayKit/examples/ASMapNode/Sample/MapHandlerNode.m +++ /dev/null @@ -1,335 +0,0 @@ -// -// MapHandlerNode.m -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import "MapHandlerNode.h" -#import "CustomMapAnnotation.h" - -#import -#import - -@interface MapHandlerNode () - -@property (nonatomic, strong) ASEditableTextNode *latEditableNode; -@property (nonatomic, strong) ASEditableTextNode *lonEditableNode; -@property (nonatomic, strong) ASEditableTextNode *deltaLatEditableNode; -@property (nonatomic, strong) ASEditableTextNode *deltaLonEditableNode; -@property (nonatomic, strong) ASButtonNode *updateRegionButton; -@property (nonatomic, strong) ASButtonNode *liveMapToggleButton; -@property (nonatomic, strong) ASMapNode *mapNode; - -@end - -@implementation MapHandlerNode - -#pragma mark - Lifecycle - -- (instancetype)init -{ - if (!(self = [super init])) - return nil; - - self.automaticallyManagesSubnodes = YES; - - _mapNode = [[ASMapNode alloc] init]; - _mapNode.mapDelegate = self; - - _latEditableNode = [[ASEditableTextNode alloc] init]; - _lonEditableNode = [[ASEditableTextNode alloc] init]; - _deltaLatEditableNode = [[ASEditableTextNode alloc] init]; - _deltaLonEditableNode = [[ASEditableTextNode alloc] init]; - - _updateRegionButton = [[ASButtonNode alloc] init]; - _liveMapToggleButton = [[ASButtonNode alloc] init]; - - UIImage *backgroundImage = [UIImage as_resizableRoundedImageWithCornerRadius:5 - cornerColor:[UIColor whiteColor] - fillColor:[UIColor lightGrayColor]]; - - UIImage *backgroundHiglightedImage = [UIImage as_resizableRoundedImageWithCornerRadius:5 - cornerColor:[UIColor whiteColor] - fillColor:[[UIColor lightGrayColor] colorWithAlphaComponent:0.4] - borderColor:[UIColor lightGrayColor] - borderWidth:2.0]; - - [_updateRegionButton setBackgroundImage:backgroundImage forState:UIControlStateNormal]; - [_updateRegionButton setBackgroundImage:backgroundHiglightedImage forState:UIControlStateHighlighted]; - - [_liveMapToggleButton setBackgroundImage:backgroundImage forState:UIControlStateNormal]; - [_liveMapToggleButton setBackgroundImage:backgroundHiglightedImage forState:UIControlStateHighlighted]; - - _updateRegionButton.contentEdgeInsets = UIEdgeInsetsMake(5, 5, 5, 5); - [_updateRegionButton setTitle:@"Update Region" withFont:nil withColor:[UIColor blueColor] forState:UIControlStateNormal]; - - [_updateRegionButton addTarget:self action:@selector(updateRegion) forControlEvents:ASControlNodeEventTouchUpInside]; - - [_liveMapToggleButton setTitle:[self liveMapStr] withFont:nil withColor:[UIColor blueColor] forState:UIControlStateNormal]; - - [_liveMapToggleButton addTarget:self action:@selector(toggleLiveMap) forControlEvents:ASControlNodeEventTouchUpInside]; - - return self; -} - -- (void)didLoad -{ - [super didLoad]; - - [self configureEditableNodes:_latEditableNode]; - [self configureEditableNodes:_lonEditableNode]; - [self configureEditableNodes:_deltaLatEditableNode]; - [self configureEditableNodes:_deltaLonEditableNode]; - - [self updateLocationTextWithMKCoordinateRegion:_mapNode.region]; - - // avoiding retain cycles - __weak MapHandlerNode *weakSelf = self; - - self.mapNode.imageForStaticMapAnnotationBlock = ^UIImage *(id annotation, CGPoint *centerOffset){ - MapHandlerNode *grabbedSelf = weakSelf; - if (grabbedSelf) { - if ([annotation isKindOfClass:[CustomMapAnnotation class]]) { - CustomMapAnnotation *customAnnotation = (CustomMapAnnotation *)annotation; - return customAnnotation.image; - } - } - return nil; - }; - - [self addAnnotations]; -} - -/** - * ------------------------------------ASStackLayoutSpec----------------------------------- - * | ---------------------------------ASInsetLayoutSpec-------------------------------- | - * | | ------------------------------ASStackLayoutSpec----------------------------- | | - * | | | ---------------------------ASStackLayoutSpec-------------------------- | | | - * | | | | -----------------ASStackLayoutSpec---------------- | | | | - * | | | | | --------------ASStackLayoutSpec------------- | | | | | - * | | | | | | ASEditableTextNode ASEditableTextNode | | | | | | - * | | | | | -------------------------------------------- | | | | | - * | | | | | --------------ASStackLayoutSpec------------- | ASButtonNode | | | | - * | | | | | | ASEditableTextNode ASEditableTextNode | | | | | | - * | | | | | -------------------------------------------- | | | | | - * | | | | -------------------------------------------------- | | | | - * | | | ---------------------------------------------------------------------- | | | - * | | | ASButtonNode | | | - * | | ---------------------------------------------------------------------------- | | - * | ---------------------------------------------------------------------------------- | - * | ASMapNode | - * ---------------------------------------------------------------------------------------- - * - * This diagram was created by setting a breakpoint on the returned `layoutSpec` - * and calling "po [layoutSpec asciiArtString]" in the debugger. - */ -#define SPACING 5 -#define HEIGHT 30 -- (ASLayoutSpec *)layoutSpecThatFits:(ASSizeRange)constrainedSize -{ - _latEditableNode.style.width = ASDimensionMake(@"50%"); - _lonEditableNode.style.width = ASDimensionMake(@"50%"); - _deltaLatEditableNode.style.width = ASDimensionMake(@"50%"); - _deltaLonEditableNode.style.width = ASDimensionMake(@"50%"); - - _liveMapToggleButton.style.maxHeight = ASDimensionMake(HEIGHT); - - _mapNode.style.flexGrow = 1.0; - - ASStackLayoutSpec *lonlatSpec = [ASStackLayoutSpec stackLayoutSpecWithDirection:ASStackLayoutDirectionHorizontal - spacing:SPACING - justifyContent:ASStackLayoutJustifyContentStart - alignItems:ASStackLayoutAlignItemsCenter - children:@[_latEditableNode, _lonEditableNode]]; - - ASStackLayoutSpec *deltaLonlatSpec = [ASStackLayoutSpec stackLayoutSpecWithDirection:ASStackLayoutDirectionHorizontal - spacing:SPACING - justifyContent:ASStackLayoutJustifyContentSpaceBetween - alignItems:ASStackLayoutAlignItemsCenter - children:@[_deltaLatEditableNode, _deltaLonEditableNode]]; - - ASStackLayoutSpec *lonlatConfigSpec = [ASStackLayoutSpec stackLayoutSpecWithDirection:ASStackLayoutDirectionVertical - spacing:SPACING - justifyContent:ASStackLayoutJustifyContentStart - alignItems:ASStackLayoutAlignItemsStretch - children:@[lonlatSpec, deltaLonlatSpec]]; - - lonlatConfigSpec.style.flexGrow = 1.0; - - ASStackLayoutSpec *dashboardSpec = [ASStackLayoutSpec stackLayoutSpecWithDirection:ASStackLayoutDirectionHorizontal - spacing:SPACING - justifyContent:ASStackLayoutJustifyContentStart - alignItems:ASStackLayoutAlignItemsStretch - children:@[lonlatConfigSpec, _updateRegionButton]]; - - ASStackLayoutSpec *headerVerticalStack = [ASStackLayoutSpec stackLayoutSpecWithDirection:ASStackLayoutDirectionVertical - spacing:SPACING - justifyContent:ASStackLayoutJustifyContentStart - alignItems:ASStackLayoutAlignItemsStretch - children:@[dashboardSpec, _liveMapToggleButton]]; - - dashboardSpec.style.flexGrow = 1.0; - - ASInsetLayoutSpec *insetSpec = [ASInsetLayoutSpec insetLayoutSpecWithInsets:UIEdgeInsetsMake(40, 10, 0, 10) - child:headerVerticalStack]; - - ASStackLayoutSpec *layoutSpec = [ASStackLayoutSpec stackLayoutSpecWithDirection:ASStackLayoutDirectionVertical - spacing:SPACING - justifyContent:ASStackLayoutJustifyContentStart - alignItems:ASStackLayoutAlignItemsStretch - children:@[insetSpec, _mapNode]]; - - return layoutSpec; -} - -#pragma mark - Button Actions - -- (void)updateRegion -{ - NSNumberFormatter *f = [[NSNumberFormatter alloc] init]; - f.numberStyle = NSNumberFormatterDecimalStyle; - - double const lat = [f numberFromString:_latEditableNode.attributedText.string].doubleValue; - double const lon = [f numberFromString:_lonEditableNode.attributedText.string].doubleValue; - double const deltaLat = [f numberFromString:_deltaLatEditableNode.attributedText.string].doubleValue; - double const deltaLon = [f numberFromString:_deltaLonEditableNode.attributedText.string].doubleValue; - - // TODO: check for valid latitude / longitude coordinates - MKCoordinateRegion region = MKCoordinateRegionMake(CLLocationCoordinate2DMake(lat, lon), - MKCoordinateSpanMake(deltaLat, deltaLon)); - - _mapNode.region = region; -} - -- (void)toggleLiveMap -{ - _mapNode.liveMap = !_mapNode.liveMap; - NSString * const liveMapStr = [self liveMapStr]; - [_liveMapToggleButton setTitle:liveMapStr withFont:nil withColor:[UIColor blueColor] forState:UIControlStateNormal]; - [_liveMapToggleButton setTitle:liveMapStr withFont:[UIFont systemFontOfSize:14] withColor:[UIColor blueColor] forState:UIControlStateHighlighted]; -} - -- (void)updateLocationTextWithMKCoordinateRegion:(MKCoordinateRegion)region -{ - _latEditableNode.attributedText = [self attributedStringFromFloat:region.center.latitude]; - _lonEditableNode.attributedText = [self attributedStringFromFloat:region.center.longitude]; - _deltaLatEditableNode.attributedText = [self attributedStringFromFloat:region.span.latitudeDelta]; - _deltaLonEditableNode.attributedText = [self attributedStringFromFloat:region.span.longitudeDelta]; -} - -#pragma mark - Helper Methods - -- (NSAttributedString *)attributedStringFromFloat:(CGFloat)value -{ - return [[NSAttributedString alloc] initWithString:[NSString stringWithFormat:@"%0.3f", value]]; -} - -- (void)addAnnotations { - - MKPointAnnotation *brno = [MKPointAnnotation new]; - brno.coordinate = CLLocationCoordinate2DMake(49.2002211, 16.6078411); - brno.title = @"Brno City"; - - CustomMapAnnotation *atlantic = [CustomMapAnnotation new]; - atlantic.coordinate = CLLocationCoordinate2DMake(38.6442228, -29.9956942); - atlantic.title = @"Atlantic Ocean"; - atlantic.image = [UIImage imageNamed:@"Water"]; - - CustomMapAnnotation *kilimanjaro = [CustomMapAnnotation new]; - kilimanjaro.coordinate = CLLocationCoordinate2DMake(-3.075833, 37.353333); - kilimanjaro.title = @"Kilimanjaro"; - kilimanjaro.image = [UIImage imageNamed:@"Hill"]; - - CustomMapAnnotation *mtblanc = [CustomMapAnnotation new]; - mtblanc.coordinate = CLLocationCoordinate2DMake(45.8325, 6.864444); - mtblanc.title = @"Mont Blanc"; - mtblanc.image = [UIImage imageNamed:@"Hill"]; - - self.mapNode.annotations = @[brno, atlantic, kilimanjaro, mtblanc]; -} - --(NSString *)liveMapStr -{ - return _mapNode.liveMap ? @"Live Map is ON" : @"Live Map is OFF"; -} - --(void)configureEditableNodes:(ASEditableTextNode *)node -{ - node.returnKeyType = node == _deltaLonEditableNode ? UIReturnKeyDone : UIReturnKeyNext; - node.delegate = self; -} - -#pragma mark - ASEditableTextNodeDelegate - -- (BOOL)editableTextNode:(ASEditableTextNode *)editableTextNode shouldChangeTextInRange:(NSRange)range replacementText:(NSString *)text -{ - if([text isEqualToString:@"\n"]) { - if(editableTextNode == _latEditableNode) - [_lonEditableNode becomeFirstResponder]; - else if(editableTextNode == _lonEditableNode) - [_deltaLatEditableNode becomeFirstResponder]; - else if(editableTextNode == _deltaLatEditableNode) - [_deltaLonEditableNode becomeFirstResponder]; - else if(editableTextNode == _deltaLonEditableNode) { - [_deltaLonEditableNode resignFirstResponder]; - [self updateRegion]; - } - return NO; - } - - NSMutableCharacterSet * s = [NSMutableCharacterSet characterSetWithCharactersInString:@".-"]; - [s formUnionWithCharacterSet:[NSCharacterSet decimalDigitCharacterSet]]; - [s invert]; - - NSRange r = [text rangeOfCharacterFromSet:s]; - if(r.location != NSNotFound) { - return NO; - } - - if([editableTextNode.attributedText.string rangeOfString:@"."].location != NSNotFound && - [text rangeOfString:@"."].location != NSNotFound) { - return NO; - } - - if ([editableTextNode.attributedText.string rangeOfString:@"-"].location != NSNotFound && - [text rangeOfString:@"-"].location != NSNotFound && - range.location > 0) { - return NO; - } - - return YES; -} - -- (MKAnnotationView *)annotationViewForAnnotation:(id)annotation -{ - MKAnnotationView *av; - - if ([annotation isKindOfClass:[CustomMapAnnotation class]]) { - av = [[MKAnnotationView alloc] init]; - av.centerOffset = CGPointMake(21, 21); - av.image = [(CustomMapAnnotation *)annotation image]; - } else { - av = [[MKPinAnnotationView alloc] initWithAnnotation:nil reuseIdentifier:@""]; - } - - av.opaque = NO; - - return av; -} - -#pragma mark - MKMapViewDelegate - -- (void)mapView:(MKMapView *)mapView regionDidChangeAnimated:(BOOL)animated -{ - [self updateLocationTextWithMKCoordinateRegion:mapView.region]; -} - -- (MKAnnotationView *)mapView:(MKMapView *)__unused mapView viewForAnnotation:(id)annotation -{ - return [self annotationViewForAnnotation:annotation]; -} - -@end diff --git a/submodules/AsyncDisplayKit/examples/ASMapNode/Sample/ViewController.h b/submodules/AsyncDisplayKit/examples/ASMapNode/Sample/ViewController.h deleted file mode 100644 index 7054e2d89c..0000000000 --- a/submodules/AsyncDisplayKit/examples/ASMapNode/Sample/ViewController.h +++ /dev/null @@ -1,16 +0,0 @@ -// -// ViewController.h -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -@interface ViewController : ASViewController - - -@end - diff --git a/submodules/AsyncDisplayKit/examples/ASMapNode/Sample/ViewController.m b/submodules/AsyncDisplayKit/examples/ASMapNode/Sample/ViewController.m deleted file mode 100644 index 390532d662..0000000000 --- a/submodules/AsyncDisplayKit/examples/ASMapNode/Sample/ViewController.m +++ /dev/null @@ -1,38 +0,0 @@ -// -// ViewController.m -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import "ViewController.h" - -#import "MapHandlerNode.h" - -@interface ViewController () - -@end - -@implementation ViewController - - -#pragma mark - Lifecycle - -- (instancetype)init -{ - self = [super initWithNode:[[MapHandlerNode alloc] init]]; - if (self == nil) { return self; } - - return self; -} - -- (void)viewWillAppear:(BOOL)animated -{ - [super viewWillAppear:animated]; - - self.navigationController.navigationBarHidden = YES; -} - -@end diff --git a/submodules/AsyncDisplayKit/examples/ASMapNode/Sample/main.m b/submodules/AsyncDisplayKit/examples/ASMapNode/Sample/main.m deleted file mode 100644 index 0e5da05001..0000000000 --- a/submodules/AsyncDisplayKit/examples/ASMapNode/Sample/main.m +++ /dev/null @@ -1,17 +0,0 @@ -// -// main.m -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import -#import "AppDelegate.h" - -int main(int argc, char * argv[]) { - @autoreleasepool { - return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); - } -} diff --git a/submodules/AsyncDisplayKit/examples/ASViewController/Podfile b/submodules/AsyncDisplayKit/examples/ASViewController/Podfile deleted file mode 100644 index 08d1b7add6..0000000000 --- a/submodules/AsyncDisplayKit/examples/ASViewController/Podfile +++ /dev/null @@ -1,6 +0,0 @@ -source 'https://github.com/CocoaPods/Specs.git' -platform :ios, '9.0' -target 'Sample' do - pod 'Texture', :path => '../..' -end - diff --git a/submodules/AsyncDisplayKit/examples/ASViewController/Sample/AppDelegate.h b/submodules/AsyncDisplayKit/examples/ASViewController/Sample/AppDelegate.h deleted file mode 100644 index 8d58a13cbe..0000000000 --- a/submodules/AsyncDisplayKit/examples/ASViewController/Sample/AppDelegate.h +++ /dev/null @@ -1,18 +0,0 @@ -// -// AppDelegate.h -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -@interface AppDelegate : UIResponder - -@property (strong, nonatomic) UIWindow *window; - - -@end - diff --git a/submodules/AsyncDisplayKit/examples/ASViewController/Sample/AppDelegate.m b/submodules/AsyncDisplayKit/examples/ASViewController/Sample/AppDelegate.m deleted file mode 100644 index ed2724b182..0000000000 --- a/submodules/AsyncDisplayKit/examples/ASViewController/Sample/AppDelegate.m +++ /dev/null @@ -1,28 +0,0 @@ -// -// AppDelegate.m -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import "AppDelegate.h" -#import "ViewController.h" - -@interface AppDelegate () - -@end - -@implementation AppDelegate - -- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { - // Override point for customization after application launch. - self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; - self.window.backgroundColor = [UIColor whiteColor]; - self.window.rootViewController = [[UINavigationController alloc] initWithRootViewController:[ViewController new]]; - [self.window makeKeyAndVisible]; - return YES; -} - -@end diff --git a/submodules/AsyncDisplayKit/examples/ASViewController/Sample/Assets.xcassets/AppIcon.appiconset/Contents.json b/submodules/AsyncDisplayKit/examples/ASViewController/Sample/Assets.xcassets/AppIcon.appiconset/Contents.json deleted file mode 100644 index 118c98f746..0000000000 --- a/submodules/AsyncDisplayKit/examples/ASViewController/Sample/Assets.xcassets/AppIcon.appiconset/Contents.json +++ /dev/null @@ -1,38 +0,0 @@ -{ - "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" - } -} \ No newline at end of file diff --git a/submodules/AsyncDisplayKit/examples/ASViewController/Sample/Base.lproj/LaunchScreen.storyboard b/submodules/AsyncDisplayKit/examples/ASViewController/Sample/Base.lproj/LaunchScreen.storyboard deleted file mode 100644 index 90d6157f11..0000000000 --- a/submodules/AsyncDisplayKit/examples/ASViewController/Sample/Base.lproj/LaunchScreen.storyboard +++ /dev/null @@ -1,27 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/submodules/AsyncDisplayKit/examples/ASViewController/Sample/DetailCellNode.h b/submodules/AsyncDisplayKit/examples/ASViewController/Sample/DetailCellNode.h deleted file mode 100644 index d524ff1c02..0000000000 --- a/submodules/AsyncDisplayKit/examples/ASViewController/Sample/DetailCellNode.h +++ /dev/null @@ -1,18 +0,0 @@ -// -// DetailCellNode.h -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -@class ASNetworkImageNode; - -@interface DetailCellNode : ASCellNode -@property (nonatomic, assign) NSInteger row; -@property (nonatomic, copy) NSString *imageCategory; -@property (nonatomic, strong) ASNetworkImageNode *imageNode; -@end diff --git a/submodules/AsyncDisplayKit/examples/ASViewController/Sample/DetailCellNode.m b/submodules/AsyncDisplayKit/examples/ASViewController/Sample/DetailCellNode.m deleted file mode 100644 index edc9932076..0000000000 --- a/submodules/AsyncDisplayKit/examples/ASViewController/Sample/DetailCellNode.m +++ /dev/null @@ -1,57 +0,0 @@ -// -// DetailCellNode.m -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import "DetailCellNode.h" -#import - -@implementation DetailCellNode - -#pragma mark - Lifecycle - -- (instancetype)init -{ - self = [super init]; - if (self == nil) { return self; } - - self.automaticallyManagesSubnodes = YES; - - _imageNode = [[ASNetworkImageNode alloc] init]; - _imageNode.backgroundColor = ASDisplayNodeDefaultPlaceholderColor(); - - return self; -} - -#pragma mark - ASDisplayNode - -- (ASLayoutSpec *)layoutSpecThatFits:(ASSizeRange)constrainedSize -{ - return [ASRatioLayoutSpec ratioLayoutSpecWithRatio:1.0 child:self.imageNode]; -} - -- (void)layoutDidFinish -{ - [super layoutDidFinish]; - - // 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 -{ - CGSize imageSize = self.calculatedSize; - NSString *imageURLString = [NSString stringWithFormat:@"http://lorempixel.com/%ld/%ld/%@/%ld", (NSInteger)imageSize.width, (NSInteger)imageSize.height, self.imageCategory, self.row]; - return [NSURL URLWithString:imageURLString]; -} - -@end diff --git a/submodules/AsyncDisplayKit/examples/ASViewController/Sample/DetailRootNode.h b/submodules/AsyncDisplayKit/examples/ASViewController/Sample/DetailRootNode.h deleted file mode 100644 index 648900b30e..0000000000 --- a/submodules/AsyncDisplayKit/examples/ASViewController/Sample/DetailRootNode.h +++ /dev/null @@ -1,20 +0,0 @@ -// -// DetailRootNode.h -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -@class ASCollectionNode; - -@interface DetailRootNode : ASDisplayNode - -@property (nonatomic, strong, readonly) ASCollectionNode *collectionNode; - -- (instancetype)initWithImageCategory:(NSString *)imageCategory; - -@end diff --git a/submodules/AsyncDisplayKit/examples/ASViewController/Sample/DetailRootNode.m b/submodules/AsyncDisplayKit/examples/ASViewController/Sample/DetailRootNode.m deleted file mode 100644 index 5d478059d9..0000000000 --- a/submodules/AsyncDisplayKit/examples/ASViewController/Sample/DetailRootNode.m +++ /dev/null @@ -1,88 +0,0 @@ -// -// DetailRootNode.m -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import "DetailRootNode.h" -#import "DetailCellNode.h" - -#import - -static const NSInteger kImageHeight = 200; - - -@interface DetailRootNode () - -@property (nonatomic, copy) NSString *imageCategory; -@property (nonatomic, strong) ASCollectionNode *collectionNode; - -@end - - -@implementation DetailRootNode - -#pragma mark - Lifecycle - -- (instancetype)initWithImageCategory:(NSString *)imageCategory -{ - self = [super init]; - if (self) { - // Enable automaticallyManagesSubnodes so the first time the layout pass of the node is happening all nodes that are referenced - // in the laaout specification within layoutSpecThatFits: will be added automatically - self.automaticallyManagesSubnodes = YES; - - _imageCategory = imageCategory; - - // 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.backgroundColor = [UIColor whiteColor]; - } - - return self; -} - -- (void)dealloc -{ - _collectionNode.delegate = nil; - _collectionNode.dataSource = nil; -} - -#pragma mark - ASDisplayNode - -- (ASLayoutSpec *)layoutSpecThatFits:(ASSizeRange)constrainedSize -{ - return [ASWrapperLayoutSpec wrapperWithLayoutElement:self.collectionNode]; -} - -#pragma mark - ASCollectionDataSource - -- (NSInteger)collectionNode:(ASCollectionNode *)collectionNode numberOfItemsInSection:(NSInteger)section -{ - return 10; -} - -- (ASCellNodeBlock)collectionNode:(ASCollectionNode *)collectionNode nodeBlockForItemAtIndexPath:(NSIndexPath *)indexPath -{ - NSString *imageCategory = self.imageCategory; - return ^{ - DetailCellNode *node = [[DetailCellNode alloc] init]; - node.row = indexPath.row; - node.imageCategory = imageCategory; - return node; - }; -} - -- (ASSizeRange)collectionNode:(ASCollectionNode *)collectionNode constrainedSizeForItemAtIndexPath:(NSIndexPath *)indexPath -{ - CGSize imageSize = CGSizeMake(CGRectGetWidth(collectionNode.view.frame), kImageHeight); - return ASSizeRangeMake(imageSize, imageSize); -} - -@end diff --git a/submodules/AsyncDisplayKit/examples/ASViewController/Sample/DetailViewController.h b/submodules/AsyncDisplayKit/examples/ASViewController/Sample/DetailViewController.h deleted file mode 100644 index 0c5eb85891..0000000000 --- a/submodules/AsyncDisplayKit/examples/ASViewController/Sample/DetailViewController.h +++ /dev/null @@ -1,15 +0,0 @@ -// -// DetailViewController.h -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import -#import "DetailRootNode.h" - -@interface DetailViewController : ASViewController - -@end diff --git a/submodules/AsyncDisplayKit/examples/ASViewController/Sample/DetailViewController.m b/submodules/AsyncDisplayKit/examples/ASViewController/Sample/DetailViewController.m deleted file mode 100644 index 2d6471cd5d..0000000000 --- a/submodules/AsyncDisplayKit/examples/ASViewController/Sample/DetailViewController.m +++ /dev/null @@ -1,26 +0,0 @@ -// -// DetailViewController.m -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import "DetailViewController.h" -#import - -#import "DetailRootNode.h" - -@implementation DetailViewController - -#pragma mark - Rotation - -- (void)viewWillTransitionToSize:(CGSize)size withTransitionCoordinator:(id)coordinator -{ - [super viewWillTransitionToSize:size withTransitionCoordinator:coordinator]; - [self.node.collectionNode.view.collectionViewLayout invalidateLayout]; -} - - -@end diff --git a/submodules/AsyncDisplayKit/examples/ASViewController/Sample/Info.plist b/submodules/AsyncDisplayKit/examples/ASViewController/Sample/Info.plist deleted file mode 100644 index 6105445463..0000000000 --- a/submodules/AsyncDisplayKit/examples/ASViewController/Sample/Info.plist +++ /dev/null @@ -1,43 +0,0 @@ - - - - - CFBundleDevelopmentRegion - en - CFBundleExecutable - $(EXECUTABLE_NAME) - CFBundleIdentifier - $(PRODUCT_BUNDLE_IDENTIFIER) - CFBundleInfoDictionaryVersion - 6.0 - CFBundleName - $(PRODUCT_NAME) - CFBundlePackageType - APPL - CFBundleShortVersionString - 1.0 - CFBundleSignature - ???? - CFBundleVersion - 1 - LSRequiresIPhoneOS - - NSAppTransportSecurity - - NSAllowsArbitraryLoads - - - UILaunchStoryboardName - LaunchScreen - UIRequiredDeviceCapabilities - - armv7 - - UISupportedInterfaceOrientations - - UIInterfaceOrientationPortrait - UIInterfaceOrientationLandscapeLeft - UIInterfaceOrientationLandscapeRight - - - diff --git a/submodules/AsyncDisplayKit/examples/ASViewController/Sample/ViewController.h b/submodules/AsyncDisplayKit/examples/ASViewController/Sample/ViewController.h deleted file mode 100644 index f1700621f0..0000000000 --- a/submodules/AsyncDisplayKit/examples/ASViewController/Sample/ViewController.h +++ /dev/null @@ -1,17 +0,0 @@ -// -// ViewController.h -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import -#import - -@interface ViewController : ASViewController - - -@end - diff --git a/submodules/AsyncDisplayKit/examples/ASViewController/Sample/ViewController.m b/submodules/AsyncDisplayKit/examples/ASViewController/Sample/ViewController.m deleted file mode 100644 index f66c7add93..0000000000 --- a/submodules/AsyncDisplayKit/examples/ASViewController/Sample/ViewController.m +++ /dev/null @@ -1,92 +0,0 @@ -// -// ViewController.m -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import "ViewController.h" -#import - -#import "DetailViewController.h" - - -@interface ViewController () - -@property (nonatomic, copy) NSArray *imageCategories; -@property (nonatomic, strong, readonly) ASTableNode *tableNode; - -@end - - -@implementation ViewController - -#pragma mark - Lifecycle - -- (instancetype)init -{ - self = [super initWithNode:[ASTableNode new]]; - if (self == nil) { return self; } - - _imageCategories = @[@"abstract", @"animals", @"business", @"cats", @"city", @"food", @"nightlife", @"fashion", @"people", @"nature", @"sports", @"technics", @"transport"]; - - return self; -} - -- (void)dealloc -{ - self.node.delegate = nil; - self.node.dataSource = nil; -} - - -#pragma mark - UIViewController - -- (void)viewDidLoad -{ - [super viewDidLoad]; - - self.title = @"Image Categories"; - - self.node.delegate = self; - self.node.dataSource = self; -} - -- (void)viewWillAppear:(BOOL)animated -{ - [super viewWillAppear:animated]; - - [self.node deselectRowAtIndexPath:self.node.indexPathForSelectedRow animated:YES]; -} - - -#pragma mark - ASTableDataSource / ASTableDelegate - -- (NSInteger)tableNode:(ASTableNode *)tableNode numberOfRowsInSection:(NSInteger)section -{ - return self.imageCategories.count; -} - -- (ASCellNodeBlock)tableNode:(ASTableNode *)tableNode nodeBlockForRowAtIndexPath:(NSIndexPath *)indexPath -{ - // As the block is executed on a background thread we need to cache the image category string outside - NSString *imageCategory = self.imageCategories[indexPath.row]; - return ^{ - ASTextCellNode *textCellNode = [ASTextCellNode new]; - textCellNode.text = [imageCategory capitalizedString]; - return textCellNode; - }; -} - -- (void)tableNode:(ASTableNode *)tableNode didSelectRowAtIndexPath:(NSIndexPath *)indexPath -{ - NSString *imageCategory = self.imageCategories[indexPath.row]; - DetailRootNode *detailRootNode = [[DetailRootNode alloc] initWithImageCategory:imageCategory]; - DetailViewController *detailViewController = [[DetailViewController alloc] initWithNode:detailRootNode]; - detailViewController.title = [imageCategory capitalizedString]; - [self.navigationController pushViewController:detailViewController animated:YES]; -} - -@end diff --git a/submodules/AsyncDisplayKit/examples/ASViewController/Sample/main.m b/submodules/AsyncDisplayKit/examples/ASViewController/Sample/main.m deleted file mode 100644 index 0e5da05001..0000000000 --- a/submodules/AsyncDisplayKit/examples/ASViewController/Sample/main.m +++ /dev/null @@ -1,17 +0,0 @@ -// -// main.m -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import -#import "AppDelegate.h" - -int main(int argc, char * argv[]) { - @autoreleasepool { - return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); - } -} diff --git a/submodules/AsyncDisplayKit/examples/AnimatedGIF/ASAnimatedImage/AppDelegate.h b/submodules/AsyncDisplayKit/examples/AnimatedGIF/ASAnimatedImage/AppDelegate.h deleted file mode 100644 index 8d58a13cbe..0000000000 --- a/submodules/AsyncDisplayKit/examples/AnimatedGIF/ASAnimatedImage/AppDelegate.h +++ /dev/null @@ -1,18 +0,0 @@ -// -// AppDelegate.h -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -@interface AppDelegate : UIResponder - -@property (strong, nonatomic) UIWindow *window; - - -@end - diff --git a/submodules/AsyncDisplayKit/examples/AnimatedGIF/ASAnimatedImage/AppDelegate.m b/submodules/AsyncDisplayKit/examples/AnimatedGIF/ASAnimatedImage/AppDelegate.m deleted file mode 100644 index a21b00ffd1..0000000000 --- a/submodules/AsyncDisplayKit/examples/AnimatedGIF/ASAnimatedImage/AppDelegate.m +++ /dev/null @@ -1,24 +0,0 @@ -// -// AppDelegate.m -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import "AppDelegate.h" - -@interface AppDelegate () - -@end - -@implementation AppDelegate - - -- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { - // Override point for customization after application launch. - return YES; -} - -@end diff --git a/submodules/AsyncDisplayKit/examples/AnimatedGIF/ASAnimatedImage/Assets.xcassets/AppIcon.appiconset/Contents.json b/submodules/AsyncDisplayKit/examples/AnimatedGIF/ASAnimatedImage/Assets.xcassets/AppIcon.appiconset/Contents.json deleted file mode 100644 index 36d2c80d88..0000000000 --- a/submodules/AsyncDisplayKit/examples/AnimatedGIF/ASAnimatedImage/Assets.xcassets/AppIcon.appiconset/Contents.json +++ /dev/null @@ -1,68 +0,0 @@ -{ - "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" - } - ], - "info" : { - "version" : 1, - "author" : "xcode" - } -} \ No newline at end of file diff --git a/submodules/AsyncDisplayKit/examples/AnimatedGIF/ASAnimatedImage/Base.lproj/LaunchScreen.storyboard b/submodules/AsyncDisplayKit/examples/AnimatedGIF/ASAnimatedImage/Base.lproj/LaunchScreen.storyboard deleted file mode 100644 index 2e721e1833..0000000000 --- a/submodules/AsyncDisplayKit/examples/AnimatedGIF/ASAnimatedImage/Base.lproj/LaunchScreen.storyboard +++ /dev/null @@ -1,27 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/submodules/AsyncDisplayKit/examples/AnimatedGIF/ASAnimatedImage/Base.lproj/Main.storyboard b/submodules/AsyncDisplayKit/examples/AnimatedGIF/ASAnimatedImage/Base.lproj/Main.storyboard deleted file mode 100644 index f56d2f3bb5..0000000000 --- a/submodules/AsyncDisplayKit/examples/AnimatedGIF/ASAnimatedImage/Base.lproj/Main.storyboard +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/submodules/AsyncDisplayKit/examples/AnimatedGIF/ASAnimatedImage/Info.plist b/submodules/AsyncDisplayKit/examples/AnimatedGIF/ASAnimatedImage/Info.plist deleted file mode 100644 index 40c6215d90..0000000000 --- a/submodules/AsyncDisplayKit/examples/AnimatedGIF/ASAnimatedImage/Info.plist +++ /dev/null @@ -1,47 +0,0 @@ - - - - - CFBundleDevelopmentRegion - en - CFBundleExecutable - $(EXECUTABLE_NAME) - CFBundleIdentifier - $(PRODUCT_BUNDLE_IDENTIFIER) - CFBundleInfoDictionaryVersion - 6.0 - CFBundleName - $(PRODUCT_NAME) - CFBundlePackageType - APPL - CFBundleShortVersionString - 1.0 - CFBundleSignature - ???? - CFBundleVersion - 1 - LSRequiresIPhoneOS - - UILaunchStoryboardName - LaunchScreen - UIMainStoryboardFile - Main - UIRequiredDeviceCapabilities - - armv7 - - UISupportedInterfaceOrientations - - UIInterfaceOrientationPortrait - UIInterfaceOrientationLandscapeLeft - UIInterfaceOrientationLandscapeRight - - UISupportedInterfaceOrientations~ipad - - UIInterfaceOrientationPortrait - UIInterfaceOrientationPortraitUpsideDown - UIInterfaceOrientationLandscapeLeft - UIInterfaceOrientationLandscapeRight - - - diff --git a/submodules/AsyncDisplayKit/examples/AnimatedGIF/ASAnimatedImage/ViewController.h b/submodules/AsyncDisplayKit/examples/AnimatedGIF/ASAnimatedImage/ViewController.h deleted file mode 100644 index 4627e29285..0000000000 --- a/submodules/AsyncDisplayKit/examples/AnimatedGIF/ASAnimatedImage/ViewController.h +++ /dev/null @@ -1,16 +0,0 @@ -// -// ViewController.h -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -@interface ViewController : UIViewController - - -@end - diff --git a/submodules/AsyncDisplayKit/examples/AnimatedGIF/ASAnimatedImage/ViewController.m b/submodules/AsyncDisplayKit/examples/AnimatedGIF/ASAnimatedImage/ViewController.m deleted file mode 100644 index 6fd98321db..0000000000 --- a/submodules/AsyncDisplayKit/examples/AnimatedGIF/ASAnimatedImage/ViewController.m +++ /dev/null @@ -1,35 +0,0 @@ -// -// ViewController.m -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import "ViewController.h" - -#import - -@interface ViewController () - -@end - -@implementation ViewController - -- (void)viewDidLoad { - [super viewDidLoad]; - // Do any additional setup after loading the view, typically from a nib. - - ASNetworkImageNode *imageNode = [[ASNetworkImageNode alloc] init]; - imageNode.URL = [NSURL URLWithString:@"https://i.pinimg.com/originals/07/44/38/074438e7c75034df2dcf37ba1057803e.gif"]; - // Uncomment to see animated webp support - // imageNode.URL = [NSURL URLWithString:@"https://storage.googleapis.com/downloads.webmproject.org/webp/images/dancing_banana2.lossless.webp"]; - imageNode.frame = self.view.bounds; - imageNode.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight; - imageNode.contentMode = UIViewContentModeScaleAspectFit; - - [self.view addSubnode:imageNode]; -} - -@end diff --git a/submodules/AsyncDisplayKit/examples/AnimatedGIF/ASAnimatedImage/main.m b/submodules/AsyncDisplayKit/examples/AnimatedGIF/ASAnimatedImage/main.m deleted file mode 100644 index 65850400e4..0000000000 --- a/submodules/AsyncDisplayKit/examples/AnimatedGIF/ASAnimatedImage/main.m +++ /dev/null @@ -1,17 +0,0 @@ -// -// main.m -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import -#import "AppDelegate.h" - -int main(int argc, char * argv[]) { - @autoreleasepool { - return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); - } -} diff --git a/submodules/AsyncDisplayKit/examples/AnimatedGIF/Podfile b/submodules/AsyncDisplayKit/examples/AnimatedGIF/Podfile deleted file mode 100644 index c998fa0a8d..0000000000 --- a/submodules/AsyncDisplayKit/examples/AnimatedGIF/Podfile +++ /dev/null @@ -1,7 +0,0 @@ -source 'https://github.com/CocoaPods/Specs.git' -platform :ios, '9.0' -target 'Sample' do - pod 'Texture', :path => '../..' - pod 'PINRemoteImage/WebP' -end - diff --git a/submodules/AsyncDisplayKit/examples/AsyncDisplayKitOverview/Podfile b/submodules/AsyncDisplayKit/examples/AsyncDisplayKitOverview/Podfile deleted file mode 100644 index ff6cb63a31..0000000000 --- a/submodules/AsyncDisplayKit/examples/AsyncDisplayKitOverview/Podfile +++ /dev/null @@ -1,10 +0,0 @@ -# Uncomment this line to define a global platform for your project -platform :ios, '9.0' - -# Uncomment this line if you're using Swift -# use_frameworks! - -target 'Sample' do - pod 'Texture', :path => '../..' -end - diff --git a/submodules/AsyncDisplayKit/examples/AsyncDisplayKitOverview/Sample/AppDelegate.h b/submodules/AsyncDisplayKit/examples/AsyncDisplayKitOverview/Sample/AppDelegate.h deleted file mode 100644 index 8d58a13cbe..0000000000 --- a/submodules/AsyncDisplayKit/examples/AsyncDisplayKitOverview/Sample/AppDelegate.h +++ /dev/null @@ -1,18 +0,0 @@ -// -// AppDelegate.h -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -@interface AppDelegate : UIResponder - -@property (strong, nonatomic) UIWindow *window; - - -@end - diff --git a/submodules/AsyncDisplayKit/examples/AsyncDisplayKitOverview/Sample/AppDelegate.m b/submodules/AsyncDisplayKit/examples/AsyncDisplayKitOverview/Sample/AppDelegate.m deleted file mode 100644 index 8221f4c755..0000000000 --- a/submodules/AsyncDisplayKit/examples/AsyncDisplayKitOverview/Sample/AppDelegate.m +++ /dev/null @@ -1,33 +0,0 @@ -// -// AppDelegate.m -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#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 diff --git a/submodules/AsyncDisplayKit/examples/AsyncDisplayKitOverview/Sample/Assets.xcassets/AppIcon.appiconset/Contents.json b/submodules/AsyncDisplayKit/examples/AsyncDisplayKitOverview/Sample/Assets.xcassets/AppIcon.appiconset/Contents.json deleted file mode 100644 index eeea76c2db..0000000000 --- a/submodules/AsyncDisplayKit/examples/AsyncDisplayKitOverview/Sample/Assets.xcassets/AppIcon.appiconset/Contents.json +++ /dev/null @@ -1,73 +0,0 @@ -{ - "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" - } -} \ No newline at end of file diff --git a/submodules/AsyncDisplayKit/examples/AsyncDisplayKitOverview/Sample/Assets.xcassets/Contents.json b/submodules/AsyncDisplayKit/examples/AsyncDisplayKitOverview/Sample/Assets.xcassets/Contents.json deleted file mode 100644 index da4a164c91..0000000000 --- a/submodules/AsyncDisplayKit/examples/AsyncDisplayKitOverview/Sample/Assets.xcassets/Contents.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "info" : { - "version" : 1, - "author" : "xcode" - } -} \ No newline at end of file diff --git a/submodules/AsyncDisplayKit/examples/AsyncDisplayKitOverview/Sample/Assets.xcassets/image.imageset/Contents.json b/submodules/AsyncDisplayKit/examples/AsyncDisplayKitOverview/Sample/Assets.xcassets/image.imageset/Contents.json deleted file mode 100644 index 28461488b5..0000000000 --- a/submodules/AsyncDisplayKit/examples/AsyncDisplayKitOverview/Sample/Assets.xcassets/image.imageset/Contents.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "images" : [ - { - "idiom" : "universal", - "filename" : "image.jpg", - "scale" : "1x" - }, - { - "idiom" : "universal", - "scale" : "2x" - }, - { - "idiom" : "universal", - "scale" : "3x" - } - ], - "info" : { - "version" : 1, - "author" : "xcode" - } -} \ No newline at end of file diff --git a/submodules/AsyncDisplayKit/examples/AsyncDisplayKitOverview/Sample/Assets.xcassets/image.imageset/image.jpg b/submodules/AsyncDisplayKit/examples/AsyncDisplayKitOverview/Sample/Assets.xcassets/image.imageset/image.jpg deleted file mode 100644 index 84428e0164..0000000000 Binary files a/submodules/AsyncDisplayKit/examples/AsyncDisplayKitOverview/Sample/Assets.xcassets/image.imageset/image.jpg and /dev/null differ diff --git a/submodules/AsyncDisplayKit/examples/AsyncDisplayKitOverview/Sample/Base.lproj/LaunchScreen.storyboard b/submodules/AsyncDisplayKit/examples/AsyncDisplayKitOverview/Sample/Base.lproj/LaunchScreen.storyboard deleted file mode 100644 index 2e721e1833..0000000000 --- a/submodules/AsyncDisplayKit/examples/AsyncDisplayKitOverview/Sample/Base.lproj/LaunchScreen.storyboard +++ /dev/null @@ -1,27 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/submodules/AsyncDisplayKit/examples/AsyncDisplayKitOverview/Sample/Info.plist b/submodules/AsyncDisplayKit/examples/AsyncDisplayKitOverview/Sample/Info.plist deleted file mode 100644 index 028aa2b33f..0000000000 --- a/submodules/AsyncDisplayKit/examples/AsyncDisplayKitOverview/Sample/Info.plist +++ /dev/null @@ -1,50 +0,0 @@ - - - - - CFBundleDevelopmentRegion - en - CFBundleExecutable - $(EXECUTABLE_NAME) - CFBundleIdentifier - $(PRODUCT_BUNDLE_IDENTIFIER) - CFBundleInfoDictionaryVersion - 6.0 - CFBundleName - $(PRODUCT_NAME) - CFBundlePackageType - APPL - CFBundleShortVersionString - 1.0 - CFBundleSignature - ???? - CFBundleVersion - 1 - LSRequiresIPhoneOS - - NSAppTransportSecurity - - NSAllowsArbitraryLoads - - - UILaunchStoryboardName - LaunchScreen - UIRequiredDeviceCapabilities - - armv7 - - UISupportedInterfaceOrientations - - UIInterfaceOrientationPortrait - UIInterfaceOrientationLandscapeLeft - UIInterfaceOrientationLandscapeRight - - UISupportedInterfaceOrientations~ipad - - UIInterfaceOrientationPortrait - UIInterfaceOrientationPortraitUpsideDown - UIInterfaceOrientationLandscapeLeft - UIInterfaceOrientationLandscapeRight - - - diff --git a/submodules/AsyncDisplayKit/examples/AsyncDisplayKitOverview/Sample/Node Containers/OverviewASCollectionNode.h b/submodules/AsyncDisplayKit/examples/AsyncDisplayKitOverview/Sample/Node Containers/OverviewASCollectionNode.h deleted file mode 100644 index 8fc32e4e43..0000000000 --- a/submodules/AsyncDisplayKit/examples/AsyncDisplayKitOverview/Sample/Node Containers/OverviewASCollectionNode.h +++ /dev/null @@ -1,13 +0,0 @@ -// -// OverviewASCollectionNode.h -// Texture -// -// Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -@interface OverviewASCollectionNode : ASDisplayNode - -@end diff --git a/submodules/AsyncDisplayKit/examples/AsyncDisplayKitOverview/Sample/Node Containers/OverviewASCollectionNode.m b/submodules/AsyncDisplayKit/examples/AsyncDisplayKitOverview/Sample/Node Containers/OverviewASCollectionNode.m deleted file mode 100644 index 5d29eea95e..0000000000 --- a/submodules/AsyncDisplayKit/examples/AsyncDisplayKitOverview/Sample/Node Containers/OverviewASCollectionNode.m +++ /dev/null @@ -1,65 +0,0 @@ -// -// OverviewASCollectionNode.m -// Texture -// -// Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import "OverviewASCollectionNode.h" - -#import - -@interface OverviewASCollectionNode () -@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 -{ - // 100% of container - _node.style.width = ASDimensionMakeWithFraction(1.0); - _node.style.height = ASDimensionMakeWithFraction(1.0); - return [ASWrapperLayoutSpec wrapperWithLayoutElement:_node]; -} - -#pragma mark - - -- (NSInteger)collectionNode:(ASCollectionNode *)collectionNode numberOfItemsInSection:(NSInteger)section -{ - return 100; -} - -- (ASCellNodeBlock)collectionNode:(ASCollectionNode *)collectionNode nodeBlockForItemAtIndexPath:(NSIndexPath *)indexPath -{ - return ^{ - ASTextCellNode *cellNode = [ASTextCellNode new]; - cellNode.backgroundColor = [UIColor lightGrayColor]; - cellNode.text = [NSString stringWithFormat:@"Row: %ld", indexPath.row]; - return cellNode; - }; -} - -- (ASSizeRange)collectionNode:(ASCollectionNode *)collectionNode constrainedSizeForItemAtIndexPath:(NSIndexPath *)indexPath -{ - return ASSizeRangeMake(CGSizeMake(100, 100)); -} - -@end diff --git a/submodules/AsyncDisplayKit/examples/AsyncDisplayKitOverview/Sample/Node Containers/OverviewASPagerNode.h b/submodules/AsyncDisplayKit/examples/AsyncDisplayKitOverview/Sample/Node Containers/OverviewASPagerNode.h deleted file mode 100644 index dd6d09d014..0000000000 --- a/submodules/AsyncDisplayKit/examples/AsyncDisplayKitOverview/Sample/Node Containers/OverviewASPagerNode.h +++ /dev/null @@ -1,13 +0,0 @@ -// -// OverviewASPagerNode.h -// Texture -// -// Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -@interface OverviewASPagerNode : ASDisplayNode - -@end diff --git a/submodules/AsyncDisplayKit/examples/AsyncDisplayKitOverview/Sample/Node Containers/OverviewASPagerNode.m b/submodules/AsyncDisplayKit/examples/AsyncDisplayKitOverview/Sample/Node Containers/OverviewASPagerNode.m deleted file mode 100644 index 7e37448497..0000000000 --- a/submodules/AsyncDisplayKit/examples/AsyncDisplayKitOverview/Sample/Node Containers/OverviewASPagerNode.m +++ /dev/null @@ -1,80 +0,0 @@ -// -// OverviewASPagerNode.m -// Texture -// -// Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#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 layoutWithLayoutElement:self size:constrainedSize.max]; -} - -@end - - -#pragma mark - OverviewASPagerNode - -@interface OverviewASPagerNode () -@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; - _node.delegate = self; - [self addSubnode:_node]; - - return self; -} - -- (ASLayoutSpec *)layoutSpecThatFits:(ASSizeRange)constrainedSize -{ - // 100% of container - _node.style.width = ASDimensionMakeWithFraction(1.0); - _node.style.height = ASDimensionMakeWithFraction(1.0); - return [ASWrapperLayoutSpec wrapperWithLayoutElement:_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 diff --git a/submodules/AsyncDisplayKit/examples/AsyncDisplayKitOverview/Sample/Node Containers/OverviewASTableNode.h b/submodules/AsyncDisplayKit/examples/AsyncDisplayKitOverview/Sample/Node Containers/OverviewASTableNode.h deleted file mode 100644 index f80af0d2c9..0000000000 --- a/submodules/AsyncDisplayKit/examples/AsyncDisplayKitOverview/Sample/Node Containers/OverviewASTableNode.h +++ /dev/null @@ -1,13 +0,0 @@ -// -// OverviewASTableNode.h -// Texture -// -// Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -@interface OverviewASTableNode : ASDisplayNode - -@end diff --git a/submodules/AsyncDisplayKit/examples/AsyncDisplayKitOverview/Sample/Node Containers/OverviewASTableNode.m b/submodules/AsyncDisplayKit/examples/AsyncDisplayKitOverview/Sample/Node Containers/OverviewASTableNode.m deleted file mode 100644 index de050c3694..0000000000 --- a/submodules/AsyncDisplayKit/examples/AsyncDisplayKitOverview/Sample/Node Containers/OverviewASTableNode.m +++ /dev/null @@ -1,57 +0,0 @@ -// -// OverviewASTableNode.m -// Texture -// -// Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import "OverviewASTableNode.h" - -@interface OverviewASTableNode () -@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 -{ - // 100% of container - _node.style.width = ASDimensionMakeWithFraction(1.0); - _node.style.height = ASDimensionMakeWithFraction(1.0); - return [ASWrapperLayoutSpec wrapperWithLayoutElement:_node]; -} - - -#pragma mark - - -- (NSInteger)tableNode:(ASTableNode *)tableNode numberOfRowsInSection:(NSInteger)section -{ - return 100; -} - -- (ASCellNodeBlock)tableNode:(ASTableNode *)tableNode nodeBlockForRowAtIndexPath:(NSIndexPath *)indexPath -{ - return ^{ - ASTextCellNode *cellNode = [ASTextCellNode new]; - cellNode.text = [NSString stringWithFormat:@"Row: %ld", indexPath.row]; - return cellNode; - }; -} - -@end diff --git a/submodules/AsyncDisplayKit/examples/AsyncDisplayKitOverview/Sample/OverviewComponentsViewController.h b/submodules/AsyncDisplayKit/examples/AsyncDisplayKitOverview/Sample/OverviewComponentsViewController.h deleted file mode 100644 index cae34ad209..0000000000 --- a/submodules/AsyncDisplayKit/examples/AsyncDisplayKitOverview/Sample/OverviewComponentsViewController.h +++ /dev/null @@ -1,24 +0,0 @@ -// -// OverviewComponentsViewController.h -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - - -@protocol ASLayoutSpecListEntry - -- (NSString *)entryTitle; -- (NSString *)entryDescription; - -@end - -@interface OverviewComponentsViewController : ASViewController - - -@end - diff --git a/submodules/AsyncDisplayKit/examples/AsyncDisplayKitOverview/Sample/OverviewComponentsViewController.m b/submodules/AsyncDisplayKit/examples/AsyncDisplayKitOverview/Sample/OverviewComponentsViewController.m deleted file mode 100644 index 740d975d2a..0000000000 --- a/submodules/AsyncDisplayKit/examples/AsyncDisplayKitOverview/Sample/OverviewComponentsViewController.m +++ /dev/null @@ -1,556 +0,0 @@ -// -// OverviewComponentsViewController.m -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import "OverviewComponentsViewController.h" - -#import "OverviewDetailViewController.h" -#import "OverviewASCollectionNode.h" -#import "OverviewASTableNode.h" -#import "OverviewASPagerNode.h" - -#import - - -#pragma mark - ASCenterLayoutSpecSizeThatFitsBlock - -typedef ASLayoutSpec *(^OverviewDisplayNodeSizeThatFitsBlock)(ASSizeRange constrainedSize); - - -#pragma mark - OverviewDisplayNodeWithSizeBlock - -@interface OverviewDisplayNodeWithSizeBlock : ASDisplayNode - -@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.attributedText.length > 0; - - ASStackLayoutSpec *verticalStackLayoutSpec = [ASStackLayoutSpec verticalStackLayoutSpec]; - verticalStackLayoutSpec.alignItems = ASStackLayoutAlignItemsStart; - 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 - Lifecycle Methods - -- (instancetype)init -{ - _tableNode = [ASTableNode new]; - - self = [super initWithNode:_tableNode]; - - if (self) { - _tableNode.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight; - _tableNode.delegate = (id)self; - _tableNode.dataSource = (id)self; - } - - return self; -} - -- (void)viewDidLoad -{ - [super viewDidLoad]; - - self.title = @"AsyncDisplayKit"; - - [self setupData]; -} - -- (void)viewWillAppear:(BOOL)animated -{ - [super viewWillAppear:animated]; - - [_tableNode deselectRowAtIndexPath:_tableNode.indexPathForSelectedRow animated:YES]; -} - - -#pragma mark - Data Model - -- (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:UIControlStateNormal]; - [buttonNode setTitle:@"Button Title Highlighted" withFont:[UIFont systemFontOfSize:14] withColor:nil forState:UIControlStateHighlighted]; - [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.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: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.jpg"]; - - CGSize imageNetworkImageNodeSize = (CGSize){imageNode.image.size.width / 7, imageNode.image.size.height / 7}; - - imageNode.style.preferredSize = imageNetworkImageNodeSize; - - 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.style.preferredSize = imageNetworkImageNodeSize; - - 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.style.preferredSize = 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.style.preferredSize = 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.style.preferredSize = 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 ASAbsoluteLayoutSpec - childNode = [self childNode]; - // Add a layout position to the child node that the absolute layout spec will pick up and place it on that position - childNode.style.layoutPosition = CGPointMake(10.0, 10.0); - - parentNode = [self parentNodeWithChild:childNode]; - parentNode.entryTitle = @"ASAbsoluteLayoutSpec"; - parentNode.entryDescription = @"Allows positioning children at fixed offsets."; - parentNode.sizeThatFitsBlock = ^ASLayoutSpec *(ASSizeRange constrainedSize) { - return [ASAbsoluteLayoutSpec absoluteLayoutSpecWithChildren:@[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.style.flexShrink = 1.0; - childNode3.style.flexShrink = 1.0; - - 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.alignItems = ASStackLayoutAlignItemsStart; - 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.style.preferredSize = CGSizeMake(10.0, 20.0); - childNode1.style.flexGrow = 1.0; - childNode1.backgroundColor = [UIColor greenColor]; - - childNode2 = [ASDisplayNode new]; - childNode2.style.preferredSize = CGSizeMake(10.0, 20.0); - childNode2.style.alignSelf = ASStackLayoutAlignSelfStretch; - childNode2.backgroundColor = [UIColor blueColor]; - - childNode3 = [ASDisplayNode new]; - childNode3.style.preferredSize = 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 *horizontalStackSpec = [ASStackLayoutSpec horizontalStackLayoutSpec]; - horizontalStackSpec.alignItems = ASStackLayoutAlignItemsStart; - horizontalStackSpec.children = @[childNode1, childNode2, childNode3]; - horizontalStackSpec.spacing = 5.0; // Spacing between children - - // Layout the stack layout with 100% width and 100% height of the parent node - horizontalStackSpec.style.height = ASDimensionMakeWithFraction(1.0); - horizontalStackSpec.style.width = ASDimensionMakeWithFraction(1.0); - - // Add a bit of inset - return [ASInsetLayoutSpec insetLayoutSpecWithInsets:UIEdgeInsetsMake(0.0, 5.0, 0.0, 5.0) child:horizontalStackSpec]; - }; - [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; -} - -#pragma mark - Parent / Child Helper - -- (OverviewDisplayNodeWithSizeBlock *)parentNodeWithChild:(ASDisplayNode *)child -{ - OverviewDisplayNodeWithSizeBlock *parentNode = [OverviewDisplayNodeWithSizeBlock new]; - parentNode.style.preferredSize = 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.style.preferredSize = CGSizeMake(50, 50); - childNode.backgroundColor = [UIColor blueColor]; - return childNode; -} - -#pragma mark - Actions - -- (void)buttonPressed:(ASButtonNode *)buttonNode -{ - NSLog(@"Button Pressed"); -} - -#pragma mark - - -- (NSInteger)numberOfSectionsInTableNode:(ASTableNode *)tableNode -{ - return self.data.count; -} - -- (nullable NSString *)tableNode:(ASTableNode *)tableNode titleForHeaderInSection:(NSInteger)section -{ - return self.data[section][@"title"]; -} - -- (NSInteger)tableNode:(ASTableNode *)tableNode numberOfRowsInSection:(NSInteger)section -{ - return [self.data[section][@"data"] count]; -} - -- (ASCellNodeBlock)tableNode:(ASTableNode *)tableNode nodeBlockForRowAtIndexPath:(NSIndexPath *)indexPath -{ - // You should get the node or data you want to pass to the cell node outside of the ASCellNodeBlock - ASDisplayNode *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.attributedText = [[NSAttributedString alloc] initWithString:node.entryTitle attributes:titleNodeAttributes]; - - if (node.entryDescription) { - NSDictionary *descriptionNodeAttributes = @{NSForegroundColorAttributeName : [UIColor lightGrayColor]}; - cellNode.descriptionNode.attributedText = [[NSAttributedString alloc] initWithString:node.entryDescription attributes:descriptionNodeAttributes]; - } - - return cellNode; - }; -} - -- (void)tableNode:(ASTableNode *)tableNode 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 diff --git a/submodules/AsyncDisplayKit/examples/AsyncDisplayKitOverview/Sample/OverviewDetailViewController.h b/submodules/AsyncDisplayKit/examples/AsyncDisplayKitOverview/Sample/OverviewDetailViewController.h deleted file mode 100644 index 8a006b4428..0000000000 --- a/submodules/AsyncDisplayKit/examples/AsyncDisplayKitOverview/Sample/OverviewDetailViewController.h +++ /dev/null @@ -1,16 +0,0 @@ -// -// OverviewDetailViewController.h -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -@class ASDisplayNode; - -@interface OverviewDetailViewController : UIViewController -- (instancetype)initWithNode:(ASDisplayNode *)node; -@end diff --git a/submodules/AsyncDisplayKit/examples/AsyncDisplayKitOverview/Sample/OverviewDetailViewController.m b/submodules/AsyncDisplayKit/examples/AsyncDisplayKitOverview/Sample/OverviewDetailViewController.m deleted file mode 100644 index b81b307921..0000000000 --- a/submodules/AsyncDisplayKit/examples/AsyncDisplayKitOverview/Sample/OverviewDetailViewController.m +++ /dev/null @@ -1,51 +0,0 @@ -// -// OverviewDetailViewController.m -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#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 layoutThatFits:ASSizeRangeMake(CGSizeZero, bounds.size)].size; - self.node.frame = CGRectMake(CGRectGetMidX(bounds) - (nodeSize.width / 2.0), - CGRectGetMidY(bounds) - (nodeSize.height / 2.0), - nodeSize.width, - nodeSize.height); -} - -@end diff --git a/submodules/AsyncDisplayKit/examples/AsyncDisplayKitOverview/Sample/main.m b/submodules/AsyncDisplayKit/examples/AsyncDisplayKitOverview/Sample/main.m deleted file mode 100644 index 0e5da05001..0000000000 --- a/submodules/AsyncDisplayKit/examples/AsyncDisplayKitOverview/Sample/main.m +++ /dev/null @@ -1,17 +0,0 @@ -// -// main.m -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import -#import "AppDelegate.h" - -int main(int argc, char * argv[]) { - @autoreleasepool { - return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); - } -} diff --git a/submodules/AsyncDisplayKit/examples/CatDealsCollectionView/Podfile b/submodules/AsyncDisplayKit/examples/CatDealsCollectionView/Podfile deleted file mode 100644 index 71a7f2c4b2..0000000000 --- a/submodules/AsyncDisplayKit/examples/CatDealsCollectionView/Podfile +++ /dev/null @@ -1,5 +0,0 @@ -source 'https://github.com/CocoaPods/Specs.git' -platform :ios, '9.0' -target 'Sample' do - pod 'Texture', :path => '../..' -end diff --git a/submodules/AsyncDisplayKit/examples/CatDealsCollectionView/Sample/ASDisplayNode+CatDeals.h b/submodules/AsyncDisplayKit/examples/CatDealsCollectionView/Sample/ASDisplayNode+CatDeals.h deleted file mode 100644 index a851e58122..0000000000 --- a/submodules/AsyncDisplayKit/examples/CatDealsCollectionView/Sample/ASDisplayNode+CatDeals.h +++ /dev/null @@ -1,19 +0,0 @@ -// -// ASDisplayNode+CatDeals.h -// Sample -// -// Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -NS_ASSUME_NONNULL_BEGIN - -@interface ASDisplayNode (CatDeals) - -@property (nullable, copy) NSString *catsLoggingID; - -@end - -NS_ASSUME_NONNULL_END diff --git a/submodules/AsyncDisplayKit/examples/CatDealsCollectionView/Sample/ASDisplayNode+CatDeals.mm b/submodules/AsyncDisplayKit/examples/CatDealsCollectionView/Sample/ASDisplayNode+CatDeals.mm deleted file mode 100644 index f7154ae5e3..0000000000 --- a/submodules/AsyncDisplayKit/examples/CatDealsCollectionView/Sample/ASDisplayNode+CatDeals.mm +++ /dev/null @@ -1,61 +0,0 @@ -// -// ASDisplayNode+CatDeals.mm -// Texture -// -// Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 - -#import "ASDisplayNode+CatDeals.h" - -#import - -// A place to store info on any display node in this app. -struct CatDealsNodeContext { - NSString *loggingID = nil; -}; - -// Convenience to cast _displayNodeContext into our struct reference. -NS_INLINE CatDealsNodeContext &GetNodeContext(ASDisplayNode *node) { - return *static_cast(node->_displayNodeContext); -} - -@implementation ASDisplayNode (CatDeals) - -- (void)baseDidInit -{ - _displayNodeContext = new CatDealsNodeContext; -} - -- (void)baseWillDealloc -{ - delete &GetNodeContext(self); -} - -- (void)setCatsLoggingID:(NSString *)catsLoggingID -{ - NSString *copy = [catsLoggingID copy]; - ASLockScopeSelf(); - GetNodeContext(self).loggingID = copy; -} - -- (NSString *)catsLoggingID -{ - ASLockScopeSelf(); - return GetNodeContext(self).loggingID; -} - -- (void)didEnterVisibleState -{ - if (NSString *loggingID = self.catsLoggingID) { - NSLog(@"Visible: %@", loggingID); - } -} - -- (void)didExitVisibleState -{ - if (NSString *loggingID = self.catsLoggingID) { - NSLog(@"NotVisible: %@", loggingID); - } -} - -@end diff --git a/submodules/AsyncDisplayKit/examples/CatDealsCollectionView/Sample/AppDelegate.h b/submodules/AsyncDisplayKit/examples/CatDealsCollectionView/Sample/AppDelegate.h deleted file mode 100644 index db20870a31..0000000000 --- a/submodules/AsyncDisplayKit/examples/CatDealsCollectionView/Sample/AppDelegate.h +++ /dev/null @@ -1,18 +0,0 @@ -// -// AppDelegate.h -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -#define SIMULATE_WEB_RESPONSE 0 - -@interface AppDelegate : UIResponder - -@property (strong, nonatomic) UIWindow *window; - -@end diff --git a/submodules/AsyncDisplayKit/examples/CatDealsCollectionView/Sample/AppDelegate.m b/submodules/AsyncDisplayKit/examples/CatDealsCollectionView/Sample/AppDelegate.m deleted file mode 100644 index 447ff93b88..0000000000 --- a/submodules/AsyncDisplayKit/examples/CatDealsCollectionView/Sample/AppDelegate.m +++ /dev/null @@ -1,49 +0,0 @@ -// -// AppDelegate.m -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import "AppDelegate.h" - -#import "PresentingViewController.h" -#import "ViewController.h" - -@implementation AppDelegate - -- (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] init]; - - [self pushNewViewControllerAnimated:NO]; - - [self.window makeKeyAndVisible]; - - return YES; -} - -- (void)pushNewViewControllerAnimated:(BOOL)animated -{ - UINavigationController *navController = (UINavigationController *)self.window.rootViewController; - -#if SIMULATE_WEB_RESPONSE - UIViewController *viewController = [[PresentingViewController alloc] init]; -#else - UIViewController *viewController = [[ViewController alloc] init]; - viewController.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:@"Push Another Copy" style:UIBarButtonItemStylePlain target:self action:@selector(pushNewViewController)]; -#endif - - [navController pushViewController:viewController animated:animated]; -} - -- (void)pushNewViewController -{ - [self pushNewViewControllerAnimated:YES]; -} - -@end diff --git a/submodules/AsyncDisplayKit/examples/CatDealsCollectionView/Sample/BlurbNode.h b/submodules/AsyncDisplayKit/examples/CatDealsCollectionView/Sample/BlurbNode.h deleted file mode 100644 index 5451fb39f0..0000000000 --- a/submodules/AsyncDisplayKit/examples/CatDealsCollectionView/Sample/BlurbNode.h +++ /dev/null @@ -1,17 +0,0 @@ -// -// BlurbNode.h -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -/** - * Simple node that displays a placekitten.com attribution. - */ -@interface BlurbNode : ASCellNode - -@end diff --git a/submodules/AsyncDisplayKit/examples/CatDealsCollectionView/Sample/BlurbNode.m b/submodules/AsyncDisplayKit/examples/CatDealsCollectionView/Sample/BlurbNode.m deleted file mode 100644 index 9c72b6d573..0000000000 --- a/submodules/AsyncDisplayKit/examples/CatDealsCollectionView/Sample/BlurbNode.m +++ /dev/null @@ -1,104 +0,0 @@ -// -// BlurbNode.m -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import "BlurbNode.h" - -#import -#import - -#import -#import - -static CGFloat kTextPadding = 10.0f; - -@interface BlurbNode () -{ - ASTextNode *_textNode; -} - -@end - - -@implementation BlurbNode - -#pragma mark - -#pragma mark ASCellNode. - -- (instancetype)init -{ - if (!(self = [super init])) - return nil; - - self.backgroundColor = [UIColor lightGrayColor]; - // create a text node - _textNode = [[ASTextNode alloc] init]; - _textNode.maximumNumberOfLines = 2; - - // configure the node to support tappable links - _textNode.delegate = self; - _textNode.userInteractionEnabled = YES; - - // generate an attributed string using the custom link attribute specified above - NSString *blurb = @"Kittens courtesy lorempixel.com \U0001F638 \nTitles courtesy of catipsum.com"; - NSMutableAttributedString *string = [[NSMutableAttributedString alloc] initWithString:blurb]; - [string addAttribute:NSFontAttributeName value:[UIFont fontWithName:@"HelveticaNeue-Light" size:16.0f] range:NSMakeRange(0, blurb.length)]; - [string addAttributes:@{ - NSLinkAttributeName: [NSURL URLWithString:@"http://lorempixel.com/"], - NSForegroundColorAttributeName: [UIColor blueColor], - NSUnderlineStyleAttributeName: @(NSUnderlineStyleSingle | NSUnderlinePatternDot), - } range:[blurb rangeOfString:@"lorempixel.com"]]; - [string addAttributes:@{ - NSLinkAttributeName: [NSURL URLWithString:@"http://www.catipsum.com/"], - NSForegroundColorAttributeName: [UIColor blueColor], - NSUnderlineStyleAttributeName: @(NSUnderlineStyleSingle | NSUnderlinePatternDot), - } range:[blurb rangeOfString:@"catipsum.com"]]; - _textNode.attributedText = string; - - // add it as a subnode, and we're done - [self addSubnode:_textNode]; - - return self; -} - -- (void)didLoad -{ - // enable highlighting now that self.layer has loaded -- see ASHighlightOverlayLayer.h - self.layer.as_allowsHighlightDrawing = YES; - - [super didLoad]; -} - -- (ASLayoutSpec *)layoutSpecThatFits:(ASSizeRange)constrainedSize -{ - ASCenterLayoutSpec *centerSpec = [[ASCenterLayoutSpec alloc] init]; - centerSpec.centeringOptions = ASCenterLayoutSpecCenteringX; - centerSpec.sizingOptions = ASCenterLayoutSpecSizingOptionMinimumY; - centerSpec.child = _textNode; - - UIEdgeInsets padding = UIEdgeInsetsMake(kTextPadding, kTextPadding, kTextPadding, kTextPadding); - return [ASInsetLayoutSpec insetLayoutSpecWithInsets:padding child:centerSpec]; -} - - -#pragma mark - -#pragma mark ASTextNodeDelegate methods. - -- (BOOL)textNode:(ASTextNode *)richTextNode shouldHighlightLinkAttribute:(NSString *)attribute value:(id)value atPoint:(CGPoint)point -{ - // opt into link highlighting -- tap and hold the link to try it! must enable highlighting on a layer, see -didLoad - return YES; -} - -- (void)textNode:(ASTextNode *)richTextNode tappedLinkAttribute:(NSString *)attribute value:(NSURL *)URL atPoint:(CGPoint)point textRange:(NSRange)textRange -{ - // the node tapped a link, open it - [[UIApplication sharedApplication] openURL:URL]; -} - -@end diff --git a/submodules/AsyncDisplayKit/examples/CatDealsCollectionView/Sample/Images.xcassets/LaunchImage.launchimage/Contents.json b/submodules/AsyncDisplayKit/examples/CatDealsCollectionView/Sample/Images.xcassets/LaunchImage.launchimage/Contents.json deleted file mode 100644 index c5fda8e395..0000000000 --- a/submodules/AsyncDisplayKit/examples/CatDealsCollectionView/Sample/Images.xcassets/LaunchImage.launchimage/Contents.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "images" : [ - - ], - "info" : { - "version" : 1, - "author" : "xcode" - } -} \ No newline at end of file diff --git a/submodules/AsyncDisplayKit/examples/CatDealsCollectionView/Sample/Images.xcassets/cat_face.imageset/Contents.json b/submodules/AsyncDisplayKit/examples/CatDealsCollectionView/Sample/Images.xcassets/cat_face.imageset/Contents.json deleted file mode 100644 index a9e3a5b11b..0000000000 --- a/submodules/AsyncDisplayKit/examples/CatDealsCollectionView/Sample/Images.xcassets/cat_face.imageset/Contents.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "images" : [ - { - "idiom" : "universal", - "filename" : "cat_face.png", - "scale" : "1x" - }, - { - "idiom" : "universal", - "scale" : "2x" - }, - { - "idiom" : "universal", - "scale" : "3x" - } - ], - "info" : { - "version" : 1, - "author" : "xcode" - } -} \ No newline at end of file diff --git a/submodules/AsyncDisplayKit/examples/CatDealsCollectionView/Sample/Images.xcassets/cat_face.imageset/cat_face.png b/submodules/AsyncDisplayKit/examples/CatDealsCollectionView/Sample/Images.xcassets/cat_face.imageset/cat_face.png deleted file mode 100644 index ee4407212c..0000000000 Binary files a/submodules/AsyncDisplayKit/examples/CatDealsCollectionView/Sample/Images.xcassets/cat_face.imageset/cat_face.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/examples/CatDealsCollectionView/Sample/Info.plist b/submodules/AsyncDisplayKit/examples/CatDealsCollectionView/Sample/Info.plist deleted file mode 100644 index 8c57e7a83d..0000000000 --- a/submodules/AsyncDisplayKit/examples/CatDealsCollectionView/Sample/Info.plist +++ /dev/null @@ -1,59 +0,0 @@ - - - - - NSAppTransportSecurity - - NSAllowsArbitraryLoads - - NSExceptionDomains - - http://lorempixel.com - - - - CFBundleDevelopmentRegion - en - CFBundleExecutable - $(EXECUTABLE_NAME) - CFBundleIcons - - CFBundleIcons~ipad - - CFBundleIdentifier - com.facebook.AsyncDisplayKit.$(PRODUCT_NAME:rfc1034identifier) - CFBundleInfoDictionaryVersion - 6.0 - CFBundleName - $(PRODUCT_NAME) - CFBundlePackageType - APPL - CFBundleShortVersionString - 1.0 - CFBundleSignature - ???? - CFBundleVersion - 1 - LSRequiresIPhoneOS - - UILaunchStoryboardName - Launchboard - UIRequiredDeviceCapabilities - - armv7 - - UISupportedInterfaceOrientations - - UIInterfaceOrientationPortrait - UIInterfaceOrientationLandscapeLeft - UIInterfaceOrientationLandscapeRight - - UISupportedInterfaceOrientations~ipad - - UIInterfaceOrientationPortrait - UIInterfaceOrientationPortraitUpsideDown - UIInterfaceOrientationLandscapeLeft - UIInterfaceOrientationLandscapeRight - - - diff --git a/submodules/AsyncDisplayKit/examples/CatDealsCollectionView/Sample/ItemNode.h b/submodules/AsyncDisplayKit/examples/CatDealsCollectionView/Sample/ItemNode.h deleted file mode 100644 index 19bfec29cc..0000000000 --- a/submodules/AsyncDisplayKit/examples/CatDealsCollectionView/Sample/ItemNode.h +++ /dev/null @@ -1,18 +0,0 @@ -// -// ItemNode.h -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import -#import "ItemViewModel.h" - -@interface ItemNode : ASCellNode - -+ (CGSize)sizeForWidth:(CGFloat)width; -+ (CGSize)preferredViewSize; - -@end diff --git a/submodules/AsyncDisplayKit/examples/CatDealsCollectionView/Sample/ItemNode.m b/submodules/AsyncDisplayKit/examples/CatDealsCollectionView/Sample/ItemNode.m deleted file mode 100644 index 6cd05accdb..0000000000 --- a/submodules/AsyncDisplayKit/examples/CatDealsCollectionView/Sample/ItemNode.m +++ /dev/null @@ -1,393 +0,0 @@ -// -// ItemNode.m -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import "ItemNode.h" - -#import "ASDisplayNode+CatDeals.h" -#import "ItemStyles.h" -#import "PlaceholderNetworkImageNode.h" -#import - -static CGFloat ASIsRTL() -{ - static BOOL __isRTL = NO; - static dispatch_once_t onceToken; - dispatch_once(&onceToken, ^{ - __isRTL = [UIApplication sharedApplication].userInterfaceLayoutDirection == UIUserInterfaceLayoutDirectionRightToLeft; - }); - return __isRTL; -} - -const CGFloat kFixedLabelsAreaHeight = 96.0; -const CGFloat kDesignWidth = 320.0; -const CGFloat kDesignHeight = 299.0; -const CGFloat kBadgeHeight = 34.0; -const CGFloat kSoldOutGBHeight = 50.0; - -@interface ItemNode() - -@property (nonatomic, strong) ItemViewModel *nodeModel; - -@property (nonatomic, strong) PlaceholderNetworkImageNode *dealImageView; - -@property (nonatomic, strong) ASTextNode *titleLabel; -@property (nonatomic, strong) ASTextNode *firstInfoLabel; -@property (nonatomic, strong) ASTextNode *distanceLabel; -@property (nonatomic, strong) ASTextNode *secondInfoLabel; -@property (nonatomic, strong) ASTextNode *originalPriceLabel; -@property (nonatomic, strong) ASTextNode *finalPriceLabel; -@property (nonatomic, strong) ASTextNode *soldOutLabelFlat; -@property (nonatomic, strong) ASDisplayNode *soldOutLabelBackground; -@property (nonatomic, strong) ASDisplayNode *soldOutOverlay; -@property (nonatomic, strong) ASTextNode *badge; - -@end - -@implementation ItemNode -// Defined on ASCellNode -@dynamic nodeModel; - -+ (void)load -{ - // Need to happen on main thread. - ASIsRTL(); -} - -- (instancetype)init -{ - self = [super init]; - if (self != nil) { - [self setupNodes]; - [self updateBackgroundColor]; - } - return self; -} - -- (void)setNodeModel:(ItemViewModel *)nodeModel -{ - [super setNodeModel:nodeModel]; - - self.catsLoggingID = [NSString stringWithFormat:@"CatDeal#%ld", (long)nodeModel.identifier]; - [self updateLabels]; - [self updateAccessibilityIdentifier]; -} - -- (void)setupNodes -{ - self.dealImageView = [[PlaceholderNetworkImageNode alloc] init]; - self.dealImageView.delegate = self; - self.dealImageView.placeholderEnabled = YES; - self.dealImageView.placeholderImageOverride = [ItemStyles placeholderImage]; - self.dealImageView.defaultImage = [ItemStyles placeholderImage]; - self.dealImageView.contentMode = UIViewContentModeScaleToFill; - self.dealImageView.placeholderFadeDuration = 0.0; - self.dealImageView.layerBacked = YES; - - self.titleLabel = [[ASTextNode alloc] init]; - self.titleLabel.maximumNumberOfLines = 2; - self.titleLabel.style.alignSelf = ASStackLayoutAlignSelfStart; - self.titleLabel.style.flexGrow = 1.0; - self.titleLabel.layerBacked = YES; - - self.firstInfoLabel = [[ASTextNode alloc] init]; - self.firstInfoLabel.maximumNumberOfLines = 1; - self.firstInfoLabel.layerBacked = YES; - - self.secondInfoLabel = [[ASTextNode alloc] init]; - self.secondInfoLabel.maximumNumberOfLines = 1; - self.secondInfoLabel.layerBacked = YES; - - self.distanceLabel = [[ASTextNode alloc] init]; - self.distanceLabel.maximumNumberOfLines = 1; - self.distanceLabel.layerBacked = YES; - - self.originalPriceLabel = [[ASTextNode alloc] init]; - self.originalPriceLabel.maximumNumberOfLines = 1; - self.originalPriceLabel.layerBacked = YES; - - self.finalPriceLabel = [[ASTextNode alloc] init]; - self.finalPriceLabel.maximumNumberOfLines = 1; - self.finalPriceLabel.layerBacked = YES; - - self.badge = [[ASTextNode alloc] init]; - self.badge.hidden = YES; - self.badge.layerBacked = YES; - - self.soldOutLabelFlat = [[ASTextNode alloc] init]; - self.soldOutLabelFlat.layerBacked = YES; - - self.soldOutLabelBackground = [[ASDisplayNode alloc] init]; - self.soldOutLabelBackground.style.width = ASDimensionMakeWithFraction(1.0); - self.soldOutLabelBackground.style.height = ASDimensionMakeWithPoints(kSoldOutGBHeight); - self.soldOutLabelBackground.backgroundColor = [[UIColor whiteColor] colorWithAlphaComponent:0.9]; - self.soldOutLabelBackground.style.flexGrow = 1.0; - self.soldOutLabelBackground.layerBacked = YES; - - self.soldOutOverlay = [[ASDisplayNode alloc] init]; - self.soldOutOverlay.style.flexGrow = 1.0; - self.soldOutOverlay.backgroundColor = [[UIColor whiteColor] colorWithAlphaComponent:0.5]; - self.soldOutOverlay.layerBacked = YES; - - [self addSubnode:self.dealImageView]; - [self addSubnode:self.titleLabel]; - [self addSubnode:self.firstInfoLabel]; - [self addSubnode:self.secondInfoLabel]; - [self addSubnode:self.originalPriceLabel]; - [self addSubnode:self.finalPriceLabel]; - [self addSubnode:self.distanceLabel]; - [self addSubnode:self.badge]; - - [self addSubnode:self.soldOutLabelBackground]; - [self addSubnode:self.soldOutLabelFlat]; - [self addSubnode:self.soldOutOverlay]; - self.soldOutOverlay.hidden = YES; - self.soldOutLabelBackground.hidden = YES; - self.soldOutLabelFlat.hidden = YES; - - if (ASIsRTL()) { - self.titleLabel.style.alignSelf = ASStackLayoutAlignSelfEnd; - self.firstInfoLabel.style.alignSelf = ASStackLayoutAlignSelfEnd; - self.distanceLabel.style.alignSelf = ASStackLayoutAlignSelfEnd; - self.secondInfoLabel.style.alignSelf = ASStackLayoutAlignSelfEnd; - self.originalPriceLabel.style.alignSelf = ASStackLayoutAlignSelfStart; - self.finalPriceLabel.style.alignSelf = ASStackLayoutAlignSelfStart; - } else { - self.firstInfoLabel.style.alignSelf = ASStackLayoutAlignSelfStart; - self.distanceLabel.style.alignSelf = ASStackLayoutAlignSelfStart; - self.secondInfoLabel.style.alignSelf = ASStackLayoutAlignSelfStart; - self.originalPriceLabel.style.alignSelf = ASStackLayoutAlignSelfEnd; - self.finalPriceLabel.style.alignSelf = ASStackLayoutAlignSelfEnd; - } -} - -- (void)updateLabels -{ - // Set Title text - if (self.nodeModel.titleText) { - self.titleLabel.attributedText = [[NSAttributedString alloc] initWithString:self.nodeModel.titleText attributes:[ItemStyles titleStyle]]; - } - if (self.nodeModel.firstInfoText) { - self.firstInfoLabel.attributedText = [[NSAttributedString alloc] initWithString:self.nodeModel.firstInfoText attributes:[ItemStyles subtitleStyle]]; - } - - if (self.nodeModel.secondInfoText) { - self.secondInfoLabel.attributedText = [[NSAttributedString alloc] initWithString:self.nodeModel.secondInfoText attributes:[ItemStyles secondInfoStyle]]; - } - if (self.nodeModel.originalPriceText) { - self.originalPriceLabel.attributedText = [[NSAttributedString alloc] initWithString:self.nodeModel.originalPriceText attributes:[ItemStyles originalPriceStyle]]; - } - if (self.nodeModel.finalPriceText) { - self.finalPriceLabel.attributedText = [[NSAttributedString alloc] initWithString:self.nodeModel.finalPriceText attributes:[ItemStyles finalPriceStyle]]; - } - if (self.nodeModel.distanceLabelText) { - NSString *format = ASIsRTL() ? @"%@ •" : @"• %@"; - NSString *distanceText = [NSString stringWithFormat:format, self.nodeModel.distanceLabelText]; - - self.distanceLabel.attributedText = [[NSAttributedString alloc] initWithString:distanceText attributes:[ItemStyles distanceStyle]]; - } - - BOOL isSoldOut = self.nodeModel.soldOutText != nil; - - if (isSoldOut) { - NSString *soldOutText = self.nodeModel.soldOutText; - self.soldOutLabelFlat.attributedText = [[NSAttributedString alloc] initWithString:soldOutText attributes:[ItemStyles soldOutStyle]]; - } - self.soldOutOverlay.hidden = !isSoldOut; - self.soldOutLabelFlat.hidden = !isSoldOut; - self.soldOutLabelBackground.hidden = !isSoldOut; - - BOOL hasBadge = self.nodeModel.badgeText != nil; - if (hasBadge) { - self.badge.attributedText = [[NSAttributedString alloc] initWithString:self.nodeModel.badgeText attributes:[ItemStyles badgeStyle]]; - self.badge.backgroundColor = [ItemStyles badgeColor]; - } - self.badge.hidden = !hasBadge; -} - -- (void)updateAccessibilityIdentifier -{ - ASSetDebugName(self, @"Item #%zd", self.nodeModel.identifier); - self.accessibilityIdentifier = self.nodeModel.titleText; -} - -- (void)updateBackgroundColor -{ - if (self.highlighted) { - self.backgroundColor = [[UIColor grayColor] colorWithAlphaComponent:0.3]; - } else if (self.selected) { - self.backgroundColor = [UIColor lightGrayColor]; - } else { - self.backgroundColor = [UIColor whiteColor]; - } -} - -- (void)setSelected:(BOOL)selected -{ - [super setSelected:selected]; - [self updateBackgroundColor]; -} - -- (void)setHighlighted:(BOOL)highlighted -{ - [super setHighlighted:highlighted]; - [self updateBackgroundColor]; -} - -#pragma mark - ASDisplayNode - -- (void)displayWillStart -{ - [super displayWillStart]; - [self didEnterPreloadState]; -} - -- (void)didEnterPreloadState -{ - [super didEnterPreloadState]; - if (self.nodeModel) { - [self loadImage]; - } -} - -- (ASLayoutSpec *)layoutSpecThatFits:(ASSizeRange)constrainedSize { - - ASLayoutSpec *textSpec = [self textSpec]; - ASLayoutSpec *imageSpec = [self imageSpecWithSize:constrainedSize]; - ASOverlayLayoutSpec *soldOutOverImage = [ASOverlayLayoutSpec overlayLayoutSpecWithChild:imageSpec overlay:[self soldOutLabelSpec]]; - - NSArray *stackChildren = @[soldOutOverImage, textSpec]; - - ASStackLayoutSpec *mainStack = [ASStackLayoutSpec stackLayoutSpecWithDirection:ASStackLayoutDirectionVertical spacing:0.0 justifyContent:ASStackLayoutJustifyContentStart alignItems:ASStackLayoutAlignItemsStretch children:stackChildren]; - - ASOverlayLayoutSpec *soldOutOverlay = [ASOverlayLayoutSpec overlayLayoutSpecWithChild:mainStack overlay:self.soldOutOverlay]; - - return soldOutOverlay; -} - -- (ASLayoutSpec *)textSpec -{ - CGFloat kInsetHorizontal = 16.0; - CGFloat kInsetTop = 6.0; - CGFloat kInsetBottom = 0.0; - - UIEdgeInsets textInsets = UIEdgeInsetsMake(kInsetTop, kInsetHorizontal, kInsetBottom, kInsetHorizontal); - - ASLayoutSpec *verticalSpacer = [[ASLayoutSpec alloc] init]; - verticalSpacer.style.flexGrow = 1.0; - - ASLayoutSpec *horizontalSpacer1 = [[ASLayoutSpec alloc] init]; - horizontalSpacer1.style.flexGrow = 1.0; - - ASLayoutSpec *horizontalSpacer2 = [[ASLayoutSpec alloc] init]; - horizontalSpacer2.style.flexGrow = 1.0; - - NSArray *info1Children = @[self.firstInfoLabel, self.distanceLabel, horizontalSpacer1, self.originalPriceLabel]; - NSArray *info2Children = @[self.secondInfoLabel, horizontalSpacer2, self.finalPriceLabel]; - if (ASIsRTL()) { - info1Children = [[info1Children reverseObjectEnumerator] allObjects]; - info2Children = [[info2Children reverseObjectEnumerator] allObjects]; - } - - ASStackLayoutSpec *info1Stack = [ASStackLayoutSpec stackLayoutSpecWithDirection:ASStackLayoutDirectionHorizontal spacing:1.0 justifyContent:ASStackLayoutJustifyContentStart alignItems:ASStackLayoutAlignItemsBaselineLast children:info1Children]; - - ASStackLayoutSpec *info2Stack = [ASStackLayoutSpec stackLayoutSpecWithDirection:ASStackLayoutDirectionHorizontal spacing:0.0 justifyContent:ASStackLayoutJustifyContentCenter alignItems:ASStackLayoutAlignItemsBaselineLast children:info2Children]; - - ASStackLayoutSpec *textStack = [ASStackLayoutSpec stackLayoutSpecWithDirection:ASStackLayoutDirectionVertical spacing:0.0 justifyContent:ASStackLayoutJustifyContentEnd alignItems:ASStackLayoutAlignItemsStretch children:@[self.titleLabel, verticalSpacer, info1Stack, info2Stack]]; - - ASInsetLayoutSpec *textWrapper = [ASInsetLayoutSpec insetLayoutSpecWithInsets:textInsets child:textStack]; - textWrapper.style.flexGrow = 1.0; - - return textWrapper; -} - -- (ASLayoutSpec *)imageSpecWithSize:(ASSizeRange)constrainedSize -{ - CGFloat imageRatio = [self imageRatioFromSize:constrainedSize.max]; - - ASRatioLayoutSpec *imagePlace = [ASRatioLayoutSpec ratioLayoutSpecWithRatio:imageRatio child:self.dealImageView]; - - self.badge.style.layoutPosition = CGPointMake(0, constrainedSize.max.height - kFixedLabelsAreaHeight - kBadgeHeight); - self.badge.style.height = ASDimensionMakeWithPoints(kBadgeHeight); - ASAbsoluteLayoutSpec *badgePosition = [ASAbsoluteLayoutSpec absoluteLayoutSpecWithChildren:@[self.badge]]; - - ASOverlayLayoutSpec *badgeOverImage = [ASOverlayLayoutSpec overlayLayoutSpecWithChild:imagePlace overlay:badgePosition]; - badgeOverImage.style.flexGrow = 1.0; - - return badgeOverImage; -} - -- (ASLayoutSpec *)soldOutLabelSpec { - ASCenterLayoutSpec *centerSoldOutLabel = [ASCenterLayoutSpec centerLayoutSpecWithCenteringOptions:ASCenterLayoutSpecCenteringXY sizingOptions:ASCenterLayoutSpecSizingOptionMinimumXY child:self.soldOutLabelFlat]; - ASCenterLayoutSpec *centerSoldOut = [ASCenterLayoutSpec centerLayoutSpecWithCenteringOptions:ASCenterLayoutSpecCenteringXY sizingOptions:ASCenterLayoutSpecSizingOptionDefault child:self.soldOutLabelBackground]; - ASBackgroundLayoutSpec *soldOutLabelOverBackground = [ASBackgroundLayoutSpec backgroundLayoutSpecWithChild:centerSoldOutLabel background:centerSoldOut]; - return soldOutLabelOverBackground; -} - -+ (CGSize)sizeForWidth:(CGFloat)width -{ - CGFloat height = [self scaledHeightForPreferredSize:[self preferredViewSize] scaledWidth:width]; - return CGSizeMake(width, height); -} - - -+ (CGSize)preferredViewSize -{ - return CGSizeMake(kDesignWidth, kDesignHeight); -} - -+ (CGFloat)scaledHeightForPreferredSize:(CGSize)preferredSize scaledWidth:(CGFloat)scaledWidth -{ - CGFloat scale = scaledWidth / kDesignWidth; - CGFloat scaledHeight = ceilf(scale * (kDesignHeight - kFixedLabelsAreaHeight)) + kFixedLabelsAreaHeight; - - return scaledHeight; -} - -#pragma mark - Image - -- (CGFloat)imageRatioFromSize:(CGSize)size -{ - CGFloat imageHeight = size.height - kFixedLabelsAreaHeight; - CGFloat imageRatio = imageHeight / size.width; - - return imageRatio; -} - -- (CGSize)imageSize -{ - if (!CGSizeEqualToSize(self.dealImageView.frame.size, CGSizeZero)) { - return self.dealImageView.frame.size; - } else if (!CGSizeEqualToSize(self.calculatedSize, CGSizeZero)) { - CGFloat imageRatio = [self imageRatioFromSize:self.calculatedSize]; - CGFloat imageWidth = self.calculatedSize.width; - return CGSizeMake(imageWidth, imageRatio * imageWidth); - } else { - return CGSizeZero; - } -} - -- (void)loadImage -{ - CGSize imageSize = [self imageSize]; - if (CGSizeEqualToSize(CGSizeZero, imageSize)) { - return; - } - - NSURL *url = [self.nodeModel imageURLWithSize:imageSize]; - - // if we're trying to set the deal image to what it already was, skip the work - if ([[url absoluteString] isEqualToString:[self.dealImageView.URL absoluteString]]) { - return; - } - - // Clear the flag that says we've loaded our image - [self.dealImageView setURL:url]; -} - -@end diff --git a/submodules/AsyncDisplayKit/examples/CatDealsCollectionView/Sample/ItemStyles.h b/submodules/AsyncDisplayKit/examples/CatDealsCollectionView/Sample/ItemStyles.h deleted file mode 100644 index db4d0d08d5..0000000000 --- a/submodules/AsyncDisplayKit/examples/CatDealsCollectionView/Sample/ItemStyles.h +++ /dev/null @@ -1,24 +0,0 @@ -// -// ItemStyles.h -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import -#import - -@interface ItemStyles : NSObject -+ (NSDictionary *)titleStyle; -+ (NSDictionary *)subtitleStyle; -+ (NSDictionary *)distanceStyle; -+ (NSDictionary *)secondInfoStyle; -+ (NSDictionary *)originalPriceStyle; -+ (NSDictionary *)finalPriceStyle; -+ (NSDictionary *)soldOutStyle; -+ (NSDictionary *)badgeStyle; -+ (UIColor *)badgeColor; -+ (UIImage *)placeholderImage; -@end diff --git a/submodules/AsyncDisplayKit/examples/CatDealsCollectionView/Sample/ItemStyles.m b/submodules/AsyncDisplayKit/examples/CatDealsCollectionView/Sample/ItemStyles.m deleted file mode 100644 index 1659341161..0000000000 --- a/submodules/AsyncDisplayKit/examples/CatDealsCollectionView/Sample/ItemStyles.m +++ /dev/null @@ -1,95 +0,0 @@ -// -// ItemStyles.m -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import "ItemStyles.h" - -const CGFloat kTitleFontSize = 20.0; -const CGFloat kInfoFontSize = 14.0; - -UIColor *kTitleColor; -UIColor *kInfoColor; -UIColor *kFinalPriceColor; -UIFont *kTitleFont; -UIFont *kInfoFont; - -@implementation ItemStyles - -+ (void)initialize { - if (self == [ItemStyles class]) { - kTitleColor = [UIColor darkGrayColor]; - kInfoColor = [UIColor grayColor]; - kFinalPriceColor = [UIColor greenColor]; - kTitleFont = [UIFont boldSystemFontOfSize:kTitleFontSize]; - kInfoFont = [UIFont systemFontOfSize:kInfoFontSize]; - } -} - -+ (NSDictionary *)titleStyle { - // Title Label - return @{ NSFontAttributeName:kTitleFont, - NSForegroundColorAttributeName:kTitleColor }; -} - -+ (NSDictionary *)subtitleStyle { - // First Subtitle - return @{ NSFontAttributeName:kInfoFont, - NSForegroundColorAttributeName:kInfoColor }; -} - -+ (NSDictionary *)distanceStyle { - // Distance Label - return @{ NSFontAttributeName:kInfoFont, - NSForegroundColorAttributeName:kInfoColor}; -} - -+ (NSDictionary *)secondInfoStyle { - // Second Subtitle - return @{ NSFontAttributeName:kInfoFont, - NSForegroundColorAttributeName:kInfoColor}; -} - -+ (NSDictionary *)originalPriceStyle { - // Original price - return @{ NSFontAttributeName:kInfoFont, - NSForegroundColorAttributeName:kInfoColor, - NSStrikethroughStyleAttributeName:@(NSUnderlineStyleSingle)}; -} - -+ (NSDictionary *)finalPriceStyle { - // Discounted / Claimable price label - return @{ NSFontAttributeName:kTitleFont, - NSForegroundColorAttributeName:kFinalPriceColor}; -} - -+ (NSDictionary *)soldOutStyle { - // Setup Sold Out Label - return @{ NSFontAttributeName:kTitleFont, - NSForegroundColorAttributeName:kTitleColor}; -} - -+ (NSDictionary *)badgeStyle { - // Setup Sold Out Label - return @{ NSFontAttributeName:kTitleFont, - NSForegroundColorAttributeName:[UIColor whiteColor]}; -} - -+ (UIColor *)badgeColor { - return [[UIColor purpleColor] colorWithAlphaComponent:0.4]; -} - -+ (UIImage *)placeholderImage { - static UIImage *__catFace = nil; - static dispatch_once_t onceToken; - dispatch_once (&onceToken, ^{ - __catFace = [UIImage imageNamed:@"cat_face"]; - }); - return __catFace; -} - -@end diff --git a/submodules/AsyncDisplayKit/examples/CatDealsCollectionView/Sample/ItemViewModel.h b/submodules/AsyncDisplayKit/examples/CatDealsCollectionView/Sample/ItemViewModel.h deleted file mode 100644 index 489a10515b..0000000000 --- a/submodules/AsyncDisplayKit/examples/CatDealsCollectionView/Sample/ItemViewModel.h +++ /dev/null @@ -1,29 +0,0 @@ -// -// ItemViewModel.h -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import -#import - -@interface ItemViewModel : NSObject - -+ (ItemViewModel *)randomItem; - -@property (nonatomic, readonly) NSInteger identifier; -@property (nonatomic, copy) NSString *titleText; -@property (nonatomic, copy) NSString *firstInfoText; -@property (nonatomic, copy) NSString *secondInfoText; -@property (nonatomic, copy) NSString *originalPriceText; -@property (nonatomic, copy) NSString *finalPriceText; -@property (nonatomic, copy) NSString *soldOutText; -@property (nonatomic, copy) NSString *distanceLabelText; -@property (nonatomic, copy) NSString *badgeText; - -- (NSURL *)imageURLWithSize:(CGSize)size; - -@end diff --git a/submodules/AsyncDisplayKit/examples/CatDealsCollectionView/Sample/ItemViewModel.m b/submodules/AsyncDisplayKit/examples/CatDealsCollectionView/Sample/ItemViewModel.m deleted file mode 100644 index 8f60900c60..0000000000 --- a/submodules/AsyncDisplayKit/examples/CatDealsCollectionView/Sample/ItemViewModel.m +++ /dev/null @@ -1,103 +0,0 @@ -// -// ItemViewModel.m -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import "ItemViewModel.h" -#import - -NSArray *titles; -NSArray *firstInfos; -NSArray *badges; - -@interface ItemViewModel() - -@property (nonatomic, assign) NSInteger catNumber; -@property (nonatomic, assign) NSInteger labelNumber; - -@end - -@implementation ItemViewModel - -+ (ItemViewModel *)randomItem { - return [[ItemViewModel alloc] init]; -} - -- (instancetype)init -{ - self = [super init]; - if (self) { - static _Atomic(NSInteger) nextID = ATOMIC_VAR_INIT(1); - _identifier = atomic_fetch_add(&nextID, 1); - _titleText = [self randomObjectFromArray:titles]; - _firstInfoText = [self randomObjectFromArray:firstInfos]; - _secondInfoText = [NSString stringWithFormat:@"%zd+ bought", [self randomNumberInRange:5 to:6000]]; - _originalPriceText = [NSString stringWithFormat:@"$%zd", [self randomNumberInRange:40 to:90]]; - _finalPriceText = [NSString stringWithFormat:@"$%zd", [self randomNumberInRange:5 to:30]]; - _soldOutText = (arc4random() % 5 == 0) ? @"SOLD OUT" : nil; - _distanceLabelText = [NSString stringWithFormat:@"%zd mi", [self randomNumberInRange:1 to:20]]; - if (arc4random() % 2 == 0) { - _badgeText = [self randomObjectFromArray:badges]; - } - _catNumber = [self randomNumberInRange:1 to:10]; - _labelNumber = [self randomNumberInRange:1 to:10000]; - } - return self; -} - -- (NSURL *)imageURLWithSize:(CGSize)size -{ - NSString *imageText = [NSString stringWithFormat:@"Fun cat pic %zd", self.labelNumber]; - NSString *urlString = [NSString stringWithFormat:@"http://lorempixel.com/%zd/%zd/cats/%zd/%@", - (NSInteger)roundl(size.width), - (NSInteger)roundl(size.height), self.catNumber, imageText]; - - urlString = [urlString stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet URLFragmentAllowedCharacterSet]]; - return [NSURL URLWithString:urlString]; -} - -// titles courtesy of http://www.catipsum.com/ -+ (void)initialize -{ - titles = @[@"Leave fur on owners clothes intrigued by the shower", - @"Meowwww", - @"Immediately regret falling into bathtub stare out the window", - @"Jump launch to pounce upon little yarn mouse, bare fangs at toy run hide in litter box until treats are fed", - @"Sleep nap", - @"Lick butt", - @"Chase laser lick arm hair present belly, scratch hand when stroked"]; - firstInfos = @[@"Kitty Shop", - @"Cat's r us", - @"Fantastic Felines", - @"The Cat Shop", - @"Cat in a hat", - @"Cat-tastic" - ]; - - badges = @[@"ADORABLE", - @"BOUNCES", - @"HATES CUCUMBERS", - @"SCRATCHY" - ]; -} - - -- (id)randomObjectFromArray:(NSArray *)strings -{ - u_int32_t ipsumCount = (u_int32_t)[strings count]; - u_int32_t location = arc4random_uniform(ipsumCount); - - return strings[location]; -} - -- (uint32_t)randomNumberInRange:(uint32_t)start to:(uint32_t)end { - - return start + arc4random_uniform(end - start); -} - - -@end diff --git a/submodules/AsyncDisplayKit/examples/CatDealsCollectionView/Sample/Launchboard.storyboard b/submodules/AsyncDisplayKit/examples/CatDealsCollectionView/Sample/Launchboard.storyboard deleted file mode 100644 index 673e0f7e68..0000000000 --- a/submodules/AsyncDisplayKit/examples/CatDealsCollectionView/Sample/Launchboard.storyboard +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - diff --git a/submodules/AsyncDisplayKit/examples/CatDealsCollectionView/Sample/LoadingNode.h b/submodules/AsyncDisplayKit/examples/CatDealsCollectionView/Sample/LoadingNode.h deleted file mode 100644 index 996a6798cf..0000000000 --- a/submodules/AsyncDisplayKit/examples/CatDealsCollectionView/Sample/LoadingNode.h +++ /dev/null @@ -1,14 +0,0 @@ -// -// LoadingNode.h -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -@interface LoadingNode : ASCellNode - -@end diff --git a/submodules/AsyncDisplayKit/examples/CatDealsCollectionView/Sample/LoadingNode.m b/submodules/AsyncDisplayKit/examples/CatDealsCollectionView/Sample/LoadingNode.m deleted file mode 100644 index 18681c011c..0000000000 --- a/submodules/AsyncDisplayKit/examples/CatDealsCollectionView/Sample/LoadingNode.m +++ /dev/null @@ -1,47 +0,0 @@ -// -// LoadingNode.m -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import "LoadingNode.h" - -#import - -@implementation LoadingNode { - ASDisplayNode *_loadingSpinner; -} - -#pragma mark - ASCellNode - -- (instancetype)init -{ - if (!(self = [super init])) - return nil; - - _loadingSpinner = [[ASDisplayNode alloc] initWithViewBlock:^UIView * _Nonnull{ - UIActivityIndicatorView *spinner = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleGray]; - [spinner startAnimating]; - return spinner; - }]; - _loadingSpinner.style.preferredSize = CGSizeMake(50, 50); - - // add it as a subnode, and we're done - [self addSubnode:_loadingSpinner]; - - return self; -} - -- (ASLayoutSpec *)layoutSpecThatFits:(ASSizeRange)constrainedSize -{ - ASCenterLayoutSpec *centerSpec = [[ASCenterLayoutSpec alloc] init]; - centerSpec.centeringOptions = ASCenterLayoutSpecCenteringXY; - centerSpec.sizingOptions = ASCenterLayoutSpecSizingOptionDefault; - centerSpec.child = _loadingSpinner; - return centerSpec; -} - -@end diff --git a/submodules/AsyncDisplayKit/examples/CatDealsCollectionView/Sample/PlaceholderNetworkImageNode.h b/submodules/AsyncDisplayKit/examples/CatDealsCollectionView/Sample/PlaceholderNetworkImageNode.h deleted file mode 100644 index a18e17c9ea..0000000000 --- a/submodules/AsyncDisplayKit/examples/CatDealsCollectionView/Sample/PlaceholderNetworkImageNode.h +++ /dev/null @@ -1,16 +0,0 @@ -// -// PlaceholderNetworkImageNode.h -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -@interface PlaceholderNetworkImageNode : ASNetworkImageNode - -@property (nonatomic, strong) UIImage *placeholderImageOverride; - -@end diff --git a/submodules/AsyncDisplayKit/examples/CatDealsCollectionView/Sample/PlaceholderNetworkImageNode.m b/submodules/AsyncDisplayKit/examples/CatDealsCollectionView/Sample/PlaceholderNetworkImageNode.m deleted file mode 100644 index 81129392a9..0000000000 --- a/submodules/AsyncDisplayKit/examples/CatDealsCollectionView/Sample/PlaceholderNetworkImageNode.m +++ /dev/null @@ -1,19 +0,0 @@ -// -// PlaceholderNetworkImageNode.m -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import "PlaceholderNetworkImageNode.h" - -@implementation PlaceholderNetworkImageNode - -- (UIImage *)placeholderImage -{ - return self.placeholderImageOverride; -} - -@end diff --git a/submodules/AsyncDisplayKit/examples/CatDealsCollectionView/Sample/PresentingViewController.h b/submodules/AsyncDisplayKit/examples/CatDealsCollectionView/Sample/PresentingViewController.h deleted file mode 100644 index 44c07c6a76..0000000000 --- a/submodules/AsyncDisplayKit/examples/CatDealsCollectionView/Sample/PresentingViewController.h +++ /dev/null @@ -1,14 +0,0 @@ -// -// PresentingViewController.h -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -@interface PresentingViewController : UIViewController - -@end diff --git a/submodules/AsyncDisplayKit/examples/CatDealsCollectionView/Sample/PresentingViewController.m b/submodules/AsyncDisplayKit/examples/CatDealsCollectionView/Sample/PresentingViewController.m deleted file mode 100644 index 216cf4dd28..0000000000 --- a/submodules/AsyncDisplayKit/examples/CatDealsCollectionView/Sample/PresentingViewController.m +++ /dev/null @@ -1,31 +0,0 @@ -// -// PresentingViewController.m -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import "PresentingViewController.h" -#import "ViewController.h" - -@interface PresentingViewController () - -@end - -@implementation PresentingViewController - -- (void)viewDidLoad -{ - [super viewDidLoad]; - self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:@"Push Details" style:UIBarButtonItemStylePlain target:self action:@selector(pushNewViewController)]; -} - -- (void)pushNewViewController -{ - ViewController *controller = [[ViewController alloc] init]; - [self.navigationController pushViewController:controller animated:true]; -} - -@end diff --git a/submodules/AsyncDisplayKit/examples/CatDealsCollectionView/Sample/ViewController.h b/submodules/AsyncDisplayKit/examples/CatDealsCollectionView/Sample/ViewController.h deleted file mode 100644 index 560b6a2d03..0000000000 --- a/submodules/AsyncDisplayKit/examples/CatDealsCollectionView/Sample/ViewController.h +++ /dev/null @@ -1,14 +0,0 @@ -// -// ViewController.h -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -@interface ViewController : ASViewController - -@end diff --git a/submodules/AsyncDisplayKit/examples/CatDealsCollectionView/Sample/ViewController.m b/submodules/AsyncDisplayKit/examples/CatDealsCollectionView/Sample/ViewController.m deleted file mode 100644 index c1f9111ad0..0000000000 --- a/submodules/AsyncDisplayKit/examples/CatDealsCollectionView/Sample/ViewController.m +++ /dev/null @@ -1,221 +0,0 @@ -// -// ViewController.m -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import "ViewController.h" - -#import -#import "ItemNode.h" -#import "BlurbNode.h" -#import "LoadingNode.h" - -static const NSTimeInterval kWebResponseDelay = 1.0; -static const BOOL kSimulateWebResponse = YES; -static const NSInteger kBatchSize = 20; - -static const CGFloat kHorizontalSectionPadding = 10.0f; - -@interface ViewController () -{ - ASCollectionNode *_collectionNode; - NSMutableArray *_data; -} - -@end - - -@implementation ViewController - -#pragma mark - -#pragma mark UIViewController. - -- (instancetype)init -{ - UICollectionViewFlowLayout *layout = [[UICollectionViewFlowLayout alloc] init]; - _collectionNode = [[ASCollectionNode alloc] initWithCollectionViewLayout:layout]; - - self = [super initWithNode:_collectionNode]; - - if (self) { - self.title = @"Cat Deals"; - - _collectionNode.dataSource = self; - _collectionNode.delegate = self; - _collectionNode.backgroundColor = [UIColor grayColor]; - _collectionNode.accessibilityIdentifier = @"Cat deals list"; - - ASRangeTuningParameters preloadTuning; - preloadTuning.leadingBufferScreenfuls = 2; - preloadTuning.trailingBufferScreenfuls = 1; - [_collectionNode setTuningParameters:preloadTuning forRangeType:ASLayoutRangeTypePreload]; - - ASRangeTuningParameters displayTuning; - displayTuning.leadingBufferScreenfuls = 1; - displayTuning.trailingBufferScreenfuls = 0.5; - [_collectionNode setTuningParameters:displayTuning forRangeType:ASLayoutRangeTypeDisplay]; - - [_collectionNode registerSupplementaryNodeOfKind:UICollectionElementKindSectionHeader]; - [_collectionNode registerSupplementaryNodeOfKind:UICollectionElementKindSectionFooter]; - - _data = [[NSMutableArray alloc] init]; - - self.navigationItem.leftItemsSupplementBackButton = YES; - self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemRefresh target:self action:@selector(reloadTapped)]; - } - - return self; -} - -- (void)viewDidLoad -{ - [super viewDidLoad]; - - // set any collectionView properties here (once the node's backing view is loaded) - _collectionNode.leadingScreensForBatching = 2; - [self fetchMoreCatsWithCompletion:nil]; -} - -- (void)fetchMoreCatsWithCompletion:(void (^)(BOOL))completion -{ - if (kSimulateWebResponse) { - __weak typeof(self) weakSelf = self; - void(^mockWebService)() = ^{ - NSLog(@"ViewController \"got data from a web service\""); - ViewController *strongSelf = weakSelf; - if (strongSelf != nil) - { - [strongSelf appendMoreItems:kBatchSize completion:completion]; - } - else { - NSLog(@"ViewController is nil - won't update collection"); - } - }; - - dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(kWebResponseDelay * NSEC_PER_SEC)), dispatch_get_main_queue(), mockWebService); - } else { - [self appendMoreItems:kBatchSize completion:completion]; - } -} - -- (void)appendMoreItems:(NSInteger)numberOfNewItems completion:(void (^)(BOOL))completion -{ - NSArray *newData = [self getMoreData:numberOfNewItems]; - [_collectionNode performBatchAnimated:YES updates:^{ - [_data addObjectsFromArray:newData]; - NSArray *addedIndexPaths = [self indexPathsForObjects:newData]; - [_collectionNode insertItemsAtIndexPaths:addedIndexPaths]; - } completion:completion]; -} - -- (NSArray *)getMoreData:(NSInteger)count -{ - NSMutableArray *data = [NSMutableArray array]; - for (int i = 0; i < count; i++) { - [data addObject:[ItemViewModel randomItem]]; - } - return data; -} - -- (NSArray *)indexPathsForObjects:(NSArray *)data -{ - NSMutableArray *indexPaths = [NSMutableArray array]; - NSInteger section = 0; - for (ItemViewModel *viewModel in data) { - NSInteger item = [_data indexOfObject:viewModel]; - NSAssert(item < [_data count] && item != NSNotFound, @"Item should be in _data"); - [indexPaths addObject:[NSIndexPath indexPathForItem:item inSection:section]]; - } - return indexPaths; -} - -- (void)viewWillTransitionToSize:(CGSize)size withTransitionCoordinator:(id)coordinator -{ - [_collectionNode.view.collectionViewLayout invalidateLayout]; -} - -- (void)reloadTapped -{ - [_collectionNode reloadData]; -} - -#pragma mark - ASCollectionNodeDelegate / ASCollectionNodeDataSource - -- (ASCellNodeBlock)collectionNode:(ASCollectionNode *)collectionNode nodeBlockForItemAtIndexPath:(NSIndexPath *)indexPath -{ - return ^{ - return [[ItemNode alloc] init]; - }; -} - -- (id)collectionNode:(ASCollectionNode *)collectionNode nodeModelForItemAtIndexPath:(NSIndexPath *)indexPath -{ - return _data[indexPath.item]; -} - -- (ASCellNode *)collectionNode:(ASCollectionNode *)collectionNode nodeForSupplementaryElementOfKind:(NSString *)kind atIndexPath:(NSIndexPath *)indexPath -{ - if ([kind isEqualToString:UICollectionElementKindSectionHeader] && indexPath.section == 0) { - return [[BlurbNode alloc] init]; - } else if ([kind isEqualToString:UICollectionElementKindSectionFooter] && indexPath.section == 0) { - return [[LoadingNode alloc] init]; - } - return nil; -} - -- (ASSizeRange)collectionNode:(ASCollectionNode *)collectionNode constrainedSizeForItemAtIndexPath:(NSIndexPath *)indexPath -{ - CGFloat collectionViewWidth = CGRectGetWidth(self.view.frame) - 2 * kHorizontalSectionPadding; - CGFloat oneItemWidth = [ItemNode preferredViewSize].width; - NSInteger numColumns = floor(collectionViewWidth / oneItemWidth); - // Number of columns should be at least 1 - numColumns = MAX(1, numColumns); - - CGFloat totalSpaceBetweenColumns = (numColumns - 1) * kHorizontalSectionPadding; - CGFloat itemWidth = ((collectionViewWidth - totalSpaceBetweenColumns) / numColumns); - CGSize itemSize = [ItemNode sizeForWidth:itemWidth]; - return ASSizeRangeMake(itemSize, itemSize); -} - -- (NSInteger)collectionNode:(ASCollectionNode *)collectionNode numberOfItemsInSection:(NSInteger)section -{ - return [_data count]; -} - -- (NSInteger)numberOfSectionsInCollectionNode:(ASCollectionNode *)collectionNode -{ - return 1; -} - -- (void)collectionNode:(ASCollectionNode *)collectionNode willBeginBatchFetchWithContext:(ASBatchContext *)context -{ - [self fetchMoreCatsWithCompletion:^(BOOL finished){ - [context completeBatchFetching:YES]; - }]; -} - -#pragma mark - ASCollectionDelegateFlowLayout - -- (ASSizeRange)collectionNode:(ASCollectionNode *)collectionNode sizeRangeForHeaderInSection:(NSInteger)section -{ - if (section == 0) { - return ASSizeRangeUnconstrained; - } else { - return ASSizeRangeZero; - } -} - -- (ASSizeRange)collectionNode:(ASCollectionNode *)collectionNode sizeRangeForFooterInSection:(NSInteger)section -{ - if (section == 0) { - return ASSizeRangeUnconstrained; - } else { - return ASSizeRangeZero; - } -} - -@end diff --git a/submodules/AsyncDisplayKit/examples/CatDealsCollectionView/Sample/main.m b/submodules/AsyncDisplayKit/examples/CatDealsCollectionView/Sample/main.m deleted file mode 100644 index 65850400e4..0000000000 --- a/submodules/AsyncDisplayKit/examples/CatDealsCollectionView/Sample/main.m +++ /dev/null @@ -1,17 +0,0 @@ -// -// main.m -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import -#import "AppDelegate.h" - -int main(int argc, char * argv[]) { - @autoreleasepool { - return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); - } -} diff --git a/submodules/AsyncDisplayKit/examples/CustomCollectionView-Swift/Podfile b/submodules/AsyncDisplayKit/examples/CustomCollectionView-Swift/Podfile deleted file mode 100644 index 92a9acc9c8..0000000000 --- a/submodules/AsyncDisplayKit/examples/CustomCollectionView-Swift/Podfile +++ /dev/null @@ -1,8 +0,0 @@ -source 'https://github.com/CocoaPods/Specs.git' -platform :ios, '9.0' - -use_frameworks! - -target 'Sample' do - pod 'Texture', :path => '../..' -end \ No newline at end of file diff --git a/submodules/AsyncDisplayKit/examples/CustomCollectionView-Swift/Sample.xcworkspace/contents.xcworkspacedata b/submodules/AsyncDisplayKit/examples/CustomCollectionView-Swift/Sample.xcworkspace/contents.xcworkspacedata deleted file mode 100644 index 7b5a2f3050..0000000000 --- a/submodules/AsyncDisplayKit/examples/CustomCollectionView-Swift/Sample.xcworkspace/contents.xcworkspacedata +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - diff --git a/submodules/AsyncDisplayKit/examples/CustomCollectionView-Swift/Sample/AppDelegate.swift b/submodules/AsyncDisplayKit/examples/CustomCollectionView-Swift/Sample/AppDelegate.swift deleted file mode 100644 index 5556f8c77e..0000000000 --- a/submodules/AsyncDisplayKit/examples/CustomCollectionView-Swift/Sample/AppDelegate.swift +++ /dev/null @@ -1,54 +0,0 @@ -// -// AppDelegate.swift -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -import UIKit - -@UIApplicationMain -class AppDelegate: UIResponder, UIApplicationDelegate { - - var window: UIWindow? - - - func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool { - // Override point for customization after application launch. - let window = UIWindow(frame: UIScreen.main.bounds) - window.backgroundColor = .white - window.rootViewController = ViewController() - window.makeKeyAndVisible() - - self.window = window - - return true - } - - func applicationWillResignActive(_ application: UIApplication) { - // 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 invalidate graphics rendering callbacks. Games should use this method to pause the game. - } - - func applicationDidEnterBackground(_ application: UIApplication) { - // 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. - } - - func applicationWillEnterForeground(_ application: UIApplication) { - // Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background. - } - - func applicationDidBecomeActive(_ application: UIApplication) { - // 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. - } - - func applicationWillTerminate(_ application: UIApplication) { - // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. - } - - -} - diff --git a/submodules/AsyncDisplayKit/examples/CustomCollectionView-Swift/Sample/Assets.xcassets/AppIcon.appiconset/Contents.json b/submodules/AsyncDisplayKit/examples/CustomCollectionView-Swift/Sample/Assets.xcassets/AppIcon.appiconset/Contents.json deleted file mode 100644 index b8236c6534..0000000000 --- a/submodules/AsyncDisplayKit/examples/CustomCollectionView-Swift/Sample/Assets.xcassets/AppIcon.appiconset/Contents.json +++ /dev/null @@ -1,48 +0,0 @@ -{ - "images" : [ - { - "idiom" : "iphone", - "size" : "20x20", - "scale" : "2x" - }, - { - "idiom" : "iphone", - "size" : "20x20", - "scale" : "3x" - }, - { - "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" - } -} \ No newline at end of file diff --git a/submodules/AsyncDisplayKit/examples/CustomCollectionView-Swift/Sample/Assets.xcassets/Contents.json b/submodules/AsyncDisplayKit/examples/CustomCollectionView-Swift/Sample/Assets.xcassets/Contents.json deleted file mode 100644 index da4a164c91..0000000000 --- a/submodules/AsyncDisplayKit/examples/CustomCollectionView-Swift/Sample/Assets.xcassets/Contents.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "info" : { - "version" : 1, - "author" : "xcode" - } -} \ No newline at end of file diff --git a/submodules/AsyncDisplayKit/examples/CustomCollectionView-Swift/Sample/Assets.xcassets/image_0.imageset/Contents.json b/submodules/AsyncDisplayKit/examples/CustomCollectionView-Swift/Sample/Assets.xcassets/image_0.imageset/Contents.json deleted file mode 100644 index 09ec0851ee..0000000000 --- a/submodules/AsyncDisplayKit/examples/CustomCollectionView-Swift/Sample/Assets.xcassets/image_0.imageset/Contents.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "images" : [ - { - "idiom" : "universal", - "filename" : "image_0.jpg", - "scale" : "1x" - }, - { - "idiom" : "universal", - "scale" : "2x" - }, - { - "idiom" : "universal", - "scale" : "3x" - } - ], - "info" : { - "version" : 1, - "author" : "xcode" - } -} \ No newline at end of file diff --git a/submodules/AsyncDisplayKit/examples/CustomCollectionView-Swift/Sample/Assets.xcassets/image_0.imageset/image_0.jpg b/submodules/AsyncDisplayKit/examples/CustomCollectionView-Swift/Sample/Assets.xcassets/image_0.imageset/image_0.jpg deleted file mode 100644 index 4a365897ea..0000000000 Binary files a/submodules/AsyncDisplayKit/examples/CustomCollectionView-Swift/Sample/Assets.xcassets/image_0.imageset/image_0.jpg and /dev/null differ diff --git a/submodules/AsyncDisplayKit/examples/CustomCollectionView-Swift/Sample/Assets.xcassets/image_1.imageset/Contents.json b/submodules/AsyncDisplayKit/examples/CustomCollectionView-Swift/Sample/Assets.xcassets/image_1.imageset/Contents.json deleted file mode 100644 index 6d2e9f5f7c..0000000000 --- a/submodules/AsyncDisplayKit/examples/CustomCollectionView-Swift/Sample/Assets.xcassets/image_1.imageset/Contents.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "images" : [ - { - "idiom" : "universal", - "filename" : "image_1.jpg", - "scale" : "1x" - }, - { - "idiom" : "universal", - "scale" : "2x" - }, - { - "idiom" : "universal", - "scale" : "3x" - } - ], - "info" : { - "version" : 1, - "author" : "xcode" - } -} \ No newline at end of file diff --git a/submodules/AsyncDisplayKit/examples/CustomCollectionView-Swift/Sample/Assets.xcassets/image_1.imageset/image_1.jpg b/submodules/AsyncDisplayKit/examples/CustomCollectionView-Swift/Sample/Assets.xcassets/image_1.imageset/image_1.jpg deleted file mode 100644 index 5cb4828f44..0000000000 Binary files a/submodules/AsyncDisplayKit/examples/CustomCollectionView-Swift/Sample/Assets.xcassets/image_1.imageset/image_1.jpg and /dev/null differ diff --git a/submodules/AsyncDisplayKit/examples/CustomCollectionView-Swift/Sample/Assets.xcassets/image_10.imageset/Contents.json b/submodules/AsyncDisplayKit/examples/CustomCollectionView-Swift/Sample/Assets.xcassets/image_10.imageset/Contents.json deleted file mode 100644 index ea10700189..0000000000 --- a/submodules/AsyncDisplayKit/examples/CustomCollectionView-Swift/Sample/Assets.xcassets/image_10.imageset/Contents.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "images" : [ - { - "idiom" : "universal", - "filename" : "image_10.jpg", - "scale" : "1x" - }, - { - "idiom" : "universal", - "scale" : "2x" - }, - { - "idiom" : "universal", - "scale" : "3x" - } - ], - "info" : { - "version" : 1, - "author" : "xcode" - } -} \ No newline at end of file diff --git a/submodules/AsyncDisplayKit/examples/CustomCollectionView-Swift/Sample/Assets.xcassets/image_10.imageset/image_10.jpg b/submodules/AsyncDisplayKit/examples/CustomCollectionView-Swift/Sample/Assets.xcassets/image_10.imageset/image_10.jpg deleted file mode 100644 index ea5cd6d268..0000000000 Binary files a/submodules/AsyncDisplayKit/examples/CustomCollectionView-Swift/Sample/Assets.xcassets/image_10.imageset/image_10.jpg and /dev/null differ diff --git a/submodules/AsyncDisplayKit/examples/CustomCollectionView-Swift/Sample/Assets.xcassets/image_11.imageset/Contents.json b/submodules/AsyncDisplayKit/examples/CustomCollectionView-Swift/Sample/Assets.xcassets/image_11.imageset/Contents.json deleted file mode 100644 index dc85469057..0000000000 --- a/submodules/AsyncDisplayKit/examples/CustomCollectionView-Swift/Sample/Assets.xcassets/image_11.imageset/Contents.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "images" : [ - { - "idiom" : "universal", - "filename" : "image_11.jpg", - "scale" : "1x" - }, - { - "idiom" : "universal", - "scale" : "2x" - }, - { - "idiom" : "universal", - "scale" : "3x" - } - ], - "info" : { - "version" : 1, - "author" : "xcode" - } -} \ No newline at end of file diff --git a/submodules/AsyncDisplayKit/examples/CustomCollectionView-Swift/Sample/Assets.xcassets/image_11.imageset/image_11.jpg b/submodules/AsyncDisplayKit/examples/CustomCollectionView-Swift/Sample/Assets.xcassets/image_11.imageset/image_11.jpg deleted file mode 100644 index e93c68e512..0000000000 Binary files a/submodules/AsyncDisplayKit/examples/CustomCollectionView-Swift/Sample/Assets.xcassets/image_11.imageset/image_11.jpg and /dev/null differ diff --git a/submodules/AsyncDisplayKit/examples/CustomCollectionView-Swift/Sample/Assets.xcassets/image_12.imageset/Contents.json b/submodules/AsyncDisplayKit/examples/CustomCollectionView-Swift/Sample/Assets.xcassets/image_12.imageset/Contents.json deleted file mode 100644 index a6d99003d1..0000000000 --- a/submodules/AsyncDisplayKit/examples/CustomCollectionView-Swift/Sample/Assets.xcassets/image_12.imageset/Contents.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "images" : [ - { - "idiom" : "universal", - "filename" : "image_12.jpg", - "scale" : "1x" - }, - { - "idiom" : "universal", - "scale" : "2x" - }, - { - "idiom" : "universal", - "scale" : "3x" - } - ], - "info" : { - "version" : 1, - "author" : "xcode" - } -} \ No newline at end of file diff --git a/submodules/AsyncDisplayKit/examples/CustomCollectionView-Swift/Sample/Assets.xcassets/image_12.imageset/image_12.jpg b/submodules/AsyncDisplayKit/examples/CustomCollectionView-Swift/Sample/Assets.xcassets/image_12.imageset/image_12.jpg deleted file mode 100644 index d520b6d80f..0000000000 Binary files a/submodules/AsyncDisplayKit/examples/CustomCollectionView-Swift/Sample/Assets.xcassets/image_12.imageset/image_12.jpg and /dev/null differ diff --git a/submodules/AsyncDisplayKit/examples/CustomCollectionView-Swift/Sample/Assets.xcassets/image_13.imageset/Contents.json b/submodules/AsyncDisplayKit/examples/CustomCollectionView-Swift/Sample/Assets.xcassets/image_13.imageset/Contents.json deleted file mode 100644 index 4eb6baad3b..0000000000 --- a/submodules/AsyncDisplayKit/examples/CustomCollectionView-Swift/Sample/Assets.xcassets/image_13.imageset/Contents.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "images" : [ - { - "idiom" : "universal", - "filename" : "image_13.jpg", - "scale" : "1x" - }, - { - "idiom" : "universal", - "scale" : "2x" - }, - { - "idiom" : "universal", - "scale" : "3x" - } - ], - "info" : { - "version" : 1, - "author" : "xcode" - } -} \ No newline at end of file diff --git a/submodules/AsyncDisplayKit/examples/CustomCollectionView-Swift/Sample/Assets.xcassets/image_13.imageset/image_13.jpg b/submodules/AsyncDisplayKit/examples/CustomCollectionView-Swift/Sample/Assets.xcassets/image_13.imageset/image_13.jpg deleted file mode 100644 index c0232370cd..0000000000 Binary files a/submodules/AsyncDisplayKit/examples/CustomCollectionView-Swift/Sample/Assets.xcassets/image_13.imageset/image_13.jpg and /dev/null differ diff --git a/submodules/AsyncDisplayKit/examples/CustomCollectionView-Swift/Sample/Assets.xcassets/image_2.imageset/Contents.json b/submodules/AsyncDisplayKit/examples/CustomCollectionView-Swift/Sample/Assets.xcassets/image_2.imageset/Contents.json deleted file mode 100644 index b2536e53de..0000000000 --- a/submodules/AsyncDisplayKit/examples/CustomCollectionView-Swift/Sample/Assets.xcassets/image_2.imageset/Contents.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "images" : [ - { - "idiom" : "universal", - "filename" : "image_2.jpg", - "scale" : "1x" - }, - { - "idiom" : "universal", - "scale" : "2x" - }, - { - "idiom" : "universal", - "scale" : "3x" - } - ], - "info" : { - "version" : 1, - "author" : "xcode" - } -} \ No newline at end of file diff --git a/submodules/AsyncDisplayKit/examples/CustomCollectionView-Swift/Sample/Assets.xcassets/image_2.imageset/image_2.jpg b/submodules/AsyncDisplayKit/examples/CustomCollectionView-Swift/Sample/Assets.xcassets/image_2.imageset/image_2.jpg deleted file mode 100644 index 175343454d..0000000000 Binary files a/submodules/AsyncDisplayKit/examples/CustomCollectionView-Swift/Sample/Assets.xcassets/image_2.imageset/image_2.jpg and /dev/null differ diff --git a/submodules/AsyncDisplayKit/examples/CustomCollectionView-Swift/Sample/Assets.xcassets/image_3.imageset/Contents.json b/submodules/AsyncDisplayKit/examples/CustomCollectionView-Swift/Sample/Assets.xcassets/image_3.imageset/Contents.json deleted file mode 100644 index 512e735090..0000000000 --- a/submodules/AsyncDisplayKit/examples/CustomCollectionView-Swift/Sample/Assets.xcassets/image_3.imageset/Contents.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "images" : [ - { - "idiom" : "universal", - "filename" : "image_3.jpg", - "scale" : "1x" - }, - { - "idiom" : "universal", - "scale" : "2x" - }, - { - "idiom" : "universal", - "scale" : "3x" - } - ], - "info" : { - "version" : 1, - "author" : "xcode" - } -} \ No newline at end of file diff --git a/submodules/AsyncDisplayKit/examples/CustomCollectionView-Swift/Sample/Assets.xcassets/image_3.imageset/image_3.jpg b/submodules/AsyncDisplayKit/examples/CustomCollectionView-Swift/Sample/Assets.xcassets/image_3.imageset/image_3.jpg deleted file mode 100644 index f5398cac79..0000000000 Binary files a/submodules/AsyncDisplayKit/examples/CustomCollectionView-Swift/Sample/Assets.xcassets/image_3.imageset/image_3.jpg and /dev/null differ diff --git a/submodules/AsyncDisplayKit/examples/CustomCollectionView-Swift/Sample/Assets.xcassets/image_4.imageset/Contents.json b/submodules/AsyncDisplayKit/examples/CustomCollectionView-Swift/Sample/Assets.xcassets/image_4.imageset/Contents.json deleted file mode 100644 index 88b2b7b98a..0000000000 --- a/submodules/AsyncDisplayKit/examples/CustomCollectionView-Swift/Sample/Assets.xcassets/image_4.imageset/Contents.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "images" : [ - { - "idiom" : "universal", - "filename" : "image_4.jpg", - "scale" : "1x" - }, - { - "idiom" : "universal", - "scale" : "2x" - }, - { - "idiom" : "universal", - "scale" : "3x" - } - ], - "info" : { - "version" : 1, - "author" : "xcode" - } -} \ No newline at end of file diff --git a/submodules/AsyncDisplayKit/examples/CustomCollectionView-Swift/Sample/Assets.xcassets/image_4.imageset/image_4.jpg b/submodules/AsyncDisplayKit/examples/CustomCollectionView-Swift/Sample/Assets.xcassets/image_4.imageset/image_4.jpg deleted file mode 100644 index 2a6fe4c264..0000000000 Binary files a/submodules/AsyncDisplayKit/examples/CustomCollectionView-Swift/Sample/Assets.xcassets/image_4.imageset/image_4.jpg and /dev/null differ diff --git a/submodules/AsyncDisplayKit/examples/CustomCollectionView-Swift/Sample/Assets.xcassets/image_5.imageset/Contents.json b/submodules/AsyncDisplayKit/examples/CustomCollectionView-Swift/Sample/Assets.xcassets/image_5.imageset/Contents.json deleted file mode 100644 index 1f24c086d9..0000000000 --- a/submodules/AsyncDisplayKit/examples/CustomCollectionView-Swift/Sample/Assets.xcassets/image_5.imageset/Contents.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "images" : [ - { - "idiom" : "universal", - "filename" : "image_5.jpg", - "scale" : "1x" - }, - { - "idiom" : "universal", - "scale" : "2x" - }, - { - "idiom" : "universal", - "scale" : "3x" - } - ], - "info" : { - "version" : 1, - "author" : "xcode" - } -} \ No newline at end of file diff --git a/submodules/AsyncDisplayKit/examples/CustomCollectionView-Swift/Sample/Assets.xcassets/image_5.imageset/image_5.jpg b/submodules/AsyncDisplayKit/examples/CustomCollectionView-Swift/Sample/Assets.xcassets/image_5.imageset/image_5.jpg deleted file mode 100644 index 4e507b8064..0000000000 Binary files a/submodules/AsyncDisplayKit/examples/CustomCollectionView-Swift/Sample/Assets.xcassets/image_5.imageset/image_5.jpg and /dev/null differ diff --git a/submodules/AsyncDisplayKit/examples/CustomCollectionView-Swift/Sample/Assets.xcassets/image_6.imageset/Contents.json b/submodules/AsyncDisplayKit/examples/CustomCollectionView-Swift/Sample/Assets.xcassets/image_6.imageset/Contents.json deleted file mode 100644 index 25f33f2acd..0000000000 --- a/submodules/AsyncDisplayKit/examples/CustomCollectionView-Swift/Sample/Assets.xcassets/image_6.imageset/Contents.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "images" : [ - { - "idiom" : "universal", - "filename" : "image_6.jpg", - "scale" : "1x" - }, - { - "idiom" : "universal", - "scale" : "2x" - }, - { - "idiom" : "universal", - "scale" : "3x" - } - ], - "info" : { - "version" : 1, - "author" : "xcode" - } -} \ No newline at end of file diff --git a/submodules/AsyncDisplayKit/examples/CustomCollectionView-Swift/Sample/Assets.xcassets/image_6.imageset/image_6.jpg b/submodules/AsyncDisplayKit/examples/CustomCollectionView-Swift/Sample/Assets.xcassets/image_6.imageset/image_6.jpg deleted file mode 100644 index 35fe778b3a..0000000000 Binary files a/submodules/AsyncDisplayKit/examples/CustomCollectionView-Swift/Sample/Assets.xcassets/image_6.imageset/image_6.jpg and /dev/null differ diff --git a/submodules/AsyncDisplayKit/examples/CustomCollectionView-Swift/Sample/Assets.xcassets/image_7.imageset/Contents.json b/submodules/AsyncDisplayKit/examples/CustomCollectionView-Swift/Sample/Assets.xcassets/image_7.imageset/Contents.json deleted file mode 100644 index 5fdd6ba2cf..0000000000 --- a/submodules/AsyncDisplayKit/examples/CustomCollectionView-Swift/Sample/Assets.xcassets/image_7.imageset/Contents.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "images" : [ - { - "idiom" : "universal", - "filename" : "image_7.jpg", - "scale" : "1x" - }, - { - "idiom" : "universal", - "scale" : "2x" - }, - { - "idiom" : "universal", - "scale" : "3x" - } - ], - "info" : { - "version" : 1, - "author" : "xcode" - } -} \ No newline at end of file diff --git a/submodules/AsyncDisplayKit/examples/CustomCollectionView-Swift/Sample/Assets.xcassets/image_7.imageset/image_7.jpg b/submodules/AsyncDisplayKit/examples/CustomCollectionView-Swift/Sample/Assets.xcassets/image_7.imageset/image_7.jpg deleted file mode 100644 index 8f5e037722..0000000000 Binary files a/submodules/AsyncDisplayKit/examples/CustomCollectionView-Swift/Sample/Assets.xcassets/image_7.imageset/image_7.jpg and /dev/null differ diff --git a/submodules/AsyncDisplayKit/examples/CustomCollectionView-Swift/Sample/Assets.xcassets/image_8.imageset/Contents.json b/submodules/AsyncDisplayKit/examples/CustomCollectionView-Swift/Sample/Assets.xcassets/image_8.imageset/Contents.json deleted file mode 100644 index 563d5ba824..0000000000 --- a/submodules/AsyncDisplayKit/examples/CustomCollectionView-Swift/Sample/Assets.xcassets/image_8.imageset/Contents.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "images" : [ - { - "idiom" : "universal", - "filename" : "image_8.jpg", - "scale" : "1x" - }, - { - "idiom" : "universal", - "scale" : "2x" - }, - { - "idiom" : "universal", - "scale" : "3x" - } - ], - "info" : { - "version" : 1, - "author" : "xcode" - } -} \ No newline at end of file diff --git a/submodules/AsyncDisplayKit/examples/CustomCollectionView-Swift/Sample/Assets.xcassets/image_8.imageset/image_8.jpg b/submodules/AsyncDisplayKit/examples/CustomCollectionView-Swift/Sample/Assets.xcassets/image_8.imageset/image_8.jpg deleted file mode 100644 index 5651436bb6..0000000000 Binary files a/submodules/AsyncDisplayKit/examples/CustomCollectionView-Swift/Sample/Assets.xcassets/image_8.imageset/image_8.jpg and /dev/null differ diff --git a/submodules/AsyncDisplayKit/examples/CustomCollectionView-Swift/Sample/Assets.xcassets/image_9.imageset/Contents.json b/submodules/AsyncDisplayKit/examples/CustomCollectionView-Swift/Sample/Assets.xcassets/image_9.imageset/Contents.json deleted file mode 100644 index 66c1b859b1..0000000000 --- a/submodules/AsyncDisplayKit/examples/CustomCollectionView-Swift/Sample/Assets.xcassets/image_9.imageset/Contents.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "images" : [ - { - "idiom" : "universal", - "filename" : "image_9.jpg", - "scale" : "1x" - }, - { - "idiom" : "universal", - "scale" : "2x" - }, - { - "idiom" : "universal", - "scale" : "3x" - } - ], - "info" : { - "version" : 1, - "author" : "xcode" - } -} \ No newline at end of file diff --git a/submodules/AsyncDisplayKit/examples/CustomCollectionView-Swift/Sample/Assets.xcassets/image_9.imageset/image_9.jpg b/submodules/AsyncDisplayKit/examples/CustomCollectionView-Swift/Sample/Assets.xcassets/image_9.imageset/image_9.jpg deleted file mode 100644 index 9fb6e47d3f..0000000000 Binary files a/submodules/AsyncDisplayKit/examples/CustomCollectionView-Swift/Sample/Assets.xcassets/image_9.imageset/image_9.jpg and /dev/null differ diff --git a/submodules/AsyncDisplayKit/examples/CustomCollectionView-Swift/Sample/Base.lproj/LaunchScreen.storyboard b/submodules/AsyncDisplayKit/examples/CustomCollectionView-Swift/Sample/Base.lproj/LaunchScreen.storyboard deleted file mode 100644 index fdf3f97d1b..0000000000 --- a/submodules/AsyncDisplayKit/examples/CustomCollectionView-Swift/Sample/Base.lproj/LaunchScreen.storyboard +++ /dev/null @@ -1,27 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/submodules/AsyncDisplayKit/examples/CustomCollectionView-Swift/Sample/ImageCellNode.swift b/submodules/AsyncDisplayKit/examples/CustomCollectionView-Swift/Sample/ImageCellNode.swift deleted file mode 100644 index 70c1692679..0000000000 --- a/submodules/AsyncDisplayKit/examples/CustomCollectionView-Swift/Sample/ImageCellNode.swift +++ /dev/null @@ -1,38 +0,0 @@ -// -// ImageCellNode.swift -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -import UIKit -import AsyncDisplayKit - -class ImageCellNode: ASCellNode { - let imageNode = ASImageNode() - required init(with image : UIImage) { - super.init() - imageNode.image = image - self.addSubnode(self.imageNode) - } - - override func layoutSpecThatFits(_ constrainedSize: ASSizeRange) -> ASLayoutSpec { - var imageRatio: CGFloat = 0.5 - if imageNode.image != nil { - imageRatio = (imageNode.image?.size.height)! / (imageNode.image?.size.width)! - } - - let imagePlace = ASRatioLayoutSpec(ratio: imageRatio, child: imageNode) - - let stackLayout = ASStackLayoutSpec.horizontal() - stackLayout.justifyContent = .start - stackLayout.alignItems = .start - stackLayout.style.flexShrink = 1.0 - stackLayout.children = [imagePlace] - - return ASInsetLayoutSpec(insets: UIEdgeInsets.zero, child: stackLayout) - } - -} diff --git a/submodules/AsyncDisplayKit/examples/CustomCollectionView-Swift/Sample/Info.plist b/submodules/AsyncDisplayKit/examples/CustomCollectionView-Swift/Sample/Info.plist deleted file mode 100755 index b8901eef4f..0000000000 --- a/submodules/AsyncDisplayKit/examples/CustomCollectionView-Swift/Sample/Info.plist +++ /dev/null @@ -1,36 +0,0 @@ - - - - - CFBundleDevelopmentRegion - en - CFBundleExecutable - $(EXECUTABLE_NAME) - CFBundleIdentifier - $(PRODUCT_BUNDLE_IDENTIFIER) - CFBundleInfoDictionaryVersion - 6.0 - CFBundleName - $(PRODUCT_NAME) - CFBundlePackageType - APPL - CFBundleShortVersionString - 1.0 - CFBundleVersion - 1 - LSRequiresIPhoneOS - - UILaunchStoryboardName - LaunchScreen - UIRequiredDeviceCapabilities - - armv7 - - UISupportedInterfaceOrientations - - UIInterfaceOrientationPortrait - UIInterfaceOrientationLandscapeLeft - UIInterfaceOrientationLandscapeRight - - - diff --git a/submodules/AsyncDisplayKit/examples/CustomCollectionView-Swift/Sample/MosaicCollectionViewLayout.swift b/submodules/AsyncDisplayKit/examples/CustomCollectionView-Swift/Sample/MosaicCollectionViewLayout.swift deleted file mode 100644 index 976481c8d2..0000000000 --- a/submodules/AsyncDisplayKit/examples/CustomCollectionView-Swift/Sample/MosaicCollectionViewLayout.swift +++ /dev/null @@ -1,246 +0,0 @@ -// -// MosaicCollectionViewLayout.swift -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -import Foundation -import UIKit -import AsyncDisplayKit - -protocol MosaicCollectionViewLayoutDelegate: ASCollectionDelegate { - func collectionView(_ collectionView: UICollectionView, layout: MosaicCollectionViewLayout, originalItemSizeAtIndexPath: IndexPath) -> CGSize -} - -class MosaicCollectionViewLayout: UICollectionViewFlowLayout { - var numberOfColumns: Int - var columnSpacing: CGFloat - var _sectionInset: UIEdgeInsets - var interItemSpacing: UIEdgeInsets - var headerHeight: CGFloat - var _columnHeights: [[CGFloat]]? - var _itemAttributes = [[UICollectionViewLayoutAttributes]]() - var _headerAttributes = [UICollectionViewLayoutAttributes]() - var _allAttributes = [UICollectionViewLayoutAttributes]() - - required override init() { - self.numberOfColumns = 2 - self.columnSpacing = 10.0 - self.headerHeight = 44.0 //viewcontroller - self._sectionInset = UIEdgeInsetsMake(10.0, 10.0, 10.0, 10.0) - self.interItemSpacing = UIEdgeInsetsMake(10.0, 0, 10.0, 0) - super.init() - self.scrollDirection = .vertical - } - required init?(coder aDecoder: NSCoder) { - fatalError("init(coder:) has not been implemented") - } - - public var delegate : MosaicCollectionViewLayoutDelegate? - - override func prepare() { - super.prepare() - guard let collectionView = self.collectionView else { return } - - _itemAttributes = [] - _allAttributes = [] - _headerAttributes = [] - _columnHeights = [] - - var top: CGFloat = 0 - - let numberOfSections: NSInteger = collectionView.numberOfSections - - for section in 0 ..< numberOfSections { - let numberOfItems = collectionView.numberOfItems(inSection: section) - - top += _sectionInset.top - - if (headerHeight > 0) { - let headerSize: CGSize = self._headerSizeForSection(section: section) - - let attributes = UICollectionViewLayoutAttributes(forSupplementaryViewOfKind: UICollectionElementKindSectionHeader, with: NSIndexPath(row: 0, section: section) as IndexPath) - - attributes.frame = CGRect(x: _sectionInset.left, y: top, width: headerSize.width, height: headerSize.height) - _headerAttributes.append(attributes) - _allAttributes.append(attributes) - top = attributes.frame.maxY - } - - _columnHeights?.append([]) //Adding new Section - for _ in 0 ..< self.numberOfColumns { - self._columnHeights?[section].append(top) - } - - let columnWidth = self._columnWidthForSection(section: section) - _itemAttributes.append([]) - for idx in 0 ..< numberOfItems { - let columnIndex: Int = self._shortestColumnIndexInSection(section: section) - let indexPath = IndexPath(item: idx, section: section) - - let itemSize = self._itemSizeAtIndexPath(indexPath: indexPath); - let xOffset = _sectionInset.left + (columnWidth + columnSpacing) * CGFloat(columnIndex) - let yOffset = _columnHeights![section][columnIndex] - - let attributes = UICollectionViewLayoutAttributes(forCellWith: indexPath) - - attributes.frame = CGRect(x: xOffset, y: yOffset, width: itemSize.width, height: itemSize.height) - - _columnHeights?[section][columnIndex] = attributes.frame.maxY + interItemSpacing.bottom - - _itemAttributes[section].append(attributes) - _allAttributes.append(attributes) - } - - let columnIndex: Int = self._tallestColumnIndexInSection(section: section) - top = (_columnHeights?[section][columnIndex])! - interItemSpacing.bottom + _sectionInset.bottom - - for idx in 0 ..< _columnHeights![section].count { - _columnHeights![section][idx] = top - } - } - } - - override func layoutAttributesForElements(in rect: CGRect) -> [UICollectionViewLayoutAttributes]? - { - var includedAttributes: [UICollectionViewLayoutAttributes] = [] - // Slow search for small batches - for attribute in _allAttributes { - if (attribute.frame.intersects(rect)) { - includedAttributes.append(attribute) - } - } - return includedAttributes - } - - override func layoutAttributesForItem(at indexPath: IndexPath) -> UICollectionViewLayoutAttributes? - { - guard indexPath.section < _itemAttributes.count, - indexPath.item < _itemAttributes[indexPath.section].count - else { - return nil - } - return _itemAttributes[indexPath.section][indexPath.item] - } - - override func layoutAttributesForSupplementaryView(ofKind elementKind: String, at indexPath: IndexPath) -> UICollectionViewLayoutAttributes? - { - if (elementKind == UICollectionElementKindSectionHeader) { - return _headerAttributes[indexPath.section] - } - return nil - } - - override func shouldInvalidateLayout(forBoundsChange newBounds: CGRect) -> Bool { - if (!(self.collectionView?.bounds.size.equalTo(newBounds.size))!) { - return true; - } - return false; - } - - func _widthForSection (section: Int) -> CGFloat - { - return self.collectionView!.bounds.size.width - _sectionInset.left - _sectionInset.right; - } - - func _columnWidthForSection(section: Int) -> CGFloat - { - return (self._widthForSection(section: section) - ((CGFloat(numberOfColumns - 1)) * columnSpacing)) / CGFloat(numberOfColumns) - } - - func _itemSizeAtIndexPath(indexPath: IndexPath) -> CGSize - { - var size = CGSize(width: self._columnWidthForSection(section: indexPath.section), height: 0) - let originalSize = self.delegate!.collectionView(self.collectionView!, layout:self, originalItemSizeAtIndexPath:indexPath) - if (originalSize.height > 0 && originalSize.width > 0) { - size.height = originalSize.height / originalSize.width * size.width - } - return size - } - - func _headerSizeForSection(section: Int) -> CGSize - { - return CGSize(width: self._widthForSection(section: section), height: headerHeight) - } - - override var collectionViewContentSize: CGSize - { - var height: CGFloat = 0 - if ((_columnHeights?.count)! > 0) { - if (_columnHeights?[(_columnHeights?.count)!-1].count)! > 0 { - height = (_columnHeights?[(_columnHeights?.count)!-1][0])! - } - } - return CGSize(width: self.collectionView!.bounds.size.width, height: height) - } - - func _tallestColumnIndexInSection(section: Int) -> Int - { - var index: Int = 0; - var tallestHeight: CGFloat = 0; - _ = _columnHeights?[section].enumerated().map { (idx,height) in - if (height > tallestHeight) { - index = idx; - tallestHeight = height - } - } - return index - } - - func _shortestColumnIndexInSection(section: Int) -> Int - { - var index: Int = 0; - var shortestHeight: CGFloat = CGFloat.greatestFiniteMagnitude - _ = _columnHeights?[section].enumerated().map { (idx,height) in - if (height < shortestHeight) { - index = idx; - shortestHeight = height - } - } - return index - } - -} - -class MosaicCollectionViewLayoutInspector: NSObject, ASCollectionViewLayoutInspecting -{ - func collectionView(_ collectionView: ASCollectionView, constrainedSizeForNodeAt indexPath: IndexPath) -> ASSizeRange { - let layout = collectionView.collectionViewLayout as! MosaicCollectionViewLayout - return ASSizeRangeMake(CGSize.zero, layout._itemSizeAtIndexPath(indexPath: indexPath)) - } - - func collectionView(_ collectionView: ASCollectionView, constrainedSizeForSupplementaryNodeOfKind: String, at atIndexPath: IndexPath) -> ASSizeRange - { - let layout = collectionView.collectionViewLayout as! MosaicCollectionViewLayout - return ASSizeRange.init(min: CGSize.zero, max: layout._headerSizeForSection(section: atIndexPath.section)) - } - - /** - * Asks the inspector for the number of supplementary sections in the collection view for the given kind. - */ - func collectionView(_ collectionView: ASCollectionView, numberOfSectionsForSupplementaryNodeOfKind kind: String) -> UInt { - if (kind == UICollectionElementKindSectionHeader) { - return UInt((collectionView.dataSource?.numberOfSections!(in: collectionView))!) - } else { - return 0 - } - } - - /** - * Asks the inspector for the number of supplementary views for the given kind in the specified section. - */ - func collectionView(_ collectionView: ASCollectionView, supplementaryNodesOfKind kind: String, inSection section: UInt) -> UInt { - if (kind == UICollectionElementKindSectionHeader) { - return 1 - } else { - return 0 - } - } - - func scrollableDirections() -> ASScrollDirection { - return ASScrollDirectionVerticalDirections; - } -} diff --git a/submodules/AsyncDisplayKit/examples/CustomCollectionView-Swift/Sample/ViewController.swift b/submodules/AsyncDisplayKit/examples/CustomCollectionView-Swift/Sample/ViewController.swift deleted file mode 100644 index 24345cdcef..0000000000 --- a/submodules/AsyncDisplayKit/examples/CustomCollectionView-Swift/Sample/ViewController.swift +++ /dev/null @@ -1,85 +0,0 @@ -// -// ViewController.swift -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -import UIKit -import AsyncDisplayKit - -class ViewController: ASViewController, MosaicCollectionViewLayoutDelegate, ASCollectionDataSource, ASCollectionDelegate { - - var _sections = [[UIImage]]() - let _collectionNode: ASCollectionNode - let _layoutInspector = MosaicCollectionViewLayoutInspector() - let kNumberOfImages: UInt = 14 - - init() { - let layout = MosaicCollectionViewLayout() - layout.numberOfColumns = 3; - layout.headerHeight = 44; - _collectionNode = ASCollectionNode(frame: CGRect.zero, collectionViewLayout: layout) - super.init(node: _collectionNode) - layout.delegate = self - - _sections.append([]); - var section = 0 - for idx in 0 ..< kNumberOfImages { - let name = String(format: "image_%d.jpg", idx) - _sections[section].append(UIImage(named: name)!) - if ((idx + 1) % 5 == 0 && idx < kNumberOfImages - 1) { - section += 1 - _sections.append([]) - } - } - - _collectionNode.backgroundColor = UIColor.white - _collectionNode.dataSource = self - _collectionNode.delegate = self - _collectionNode.layoutInspector = _layoutInspector - _collectionNode.registerSupplementaryNode(ofKind: UICollectionElementKindSectionHeader) - } - - required init?(coder aDecoder: NSCoder) { - fatalError("init(coder:) has not been implemented") - } - - override func viewDidLoad() { - super.viewDidLoad() - _collectionNode.view.isScrollEnabled = true - } - - func collectionNode(_ collectionNode: ASCollectionNode, nodeForItemAt indexPath: IndexPath) -> ASCellNode { - let image = _sections[indexPath.section][indexPath.item] - return ImageCellNode(with: image) - } - - - func collectionNode(_ collectionNode: ASCollectionNode, nodeForSupplementaryElementOfKind kind: String, at indexPath: IndexPath) -> ASCellNode { - let textAttributes : NSDictionary = [ - NSFontAttributeName: UIFont.preferredFont(forTextStyle: UIFontTextStyle.headline), - NSForegroundColorAttributeName: UIColor.gray - ] - let textInsets = UIEdgeInsets(top: 11, left: 0, bottom: 11, right: 0) - let textCellNode = ASTextCellNode(attributes: textAttributes as! [AnyHashable : Any], insets: textInsets) - textCellNode.text = String(format: "Section %zd", indexPath.section + 1) - return textCellNode - } - - - func numberOfSections(in collectionNode: ASCollectionNode) -> Int { - return _sections.count - } - - func collectionNode(_ collectionNode: ASCollectionNode, numberOfItemsInSection section: Int) -> Int { - return _sections[section].count - } - - internal func collectionView(_ collectionView: UICollectionView, layout: MosaicCollectionViewLayout, originalItemSizeAtIndexPath: IndexPath) -> CGSize { - return _sections[originalItemSizeAtIndexPath.section][originalItemSizeAtIndexPath.item].size - } -} - diff --git a/submodules/AsyncDisplayKit/examples/CustomCollectionView/Podfile b/submodules/AsyncDisplayKit/examples/CustomCollectionView/Podfile deleted file mode 100644 index 71a7f2c4b2..0000000000 --- a/submodules/AsyncDisplayKit/examples/CustomCollectionView/Podfile +++ /dev/null @@ -1,5 +0,0 @@ -source 'https://github.com/CocoaPods/Specs.git' -platform :ios, '9.0' -target 'Sample' do - pod 'Texture', :path => '../..' -end diff --git a/submodules/AsyncDisplayKit/examples/CustomCollectionView/Sample.xcworkspace/contents.xcworkspacedata b/submodules/AsyncDisplayKit/examples/CustomCollectionView/Sample.xcworkspace/contents.xcworkspacedata deleted file mode 100644 index 7b5a2f3050..0000000000 --- a/submodules/AsyncDisplayKit/examples/CustomCollectionView/Sample.xcworkspace/contents.xcworkspacedata +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - diff --git a/submodules/AsyncDisplayKit/examples/CustomCollectionView/Sample/AppDelegate.h b/submodules/AsyncDisplayKit/examples/CustomCollectionView/Sample/AppDelegate.h deleted file mode 100644 index 19db03c153..0000000000 --- a/submodules/AsyncDisplayKit/examples/CustomCollectionView/Sample/AppDelegate.h +++ /dev/null @@ -1,16 +0,0 @@ -// -// AppDelegate.h -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -@interface AppDelegate : UIResponder - -@property (strong, nonatomic) UIWindow *window; - -@end diff --git a/submodules/AsyncDisplayKit/examples/CustomCollectionView/Sample/AppDelegate.m b/submodules/AsyncDisplayKit/examples/CustomCollectionView/Sample/AppDelegate.m deleted file mode 100644 index 867dafbc92..0000000000 --- a/submodules/AsyncDisplayKit/examples/CustomCollectionView/Sample/AppDelegate.m +++ /dev/null @@ -1,27 +0,0 @@ -// -// AppDelegate.m -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import "AppDelegate.h" - -#import "ViewController.h" - -@implementation AppDelegate - -- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions -{ - self.window = [[UIWindow alloc] initWithFrame:UIScreen.mainScreen.bounds]; - self.window.backgroundColor = [UIColor whiteColor]; - self.window.rootViewController = [[ViewController alloc] init]; - - [self.window makeKeyAndVisible]; - - return YES; -} - -@end diff --git a/submodules/AsyncDisplayKit/examples/CustomCollectionView/Sample/ImageCellNode.h b/submodules/AsyncDisplayKit/examples/CustomCollectionView/Sample/ImageCellNode.h deleted file mode 100644 index 787ee041ca..0000000000 --- a/submodules/AsyncDisplayKit/examples/CustomCollectionView/Sample/ImageCellNode.h +++ /dev/null @@ -1,17 +0,0 @@ -// -// ImageCellNode.h -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -@interface ImageCellNode : ASCellNode - -- (instancetype)initWithImage:(UIImage *)image; -@property (nonatomic, strong) UIImage *image; - -@end diff --git a/submodules/AsyncDisplayKit/examples/CustomCollectionView/Sample/ImageCellNode.m b/submodules/AsyncDisplayKit/examples/CustomCollectionView/Sample/ImageCellNode.m deleted file mode 100644 index 9e3e4a72ff..0000000000 --- a/submodules/AsyncDisplayKit/examples/CustomCollectionView/Sample/ImageCellNode.m +++ /dev/null @@ -1,45 +0,0 @@ -// -// ImageCellNode.m -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import "ImageCellNode.h" - -@implementation ImageCellNode { - ASImageNode *_imageNode; -} - -- (id)initWithImage:(UIImage *)image -{ - self = [super init]; - if (self != nil) { - _imageNode = [[ASImageNode alloc] init]; - _imageNode.image = image; - [self addSubnode:_imageNode]; - } - return self; -} - -- (ASLayoutSpec *)layoutSpecThatFits:(ASSizeRange)constrainedSize -{ - CGSize imageSize = self.image.size; - return [ASInsetLayoutSpec insetLayoutSpecWithInsets:UIEdgeInsetsZero - child:[ASRatioLayoutSpec ratioLayoutSpecWithRatio:imageSize.height/imageSize.width - child:_imageNode]]; -} - -- (void)setImage:(UIImage *)image -{ - _imageNode.image = image; -} - -- (UIImage *)image -{ - return _imageNode.image; -} - -@end diff --git a/submodules/AsyncDisplayKit/examples/CustomCollectionView/Sample/ImageCollectionViewCell.h b/submodules/AsyncDisplayKit/examples/CustomCollectionView/Sample/ImageCollectionViewCell.h deleted file mode 100644 index 8359fb72a0..0000000000 --- a/submodules/AsyncDisplayKit/examples/CustomCollectionView/Sample/ImageCollectionViewCell.h +++ /dev/null @@ -1,13 +0,0 @@ -// -// ImageCollectionViewCell.h -// Texture -// -// Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -@interface ImageCollectionViewCell : UICollectionViewCell - -@end diff --git a/submodules/AsyncDisplayKit/examples/CustomCollectionView/Sample/ImageCollectionViewCell.m b/submodules/AsyncDisplayKit/examples/CustomCollectionView/Sample/ImageCollectionViewCell.m deleted file mode 100644 index c04c865039..0000000000 --- a/submodules/AsyncDisplayKit/examples/CustomCollectionView/Sample/ImageCollectionViewCell.m +++ /dev/null @@ -1,46 +0,0 @@ -// -// ImageCollectionViewCell.m -// Texture -// -// Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import "ImageCollectionViewCell.h" - -@implementation ImageCollectionViewCell -{ - UILabel *_title; - UILabel *_description; -} - -- (id)initWithFrame:(CGRect)aRect -{ - self = [super initWithFrame:aRect]; - if (self) { - _title = [[UILabel alloc] init]; - _title.text = @"UICollectionViewCell"; - [self.contentView addSubview:_title]; - - _description = [[UILabel alloc] init]; - _description.text = @"description for cell"; - [self.contentView addSubview:_description]; - - self.contentView.backgroundColor = [UIColor orangeColor]; - } - return self; -} - -- (void)layoutSubviews -{ - [super layoutSubviews]; - - [_title sizeToFit]; - [_description sizeToFit]; - - CGRect frame = _title.frame; - frame.origin.y = _title.frame.size.height; - _description.frame = frame; -} - -@end diff --git a/submodules/AsyncDisplayKit/examples/CustomCollectionView/Sample/Images.xcassets/LaunchImage.launchimage/Contents.json b/submodules/AsyncDisplayKit/examples/CustomCollectionView/Sample/Images.xcassets/LaunchImage.launchimage/Contents.json deleted file mode 100644 index f0fce54771..0000000000 --- a/submodules/AsyncDisplayKit/examples/CustomCollectionView/Sample/Images.xcassets/LaunchImage.launchimage/Contents.json +++ /dev/null @@ -1,39 +0,0 @@ -{ - "images" : [ - { - "orientation" : "portrait", - "idiom" : "iphone", - "filename" : "Default-568h@2x.png", - "minimum-system-version" : "7.0", - "subtype" : "retina4", - "scale" : "2x" - }, - { - "idiom" : "iphone", - "scale" : "1x", - "orientation" : "portrait" - }, - { - "idiom" : "iphone", - "scale" : "2x", - "orientation" : "portrait" - }, - { - "orientation" : "portrait", - "idiom" : "iphone", - "filename" : "Default-568h@2x.png", - "subtype" : "retina4", - "scale" : "2x" - }, - { - "orientation" : "portrait", - "idiom" : "iphone", - "minimum-system-version" : "7.0", - "scale" : "2x" - } - ], - "info" : { - "version" : 1, - "author" : "xcode" - } -} \ No newline at end of file diff --git a/submodules/AsyncDisplayKit/examples/CustomCollectionView/Sample/Images.xcassets/LaunchImage.launchimage/Default-568h@2x.png b/submodules/AsyncDisplayKit/examples/CustomCollectionView/Sample/Images.xcassets/LaunchImage.launchimage/Default-568h@2x.png deleted file mode 100644 index 1547a98454..0000000000 Binary files a/submodules/AsyncDisplayKit/examples/CustomCollectionView/Sample/Images.xcassets/LaunchImage.launchimage/Default-568h@2x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/examples/CustomCollectionView/Sample/Images.xcassets/image_0.imageset/Contents.json b/submodules/AsyncDisplayKit/examples/CustomCollectionView/Sample/Images.xcassets/image_0.imageset/Contents.json deleted file mode 100644 index 4eaff61cc1..0000000000 --- a/submodules/AsyncDisplayKit/examples/CustomCollectionView/Sample/Images.xcassets/image_0.imageset/Contents.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "images" : [ - { - "idiom" : "universal", - "scale" : "1x", - "filename" : "image_0.jpg" - }, - { - "idiom" : "universal", - "scale" : "2x" - }, - { - "idiom" : "universal", - "scale" : "3x" - } - ], - "info" : { - "version" : 1, - "author" : "xcode" - } -} \ No newline at end of file diff --git a/submodules/AsyncDisplayKit/examples/CustomCollectionView/Sample/Images.xcassets/image_0.imageset/image_0.jpg b/submodules/AsyncDisplayKit/examples/CustomCollectionView/Sample/Images.xcassets/image_0.imageset/image_0.jpg deleted file mode 100644 index 4a365897ea..0000000000 Binary files a/submodules/AsyncDisplayKit/examples/CustomCollectionView/Sample/Images.xcassets/image_0.imageset/image_0.jpg and /dev/null differ diff --git a/submodules/AsyncDisplayKit/examples/CustomCollectionView/Sample/Images.xcassets/image_1.imageset/Contents.json b/submodules/AsyncDisplayKit/examples/CustomCollectionView/Sample/Images.xcassets/image_1.imageset/Contents.json deleted file mode 100644 index 80c90eca3e..0000000000 --- a/submodules/AsyncDisplayKit/examples/CustomCollectionView/Sample/Images.xcassets/image_1.imageset/Contents.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "images" : [ - { - "idiom" : "universal", - "scale" : "1x", - "filename" : "image_1.jpg" - }, - { - "idiom" : "universal", - "scale" : "2x" - }, - { - "idiom" : "universal", - "scale" : "3x" - } - ], - "info" : { - "version" : 1, - "author" : "xcode" - } -} \ No newline at end of file diff --git a/submodules/AsyncDisplayKit/examples/CustomCollectionView/Sample/Images.xcassets/image_1.imageset/image_1.jpg b/submodules/AsyncDisplayKit/examples/CustomCollectionView/Sample/Images.xcassets/image_1.imageset/image_1.jpg deleted file mode 100644 index 5cb4828f44..0000000000 Binary files a/submodules/AsyncDisplayKit/examples/CustomCollectionView/Sample/Images.xcassets/image_1.imageset/image_1.jpg and /dev/null differ diff --git a/submodules/AsyncDisplayKit/examples/CustomCollectionView/Sample/Images.xcassets/image_10.imageset/Contents.json b/submodules/AsyncDisplayKit/examples/CustomCollectionView/Sample/Images.xcassets/image_10.imageset/Contents.json deleted file mode 100644 index d61e934e39..0000000000 --- a/submodules/AsyncDisplayKit/examples/CustomCollectionView/Sample/Images.xcassets/image_10.imageset/Contents.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "images" : [ - { - "idiom" : "universal", - "scale" : "1x", - "filename" : "image_10.jpg" - }, - { - "idiom" : "universal", - "scale" : "2x" - }, - { - "idiom" : "universal", - "scale" : "3x" - } - ], - "info" : { - "version" : 1, - "author" : "xcode" - } -} \ No newline at end of file diff --git a/submodules/AsyncDisplayKit/examples/CustomCollectionView/Sample/Images.xcassets/image_10.imageset/image_10.jpg b/submodules/AsyncDisplayKit/examples/CustomCollectionView/Sample/Images.xcassets/image_10.imageset/image_10.jpg deleted file mode 100644 index ea5cd6d268..0000000000 Binary files a/submodules/AsyncDisplayKit/examples/CustomCollectionView/Sample/Images.xcassets/image_10.imageset/image_10.jpg and /dev/null differ diff --git a/submodules/AsyncDisplayKit/examples/CustomCollectionView/Sample/Images.xcassets/image_11.imageset/Contents.json b/submodules/AsyncDisplayKit/examples/CustomCollectionView/Sample/Images.xcassets/image_11.imageset/Contents.json deleted file mode 100644 index 94921077f9..0000000000 --- a/submodules/AsyncDisplayKit/examples/CustomCollectionView/Sample/Images.xcassets/image_11.imageset/Contents.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "images" : [ - { - "idiom" : "universal", - "scale" : "1x", - "filename" : "image_11.jpg" - }, - { - "idiom" : "universal", - "scale" : "2x" - }, - { - "idiom" : "universal", - "scale" : "3x" - } - ], - "info" : { - "version" : 1, - "author" : "xcode" - } -} \ No newline at end of file diff --git a/submodules/AsyncDisplayKit/examples/CustomCollectionView/Sample/Images.xcassets/image_11.imageset/image_11.jpg b/submodules/AsyncDisplayKit/examples/CustomCollectionView/Sample/Images.xcassets/image_11.imageset/image_11.jpg deleted file mode 100644 index e93c68e512..0000000000 Binary files a/submodules/AsyncDisplayKit/examples/CustomCollectionView/Sample/Images.xcassets/image_11.imageset/image_11.jpg and /dev/null differ diff --git a/submodules/AsyncDisplayKit/examples/CustomCollectionView/Sample/Images.xcassets/image_12.imageset/Contents.json b/submodules/AsyncDisplayKit/examples/CustomCollectionView/Sample/Images.xcassets/image_12.imageset/Contents.json deleted file mode 100644 index 61488a9fdc..0000000000 --- a/submodules/AsyncDisplayKit/examples/CustomCollectionView/Sample/Images.xcassets/image_12.imageset/Contents.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "images" : [ - { - "idiom" : "universal", - "scale" : "1x", - "filename" : "image_12.jpg" - }, - { - "idiom" : "universal", - "scale" : "2x" - }, - { - "idiom" : "universal", - "scale" : "3x" - } - ], - "info" : { - "version" : 1, - "author" : "xcode" - } -} \ No newline at end of file diff --git a/submodules/AsyncDisplayKit/examples/CustomCollectionView/Sample/Images.xcassets/image_12.imageset/image_12.jpg b/submodules/AsyncDisplayKit/examples/CustomCollectionView/Sample/Images.xcassets/image_12.imageset/image_12.jpg deleted file mode 100644 index d520b6d80f..0000000000 Binary files a/submodules/AsyncDisplayKit/examples/CustomCollectionView/Sample/Images.xcassets/image_12.imageset/image_12.jpg and /dev/null differ diff --git a/submodules/AsyncDisplayKit/examples/CustomCollectionView/Sample/Images.xcassets/image_13.imageset/Contents.json b/submodules/AsyncDisplayKit/examples/CustomCollectionView/Sample/Images.xcassets/image_13.imageset/Contents.json deleted file mode 100644 index 7f83f8a390..0000000000 --- a/submodules/AsyncDisplayKit/examples/CustomCollectionView/Sample/Images.xcassets/image_13.imageset/Contents.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "images" : [ - { - "idiom" : "universal", - "scale" : "1x", - "filename" : "image_13.jpg" - }, - { - "idiom" : "universal", - "scale" : "2x" - }, - { - "idiom" : "universal", - "scale" : "3x" - } - ], - "info" : { - "version" : 1, - "author" : "xcode" - } -} \ No newline at end of file diff --git a/submodules/AsyncDisplayKit/examples/CustomCollectionView/Sample/Images.xcassets/image_13.imageset/image_13.jpg b/submodules/AsyncDisplayKit/examples/CustomCollectionView/Sample/Images.xcassets/image_13.imageset/image_13.jpg deleted file mode 100644 index c0232370cd..0000000000 Binary files a/submodules/AsyncDisplayKit/examples/CustomCollectionView/Sample/Images.xcassets/image_13.imageset/image_13.jpg and /dev/null differ diff --git a/submodules/AsyncDisplayKit/examples/CustomCollectionView/Sample/Images.xcassets/image_2.imageset/Contents.json b/submodules/AsyncDisplayKit/examples/CustomCollectionView/Sample/Images.xcassets/image_2.imageset/Contents.json deleted file mode 100644 index 774cde7833..0000000000 --- a/submodules/AsyncDisplayKit/examples/CustomCollectionView/Sample/Images.xcassets/image_2.imageset/Contents.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "images" : [ - { - "idiom" : "universal", - "scale" : "1x", - "filename" : "image_2.jpg" - }, - { - "idiom" : "universal", - "scale" : "2x" - }, - { - "idiom" : "universal", - "scale" : "3x" - } - ], - "info" : { - "version" : 1, - "author" : "xcode" - } -} \ No newline at end of file diff --git a/submodules/AsyncDisplayKit/examples/CustomCollectionView/Sample/Images.xcassets/image_2.imageset/image_2.jpg b/submodules/AsyncDisplayKit/examples/CustomCollectionView/Sample/Images.xcassets/image_2.imageset/image_2.jpg deleted file mode 100644 index 175343454d..0000000000 Binary files a/submodules/AsyncDisplayKit/examples/CustomCollectionView/Sample/Images.xcassets/image_2.imageset/image_2.jpg and /dev/null differ diff --git a/submodules/AsyncDisplayKit/examples/CustomCollectionView/Sample/Images.xcassets/image_3.imageset/Contents.json b/submodules/AsyncDisplayKit/examples/CustomCollectionView/Sample/Images.xcassets/image_3.imageset/Contents.json deleted file mode 100644 index c0abe414cd..0000000000 --- a/submodules/AsyncDisplayKit/examples/CustomCollectionView/Sample/Images.xcassets/image_3.imageset/Contents.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "images" : [ - { - "idiom" : "universal", - "scale" : "1x", - "filename" : "image_3.jpg" - }, - { - "idiom" : "universal", - "scale" : "2x" - }, - { - "idiom" : "universal", - "scale" : "3x" - } - ], - "info" : { - "version" : 1, - "author" : "xcode" - } -} \ No newline at end of file diff --git a/submodules/AsyncDisplayKit/examples/CustomCollectionView/Sample/Images.xcassets/image_3.imageset/image_3.jpg b/submodules/AsyncDisplayKit/examples/CustomCollectionView/Sample/Images.xcassets/image_3.imageset/image_3.jpg deleted file mode 100644 index f5398cac79..0000000000 Binary files a/submodules/AsyncDisplayKit/examples/CustomCollectionView/Sample/Images.xcassets/image_3.imageset/image_3.jpg and /dev/null differ diff --git a/submodules/AsyncDisplayKit/examples/CustomCollectionView/Sample/Images.xcassets/image_4.imageset/Contents.json b/submodules/AsyncDisplayKit/examples/CustomCollectionView/Sample/Images.xcassets/image_4.imageset/Contents.json deleted file mode 100644 index 55a498a8a0..0000000000 --- a/submodules/AsyncDisplayKit/examples/CustomCollectionView/Sample/Images.xcassets/image_4.imageset/Contents.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "images" : [ - { - "idiom" : "universal", - "scale" : "1x", - "filename" : "image_4.jpg" - }, - { - "idiom" : "universal", - "scale" : "2x" - }, - { - "idiom" : "universal", - "scale" : "3x" - } - ], - "info" : { - "version" : 1, - "author" : "xcode" - } -} \ No newline at end of file diff --git a/submodules/AsyncDisplayKit/examples/CustomCollectionView/Sample/Images.xcassets/image_4.imageset/image_4.jpg b/submodules/AsyncDisplayKit/examples/CustomCollectionView/Sample/Images.xcassets/image_4.imageset/image_4.jpg deleted file mode 100644 index 2a6fe4c264..0000000000 Binary files a/submodules/AsyncDisplayKit/examples/CustomCollectionView/Sample/Images.xcassets/image_4.imageset/image_4.jpg and /dev/null differ diff --git a/submodules/AsyncDisplayKit/examples/CustomCollectionView/Sample/Images.xcassets/image_5.imageset/Contents.json b/submodules/AsyncDisplayKit/examples/CustomCollectionView/Sample/Images.xcassets/image_5.imageset/Contents.json deleted file mode 100644 index 9a1181e83b..0000000000 --- a/submodules/AsyncDisplayKit/examples/CustomCollectionView/Sample/Images.xcassets/image_5.imageset/Contents.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "images" : [ - { - "idiom" : "universal", - "scale" : "1x", - "filename" : "image_5.jpg" - }, - { - "idiom" : "universal", - "scale" : "2x" - }, - { - "idiom" : "universal", - "scale" : "3x" - } - ], - "info" : { - "version" : 1, - "author" : "xcode" - } -} \ No newline at end of file diff --git a/submodules/AsyncDisplayKit/examples/CustomCollectionView/Sample/Images.xcassets/image_5.imageset/image_5.jpg b/submodules/AsyncDisplayKit/examples/CustomCollectionView/Sample/Images.xcassets/image_5.imageset/image_5.jpg deleted file mode 100644 index 4e507b8064..0000000000 Binary files a/submodules/AsyncDisplayKit/examples/CustomCollectionView/Sample/Images.xcassets/image_5.imageset/image_5.jpg and /dev/null differ diff --git a/submodules/AsyncDisplayKit/examples/CustomCollectionView/Sample/Images.xcassets/image_6.imageset/Contents.json b/submodules/AsyncDisplayKit/examples/CustomCollectionView/Sample/Images.xcassets/image_6.imageset/Contents.json deleted file mode 100644 index 6aef7d6047..0000000000 --- a/submodules/AsyncDisplayKit/examples/CustomCollectionView/Sample/Images.xcassets/image_6.imageset/Contents.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "images" : [ - { - "idiom" : "universal", - "scale" : "1x", - "filename" : "image_6.jpg" - }, - { - "idiom" : "universal", - "scale" : "2x" - }, - { - "idiom" : "universal", - "scale" : "3x" - } - ], - "info" : { - "version" : 1, - "author" : "xcode" - } -} \ No newline at end of file diff --git a/submodules/AsyncDisplayKit/examples/CustomCollectionView/Sample/Images.xcassets/image_6.imageset/image_6.jpg b/submodules/AsyncDisplayKit/examples/CustomCollectionView/Sample/Images.xcassets/image_6.imageset/image_6.jpg deleted file mode 100644 index 35fe778b3a..0000000000 Binary files a/submodules/AsyncDisplayKit/examples/CustomCollectionView/Sample/Images.xcassets/image_6.imageset/image_6.jpg and /dev/null differ diff --git a/submodules/AsyncDisplayKit/examples/CustomCollectionView/Sample/Images.xcassets/image_7.imageset/Contents.json b/submodules/AsyncDisplayKit/examples/CustomCollectionView/Sample/Images.xcassets/image_7.imageset/Contents.json deleted file mode 100644 index acdb0e87f0..0000000000 --- a/submodules/AsyncDisplayKit/examples/CustomCollectionView/Sample/Images.xcassets/image_7.imageset/Contents.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "images" : [ - { - "idiom" : "universal", - "scale" : "1x", - "filename" : "image_7.jpg" - }, - { - "idiom" : "universal", - "scale" : "2x" - }, - { - "idiom" : "universal", - "scale" : "3x" - } - ], - "info" : { - "version" : 1, - "author" : "xcode" - } -} \ No newline at end of file diff --git a/submodules/AsyncDisplayKit/examples/CustomCollectionView/Sample/Images.xcassets/image_7.imageset/image_7.jpg b/submodules/AsyncDisplayKit/examples/CustomCollectionView/Sample/Images.xcassets/image_7.imageset/image_7.jpg deleted file mode 100644 index 8f5e037722..0000000000 Binary files a/submodules/AsyncDisplayKit/examples/CustomCollectionView/Sample/Images.xcassets/image_7.imageset/image_7.jpg and /dev/null differ diff --git a/submodules/AsyncDisplayKit/examples/CustomCollectionView/Sample/Images.xcassets/image_8.imageset/Contents.json b/submodules/AsyncDisplayKit/examples/CustomCollectionView/Sample/Images.xcassets/image_8.imageset/Contents.json deleted file mode 100644 index 40d616ed40..0000000000 --- a/submodules/AsyncDisplayKit/examples/CustomCollectionView/Sample/Images.xcassets/image_8.imageset/Contents.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "images" : [ - { - "idiom" : "universal", - "scale" : "1x", - "filename" : "image_8.jpg" - }, - { - "idiom" : "universal", - "scale" : "2x" - }, - { - "idiom" : "universal", - "scale" : "3x" - } - ], - "info" : { - "version" : 1, - "author" : "xcode" - } -} \ No newline at end of file diff --git a/submodules/AsyncDisplayKit/examples/CustomCollectionView/Sample/Images.xcassets/image_8.imageset/image_8.jpg b/submodules/AsyncDisplayKit/examples/CustomCollectionView/Sample/Images.xcassets/image_8.imageset/image_8.jpg deleted file mode 100644 index 5651436bb6..0000000000 Binary files a/submodules/AsyncDisplayKit/examples/CustomCollectionView/Sample/Images.xcassets/image_8.imageset/image_8.jpg and /dev/null differ diff --git a/submodules/AsyncDisplayKit/examples/CustomCollectionView/Sample/Images.xcassets/image_9.imageset/Contents.json b/submodules/AsyncDisplayKit/examples/CustomCollectionView/Sample/Images.xcassets/image_9.imageset/Contents.json deleted file mode 100644 index b3b3c74e12..0000000000 --- a/submodules/AsyncDisplayKit/examples/CustomCollectionView/Sample/Images.xcassets/image_9.imageset/Contents.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "images" : [ - { - "idiom" : "universal", - "scale" : "1x", - "filename" : "image_9.jpg" - }, - { - "idiom" : "universal", - "scale" : "2x" - }, - { - "idiom" : "universal", - "scale" : "3x" - } - ], - "info" : { - "version" : 1, - "author" : "xcode" - } -} \ No newline at end of file diff --git a/submodules/AsyncDisplayKit/examples/CustomCollectionView/Sample/Images.xcassets/image_9.imageset/image_9.jpg b/submodules/AsyncDisplayKit/examples/CustomCollectionView/Sample/Images.xcassets/image_9.imageset/image_9.jpg deleted file mode 100644 index 9fb6e47d3f..0000000000 Binary files a/submodules/AsyncDisplayKit/examples/CustomCollectionView/Sample/Images.xcassets/image_9.imageset/image_9.jpg and /dev/null differ diff --git a/submodules/AsyncDisplayKit/examples/CustomCollectionView/Sample/Info.plist b/submodules/AsyncDisplayKit/examples/CustomCollectionView/Sample/Info.plist deleted file mode 100644 index eeb71a8d35..0000000000 --- a/submodules/AsyncDisplayKit/examples/CustomCollectionView/Sample/Info.plist +++ /dev/null @@ -1,49 +0,0 @@ - - - - - CFBundleDevelopmentRegion - en - CFBundleExecutable - $(EXECUTABLE_NAME) - CFBundleIcons - - CFBundleIcons~ipad - - CFBundleIdentifier - com.facebook.AsyncDisplayKit.$(PRODUCT_NAME:rfc1034identifier) - CFBundleInfoDictionaryVersion - 6.0 - CFBundleName - $(PRODUCT_NAME) - CFBundlePackageType - APPL - CFBundleShortVersionString - 1.0 - CFBundleSignature - ???? - CFBundleVersion - 1 - LSRequiresIPhoneOS - - UILaunchStoryboardName - Launchboard - UIRequiredDeviceCapabilities - - armv7 - - UISupportedInterfaceOrientations - - UIInterfaceOrientationPortrait - UIInterfaceOrientationLandscapeLeft - UIInterfaceOrientationLandscapeRight - - UISupportedInterfaceOrientations~ipad - - UIInterfaceOrientationPortrait - UIInterfaceOrientationPortraitUpsideDown - UIInterfaceOrientationLandscapeLeft - UIInterfaceOrientationLandscapeRight - - - diff --git a/submodules/AsyncDisplayKit/examples/CustomCollectionView/Sample/Launchboard.storyboard b/submodules/AsyncDisplayKit/examples/CustomCollectionView/Sample/Launchboard.storyboard deleted file mode 100644 index 673e0f7e68..0000000000 --- a/submodules/AsyncDisplayKit/examples/CustomCollectionView/Sample/Launchboard.storyboard +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - diff --git a/submodules/AsyncDisplayKit/examples/CustomCollectionView/Sample/MosaicCollectionLayoutDelegate.h b/submodules/AsyncDisplayKit/examples/CustomCollectionView/Sample/MosaicCollectionLayoutDelegate.h deleted file mode 100644 index b6651953d1..0000000000 --- a/submodules/AsyncDisplayKit/examples/CustomCollectionView/Sample/MosaicCollectionLayoutDelegate.h +++ /dev/null @@ -1,16 +0,0 @@ -// -// MosaicCollectionLayoutDelegate.h -// Texture -// -// Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import -#import - -@interface MosaicCollectionLayoutDelegate : NSObject - -- (instancetype)initWithNumberOfColumns:(NSInteger)numberOfColumns headerHeight:(CGFloat)headerHeight; - -@end diff --git a/submodules/AsyncDisplayKit/examples/CustomCollectionView/Sample/MosaicCollectionLayoutDelegate.m b/submodules/AsyncDisplayKit/examples/CustomCollectionView/Sample/MosaicCollectionLayoutDelegate.m deleted file mode 100644 index 1715e1c374..0000000000 --- a/submodules/AsyncDisplayKit/examples/CustomCollectionView/Sample/MosaicCollectionLayoutDelegate.m +++ /dev/null @@ -1,167 +0,0 @@ -// -// MosaicCollectionLayoutDelegate.m -// Texture -// -// Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import "MosaicCollectionLayoutDelegate.h" -#import "MosaicCollectionLayoutInfo.h" -#import "ImageCellNode.h" - -#import - -@implementation MosaicCollectionLayoutDelegate { - // Read-only properties - MosaicCollectionLayoutInfo *_info; -} - -- (instancetype)initWithNumberOfColumns:(NSInteger)numberOfColumns headerHeight:(CGFloat)headerHeight -{ - self = [super init]; - if (self != nil) { - _info = [[MosaicCollectionLayoutInfo alloc] initWithNumberOfColumns:numberOfColumns - headerHeight:headerHeight - columnSpacing:10.0 - sectionInsets:UIEdgeInsetsMake(10.0, 10.0, 10.0, 10.0) - interItemSpacing:UIEdgeInsetsMake(10.0, 0, 10.0, 0)]; - } - return self; -} - -- (ASScrollDirection)scrollableDirections -{ - ASDisplayNodeAssertMainThread(); - return ASScrollDirectionVerticalDirections; -} - -- (id)additionalInfoForLayoutWithElements:(ASElementMap *)elements -{ - ASDisplayNodeAssertMainThread(); - return _info; -} - -+ (ASCollectionLayoutState *)calculateLayoutWithContext:(ASCollectionLayoutContext *)context -{ - CGFloat layoutWidth = context.viewportSize.width; - ASElementMap *elements = context.elements; - CGFloat top = 0; - MosaicCollectionLayoutInfo *info = (MosaicCollectionLayoutInfo *)context.additionalInfo; - - NSMapTable *attrsMap = [NSMapTable elementToLayoutAttributesTable]; - NSMutableArray *columnHeights = [NSMutableArray array]; - - NSInteger numberOfSections = [elements numberOfSections]; - for (NSUInteger section = 0; section < numberOfSections; section++) { - NSInteger numberOfItems = [elements numberOfItemsInSection:section]; - - top += info.sectionInsets.top; - - if (info.headerHeight > 0) { - NSIndexPath *indexPath = [NSIndexPath indexPathForItem:0 inSection:section]; - ASCollectionElement *element = [elements supplementaryElementOfKind:UICollectionElementKindSectionHeader - atIndexPath:indexPath]; - UICollectionViewLayoutAttributes *attrs = [UICollectionViewLayoutAttributes layoutAttributesForSupplementaryViewOfKind:UICollectionElementKindSectionHeader - withIndexPath:indexPath]; - - ASSizeRange sizeRange = [self _sizeRangeForHeaderOfSection:section withLayoutWidth:layoutWidth info:info]; - CGSize size = [element.node layoutThatFits:sizeRange].size; - CGRect frame = CGRectMake(info.sectionInsets.left, top, size.width, size.height); - - attrs.frame = frame; - [attrsMap setObject:attrs forKey:element]; - top = CGRectGetMaxY(frame); - } - - [columnHeights addObject:[NSMutableArray array]]; - for (NSUInteger idx = 0; idx < info.numberOfColumns; idx++) { - [columnHeights[section] addObject:@(top)]; - } - - CGFloat columnWidth = [self _columnWidthForSection:section withLayoutWidth:layoutWidth info:info]; - for (NSUInteger idx = 0; idx < numberOfItems; idx++) { - NSUInteger columnIndex = [self _shortestColumnIndexInSection:section withColumnHeights:columnHeights]; - NSIndexPath *indexPath = [NSIndexPath indexPathForItem:idx inSection:section]; - ASCollectionElement *element = [elements elementForItemAtIndexPath:indexPath]; - UICollectionViewLayoutAttributes *attrs = [UICollectionViewLayoutAttributes layoutAttributesForCellWithIndexPath:indexPath]; - - ASSizeRange sizeRange = [self _sizeRangeForItem:element.node atIndexPath:indexPath withLayoutWidth:layoutWidth info:info]; - CGSize size = [element.node layoutThatFits:sizeRange].size; - CGPoint position = CGPointMake(info.sectionInsets.left + (columnWidth + info.columnSpacing) * columnIndex, - [columnHeights[section][columnIndex] floatValue]); - CGRect frame = CGRectMake(position.x, position.y, size.width, size.height); - - attrs.frame = frame; - [attrsMap setObject:attrs forKey:element]; - // TODO Profile and avoid boxing if there are significant retain/release overheads - columnHeights[section][columnIndex] = @(CGRectGetMaxY(frame) + info.interItemSpacing.bottom); - } - - NSUInteger columnIndex = [self _tallestColumnIndexInSection:section withColumnHeights:columnHeights]; - top = [columnHeights[section][columnIndex] floatValue] - info.interItemSpacing.bottom + info.sectionInsets.bottom; - - for (NSUInteger idx = 0; idx < [columnHeights[section] count]; idx++) { - columnHeights[section][idx] = @(top); - } - } - - CGFloat contentHeight = [[[columnHeights lastObject] firstObject] floatValue]; - CGSize contentSize = CGSizeMake(layoutWidth, contentHeight); - return [[ASCollectionLayoutState alloc] initWithContext:context - contentSize:contentSize - elementToLayoutAttributesTable:attrsMap]; -} - -+ (CGFloat)_columnWidthForSection:(NSUInteger)section withLayoutWidth:(CGFloat)layoutWidth info:(MosaicCollectionLayoutInfo *)info -{ - return ([self _widthForSection:section withLayoutWidth:layoutWidth info:info] - ((info.numberOfColumns - 1) * info.columnSpacing)) / info.numberOfColumns; -} - -+ (CGFloat)_widthForSection:(NSUInteger)section withLayoutWidth:(CGFloat)layoutWidth info:(MosaicCollectionLayoutInfo *)info -{ - return layoutWidth - info.sectionInsets.left - info.sectionInsets.right; -} - -+ (ASSizeRange)_sizeRangeForItem:(ASCellNode *)item atIndexPath:(NSIndexPath *)indexPath withLayoutWidth:(CGFloat)layoutWidth info:(MosaicCollectionLayoutInfo *)info -{ - CGFloat itemWidth = [self _columnWidthForSection:indexPath.section withLayoutWidth:layoutWidth info:info]; - if ([item isKindOfClass:[ImageCellNode class]]) { - return ASSizeRangeMake(CGSizeMake(itemWidth, 0), CGSizeMake(itemWidth, CGFLOAT_MAX)); - } else { - return ASSizeRangeMake(CGSizeMake(itemWidth, itemWidth)); // In kShowUICollectionViewCells = YES mode, make those cells itemWidth x itemWidth. - } -} - -+ (ASSizeRange)_sizeRangeForHeaderOfSection:(NSInteger)section withLayoutWidth:(CGFloat)layoutWidth info:(MosaicCollectionLayoutInfo *)info -{ - return ASSizeRangeMake(CGSizeMake(0, info.headerHeight), CGSizeMake([self _widthForSection:section withLayoutWidth:layoutWidth info:info], info.headerHeight)); -} - -+ (NSUInteger)_tallestColumnIndexInSection:(NSUInteger)section withColumnHeights:(NSArray *)columnHeights -{ - __block NSUInteger index = 0; - __block CGFloat tallestHeight = 0; - [columnHeights[section] enumerateObjectsUsingBlock:^(NSNumber *height, NSUInteger idx, BOOL *stop) { - if (height.floatValue > tallestHeight) { - index = idx; - tallestHeight = height.floatValue; - } - }]; - return index; -} - -+ (NSUInteger)_shortestColumnIndexInSection:(NSUInteger)section withColumnHeights:(NSArray *)columnHeights -{ - __block NSUInteger index = 0; - __block CGFloat shortestHeight = CGFLOAT_MAX; - [columnHeights[section] enumerateObjectsUsingBlock:^(NSNumber *height, NSUInteger idx, BOOL *stop) { - if (height.floatValue < shortestHeight) { - index = idx; - shortestHeight = height.floatValue; - } - }]; - return index; -} - -@end diff --git a/submodules/AsyncDisplayKit/examples/CustomCollectionView/Sample/MosaicCollectionLayoutInfo.h b/submodules/AsyncDisplayKit/examples/CustomCollectionView/Sample/MosaicCollectionLayoutInfo.h deleted file mode 100644 index b887e1d2be..0000000000 --- a/submodules/AsyncDisplayKit/examples/CustomCollectionView/Sample/MosaicCollectionLayoutInfo.h +++ /dev/null @@ -1,28 +0,0 @@ -// -// MosaicCollectionLayoutInfo.h -// Texture -// -// Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -@interface MosaicCollectionLayoutInfo : NSObject - -// Read-only properties -@property (nonatomic, assign, readonly) NSInteger numberOfColumns; -@property (nonatomic, assign, readonly) CGFloat headerHeight; -@property (nonatomic, assign, readonly) CGFloat columnSpacing; -@property (nonatomic, assign, readonly) UIEdgeInsets sectionInsets; -@property (nonatomic, assign, readonly) UIEdgeInsets interItemSpacing; - -- (instancetype)initWithNumberOfColumns:(NSInteger)numberOfColumns - headerHeight:(CGFloat)headerHeight - columnSpacing:(CGFloat)columnSpacing - sectionInsets:(UIEdgeInsets)sectionInsets - interItemSpacing:(UIEdgeInsets)interItemSpacing NS_DESIGNATED_INITIALIZER; - -- (instancetype)init __unavailable; - -@end diff --git a/submodules/AsyncDisplayKit/examples/CustomCollectionView/Sample/MosaicCollectionLayoutInfo.m b/submodules/AsyncDisplayKit/examples/CustomCollectionView/Sample/MosaicCollectionLayoutInfo.m deleted file mode 100644 index 9eb80c2186..0000000000 --- a/submodules/AsyncDisplayKit/examples/CustomCollectionView/Sample/MosaicCollectionLayoutInfo.m +++ /dev/null @@ -1,74 +0,0 @@ -// -// MosaicCollectionLayoutInfo.m -// Texture -// -// Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import "MosaicCollectionLayoutInfo.h" - -#import - -@implementation MosaicCollectionLayoutInfo - -- (instancetype)initWithNumberOfColumns:(NSInteger)numberOfColumns - headerHeight:(CGFloat)headerHeight - columnSpacing:(CGFloat)columnSpacing - sectionInsets:(UIEdgeInsets)sectionInsets - interItemSpacing:(UIEdgeInsets)interItemSpacing -{ - self = [super init]; - if (self) { - _numberOfColumns = numberOfColumns; - _headerHeight = headerHeight; - _columnSpacing = columnSpacing; - _sectionInsets = sectionInsets; - _interItemSpacing = interItemSpacing; - } - return self; -} - -- (BOOL)isEqualToInfo:(MosaicCollectionLayoutInfo *)info -{ - if (info == nil) { - return NO; - } - - return _numberOfColumns == info.numberOfColumns - && _headerHeight == info.headerHeight - && _columnSpacing == info.columnSpacing - && UIEdgeInsetsEqualToEdgeInsets(_sectionInsets, info.sectionInsets) - && UIEdgeInsetsEqualToEdgeInsets(_interItemSpacing, info.interItemSpacing); -} - -- (BOOL)isEqual:(id)other -{ - if (self == other) { - return YES; - } - if (! [other isKindOfClass:[MosaicCollectionLayoutInfo class]]) { - return NO; - } - return [self isEqualToInfo:other]; -} - -- (NSUInteger)hash -{ - struct { - NSInteger numberOfColumns; - CGFloat headerHeight; - CGFloat columnSpacing; - UIEdgeInsets sectionInsets; - UIEdgeInsets interItemSpacing; - } data = { - _numberOfColumns, - _headerHeight, - _columnSpacing, - _sectionInsets, - _interItemSpacing, - }; - return ASHashBytes(&data, sizeof(data)); -} - -@end diff --git a/submodules/AsyncDisplayKit/examples/CustomCollectionView/Sample/ViewController.h b/submodules/AsyncDisplayKit/examples/CustomCollectionView/Sample/ViewController.h deleted file mode 100644 index da850f7446..0000000000 --- a/submodules/AsyncDisplayKit/examples/CustomCollectionView/Sample/ViewController.h +++ /dev/null @@ -1,15 +0,0 @@ -// -// ViewController.h -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import -#import - -@interface ViewController : ASViewController - -@end diff --git a/submodules/AsyncDisplayKit/examples/CustomCollectionView/Sample/ViewController.m b/submodules/AsyncDisplayKit/examples/CustomCollectionView/Sample/ViewController.m deleted file mode 100644 index 7715fc8c07..0000000000 --- a/submodules/AsyncDisplayKit/examples/CustomCollectionView/Sample/ViewController.m +++ /dev/null @@ -1,142 +0,0 @@ -// -// ViewController.m -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import "ViewController.h" - -#import -#import -#import "MosaicCollectionLayoutDelegate.h" -#import "ImageCellNode.h" -#import "ImageCollectionViewCell.h" - -// This option demonstrates that raw UIKit cells can still be used alongside native ASCellNodes. -static BOOL kShowUICollectionViewCells = YES; -static NSString *kReuseIdentifier = @"ImageCollectionViewCell"; -static NSUInteger kNumberOfImages = 14; - -@interface ViewController () -{ - NSMutableArray *_sections; - ASCollectionNode *_collectionNode; -} - -@end - -@implementation ViewController - -#pragma mark - -#pragma mark UIViewController - -- (instancetype)init -{ - MosaicCollectionLayoutDelegate *layoutDelegate = [[MosaicCollectionLayoutDelegate alloc] initWithNumberOfColumns:2 headerHeight:44.0]; - _collectionNode = [[ASCollectionNode alloc] initWithLayoutDelegate:layoutDelegate layoutFacilitator:nil]; - _collectionNode.dataSource = self; - _collectionNode.delegate = self; - _collectionNode.layoutInspector = self; - - if (!(self = [super initWithNode:_collectionNode])) - return nil; - - _sections = [NSMutableArray array]; - [_sections addObject:[NSMutableArray array]]; - for (NSUInteger idx = 0, section = 0; idx < kNumberOfImages; idx++) { - NSString *name = [NSString stringWithFormat:@"image_%lu.jpg", (unsigned long)idx]; - [_sections[section] addObject:[UIImage imageNamed:name]]; - if ((idx + 1) % 5 == 0 && idx < kNumberOfImages - 1) { - section++; - [_sections addObject:[NSMutableArray array]]; - } - } - - [_collectionNode registerSupplementaryNodeOfKind:UICollectionElementKindSectionHeader]; - - return self; -} - -- (void)viewDidLoad -{ - [super viewDidLoad]; - - [_collectionNode.view registerClass:[ImageCollectionViewCell class] forCellWithReuseIdentifier:kReuseIdentifier]; -} - -- (void)reloadTapped -{ - [_collectionNode reloadData]; -} - -#pragma mark - ASCollectionNode data source. - -- (ASCellNodeBlock)collectionNode:(ASCollectionNode *)collectionNode nodeBlockForItemAtIndexPath:(NSIndexPath *)indexPath -{ - if (kShowUICollectionViewCells && indexPath.item % 3 == 1) { - // When enabled, return nil for every third cell and then cellForItemAtIndexPath: will be called. - return nil; - } - - UIImage *image = _sections[indexPath.section][indexPath.item]; - return ^{ - return [[ImageCellNode alloc] initWithImage:image]; - }; -} - -// The below 2 methods are required by ASCollectionViewLayoutInspecting, but ASCollectionLayout and its layout delegate are the ones that really determine the size ranges and directions -// TODO Remove these methods once a layout inspector is no longer required under ASCollectionLayout mode -- (ASSizeRange)collectionView:(ASCollectionView *)collectionView constrainedSizeForNodeAtIndexPath:(NSIndexPath *)indexPath -{ - return ASSizeRangeZero; -} - -- (ASScrollDirection)scrollableDirections -{ - return ASScrollDirectionVerticalDirections; -} - -/** - * Asks the inspector for the number of supplementary views for the given kind in the specified section. - */ -- (NSUInteger)collectionView:(ASCollectionView *)collectionView supplementaryNodesOfKind:(NSString *)kind inSection:(NSUInteger)section -{ - return [kind isEqualToString:UICollectionElementKindSectionHeader] ? 1 : 0; -} - -- (ASCellNode *)collectionNode:(ASCollectionNode *)collectionNode nodeForSupplementaryElementOfKind:(NSString *)kind atIndexPath:(NSIndexPath *)indexPath -{ - NSDictionary *textAttributes = @{ - NSFontAttributeName: [UIFont preferredFontForTextStyle:UIFontTextStyleHeadline], - NSForegroundColorAttributeName: [UIColor grayColor] - }; - UIEdgeInsets textInsets = UIEdgeInsetsMake(11.0, 0, 11.0, 0); - ASTextCellNode *textCellNode = [[ASTextCellNode alloc] initWithAttributes:textAttributes insets:textInsets]; - textCellNode.text = [NSString stringWithFormat:@"Section %zd", indexPath.section + 1]; - return textCellNode; -} - -- (NSInteger)numberOfSectionsInCollectionNode:(ASCollectionNode *)collectionNode -{ - return _sections.count; -} - -- (NSInteger)collectionNode:(ASCollectionNode *)collectionNode numberOfItemsInSection:(NSInteger)section -{ - return [_sections[section] count]; -} - -- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath -{ - return [_collectionNode.view dequeueReusableCellWithReuseIdentifier:kReuseIdentifier forIndexPath:indexPath]; -} - -- (UICollectionReusableView *)collectionView:(UICollectionView *)collectionView viewForSupplementaryElementOfKind:(NSString *)kind atIndexPath:(NSIndexPath *)indexPath -{ - return nil; -} - -@end diff --git a/submodules/AsyncDisplayKit/examples/CustomCollectionView/Sample/main.m b/submodules/AsyncDisplayKit/examples/CustomCollectionView/Sample/main.m deleted file mode 100644 index 65850400e4..0000000000 --- a/submodules/AsyncDisplayKit/examples/CustomCollectionView/Sample/main.m +++ /dev/null @@ -1,17 +0,0 @@ -// -// main.m -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import -#import "AppDelegate.h" - -int main(int argc, char * argv[]) { - @autoreleasepool { - return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); - } -} diff --git a/submodules/AsyncDisplayKit/examples/HorizontalWithinVerticalScrolling/Default-568h@2x.png b/submodules/AsyncDisplayKit/examples/HorizontalWithinVerticalScrolling/Default-568h@2x.png deleted file mode 100644 index 6ee80b9393..0000000000 Binary files a/submodules/AsyncDisplayKit/examples/HorizontalWithinVerticalScrolling/Default-568h@2x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/examples/HorizontalWithinVerticalScrolling/Default-667h@2x.png b/submodules/AsyncDisplayKit/examples/HorizontalWithinVerticalScrolling/Default-667h@2x.png deleted file mode 100644 index e7b975e21b..0000000000 Binary files a/submodules/AsyncDisplayKit/examples/HorizontalWithinVerticalScrolling/Default-667h@2x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/examples/HorizontalWithinVerticalScrolling/Default-736h@3x.png b/submodules/AsyncDisplayKit/examples/HorizontalWithinVerticalScrolling/Default-736h@3x.png deleted file mode 100644 index c8949cae16..0000000000 Binary files a/submodules/AsyncDisplayKit/examples/HorizontalWithinVerticalScrolling/Default-736h@3x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/examples/HorizontalWithinVerticalScrolling/Podfile b/submodules/AsyncDisplayKit/examples/HorizontalWithinVerticalScrolling/Podfile deleted file mode 100644 index 71a7f2c4b2..0000000000 --- a/submodules/AsyncDisplayKit/examples/HorizontalWithinVerticalScrolling/Podfile +++ /dev/null @@ -1,5 +0,0 @@ -source 'https://github.com/CocoaPods/Specs.git' -platform :ios, '9.0' -target 'Sample' do - pod 'Texture', :path => '../..' -end diff --git a/submodules/AsyncDisplayKit/examples/HorizontalWithinVerticalScrolling/Sample/AppDelegate.h b/submodules/AsyncDisplayKit/examples/HorizontalWithinVerticalScrolling/Sample/AppDelegate.h deleted file mode 100644 index c30a27f4dc..0000000000 --- a/submodules/AsyncDisplayKit/examples/HorizontalWithinVerticalScrolling/Sample/AppDelegate.h +++ /dev/null @@ -1,18 +0,0 @@ -// -// AppDelegate.h -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -#define UseAutomaticLayout 1 - -@interface AppDelegate : UIResponder - -@property (strong, nonatomic) UIWindow *window; - -@end diff --git a/submodules/AsyncDisplayKit/examples/HorizontalWithinVerticalScrolling/Sample/AppDelegate.m b/submodules/AsyncDisplayKit/examples/HorizontalWithinVerticalScrolling/Sample/AppDelegate.m deleted file mode 100644 index f8437855b0..0000000000 --- a/submodules/AsyncDisplayKit/examples/HorizontalWithinVerticalScrolling/Sample/AppDelegate.m +++ /dev/null @@ -1,25 +0,0 @@ -// -// AppDelegate.m -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import "AppDelegate.h" - -#import "ViewController.h" - -@implementation AppDelegate - -- (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 diff --git a/submodules/AsyncDisplayKit/examples/HorizontalWithinVerticalScrolling/Sample/HorizontalScrollCellNode.h b/submodules/AsyncDisplayKit/examples/HorizontalWithinVerticalScrolling/Sample/HorizontalScrollCellNode.h deleted file mode 100644 index 49b6e48d09..0000000000 --- a/submodules/AsyncDisplayKit/examples/HorizontalWithinVerticalScrolling/Sample/HorizontalScrollCellNode.h +++ /dev/null @@ -1,20 +0,0 @@ -// -// HorizontalScrollCellNode.h -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -/** - * This ASCellNode contains an ASCollectionNode. It intelligently interacts with a containing ASCollectionView or ASTableView, - * to preload and clean up contents as the user scrolls around both vertically and horizontally — in a way that minimizes memory usage. - */ -@interface HorizontalScrollCellNode : ASCellNode - -- (instancetype)initWithElementSize:(CGSize)size; - -@end diff --git a/submodules/AsyncDisplayKit/examples/HorizontalWithinVerticalScrolling/Sample/HorizontalScrollCellNode.mm b/submodules/AsyncDisplayKit/examples/HorizontalWithinVerticalScrolling/Sample/HorizontalScrollCellNode.mm deleted file mode 100644 index 0794643893..0000000000 --- a/submodules/AsyncDisplayKit/examples/HorizontalWithinVerticalScrolling/Sample/HorizontalScrollCellNode.mm +++ /dev/null @@ -1,105 +0,0 @@ -// -// HorizontalScrollCellNode.mm -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import "HorizontalScrollCellNode.h" -#import "RandomCoreGraphicsNode.h" -#import "AppDelegate.h" - -#import - -#import -#import - -static const CGFloat kOuterPadding = 16.0f; -static const CGFloat kInnerPadding = 10.0f; - -@interface HorizontalScrollCellNode () -{ - ASCollectionNode *_collectionNode; - CGSize _elementSize; - ASDisplayNode *_divider; -} - -@end - - -@implementation HorizontalScrollCellNode - -#pragma mark - Lifecycle - -- (instancetype)initWithElementSize:(CGSize)size -{ - if (!(self = [super init])) - return nil; - - _elementSize = size; - - // the containing table uses -nodeForRowAtIndexPath (rather than -nodeBlockForRowAtIndexPath), - // so this init method will always be run on the main thread (thus it is safe to do UIKit things). - UICollectionViewFlowLayout *flowLayout = [[UICollectionViewFlowLayout alloc] init]; - flowLayout.scrollDirection = UICollectionViewScrollDirectionHorizontal; - flowLayout.itemSize = _elementSize; - flowLayout.minimumInteritemSpacing = kInnerPadding; - - _collectionNode = [[ASCollectionNode alloc] initWithCollectionViewLayout:flowLayout]; - _collectionNode.delegate = self; - _collectionNode.dataSource = self; - [self addSubnode:_collectionNode]; - - // hairline cell separator - _divider = [[ASDisplayNode alloc] init]; - _divider.backgroundColor = [UIColor lightGrayColor]; - [self addSubnode:_divider]; - - return self; -} - -// With box model, you don't need to override this method, unless you want to add custom logic. -- (void)layout -{ - [super layout]; - - _collectionNode.view.contentInset = UIEdgeInsetsMake(0.0, kOuterPadding, 0.0, kOuterPadding); - - // Manually layout the divider. - CGFloat pixelHeight = 1.0f / [[UIScreen mainScreen] scale]; - _divider.frame = CGRectMake(0.0f, 0.0f, self.calculatedSize.width, pixelHeight); -} - -- (ASLayoutSpec *)layoutSpecThatFits:(ASSizeRange)constrainedSize -{ - CGSize collectionNodeSize = CGSizeMake(constrainedSize.max.width, _elementSize.height); - _collectionNode.style.preferredSize = collectionNodeSize; - - ASInsetLayoutSpec *insetSpec = [[ASInsetLayoutSpec alloc] init]; - insetSpec.insets = UIEdgeInsetsMake(kOuterPadding, 0.0, kOuterPadding, 0.0); - insetSpec.child = _collectionNode; - - return insetSpec; -} - -#pragma mark - ASCollectionNode - -- (NSInteger)collectionNode:(ASCollectionNode *)collectionNode numberOfItemsInSection:(NSInteger)section -{ - return 5; -} - -- (ASCellNodeBlock)collectionNode:(ASCollectionNode *)collectionNode nodeBlockForItemAtIndexPath:(NSIndexPath *)indexPath -{ - CGSize elementSize = _elementSize; - - return ^{ - RandomCoreGraphicsNode *elementNode = [[RandomCoreGraphicsNode alloc] init]; - elementNode.style.preferredSize = elementSize; - return elementNode; - }; -} - -@end diff --git a/submodules/AsyncDisplayKit/examples/HorizontalWithinVerticalScrolling/Sample/Info.plist b/submodules/AsyncDisplayKit/examples/HorizontalWithinVerticalScrolling/Sample/Info.plist deleted file mode 100644 index 35d842827b..0000000000 --- a/submodules/AsyncDisplayKit/examples/HorizontalWithinVerticalScrolling/Sample/Info.plist +++ /dev/null @@ -1,36 +0,0 @@ - - - - - CFBundleDevelopmentRegion - en - CFBundleExecutable - $(EXECUTABLE_NAME) - CFBundleIdentifier - com.facebook.AsyncDisplayKit.$(PRODUCT_NAME:rfc1034identifier) - CFBundleInfoDictionaryVersion - 6.0 - CFBundleName - $(PRODUCT_NAME) - CFBundlePackageType - APPL - CFBundleShortVersionString - 1.0 - CFBundleSignature - ???? - CFBundleVersion - 1 - LSRequiresIPhoneOS - - UIRequiredDeviceCapabilities - - armv7 - - UISupportedInterfaceOrientations - - UIInterfaceOrientationPortrait - UIInterfaceOrientationLandscapeLeft - UIInterfaceOrientationLandscapeRight - - - diff --git a/submodules/AsyncDisplayKit/examples/HorizontalWithinVerticalScrolling/Sample/RandomCoreGraphicsNode.h b/submodules/AsyncDisplayKit/examples/HorizontalWithinVerticalScrolling/Sample/RandomCoreGraphicsNode.h deleted file mode 100644 index 85b53290cc..0000000000 --- a/submodules/AsyncDisplayKit/examples/HorizontalWithinVerticalScrolling/Sample/RandomCoreGraphicsNode.h +++ /dev/null @@ -1,14 +0,0 @@ -// -// RandomCoreGraphicsNode.h -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -@interface RandomCoreGraphicsNode : ASCellNode - -@end diff --git a/submodules/AsyncDisplayKit/examples/HorizontalWithinVerticalScrolling/Sample/RandomCoreGraphicsNode.m b/submodules/AsyncDisplayKit/examples/HorizontalWithinVerticalScrolling/Sample/RandomCoreGraphicsNode.m deleted file mode 100644 index 83d9ed6795..0000000000 --- a/submodules/AsyncDisplayKit/examples/HorizontalWithinVerticalScrolling/Sample/RandomCoreGraphicsNode.m +++ /dev/null @@ -1,45 +0,0 @@ -// -// RandomCoreGraphicsNode.m -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import "RandomCoreGraphicsNode.h" -#import - -@implementation RandomCoreGraphicsNode - -+ (UIColor *)randomColor -{ - 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]; -} - -+ (void)drawRect:(CGRect)bounds withParameters:(id)parameters isCancelled:(asdisplaynode_iscancelled_block_t)isCancelledBlock isRasterizing:(BOOL)isRasterizing -{ - CGFloat locations[3]; - NSMutableArray *colors = [NSMutableArray arrayWithCapacity:3]; - [colors addObject:(id)[[RandomCoreGraphicsNode randomColor] CGColor]]; - locations[0] = 0.0; - [colors addObject:(id)[[RandomCoreGraphicsNode randomColor] CGColor]]; - locations[1] = 1.0; - [colors addObject:(id)[[RandomCoreGraphicsNode randomColor] CGColor]]; - locations[2] = ( arc4random() % 256 / 256.0 ); - - - CGContextRef ctx = UIGraphicsGetCurrentContext(); - CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB(); - CGGradientRef gradient = CGGradientCreateWithColors(colorSpace, (CFArrayRef)colors, locations); - - CGContextDrawLinearGradient(ctx, gradient, CGPointZero, CGPointMake(bounds.size.width, bounds.size.height), 0); - - CGGradientRelease(gradient); - CGColorSpaceRelease(colorSpace); -} - -@end diff --git a/submodules/AsyncDisplayKit/examples/HorizontalWithinVerticalScrolling/Sample/ViewController.h b/submodules/AsyncDisplayKit/examples/HorizontalWithinVerticalScrolling/Sample/ViewController.h deleted file mode 100644 index 560b6a2d03..0000000000 --- a/submodules/AsyncDisplayKit/examples/HorizontalWithinVerticalScrolling/Sample/ViewController.h +++ /dev/null @@ -1,14 +0,0 @@ -// -// ViewController.h -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -@interface ViewController : ASViewController - -@end diff --git a/submodules/AsyncDisplayKit/examples/HorizontalWithinVerticalScrolling/Sample/ViewController.m b/submodules/AsyncDisplayKit/examples/HorizontalWithinVerticalScrolling/Sample/ViewController.m deleted file mode 100644 index f1b1858825..0000000000 --- a/submodules/AsyncDisplayKit/examples/HorizontalWithinVerticalScrolling/Sample/ViewController.m +++ /dev/null @@ -1,68 +0,0 @@ -// -// ViewController.m -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -#import "ViewController.h" -#import "HorizontalScrollCellNode.h" - -@interface ViewController () -{ - ASTableNode *_tableNode; -} - -@end - -@implementation ViewController - -#pragma mark - -#pragma mark UIViewController. - -- (instancetype)init -{ - _tableNode = [[ASTableNode alloc] initWithStyle:UITableViewStylePlain]; - _tableNode.dataSource = self; - _tableNode.delegate = self; - - if (!(self = [super initWithNode:_tableNode])) - return nil; - - self.title = @"Horizontal Scrolling Gradients"; - self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemRedo - target:self - action:@selector(reloadEverything)]; - - return self; -} - -- (void)viewDidLoad -{ - [super viewDidLoad]; - - _tableNode.view.separatorStyle = UITableViewCellSeparatorStyleNone; -} - -- (void)reloadEverything -{ - [_tableNode reloadData]; -} - -#pragma mark - ASTableNode - -- (ASCellNode *)tableNode:(ASTableNode *)tableNode nodeForRowAtIndexPath:(NSIndexPath *)indexPath -{ - return [[HorizontalScrollCellNode alloc] initWithElementSize:CGSizeMake(100, 100)]; -} - -- (NSInteger)tableNode:(ASTableNode *)tableNode numberOfRowsInSection:(NSInteger)section -{ - return 100; -} - -@end diff --git a/submodules/AsyncDisplayKit/examples/HorizontalWithinVerticalScrolling/Sample/main.m b/submodules/AsyncDisplayKit/examples/HorizontalWithinVerticalScrolling/Sample/main.m deleted file mode 100644 index 511cd1a7ac..0000000000 --- a/submodules/AsyncDisplayKit/examples/HorizontalWithinVerticalScrolling/Sample/main.m +++ /dev/null @@ -1,18 +0,0 @@ -// -// main.m -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -#import "AppDelegate.h" - -int main(int argc, char * argv[]) { - @autoreleasepool { - return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); - } -} diff --git a/submodules/AsyncDisplayKit/examples/Kittens/Default-568h@2x.png b/submodules/AsyncDisplayKit/examples/Kittens/Default-568h@2x.png deleted file mode 100644 index 6ee80b9393..0000000000 Binary files a/submodules/AsyncDisplayKit/examples/Kittens/Default-568h@2x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/examples/Kittens/Default-667h@2x.png b/submodules/AsyncDisplayKit/examples/Kittens/Default-667h@2x.png deleted file mode 100644 index e7b975e21b..0000000000 Binary files a/submodules/AsyncDisplayKit/examples/Kittens/Default-667h@2x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/examples/Kittens/Default-736h@3x.png b/submodules/AsyncDisplayKit/examples/Kittens/Default-736h@3x.png deleted file mode 100644 index c8949cae16..0000000000 Binary files a/submodules/AsyncDisplayKit/examples/Kittens/Default-736h@3x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/examples/Kittens/Podfile b/submodules/AsyncDisplayKit/examples/Kittens/Podfile deleted file mode 100644 index 71a7f2c4b2..0000000000 --- a/submodules/AsyncDisplayKit/examples/Kittens/Podfile +++ /dev/null @@ -1,5 +0,0 @@ -source 'https://github.com/CocoaPods/Specs.git' -platform :ios, '9.0' -target 'Sample' do - pod 'Texture', :path => '../..' -end diff --git a/submodules/AsyncDisplayKit/examples/Kittens/Sample/AppDelegate.h b/submodules/AsyncDisplayKit/examples/Kittens/Sample/AppDelegate.h deleted file mode 100644 index c30a27f4dc..0000000000 --- a/submodules/AsyncDisplayKit/examples/Kittens/Sample/AppDelegate.h +++ /dev/null @@ -1,18 +0,0 @@ -// -// AppDelegate.h -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -#define UseAutomaticLayout 1 - -@interface AppDelegate : UIResponder - -@property (strong, nonatomic) UIWindow *window; - -@end diff --git a/submodules/AsyncDisplayKit/examples/Kittens/Sample/AppDelegate.m b/submodules/AsyncDisplayKit/examples/Kittens/Sample/AppDelegate.m deleted file mode 100644 index 2395642bd1..0000000000 --- a/submodules/AsyncDisplayKit/examples/Kittens/Sample/AppDelegate.m +++ /dev/null @@ -1,37 +0,0 @@ -// -// AppDelegate.m -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import "AppDelegate.h" - -#import "ViewController.h" -#import - -@implementation AppDelegate - -- (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 - -@implementation ASConfiguration (UserProvided) - -+ (ASConfiguration *)textureConfiguration -{ - ASConfiguration *configuration = [ASConfiguration new]; - return configuration; - -} - -@end diff --git a/submodules/AsyncDisplayKit/examples/Kittens/Sample/BlurbNode.h b/submodules/AsyncDisplayKit/examples/Kittens/Sample/BlurbNode.h deleted file mode 100644 index 5451fb39f0..0000000000 --- a/submodules/AsyncDisplayKit/examples/Kittens/Sample/BlurbNode.h +++ /dev/null @@ -1,17 +0,0 @@ -// -// BlurbNode.h -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -/** - * Simple node that displays a placekitten.com attribution. - */ -@interface BlurbNode : ASCellNode - -@end diff --git a/submodules/AsyncDisplayKit/examples/Kittens/Sample/BlurbNode.m b/submodules/AsyncDisplayKit/examples/Kittens/Sample/BlurbNode.m deleted file mode 100644 index 6014711d33..0000000000 --- a/submodules/AsyncDisplayKit/examples/Kittens/Sample/BlurbNode.m +++ /dev/null @@ -1,120 +0,0 @@ -// -// BlurbNode.m -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import "BlurbNode.h" -#import "AppDelegate.h" - -#import -#import - -#import -#import - -static CGFloat kTextPadding = 10.0f; -static NSString *kLinkAttributeName = @"PlaceKittenNodeLinkAttributeName"; - -@interface BlurbNode () -{ - ASTextNode *_textNode; -} - -@end - - -@implementation BlurbNode - -#pragma mark - -#pragma mark ASCellNode. - -- (instancetype)init -{ - if (!(self = [super init])) - return nil; - - // create a text node - _textNode = [[ASTextNode alloc] init]; - - // configure the node to support tappable links - _textNode.delegate = self; - _textNode.userInteractionEnabled = YES; - _textNode.linkAttributeNames = @[ kLinkAttributeName ]; - - // generate an attributed string using the custom link attribute specified above - NSString *blurb = @"kittens courtesy placekitten.com \U0001F638"; - NSMutableAttributedString *string = [[NSMutableAttributedString alloc] initWithString:blurb]; - [string addAttribute:NSFontAttributeName value:[UIFont fontWithName:@"HelveticaNeue-Light" size:16.0f] range:NSMakeRange(0, blurb.length)]; - [string addAttributes:@{ - kLinkAttributeName: [NSURL URLWithString:@"http://placekitten.com/"], - NSForegroundColorAttributeName: [UIColor grayColor], - NSUnderlineStyleAttributeName: @(NSUnderlineStyleSingle | NSUnderlinePatternDot), - } - range:[blurb rangeOfString:@"placekitten.com"]]; - _textNode.attributedText = string; - - // add it as a subnode, and we're done - [self addSubnode:_textNode]; - - return self; -} - -- (void)didLoad -{ - // enable highlighting now that self.layer has loaded -- see ASHighlightOverlayLayer.h - self.layer.as_allowsHighlightDrawing = YES; - - [super didLoad]; -} - -#if UseAutomaticLayout -- (ASLayoutSpec *)layoutSpecThatFits:(ASSizeRange)constrainedSize -{ - ASCenterLayoutSpec *centerSpec = [[ASCenterLayoutSpec alloc] init]; - centerSpec.centeringOptions = ASCenterLayoutSpecCenteringX; - centerSpec.sizingOptions = ASCenterLayoutSpecSizingOptionMinimumY; - centerSpec.child = _textNode; - - UIEdgeInsets padding =UIEdgeInsetsMake(kTextPadding, kTextPadding, kTextPadding, kTextPadding); - return [ASInsetLayoutSpec insetLayoutSpecWithInsets:padding child:centerSpec]; -} -#else -- (CGSize)calculateSizeThatFits:(CGSize)constrainedSize -{ - // called on a background thread. custom nodes must call -measure: on their subnodes in -calculateSizeThatFits: - CGSize measuredSize = [_textNode measure:CGSizeMake(constrainedSize.width - 2 * kTextPadding, - constrainedSize.height - 2 * kTextPadding)]; - return CGSizeMake(constrainedSize.width, measuredSize.height + 2 * kTextPadding); -} - -- (void)layout -{ - // called on the main thread. we'll use the stashed size from above, instead of blocking on text sizing - CGSize textNodeSize = _textNode.calculatedSize; - _textNode.frame = CGRectMake(roundf((self.calculatedSize.width - textNodeSize.width) / 2.0f), - kTextPadding, - textNodeSize.width, - textNodeSize.height); -} -#endif - -#pragma mark - -#pragma mark ASTextNodeDelegate methods. - -- (BOOL)textNode:(ASTextNode *)richTextNode shouldHighlightLinkAttribute:(NSString *)attribute value:(id)value atPoint:(CGPoint)point -{ - // opt into link highlighting -- tap and hold the link to try it! must enable highlighting on a layer, see -didLoad - return YES; -} - -- (void)textNode:(ASTextNode *)richTextNode tappedLinkAttribute:(NSString *)attribute value:(NSURL *)URL atPoint:(CGPoint)point textRange:(NSRange)textRange -{ - // the node tapped a link, open it - [[UIApplication sharedApplication] openURL:URL]; -} - -@end diff --git a/submodules/AsyncDisplayKit/examples/Kittens/Sample/Info.plist b/submodules/AsyncDisplayKit/examples/Kittens/Sample/Info.plist deleted file mode 100644 index fb4115c84c..0000000000 --- a/submodules/AsyncDisplayKit/examples/Kittens/Sample/Info.plist +++ /dev/null @@ -1,36 +0,0 @@ - - - - - CFBundleDevelopmentRegion - en - CFBundleExecutable - $(EXECUTABLE_NAME) - CFBundleIdentifier - $(PRODUCT_BUNDLE_IDENTIFIER) - CFBundleInfoDictionaryVersion - 6.0 - CFBundleName - $(PRODUCT_NAME) - CFBundlePackageType - APPL - CFBundleShortVersionString - 1.0 - CFBundleSignature - ???? - CFBundleVersion - 1 - LSRequiresIPhoneOS - - UIRequiredDeviceCapabilities - - armv7 - - UISupportedInterfaceOrientations - - UIInterfaceOrientationPortrait - UIInterfaceOrientationLandscapeLeft - UIInterfaceOrientationLandscapeRight - - - diff --git a/submodules/AsyncDisplayKit/examples/Kittens/Sample/KittenNode.h b/submodules/AsyncDisplayKit/examples/Kittens/Sample/KittenNode.h deleted file mode 100644 index 5b0b04203e..0000000000 --- a/submodules/AsyncDisplayKit/examples/Kittens/Sample/KittenNode.h +++ /dev/null @@ -1,22 +0,0 @@ -// -// KittenNode.h -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -/** - * Social media-style node that displays a kitten picture and a random length - * of lorem ipsum text. Uses a placekitten.com kitten of the specified size. - */ -@interface KittenNode : ASCellNode - -- (instancetype)initWithKittenOfSize:(CGSize)size; - -- (void)toggleImageEnlargement; - -@end diff --git a/submodules/AsyncDisplayKit/examples/Kittens/Sample/KittenNode.mm b/submodules/AsyncDisplayKit/examples/Kittens/Sample/KittenNode.mm deleted file mode 100644 index f8ae2ef2e6..0000000000 --- a/submodules/AsyncDisplayKit/examples/Kittens/Sample/KittenNode.mm +++ /dev/null @@ -1,252 +0,0 @@ -// -// KittenNode.mm -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import "KittenNode.h" -#import "AppDelegate.h" - -#import - -#import -#import -#import - -static const CGFloat kImageSize = 80.0f; -static const CGFloat kOuterPadding = 16.0f; -static const CGFloat kInnerPadding = 10.0f; - - -@interface KittenNode () -{ - CGSize _kittenSize; - - ASNetworkImageNode *_imageNode; - ASTextNode *_textNode; - ASDisplayNode *_divider; - BOOL _isImageEnlarged; - BOOL _swappedTextAndImage; -} - -@end - - -@implementation KittenNode - -// lorem ipsum text courtesy https://kittyipsum.com/ <3 -+ (NSArray *)placeholders -{ - static NSArray *placeholders = nil; - - static dispatch_once_t once; - dispatch_once(&once, ^{ - placeholders = @[ - @"Kitty ipsum dolor sit amet, purr sleep on your face lay down in your way biting, sniff tincidunt a etiam fluffy fur judging you stuck in a tree kittens.", - @"Lick tincidunt a biting eat the grass, egestas enim ut lick leap puking climb the curtains lick.", - @"Lick quis nunc toss the mousie vel, tortor pellentesque sunbathe orci turpis non tail flick suscipit sleep in the sink.", - @"Orci turpis litter box et stuck in a tree, egestas ac tempus et aliquam elit.", - @"Hairball iaculis dolor dolor neque, nibh adipiscing vehicula egestas dolor aliquam.", - @"Sunbathe fluffy fur tortor faucibus pharetra jump, enim jump on the table I don't like that food catnip toss the mousie scratched.", - @"Quis nunc nam sleep in the sink quis nunc purr faucibus, chase the red dot consectetur bat sagittis.", - @"Lick tail flick jump on the table stretching purr amet, rhoncus scratched jump on the table run.", - @"Suspendisse aliquam vulputate feed me sleep on your keyboard, rip the couch faucibus sleep on your keyboard tristique give me fish dolor.", - @"Rip the couch hiss attack your ankles biting pellentesque puking, enim suspendisse enim mauris a.", - @"Sollicitudin iaculis vestibulum toss the mousie biting attack your ankles, puking nunc jump adipiscing in viverra.", - @"Nam zzz amet neque, bat tincidunt a iaculis sniff hiss bibendum leap nibh.", - @"Chase the red dot enim puking chuf, tristique et egestas sniff sollicitudin pharetra enim ut mauris a.", - @"Sagittis scratched et lick, hairball leap attack adipiscing catnip tail flick iaculis lick.", - @"Neque neque sleep in the sink neque sleep on your face, climb the curtains chuf tail flick sniff tortor non.", - @"Ac etiam kittens claw toss the mousie jump, pellentesque rhoncus litter box give me fish adipiscing mauris a.", - @"Pharetra egestas sunbathe faucibus ac fluffy fur, hiss feed me give me fish accumsan.", - @"Tortor leap tristique accumsan rutrum sleep in the sink, amet sollicitudin adipiscing dolor chase the red dot.", - @"Knock over the lamp pharetra vehicula sleep on your face rhoncus, jump elit cras nec quis quis nunc nam.", - @"Sollicitudin feed me et ac in viverra catnip, nunc eat I don't like that food iaculis give me fish.", - ]; - }); - - return placeholders; -} - -- (instancetype)initWithKittenOfSize:(CGSize)size -{ - if (!(self = [super init])) - return nil; - - _kittenSize = size; - - // kitten image, with a solid background colour serving as placeholder - _imageNode = [[ASNetworkImageNode alloc] init]; - _imageNode.URL = [NSURL URLWithString:[NSString stringWithFormat:@"https://placekitten.com/%zd/%zd", - (NSInteger)roundl(_kittenSize.width), - (NSInteger)roundl(_kittenSize.height)]]; - _imageNode.placeholderFadeDuration = .5; - _imageNode.placeholderColor = ASDisplayNodeDefaultPlaceholderColor(); - // _imageNode.contentMode = UIViewContentModeCenter; - [_imageNode addTarget:self action:@selector(toggleNodesSwap) forControlEvents:ASControlNodeEventTouchUpInside]; - [self addSubnode:_imageNode]; - - // lorem ipsum text, plus some nice styling - - _textNode = [[ASTextNode alloc] init]; - _textNode.shadowColor = [UIColor blackColor].CGColor; - _textNode.shadowRadius = 3; - _textNode.shadowOffset = CGSizeMake(-2, -2); - _textNode.shadowOpacity = 0.3; - if (_textNode.usingExperiment) { - _textNode.backgroundColor = [UIColor colorWithRed:0.9 green:0.9 blue:1 alpha:1]; - } else { - _textNode.backgroundColor = [UIColor colorWithRed:1 green:0.9 blue:0.9 alpha:1]; - } - _textNode.maximumNumberOfLines = 2; - _textNode.truncationAttributedText = [[NSAttributedString alloc] initWithString:@"…"]; - _textNode.additionalTruncationMessage = [[NSAttributedString alloc] initWithString:@"More"]; - _textNode.attributedText = [[NSAttributedString alloc] initWithString:[self kittyIpsum] attributes:[self textStyle]]; - [self addSubnode:_textNode]; - - // hairline cell separator - _divider = [[ASDisplayNode alloc] init]; - _divider.backgroundColor = [UIColor lightGrayColor]; - [self addSubnode:_divider]; - - return self; -} - -- (NSString *)kittyIpsum -{ - NSArray *placeholders = [KittenNode placeholders]; - u_int32_t ipsumCount = (u_int32_t)[placeholders count]; - u_int32_t location = arc4random_uniform(ipsumCount); - u_int32_t length = arc4random_uniform(ipsumCount - location); - - NSMutableString *string = [placeholders[location] mutableCopy]; - for (u_int32_t i = location + 1; i < location + length; i++) { - [string appendString:(i % 2 == 0) ? @"\n" : @" "]; - [string appendString:placeholders[i]]; - } - - return string; -} - -- (NSDictionary *)textStyle -{ - UIFont *font = [UIFont fontWithName:@"HelveticaNeue" size:12.0f]; - - NSMutableParagraphStyle *style = [[NSParagraphStyle defaultParagraphStyle] mutableCopy]; - style.paragraphSpacing = 0.5 * font.lineHeight; - style.hyphenationFactor = 1.0; - - return @{ - NSFontAttributeName: font, - NSParagraphStyleAttributeName: style, - ASTextNodeWordKerningAttributeName : @.5 - }; -} - -#if UseAutomaticLayout -- (ASLayoutSpec *)layoutSpecThatFits:(ASSizeRange)constrainedSize -{ - // Set an intrinsic size for the image node - CGSize imageSize = _isImageEnlarged ? CGSizeMake(2.0 * kImageSize, 2.0 * kImageSize) : CGSizeMake(kImageSize, kImageSize); - _imageNode.style.preferredSize = imageSize; - - // Shrink the text node in case the image + text gonna be too wide - _textNode.style.flexShrink = 1.0; - - // Configure stack - ASStackLayoutSpec *stackLayoutSpec = - [ASStackLayoutSpec - stackLayoutSpecWithDirection:ASStackLayoutDirectionHorizontal - spacing:kInnerPadding - justifyContent:ASStackLayoutJustifyContentStart - alignItems:ASStackLayoutAlignItemsStart - children:_swappedTextAndImage ? @[_textNode, _imageNode] : @[_imageNode, _textNode]]; - - // Add inset - return [ASInsetLayoutSpec - insetLayoutSpecWithInsets:UIEdgeInsetsMake(kOuterPadding, kOuterPadding, kOuterPadding, kOuterPadding) - child:stackLayoutSpec]; -} - -// With box model, you don't need to override this method, unless you want to add custom logic. -- (void)layout -{ - [super layout]; - - // Manually layout the divider. - CGFloat pixelHeight = 1.0f / [[UIScreen mainScreen] scale]; - _divider.frame = CGRectMake(0.0f, 0.0f, self.calculatedSize.width, pixelHeight); -} -#else -- (CGSize)calculateSizeThatFits:(CGSize)constrainedSize -{ - CGSize imageSize = CGSizeMake(kImageSize, kImageSize); - CGSize textSize = [_textNode measure:CGSizeMake(constrainedSize.width - kImageSize - 2 * kOuterPadding - kInnerPadding, - constrainedSize.height)]; - - // ensure there's room for the text - CGFloat requiredHeight = MAX(textSize.height, imageSize.height); - return CGSizeMake(constrainedSize.width, requiredHeight + 2 * kOuterPadding); -} - -- (void)layout -{ - CGFloat pixelHeight = 1.0f / [[UIScreen mainScreen] scale]; - _divider.frame = CGRectMake(0.0f, 0.0f, self.calculatedSize.width, pixelHeight); - - _imageNode.frame = CGRectMake(kOuterPadding, kOuterPadding, kImageSize, kImageSize); - - CGSize textSize = _textNode.calculatedSize; - _textNode.frame = CGRectMake(kOuterPadding + kImageSize + kInnerPadding, kOuterPadding, textSize.width, textSize.height); -} -#endif - -- (void)toggleImageEnlargement -{ - _isImageEnlarged = !_isImageEnlarged; - [self setNeedsLayout]; -} - -- (void)toggleNodesSwap -{ - _swappedTextAndImage = !_swappedTextAndImage; - - [UIView animateWithDuration:0.15 animations:^{ - self.alpha = 0; - } completion:^(BOOL finished) { - [self setNeedsLayout]; - [self.view layoutIfNeeded]; - - [UIView animateWithDuration:0.15 animations:^{ - self.alpha = 1; - }]; - }]; -} - -- (void)updateBackgroundColor -{ - if (self.highlighted) { - self.backgroundColor = [UIColor lightGrayColor]; - } else if (self.selected) { - self.backgroundColor = [UIColor blueColor]; - } else { - self.backgroundColor = [UIColor whiteColor]; - } -} - -- (void)setSelected:(BOOL)selected -{ - [super setSelected:selected]; - [self updateBackgroundColor]; -} - -- (void)setHighlighted:(BOOL)highlighted -{ - [super setHighlighted:highlighted]; - [self updateBackgroundColor]; -} - -@end diff --git a/submodules/AsyncDisplayKit/examples/Kittens/Sample/ViewController.h b/submodules/AsyncDisplayKit/examples/Kittens/Sample/ViewController.h deleted file mode 100644 index 560b6a2d03..0000000000 --- a/submodules/AsyncDisplayKit/examples/Kittens/Sample/ViewController.h +++ /dev/null @@ -1,14 +0,0 @@ -// -// ViewController.h -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -@interface ViewController : ASViewController - -@end diff --git a/submodules/AsyncDisplayKit/examples/Kittens/Sample/ViewController.m b/submodules/AsyncDisplayKit/examples/Kittens/Sample/ViewController.m deleted file mode 100644 index 552f482886..0000000000 --- a/submodules/AsyncDisplayKit/examples/Kittens/Sample/ViewController.m +++ /dev/null @@ -1,176 +0,0 @@ -// -// ViewController.m -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import "ViewController.h" - -#import -#import - -#import "BlurbNode.h" -#import "KittenNode.h" - - -static const NSInteger kLitterSize = 20; // intial number of kitten cells in ASTableNode -static const NSInteger kLitterBatchSize = 10; // number of kitten cells to add to ASTableNode -static const NSInteger kMaxLitterSize = 100; // max number of kitten cells allowed in ASTableNode - -@interface ViewController () -{ - ASTableNode *_tableNode; - - // array of boxed CGSizes corresponding to placekitten.com kittens - NSMutableArray *_kittenDataSource; - - NSIndexPath *_blurbNodeIndexPath; -} - -@property (nonatomic, strong) NSMutableArray *kittenDataSource; - -@end - - -@implementation ViewController - -#pragma mark - Lifecycle - -- (instancetype)init -{ - _tableNode = [[ASTableNode alloc] initWithStyle:UITableViewStylePlain]; - _tableNode.dataSource = self; - _tableNode.delegate = self; - - if (!(self = [super initWithNode:_tableNode])) - return nil; - - // populate our "data source" with some random kittens - _kittenDataSource = [self createLitterWithSize:kLitterSize]; - _blurbNodeIndexPath = [NSIndexPath indexPathForItem:0 inSection:0]; - - self.title = @"Kittens"; - self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemEdit - target:self - action:@selector(toggleEditingMode)]; - - return self; -} - -- (void)viewDidLoad -{ - [super viewDidLoad]; - - _tableNode.view.separatorStyle = UITableViewCellSeparatorStyleNone; // KittenNode has its own separator - [self.node addSubnode:_tableNode]; -} - -#pragma mark - Data Model - -- (NSMutableArray *)createLitterWithSize:(NSInteger)litterSize -{ - NSMutableArray *kittens = [NSMutableArray arrayWithCapacity:litterSize]; - for (NSInteger i = 0; i < litterSize; i++) { - - // placekitten.com will return the same kitten picture if the same pixel height & width are requested, - // so generate kittens with different width & height values. - u_int32_t deltaX = arc4random_uniform(10) - 5; - u_int32_t deltaY = arc4random_uniform(10) - 5; - CGSize size = CGSizeMake(350 + 2 * deltaX, 350 + 4 * deltaY); - - [kittens addObject:[NSValue valueWithCGSize:size]]; - } - return kittens; -} - -- (void)toggleEditingMode -{ - [_tableNode.view setEditing:!_tableNode.view.editing animated:YES]; -} - - -#pragma mark - ASTableNode - -- (NSInteger)tableNode:(ASTableNode *)tableNode numberOfRowsInSection:(NSInteger)section -{ - // blurb node + kLitterSize kitties - return 1 + _kittenDataSource.count; -} - -- (ASCellNode *)tableNode:(ASTableNode *)tableNode nodeForRowAtIndexPath:(NSIndexPath *)indexPath -{ - // special-case the first row - if ([_blurbNodeIndexPath compare:indexPath] == NSOrderedSame) { - BlurbNode *node = [[BlurbNode alloc] init]; - return node; - } - - NSValue *size = _kittenDataSource[indexPath.row - 1]; - KittenNode *node = [[KittenNode alloc] initWithKittenOfSize:size.CGSizeValue]; - return node; -} - -- (void)tableNode:(ASTableNode *)tableNode didSelectRowAtIndexPath:(NSIndexPath *)indexPath -{ - [_tableNode deselectRowAtIndexPath:indexPath animated:YES]; - - // Assume only kitten nodes are selectable (see -tableNode:shouldHighlightRowAtIndexPath:). - KittenNode *node = (KittenNode *)[_tableNode nodeForRowAtIndexPath:indexPath]; - - [node toggleImageEnlargement]; -} - -- (BOOL)tableNode:(ASTableNode *)tableNode shouldHighlightRowAtIndexPath:(NSIndexPath *)indexPath -{ - // Enable selection for kitten nodes - return [_blurbNodeIndexPath compare:indexPath] != NSOrderedSame; -} - -- (void)tableNode:(ASTableNode *)tableNode willBeginBatchFetchWithContext:(nonnull ASBatchContext *)context -{ - dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ - // populate a new array of random-sized kittens - NSArray *moarKittens = [self createLitterWithSize:kLitterBatchSize]; - - NSMutableArray *indexPaths = [[NSMutableArray alloc] init]; - - // find number of kittens in the data source and create their indexPaths - NSInteger existingRows = _kittenDataSource.count + 1; - - for (NSInteger i = 0; i < moarKittens.count; i++) { - [indexPaths addObject:[NSIndexPath indexPathForRow:existingRows + i inSection:0]]; - } - - // add new kittens to the data source & notify table of new indexpaths - [_kittenDataSource addObjectsFromArray:moarKittens]; - [tableNode insertRowsAtIndexPaths:indexPaths withRowAnimation:UITableViewRowAnimationFade]; - - [context completeBatchFetching:YES]; - }); -} - -- (BOOL)shouldBatchFetchForTableNode:(ASTableNode *)tableNode -{ - return _kittenDataSource.count < kMaxLitterSize; -} - -- (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath -{ - // Enable editing for Kitten nodes - return [_blurbNodeIndexPath compare:indexPath] != NSOrderedSame; -} - -- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle - forRowAtIndexPath:(NSIndexPath *)indexPath -{ - if (editingStyle == UITableViewCellEditingStyleDelete) { - // Assume only kitten nodes are editable (see -tableView:canEditRowAtIndexPath:). - [_kittenDataSource removeObjectAtIndex:indexPath.row - 1]; - [_tableNode deleteRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationAutomatic]; - } -} - -@end diff --git a/submodules/AsyncDisplayKit/examples/Kittens/Sample/main.m b/submodules/AsyncDisplayKit/examples/Kittens/Sample/main.m deleted file mode 100644 index 511cd1a7ac..0000000000 --- a/submodules/AsyncDisplayKit/examples/Kittens/Sample/main.m +++ /dev/null @@ -1,18 +0,0 @@ -// -// main.m -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -#import "AppDelegate.h" - -int main(int argc, char * argv[]) { - @autoreleasepool { - return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); - } -} diff --git a/submodules/AsyncDisplayKit/examples/LayoutSpecExamples-Swift/Podfile b/submodules/AsyncDisplayKit/examples/LayoutSpecExamples-Swift/Podfile deleted file mode 100644 index 83d2cae8bf..0000000000 --- a/submodules/AsyncDisplayKit/examples/LayoutSpecExamples-Swift/Podfile +++ /dev/null @@ -1,8 +0,0 @@ -source 'https://github.com/CocoaPods/Specs.git' -platform :ios, '9.0' - -use_frameworks! - -target 'Sample' do - pod 'Texture', :path => '../..' -end diff --git a/submodules/AsyncDisplayKit/examples/LayoutSpecExamples-Swift/Sample.xcworkspace/contents.xcworkspacedata b/submodules/AsyncDisplayKit/examples/LayoutSpecExamples-Swift/Sample.xcworkspace/contents.xcworkspacedata deleted file mode 100644 index 7b5a2f3050..0000000000 --- a/submodules/AsyncDisplayKit/examples/LayoutSpecExamples-Swift/Sample.xcworkspace/contents.xcworkspacedata +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - diff --git a/submodules/AsyncDisplayKit/examples/LayoutSpecExamples-Swift/Sample/AppDelegate.swift b/submodules/AsyncDisplayKit/examples/LayoutSpecExamples-Swift/Sample/AppDelegate.swift deleted file mode 100644 index 9a465c6de8..0000000000 --- a/submodules/AsyncDisplayKit/examples/LayoutSpecExamples-Swift/Sample/AppDelegate.swift +++ /dev/null @@ -1,31 +0,0 @@ -// -// AppDelegate.swift -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -import UIKit - -@UIApplicationMain -class AppDelegate: UIResponder, UIApplicationDelegate { - - var window: UIWindow? - - func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool { - let window = UIWindow(frame: UIScreen.main.bounds) - window.backgroundColor = UIColor.white - window.rootViewController = UINavigationController(rootViewController: OverviewViewController()) - window.makeKeyAndVisible() - self.window = window - - UINavigationBar.appearance().barTintColor = UIColor(red: 47/255.0, green: 184/255.0, blue: 253/255.0, alpha: 1.0) - UINavigationBar.appearance().tintColor = .white - UINavigationBar.appearance().titleTextAttributes = [NSForegroundColorAttributeName : UIColor.white] - - return true - } - -} diff --git a/submodules/AsyncDisplayKit/examples/LayoutSpecExamples-Swift/Sample/Base.lproj/LaunchScreen.storyboard b/submodules/AsyncDisplayKit/examples/LayoutSpecExamples-Swift/Sample/Base.lproj/LaunchScreen.storyboard deleted file mode 100644 index f4fc7f7736..0000000000 --- a/submodules/AsyncDisplayKit/examples/LayoutSpecExamples-Swift/Sample/Base.lproj/LaunchScreen.storyboard +++ /dev/null @@ -1,27 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/submodules/AsyncDisplayKit/examples/LayoutSpecExamples-Swift/Sample/Info.plist b/submodules/AsyncDisplayKit/examples/LayoutSpecExamples-Swift/Sample/Info.plist deleted file mode 100644 index 6105445463..0000000000 --- a/submodules/AsyncDisplayKit/examples/LayoutSpecExamples-Swift/Sample/Info.plist +++ /dev/null @@ -1,43 +0,0 @@ - - - - - CFBundleDevelopmentRegion - en - CFBundleExecutable - $(EXECUTABLE_NAME) - CFBundleIdentifier - $(PRODUCT_BUNDLE_IDENTIFIER) - CFBundleInfoDictionaryVersion - 6.0 - CFBundleName - $(PRODUCT_NAME) - CFBundlePackageType - APPL - CFBundleShortVersionString - 1.0 - CFBundleSignature - ???? - CFBundleVersion - 1 - LSRequiresIPhoneOS - - NSAppTransportSecurity - - NSAllowsArbitraryLoads - - - UILaunchStoryboardName - LaunchScreen - UIRequiredDeviceCapabilities - - armv7 - - UISupportedInterfaceOrientations - - UIInterfaceOrientationPortrait - UIInterfaceOrientationLandscapeLeft - UIInterfaceOrientationLandscapeRight - - - diff --git a/submodules/AsyncDisplayKit/examples/LayoutSpecExamples-Swift/Sample/LayoutExampleNode+Layouts.swift b/submodules/AsyncDisplayKit/examples/LayoutSpecExamples-Swift/Sample/LayoutExampleNode+Layouts.swift deleted file mode 100644 index cf6bfbf1a6..0000000000 --- a/submodules/AsyncDisplayKit/examples/LayoutSpecExamples-Swift/Sample/LayoutExampleNode+Layouts.swift +++ /dev/null @@ -1,85 +0,0 @@ -// -// LayoutExampleNode+Layouts.swift -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -import AsyncDisplayKit - -extension HeaderWithRightAndLeftItems { - - override func layoutSpecThatFits(_ constrainedSize: ASSizeRange) -> ASLayoutSpec { - let nameLocationStack = ASStackLayoutSpec.vertical() - nameLocationStack.style.flexShrink = 1.0 - nameLocationStack.style.flexGrow = 1.0 - - if postLocationNode.attributedText != nil { - nameLocationStack.children = [userNameNode, postLocationNode] - } else { - nameLocationStack.children = [userNameNode] - } - - let headerStackSpec = ASStackLayoutSpec(direction: .horizontal, - spacing: 40, - justifyContent: .start, - alignItems: .center, - children: [nameLocationStack, postTimeNode]) - - return ASInsetLayoutSpec(insets: UIEdgeInsets(top: 0, left: 10, bottom: 0, right: 10), child: headerStackSpec) - } - -} - -extension PhotoWithInsetTextOverlay { - - override func layoutSpecThatFits(_ constrainedSize: ASSizeRange) -> ASLayoutSpec { - let photoDimension: CGFloat = constrainedSize.max.width / 4.0 - photoNode.style.preferredSize = CGSize(width: photoDimension, height: photoDimension) - - // INFINITY is used to make the inset unbounded - let insets = UIEdgeInsets(top: CGFloat.infinity, left: 12, bottom: 12, right: 12) - let textInsetSpec = ASInsetLayoutSpec(insets: insets, child: titleNode) - - return ASOverlayLayoutSpec(child: photoNode, overlay: textInsetSpec) - } - -} - -extension PhotoWithOutsetIconOverlay { - - override func layoutSpecThatFits(_ constrainedSize: ASSizeRange) -> ASLayoutSpec { - iconNode.style.preferredSize = CGSize(width: 40, height: 40); - iconNode.style.layoutPosition = CGPoint(x: 150, y: 0); - - photoNode.style.preferredSize = CGSize(width: 150, height: 150); - photoNode.style.layoutPosition = CGPoint(x: 40 / 2.0, y: 40 / 2.0); - - let absoluteSpec = ASAbsoluteLayoutSpec(children: [photoNode, iconNode]) - - // ASAbsoluteLayoutSpec's .sizing property recreates the behavior of ASDK Layout API 1.0's "ASStaticLayoutSpec" - absoluteSpec.sizing = .sizeToFit - - return absoluteSpec; - } - -} - -extension FlexibleSeparatorSurroundingContent { - - override func layoutSpecThatFits(_ constrainedSize: ASSizeRange) -> ASLayoutSpec { - topSeparator.style.flexGrow = 1.0 - bottomSeparator.style.flexGrow = 1.0 - textNode.style.alignSelf = .center - - let verticalStackSpec = ASStackLayoutSpec.vertical() - verticalStackSpec.spacing = 20 - verticalStackSpec.justifyContent = .center - verticalStackSpec.children = [topSeparator, textNode, bottomSeparator] - - return ASInsetLayoutSpec(insets:UIEdgeInsets(top: 60, left: 0, bottom: 60, right: 0), child: verticalStackSpec) - } - -} diff --git a/submodules/AsyncDisplayKit/examples/LayoutSpecExamples-Swift/Sample/LayoutExampleNode.swift b/submodules/AsyncDisplayKit/examples/LayoutSpecExamples-Swift/Sample/LayoutExampleNode.swift deleted file mode 100644 index c113e07d37..0000000000 --- a/submodules/AsyncDisplayKit/examples/LayoutSpecExamples-Swift/Sample/LayoutExampleNode.swift +++ /dev/null @@ -1,274 +0,0 @@ -// -// LayoutExampleNode.swift -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -import AsyncDisplayKit - -class LayoutExampleNode: ASDisplayNode { - override required init() { - super.init() - automaticallyManagesSubnodes = true - backgroundColor = .white - } - - class func title() -> String { - assertionFailure("All layout example nodes must provide a title!") - return "" - } - - class func descriptionTitle() -> String? { - return nil - } -} - -class HeaderWithRightAndLeftItems : LayoutExampleNode { - let userNameNode = ASTextNode() - let postLocationNode = ASTextNode() - let postTimeNode = ASTextNode() - - required init() { - super.init() - - userNameNode.attributedText = NSAttributedString.attributedString(string: "hannahmbanana", fontSize: 20, color: .darkBlueColor()) - userNameNode.maximumNumberOfLines = 1 - userNameNode.truncationMode = .byTruncatingTail - - postLocationNode.attributedText = NSAttributedString.attributedString(string: "Sunset Beach, San Fransisco, CA", fontSize: 20, color: .lightBlueColor()) - postLocationNode.maximumNumberOfLines = 1 - postLocationNode.truncationMode = .byTruncatingTail - - postTimeNode.attributedText = NSAttributedString.attributedString(string: "30m", fontSize: 20, color: .lightGray) - postTimeNode.maximumNumberOfLines = 1 - postTimeNode.truncationMode = .byTruncatingTail - } - - override class func title() -> String { - return "Header with left and right justified text" - } - - override class func descriptionTitle() -> String? { - return "try rotating me!" - } -} - -class PhotoWithInsetTextOverlay : LayoutExampleNode { - let photoNode = ASNetworkImageNode() - let titleNode = ASTextNode() - - required init() { - super.init() - - backgroundColor = .clear - - photoNode.url = URL(string: "http://texturegroup.org/static/images/layout-examples-photo-with-inset-text-overlay-photo.png") - photoNode.willDisplayNodeContentWithRenderingContext = { context, drawParameters in - let bounds = context.boundingBoxOfClipPath - UIBezierPath(roundedRect: bounds, cornerRadius: 10).addClip() - } - - titleNode.attributedText = NSAttributedString.attributedString(string: "family fall hikes", fontSize: 16, color: .white) - titleNode.truncationAttributedText = NSAttributedString.attributedString(string: "...", fontSize: 16, color: .white) - titleNode.maximumNumberOfLines = 2 - titleNode.truncationMode = .byTruncatingTail - } - - override class func title() -> String { - return "Photo with inset text overlay" - } - - override class func descriptionTitle() -> String? { - return "try rotating me!" - } -} - -class PhotoWithOutsetIconOverlay : LayoutExampleNode { - let photoNode = ASNetworkImageNode() - let iconNode = ASNetworkImageNode() - - required init() { - super.init() - - photoNode.url = URL(string: "http://texturegroup.org/static/images/layout-examples-photo-with-outset-icon-overlay-photo.png") - - iconNode.url = URL(string: "http://texturegroup.org/static/images/layout-examples-photo-with-outset-icon-overlay-icon.png") - - iconNode.imageModificationBlock = { image in - let profileImageSize = CGSize(width: 60, height: 60) - return image.makeCircularImage(size: profileImageSize, borderWidth: 10) - } - } - - override class func title() -> String { - return "Photo with outset icon overlay" - } - - override class func descriptionTitle() -> String? { - return nil - } -} - -class FlexibleSeparatorSurroundingContent : LayoutExampleNode { - let topSeparator = ASImageNode() - let bottomSeparator = ASImageNode() - let textNode = ASTextNode() - - required init() { - super.init() - - topSeparator.image = UIImage.as_resizableRoundedImage(withCornerRadius: 1.0, cornerColor: .black, fill: .black) - - textNode.attributedText = NSAttributedString.attributedString(string: "this is a long text node", fontSize: 16, color: .black) - - bottomSeparator.image = UIImage.as_resizableRoundedImage(withCornerRadius: 1.0, cornerColor: .black, fill: .black) - } - - override class func title() -> String { - return "Top and bottom cell separator lines" - } - - override class func descriptionTitle() -> String? { - return "try rotating me!" - } -} - -class CornerLayoutSample : PhotoWithOutsetIconOverlay { - let photoNode1 = ASImageNode() - let photoNode2 = ASImageNode() - let dotNode = ASImageNode() - let badgeTextNode = ASTextNode() - let badgeImageNode = ASImageNode() - - struct ImageSize { - static let avatar = CGSize(width: 100, height: 100) - static let icon = CGSize(width: 26, height: 26) - } - - struct ImageColor { - static let avatar = UIColor.lightGray - static let icon = UIColor.red - } - - required init() { - super.init() - - let avatarImage = UIImage.draw(size: ImageSize.avatar, fillColor: ImageColor.avatar) { () -> UIBezierPath in - return UIBezierPath(roundedRect: CGRect(origin: CGPoint.zero, size: ImageSize.avatar), cornerRadius: ImageSize.avatar.width / 20) - } - - let iconImage = UIImage.draw(size: ImageSize.icon, fillColor: ImageColor.icon) { () -> UIBezierPath in - return UIBezierPath(ovalIn: CGRect(origin: CGPoint.zero, size: ImageSize.icon)) - } - - photoNode1.image = avatarImage - photoNode2.image = avatarImage - dotNode.image = iconImage - - badgeTextNode.attributedText = NSAttributedString.attributedString(string: " 999+ ", fontSize: 20, color: .white) - - badgeImageNode.image = UIImage.as_resizableRoundedImage(withCornerRadius: 12, cornerColor: .clear, fill: .red) - } - - override func layoutSpecThatFits(_ constrainedSize: ASSizeRange) -> ASLayoutSpec { - photoNode.style.preferredSize = ImageSize.avatar - iconNode.style.preferredSize = ImageSize.icon - - let badgeSpec = ASBackgroundLayoutSpec(child: badgeTextNode, background: badgeImageNode) - let cornerSpec1 = ASCornerLayoutSpec(child: photoNode1, corner: dotNode, location: .topRight) - let cornerSpec2 = ASCornerLayoutSpec(child: photoNode2, corner: badgeSpec, location: .topRight) - let cornerSpec3 = ASCornerLayoutSpec(child: photoNode, corner: iconNode, location: .topRight) - - cornerSpec1.offset = CGPoint(x: -3, y: 3) - - let stackSpec = ASStackLayoutSpec.vertical() - stackSpec.spacing = 40 - stackSpec.children = [cornerSpec1, cornerSpec2, cornerSpec3] - - return stackSpec - } - - override class func title() -> String { - return "Declarative way for Corner image Layout" - } - - override class func descriptionTitle() -> String? { - return nil - } -} - -class UserProfileSample : LayoutExampleNode { - - let badgeNode = ASImageNode() - let avatarNode = ASImageNode() - let usernameNode = ASTextNode() - let subtitleNode = ASTextNode() - - struct ImageSize { - static let avatar = CGSize(width: 44, height: 44) - static let badge = CGSize(width: 15, height: 15) - } - - struct ImageColor { - static let avatar = UIColor.lightGray - static let badge = UIColor.red - } - - required init() { - super.init() - - avatarNode.image = UIImage.draw(size: ImageSize.avatar, fillColor: ImageColor.avatar) { () -> UIBezierPath in - return UIBezierPath(ovalIn: CGRect(origin: CGPoint.zero, size: ImageSize.avatar)) - } - - badgeNode.image = UIImage.draw(size: ImageSize.badge, fillColor: ImageColor.badge) { () -> UIBezierPath in - return UIBezierPath(ovalIn: CGRect(origin: CGPoint.zero, size: ImageSize.badge)) - } - - makeSingleLine(for: usernameNode, with: "Hello world", fontSize: 17, textColor: .black) - makeSingleLine(for: subtitleNode, with: "This is a long long subtitle, with a long long appended string.", fontSize: 14, textColor: .lightGray) - } - - private func makeSingleLine(for node: ASTextNode, with text: String, fontSize: CGFloat, textColor: UIColor) { - node.attributedText = NSAttributedString.attributedString(string: text, fontSize: fontSize, color: textColor) - node.maximumNumberOfLines = 1 - } - - override func layoutSpecThatFits(_ constrainedSize: ASSizeRange) -> ASLayoutSpec { - let avatarBox = ASCornerLayoutSpec(child: avatarNode, corner: badgeNode, location: .bottomRight) - avatarBox.offset = CGPoint(x: -6, y: -6) - - let textBox = ASStackLayoutSpec.vertical() - textBox.justifyContent = .spaceAround - textBox.children = [usernameNode, subtitleNode] - - let profileBox = ASStackLayoutSpec.horizontal() - profileBox.spacing = 10 - profileBox.children = [avatarBox, textBox] - - // Apply text truncation - let elems: [ASLayoutElement] = [usernameNode, subtitleNode, textBox, profileBox] - for elem in elems { - elem.style.flexShrink = 1 - } - - let insetBox = ASInsetLayoutSpec( - insets: UIEdgeInsets(top: 120, left: 20, bottom: CGFloat.infinity, right: 20), - child: profileBox - ) - - return insetBox - } - - override class func title() -> String { - return "Common user profile layout." - } - - override class func descriptionTitle() -> String? { - return "For corner image layout and text truncation." - } - -} diff --git a/submodules/AsyncDisplayKit/examples/LayoutSpecExamples-Swift/Sample/LayoutExampleViewController.swift b/submodules/AsyncDisplayKit/examples/LayoutSpecExamples-Swift/Sample/LayoutExampleViewController.swift deleted file mode 100644 index 25a391694f..0000000000 --- a/submodules/AsyncDisplayKit/examples/LayoutSpecExamples-Swift/Sample/LayoutExampleViewController.swift +++ /dev/null @@ -1,38 +0,0 @@ -// -// LayoutExampleViewController.swift -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -import AsyncDisplayKit - -class LayoutExampleViewController: ASViewController { - - let customNode: LayoutExampleNode - - init(layoutExampleType: LayoutExampleNode.Type) { - customNode = layoutExampleType.init() - - super.init(node: ASDisplayNode()) - self.title = "Layout Example" - - self.node.addSubnode(customNode) - let needsOnlyYCentering = (layoutExampleType.isEqual(HeaderWithRightAndLeftItems.self) || layoutExampleType.isEqual(FlexibleSeparatorSurroundingContent.self)) - - self.node.backgroundColor = needsOnlyYCentering ? .lightGray : .white - - self.node.layoutSpecBlock = { [weak self] node, constrainedSize in - guard let customNode = self?.customNode else { return ASLayoutSpec() } - return ASCenterLayoutSpec(centeringOptions: needsOnlyYCentering ? .Y : .XY, - sizingOptions: .minimumXY, - child: customNode) - } - } - - required init?(coder aDecoder: NSCoder) { - fatalError("init(coder:) has not been implemented") - } -} diff --git a/submodules/AsyncDisplayKit/examples/LayoutSpecExamples-Swift/Sample/OverviewCellNode.swift b/submodules/AsyncDisplayKit/examples/LayoutSpecExamples-Swift/Sample/OverviewCellNode.swift deleted file mode 100644 index e6e511b62d..0000000000 --- a/submodules/AsyncDisplayKit/examples/LayoutSpecExamples-Swift/Sample/OverviewCellNode.swift +++ /dev/null @@ -1,38 +0,0 @@ -// -// OverviewCellNode.swift -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -import AsyncDisplayKit - -class OverviewCellNode: ASCellNode { - - let layoutExampleType: LayoutExampleNode.Type - - fileprivate let titleNode = ASTextNode() - fileprivate let descriptionNode = ASTextNode() - - init(layoutExampleType le: LayoutExampleNode.Type) { - layoutExampleType = le - - super.init() - self.automaticallyManagesSubnodes = true - - titleNode.attributedText = NSAttributedString.attributedString(string: layoutExampleType.title(), fontSize: 16, color: .black) - descriptionNode.attributedText = NSAttributedString.attributedString(string: layoutExampleType.descriptionTitle(), fontSize: 12, color: .lightGray) - } - - override func layoutSpecThatFits(_ constrainedSize: ASSizeRange) -> ASLayoutSpec { - let verticalStackSpec = ASStackLayoutSpec.vertical() - verticalStackSpec.alignItems = .start - verticalStackSpec.spacing = 5.0 - verticalStackSpec.children = [titleNode, descriptionNode] - - return ASInsetLayoutSpec(insets: UIEdgeInsets(top: 10, left: 16, bottom: 10, right: 10), child: verticalStackSpec) - } - -} diff --git a/submodules/AsyncDisplayKit/examples/LayoutSpecExamples-Swift/Sample/OverviewViewController.swift b/submodules/AsyncDisplayKit/examples/LayoutSpecExamples-Swift/Sample/OverviewViewController.swift deleted file mode 100644 index c43856f11a..0000000000 --- a/submodules/AsyncDisplayKit/examples/LayoutSpecExamples-Swift/Sample/OverviewViewController.swift +++ /dev/null @@ -1,64 +0,0 @@ -// -// OverviewViewController.swift -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -import AsyncDisplayKit - -class OverviewViewController: ASViewController { - let tableNode = ASTableNode() - let layoutExamples: [LayoutExampleNode.Type] - - init() { - layoutExamples = [ - HeaderWithRightAndLeftItems.self, - PhotoWithInsetTextOverlay.self, - PhotoWithOutsetIconOverlay.self, - FlexibleSeparatorSurroundingContent.self, - CornerLayoutSample.self, - UserProfileSample.self - ] - - super.init(node: tableNode) - - self.title = "Layout Examples" - self.navigationItem.backBarButtonItem = UIBarButtonItem(title: "", style: .plain, target: nil, action: nil) - tableNode.delegate = self - tableNode.dataSource = self - } - - required init?(coder aDecoder: NSCoder) { - fatalError("init(coder:) has not been implemented") - } - - override func viewWillAppear(_ animated: Bool) { - super.viewWillAppear(animated) - - if let indexPath = tableNode.indexPathForSelectedRow { - tableNode.deselectRow(at: indexPath, animated: true) - } - } - -} - -extension OverviewViewController: ASTableDataSource { - func tableNode(_ tableNode: ASTableNode, numberOfRowsInSection section: Int) -> Int { - return layoutExamples.count - } - - func tableNode(_ tableNode: ASTableNode, nodeForRowAt indexPath: IndexPath) -> ASCellNode { - return OverviewCellNode(layoutExampleType: layoutExamples[indexPath.row]) - } -} - -extension OverviewViewController: ASTableDelegate { - func tableNode(_ tableNode: ASTableNode, didSelectRowAt indexPath: IndexPath) { - let layoutExampleType = (tableNode.nodeForRow(at: indexPath) as! OverviewCellNode).layoutExampleType - let detail = LayoutExampleViewController(layoutExampleType: layoutExampleType) - self.navigationController?.pushViewController(detail, animated: true) - } -} diff --git a/submodules/AsyncDisplayKit/examples/LayoutSpecExamples-Swift/Sample/Utilities.swift b/submodules/AsyncDisplayKit/examples/LayoutSpecExamples-Swift/Sample/Utilities.swift deleted file mode 100644 index f235be8166..0000000000 --- a/submodules/AsyncDisplayKit/examples/LayoutSpecExamples-Swift/Sample/Utilities.swift +++ /dev/null @@ -1,99 +0,0 @@ -// -// Utilities.swift -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -import UIKit -import Foundation - -extension UIColor { - - static func darkBlueColor() -> UIColor { - return UIColor(red: 18.0/255.0, green: 86.0/255.0, blue: 136.0/255.0, alpha: 1.0) - } - - static func lightBlueColor() -> UIColor { - return UIColor(red: 0.0, green: 122.0/255.0, blue: 1.0, alpha: 1.0) - } - - static func duskColor() -> UIColor { - return UIColor(red: 255/255.0, green: 181/255.0, blue: 68/255.0, alpha: 1.0) - } - - static func customOrangeColor() -> UIColor { - return UIColor(red: 40/255.0, green: 43/255.0, blue: 53/255.0, alpha: 1.0) - } - -} - -extension UIImage { - - func makeCircularImage(size: CGSize, borderWidth width: CGFloat) -> UIImage { - // make a CGRect with the image's size - let circleRect = CGRect(origin: .zero, size: size) - - // begin the image context since we're not in a drawRect: - UIGraphicsBeginImageContextWithOptions(circleRect.size, false, 0) - - // create a UIBezierPath circle - let circle = UIBezierPath(roundedRect: circleRect, cornerRadius: circleRect.size.width * 0.5) - - // clip to the circle - circle.addClip() - - UIColor.white.set() - circle.fill() - - // draw the image in the circleRect *AFTER* the context is clipped - self.draw(in: circleRect) - - // create a border (for white background pictures) - if width > 0 { - circle.lineWidth = width; - UIColor.white.set() - circle.stroke() - } - - // get an image from the image context - let roundedImage = UIGraphicsGetImageFromCurrentImageContext(); - - // end the image context since we're not in a drawRect: - UIGraphicsEndImageContext(); - - return roundedImage ?? self - } - - class func draw(size: CGSize, fillColor: UIColor, shapeClosure: () -> UIBezierPath) -> UIImage { - UIGraphicsBeginImageContext(size) - - let path = shapeClosure() - path.addClip() - - fillColor.setFill() - path.fill() - - let image = UIGraphicsGetImageFromCurrentImageContext() - UIGraphicsEndImageContext() - - return image! - } -} - -extension NSAttributedString { - - static func attributedString(string: String?, fontSize size: CGFloat, color: UIColor?) -> NSAttributedString? { - guard let string = string else { return nil } - - let attributes = [NSForegroundColorAttributeName: color ?? UIColor.black, - NSFontAttributeName: UIFont.boldSystemFont(ofSize: size)] - - let attributedString = NSMutableAttributedString(string: string, attributes: attributes) - - return attributedString - } - -} diff --git a/submodules/AsyncDisplayKit/examples/LayoutSpecExamples/Podfile b/submodules/AsyncDisplayKit/examples/LayoutSpecExamples/Podfile deleted file mode 100644 index 08d1b7add6..0000000000 --- a/submodules/AsyncDisplayKit/examples/LayoutSpecExamples/Podfile +++ /dev/null @@ -1,6 +0,0 @@ -source 'https://github.com/CocoaPods/Specs.git' -platform :ios, '9.0' -target 'Sample' do - pod 'Texture', :path => '../..' -end - diff --git a/submodules/AsyncDisplayKit/examples/LayoutSpecExamples/Sample.xcworkspace/contents.xcworkspacedata b/submodules/AsyncDisplayKit/examples/LayoutSpecExamples/Sample.xcworkspace/contents.xcworkspacedata deleted file mode 100644 index 7b5a2f3050..0000000000 --- a/submodules/AsyncDisplayKit/examples/LayoutSpecExamples/Sample.xcworkspace/contents.xcworkspacedata +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - diff --git a/submodules/AsyncDisplayKit/examples/LayoutSpecExamples/Sample/AppDelegate.h b/submodules/AsyncDisplayKit/examples/LayoutSpecExamples/Sample/AppDelegate.h deleted file mode 100644 index d5c7194563..0000000000 --- a/submodules/AsyncDisplayKit/examples/LayoutSpecExamples/Sample/AppDelegate.h +++ /dev/null @@ -1,15 +0,0 @@ -// -// AppDelegate.h -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -@interface AppDelegate : UIResponder -@property (strong, nonatomic) UIWindow *window; -@end - diff --git a/submodules/AsyncDisplayKit/examples/LayoutSpecExamples/Sample/AppDelegate.m b/submodules/AsyncDisplayKit/examples/LayoutSpecExamples/Sample/AppDelegate.m deleted file mode 100644 index 73fc27af6e..0000000000 --- a/submodules/AsyncDisplayKit/examples/LayoutSpecExamples/Sample/AppDelegate.m +++ /dev/null @@ -1,29 +0,0 @@ -// -// AppDelegate.m -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import "AppDelegate.h" -#import "OverviewViewController.h" - -@implementation AppDelegate - -- (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:[OverviewViewController new]]; - [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 diff --git a/submodules/AsyncDisplayKit/examples/LayoutSpecExamples/Sample/Base.lproj/LaunchScreen.storyboard b/submodules/AsyncDisplayKit/examples/LayoutSpecExamples/Sample/Base.lproj/LaunchScreen.storyboard deleted file mode 100644 index f4fc7f7736..0000000000 --- a/submodules/AsyncDisplayKit/examples/LayoutSpecExamples/Sample/Base.lproj/LaunchScreen.storyboard +++ /dev/null @@ -1,27 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/submodules/AsyncDisplayKit/examples/LayoutSpecExamples/Sample/Info.plist b/submodules/AsyncDisplayKit/examples/LayoutSpecExamples/Sample/Info.plist deleted file mode 100644 index 6105445463..0000000000 --- a/submodules/AsyncDisplayKit/examples/LayoutSpecExamples/Sample/Info.plist +++ /dev/null @@ -1,43 +0,0 @@ - - - - - CFBundleDevelopmentRegion - en - CFBundleExecutable - $(EXECUTABLE_NAME) - CFBundleIdentifier - $(PRODUCT_BUNDLE_IDENTIFIER) - CFBundleInfoDictionaryVersion - 6.0 - CFBundleName - $(PRODUCT_NAME) - CFBundlePackageType - APPL - CFBundleShortVersionString - 1.0 - CFBundleSignature - ???? - CFBundleVersion - 1 - LSRequiresIPhoneOS - - NSAppTransportSecurity - - NSAllowsArbitraryLoads - - - UILaunchStoryboardName - LaunchScreen - UIRequiredDeviceCapabilities - - armv7 - - UISupportedInterfaceOrientations - - UIInterfaceOrientationPortrait - UIInterfaceOrientationLandscapeLeft - UIInterfaceOrientationLandscapeRight - - - diff --git a/submodules/AsyncDisplayKit/examples/LayoutSpecExamples/Sample/LayoutExampleNodes.h b/submodules/AsyncDisplayKit/examples/LayoutSpecExamples/Sample/LayoutExampleNodes.h deleted file mode 100644 index 484ba5d418..0000000000 --- a/submodules/AsyncDisplayKit/examples/LayoutSpecExamples/Sample/LayoutExampleNodes.h +++ /dev/null @@ -1,33 +0,0 @@ -// -// LayoutExampleNodes.h -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -@interface LayoutExampleNode : ASDisplayNode -+ (NSString *)title; -+ (NSString *)descriptionTitle; -@end - -@interface HeaderWithRightAndLeftItems : LayoutExampleNode -@end - -@interface PhotoWithInsetTextOverlay : LayoutExampleNode -@end - -@interface PhotoWithOutsetIconOverlay : LayoutExampleNode -@end - -@interface FlexibleSeparatorSurroundingContent : LayoutExampleNode -@end - -@interface CornerLayoutExample : PhotoWithOutsetIconOverlay -@end - -@interface UserProfileSample : LayoutExampleNode -@end diff --git a/submodules/AsyncDisplayKit/examples/LayoutSpecExamples/Sample/LayoutExampleNodes.m b/submodules/AsyncDisplayKit/examples/LayoutSpecExamples/Sample/LayoutExampleNodes.m deleted file mode 100644 index 5d9d63663f..0000000000 --- a/submodules/AsyncDisplayKit/examples/LayoutSpecExamples/Sample/LayoutExampleNodes.m +++ /dev/null @@ -1,461 +0,0 @@ -// -// LayoutExampleNodes.m -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import "LayoutExampleNodes.h" - -#import - -#import "Utilities.h" - -@interface HeaderWithRightAndLeftItems () -@property (nonatomic, strong) ASTextNode *usernameNode; -@property (nonatomic, strong) ASTextNode *postLocationNode; -@property (nonatomic, strong) ASTextNode *postTimeNode; -@end - -@interface PhotoWithInsetTextOverlay () -@property (nonatomic, strong) ASNetworkImageNode *photoNode; -@property (nonatomic, strong) ASTextNode *titleNode; -@end - -@interface PhotoWithOutsetIconOverlay () -@property (nonatomic, strong) ASNetworkImageNode *photoNode; -@property (nonatomic, strong) ASNetworkImageNode *iconNode; -@end - -@interface FlexibleSeparatorSurroundingContent () -@property (nonatomic, strong) ASImageNode *topSeparator; -@property (nonatomic, strong) ASImageNode *bottomSeparator; -@property (nonatomic, strong) ASTextNode *textNode; -@end - -@implementation HeaderWithRightAndLeftItems - -+ (NSString *)title -{ - return @"Header with left and right justified text"; -} - -+ (NSString *)descriptionTitle -{ - return @"try rotating me!"; -} - -- (instancetype)init -{ - self = [super init]; - - if (self) { - _usernameNode = [[ASTextNode alloc] init]; - _usernameNode.attributedText = [NSAttributedString attributedStringWithString:@"hannahmbanana" - fontSize:20 - color:[UIColor darkBlueColor]]; - _usernameNode.maximumNumberOfLines = 1; - _usernameNode.truncationMode = NSLineBreakByTruncatingTail; - - _postLocationNode = [[ASTextNode alloc] init]; - _postLocationNode.maximumNumberOfLines = 1; - _postLocationNode.attributedText = [NSAttributedString attributedStringWithString:@"Sunset Beach, San Fransisco, CA" - fontSize:20 - color:[UIColor lightBlueColor]]; - _postLocationNode.maximumNumberOfLines = 1; - _postLocationNode.truncationMode = NSLineBreakByTruncatingTail; - - _postTimeNode = [[ASTextNode alloc] init]; - _postTimeNode.attributedText = [NSAttributedString attributedStringWithString:@"30m" - fontSize:20 - color:[UIColor lightGrayColor]]; - _postLocationNode.maximumNumberOfLines = 1; - _postLocationNode.truncationMode = NSLineBreakByTruncatingTail; - } - - return self; -} - -- (ASLayoutSpec *)layoutSpecThatFits:(ASSizeRange)constrainedSize -{ - - ASStackLayoutSpec *nameLocationStack = [ASStackLayoutSpec verticalStackLayoutSpec]; - nameLocationStack.style.flexShrink = 1.0; - nameLocationStack.style.flexGrow = 1.0; - - if (_postLocationNode.attributedText) { - nameLocationStack.children = @[_usernameNode, _postLocationNode]; - } else { - nameLocationStack.children = @[_usernameNode]; - } - - ASStackLayoutSpec *headerStackSpec = [ASStackLayoutSpec stackLayoutSpecWithDirection:ASStackLayoutDirectionHorizontal - spacing:40 - justifyContent:ASStackLayoutJustifyContentStart - alignItems:ASStackLayoutAlignItemsCenter - children:@[nameLocationStack, _postTimeNode]]; - - return [ASInsetLayoutSpec insetLayoutSpecWithInsets:UIEdgeInsetsMake(0, 10, 0, 10) child:headerStackSpec]; -} - -@end - - -@implementation PhotoWithInsetTextOverlay - -+ (NSString *)title -{ - return @"Photo with inset text overlay"; -} - -+ (NSString *)descriptionTitle -{ - return @"try rotating me!"; -} - -- (instancetype)init -{ - self = [super init]; - - if (self) { - self.backgroundColor = [UIColor clearColor]; - - _photoNode = [[ASNetworkImageNode alloc] init]; - _photoNode.URL = [NSURL URLWithString:@"http://texturegroup.org/static/images/layout-examples-photo-with-inset-text-overlay-photo.png"]; - _photoNode.willDisplayNodeContentWithRenderingContext = ^(CGContextRef context, id drawParameters) { - CGRect bounds = CGContextGetClipBoundingBox(context); - [[UIBezierPath bezierPathWithRoundedRect:bounds cornerRadius:10] addClip]; - }; - - _titleNode = [[ASTextNode alloc] init]; - _titleNode.maximumNumberOfLines = 2; - _titleNode.truncationMode = NSLineBreakByTruncatingTail; - _titleNode.truncationAttributedText = [NSAttributedString attributedStringWithString:@"..." fontSize:16 color:[UIColor whiteColor]]; - _titleNode.attributedText = [NSAttributedString attributedStringWithString:@"family fall hikes" fontSize:16 color:[UIColor whiteColor]]; - } - - return self; -} - -- (ASLayoutSpec *)layoutSpecThatFits:(ASSizeRange)constrainedSize -{ - CGFloat photoDimension = constrainedSize.max.width / 4.0; - _photoNode.style.preferredSize = CGSizeMake(photoDimension, photoDimension); - - // INFINITY is used to make the inset unbounded - UIEdgeInsets insets = UIEdgeInsetsMake(INFINITY, 12, 12, 12); - ASInsetLayoutSpec *textInsetSpec = [ASInsetLayoutSpec insetLayoutSpecWithInsets:insets child:_titleNode]; - - return [ASOverlayLayoutSpec overlayLayoutSpecWithChild:_photoNode overlay:textInsetSpec];; -} - -@end - - -@implementation PhotoWithOutsetIconOverlay - -+ (NSString *)title -{ - return @"Photo with outset icon overlay"; -} - -- (instancetype)init -{ - self = [super init]; - - if (self) { - _photoNode = [[ASNetworkImageNode alloc] init]; - _photoNode.URL = [NSURL URLWithString:@"http://texturegroup.org/static/images/layout-examples-photo-with-outset-icon-overlay-photo.png"]; - - _iconNode = [[ASNetworkImageNode alloc] init]; - _iconNode.URL = [NSURL URLWithString:@"http://texturegroup.org/static/images/layout-examples-photo-with-outset-icon-overlay-icon.png"]; - - [_iconNode setImageModificationBlock:^UIImage *(UIImage *image) { // FIXME: in framework autocomplete for setImageModificationBlock line seems broken - CGSize profileImageSize = CGSizeMake(60, 60); - return [image makeCircularImageWithSize:profileImageSize withBorderWidth:10]; - }]; - } - - return self; -} - -- (ASLayoutSpec *)layoutSpecThatFits:(ASSizeRange)constrainedSize -{ - _iconNode.style.preferredSize = CGSizeMake(40, 40); - _iconNode.style.layoutPosition = CGPointMake(150, 0); - - _photoNode.style.preferredSize = CGSizeMake(150, 150); - _photoNode.style.layoutPosition = CGPointMake(40 / 2.0, 40 / 2.0); - - ASAbsoluteLayoutSpec *absoluteSpec = [ASAbsoluteLayoutSpec absoluteLayoutSpecWithChildren:@[_photoNode, _iconNode]]; - - // ASAbsoluteLayoutSpec's .sizing property recreates the behavior of ASDK Layout API 1.0's "ASStaticLayoutSpec" - absoluteSpec.sizing = ASAbsoluteLayoutSpecSizingSizeToFit; - - return absoluteSpec; -} - - - -@end - - -@implementation FlexibleSeparatorSurroundingContent - -+ (NSString *)title -{ - return @"Top and bottom cell separator lines"; -} - -+ (NSString *)descriptionTitle -{ - return @"try rotating me!"; -} - -- (instancetype)init -{ - self = [super init]; - - if (self) { - self.backgroundColor = [UIColor whiteColor]; - - _topSeparator = [[ASImageNode alloc] init]; - _topSeparator.image = [UIImage as_resizableRoundedImageWithCornerRadius:1.0 cornerColor:[UIColor blackColor] fillColor:[UIColor blackColor]]; - - _textNode = [[ASTextNode alloc] init]; - _textNode.attributedText = [NSAttributedString attributedStringWithString:@"this is a long text node" - fontSize:16 - color:[UIColor blackColor]]; - - _bottomSeparator = [[ASImageNode alloc] init]; - _bottomSeparator.image = [UIImage as_resizableRoundedImageWithCornerRadius:1.0 cornerColor:[UIColor blackColor] fillColor:[UIColor blackColor]]; - } - - return self; -} - -- (ASLayoutSpec *)layoutSpecThatFits:(ASSizeRange)constrainedSize -{ - _topSeparator.style.flexGrow = 1.0; - _bottomSeparator.style.flexGrow = 1.0; - _textNode.style.alignSelf = ASStackLayoutAlignSelfCenter; - - ASStackLayoutSpec *verticalStackSpec = [ASStackLayoutSpec verticalStackLayoutSpec]; - verticalStackSpec.spacing = 20; - verticalStackSpec.justifyContent = ASStackLayoutJustifyContentCenter; - verticalStackSpec.children = @[_topSeparator, _textNode, _bottomSeparator]; - - return [ASInsetLayoutSpec insetLayoutSpecWithInsets:UIEdgeInsetsMake(60, 0, 60, 0) child:verticalStackSpec]; -} - -@end - -@interface CornerLayoutExample () -@property (nonatomic, strong) ASImageNode *dotNode; -@property (nonatomic, strong) ASImageNode *photoNode1; -@property (nonatomic, strong) ASTextNode *badgeTextNode; -@property (nonatomic, strong) ASImageNode *badgeImageNode; -@property (nonatomic, strong) ASImageNode *photoNode2; -@end - -@implementation CornerLayoutExample - -static CGFloat const kSampleAvatarSize = 100; -static CGFloat const kSampleIconSize = 26; -static CGFloat const kSampleBadgeCornerRadius = 12; - -+ (NSString *)title -{ - return @"Declarative way for Corner image Layout"; -} - -+ (NSString *)descriptionTitle -{ - return nil; -} - -- (instancetype)init -{ - self = [super init]; - if (self) { - UIImage *avatarImage = [self avatarImageWithSize:CGSizeMake(kSampleAvatarSize, kSampleAvatarSize)]; - UIImage *cornerImage = [self cornerImageWithSize:CGSizeMake(kSampleIconSize, kSampleIconSize)]; - - NSAttributedString *numberText = [NSAttributedString attributedStringWithString:@" 999+ " fontSize:20 color:UIColor.whiteColor]; - - _dotNode = [ASImageNode new]; - _dotNode.image = cornerImage; - - _photoNode1 = [ASImageNode new]; - _photoNode1.image = avatarImage; - - _badgeTextNode = [ASTextNode new]; - _badgeTextNode.attributedText = numberText; - - _badgeImageNode = [ASImageNode new]; - _badgeImageNode.image = [UIImage as_resizableRoundedImageWithCornerRadius:kSampleBadgeCornerRadius - cornerColor:UIColor.clearColor - fillColor:UIColor.redColor]; - - _photoNode2 = [ASImageNode new]; - _photoNode2.image = avatarImage; - } - return self; -} - -- (ASLayoutSpec *)layoutSpecThatFits:(ASSizeRange)constrainedSize -{ - - ASBackgroundLayoutSpec *badgeSpec = [ASBackgroundLayoutSpec backgroundLayoutSpecWithChild:_badgeTextNode - background:_badgeImageNode]; - - ASCornerLayoutSpec *cornerSpec1 = [ASCornerLayoutSpec cornerLayoutSpecWithChild:_photoNode1 corner:_dotNode location:ASCornerLayoutLocationTopRight]; - cornerSpec1.offset = CGPointMake(-3, 3); - - ASCornerLayoutSpec *cornerSpec2 = [ASCornerLayoutSpec cornerLayoutSpecWithChild:_photoNode2 corner:badgeSpec location:ASCornerLayoutLocationTopRight]; - - self.photoNode.style.preferredSize = CGSizeMake(kSampleAvatarSize, kSampleAvatarSize); - self.iconNode.style.preferredSize = CGSizeMake(kSampleIconSize, kSampleIconSize); - - ASCornerLayoutSpec *cornerSpec3 = [ASCornerLayoutSpec cornerLayoutSpecWithChild:self.photoNode corner:self.iconNode location:ASCornerLayoutLocationTopRight]; - - ASStackLayoutSpec *stackSpec = [ASStackLayoutSpec verticalStackLayoutSpec]; - stackSpec.spacing = 40; - stackSpec.children = @[cornerSpec1, cornerSpec2, cornerSpec3]; - - return stackSpec; -} - -- (UIImage *)avatarImageWithSize:(CGSize)size -{ - return [UIImage imageWithSize:size fillColor:UIColor.lightGrayColor shapeBlock:^UIBezierPath *{ - CGRect rect = (CGRect){ CGPointZero, size }; - return [UIBezierPath bezierPathWithRoundedRect:rect cornerRadius:MIN(size.width, size.height) / 20]; - }]; -} - -- (UIImage *)cornerImageWithSize:(CGSize)size -{ - return [UIImage imageWithSize:size fillColor:UIColor.redColor shapeBlock:^UIBezierPath *{ - return [UIBezierPath bezierPathWithOvalInRect:(CGRect){ CGPointZero, size }]; - }]; -} - -@end - - -@interface UserProfileSample () -@property (nonatomic, strong) ASImageNode *badgeNode; -@property (nonatomic, strong) ASImageNode *avatarNode; -@property (nonatomic, strong) ASTextNode *usernameNode; -@property (nonatomic, strong) ASTextNode *subtitleNode; -@property (nonatomic, assign) CGFloat photoSizeValue; -@property (nonatomic, assign) CGFloat iconSizeValue; -@end - -@implementation UserProfileSample - -+ (NSString *)title -{ - return @"Common user profile layout."; -} - -+ (NSString *)descriptionTitle -{ - return @"For corner image layout and text truncation."; -} - -- (instancetype)init -{ - self = [super init]; - if (self) { - _photoSizeValue = 44; - _iconSizeValue = 15; - - CGSize iconSize = CGSizeMake(_iconSizeValue, _iconSizeValue); - CGSize photoSize = CGSizeMake(_photoSizeValue, _photoSizeValue); - - _badgeNode = [ASImageNode new]; - _badgeNode.style.preferredSize = iconSize; - _badgeNode.image = [UIImage imageWithSize:iconSize fillColor:UIColor.redColor shapeBlock:^UIBezierPath *{ - return [UIBezierPath bezierPathWithOvalInRect:(CGRect){ CGPointZero, iconSize }]; - }]; - - _avatarNode = [ASImageNode new]; - _avatarNode.style.preferredSize = photoSize; - _avatarNode.image = [UIImage imageWithSize:photoSize fillColor:UIColor.lightGrayColor shapeBlock:^UIBezierPath *{ - return [UIBezierPath bezierPathWithOvalInRect:(CGRect){ CGPointZero, photoSize }]; - }]; - - _usernameNode = [ASTextNode new]; - _usernameNode.attributedText = [NSAttributedString attributedStringWithString:@"Hello World" fontSize:17 color:UIColor.blackColor]; - _usernameNode.maximumNumberOfLines = 1; - - _subtitleNode = [ASTextNode new]; - _subtitleNode.attributedText = [NSAttributedString attributedStringWithString:@"This is a long long subtitle, with a long long appended string." fontSize:14 color:UIColor.lightGrayColor]; - _subtitleNode.maximumNumberOfLines = 1; - } - return self; -} - -- (ASLayoutSpec *)layoutSpecThatFits:(ASSizeRange)constrainedSize -{ - // Apply avatar with badge - // Normally, avatar's box size is the only photo size and it will not include the badge size. - // Otherwise, use includeCornerForSizeCalculation property to increase the box's size if needed. - ASCornerLayoutSpec *avatarBox = [ASCornerLayoutSpec new]; - avatarBox.child = _avatarNode; - avatarBox.corner = _badgeNode; - avatarBox.cornerLocation = ASCornerLayoutLocationBottomRight; - avatarBox.offset = CGPointMake(-6, -6); - - ASStackLayoutSpec *textBox = [ASStackLayoutSpec verticalStackLayoutSpec]; - textBox.justifyContent = ASStackLayoutJustifyContentSpaceAround; - textBox.children = @[_usernameNode, _subtitleNode]; - - ASStackLayoutSpec *profileBox = [ASStackLayoutSpec horizontalStackLayoutSpec]; - profileBox.spacing = 10; - profileBox.children = @[avatarBox, textBox]; - - // Apply text truncation. - NSArray *elems = @[_usernameNode, _subtitleNode, textBox, profileBox]; - for (id elem in elems) { - elem.style.flexShrink = 1; - } - - ASInsetLayoutSpec *profileInsetBox = [ASInsetLayoutSpec new]; - profileInsetBox.insets = UIEdgeInsetsMake(120, 20, INFINITY, 20); - profileInsetBox.child = profileBox; - - return profileInsetBox; -} - -@end - -@implementation LayoutExampleNode - -+ (NSString *)title -{ - NSAssert(NO, @"All layout example nodes must provide a title!"); - return nil; -} - -+ (NSString *)descriptionTitle -{ - return nil; -} - -- (instancetype)init -{ - self = [super init]; - if (self) { - self.automaticallyManagesSubnodes = YES; - self.backgroundColor = [UIColor whiteColor]; - } - return self; -} - -@end - diff --git a/submodules/AsyncDisplayKit/examples/LayoutSpecExamples/Sample/LayoutExampleViewController.h b/submodules/AsyncDisplayKit/examples/LayoutSpecExamples/Sample/LayoutExampleViewController.h deleted file mode 100644 index d087bcc77f..0000000000 --- a/submodules/AsyncDisplayKit/examples/LayoutSpecExamples/Sample/LayoutExampleViewController.h +++ /dev/null @@ -1,15 +0,0 @@ -// -// LayoutExampleViewController.h -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -@interface LayoutExampleViewController : ASViewController -- (instancetype)initWithLayoutExampleClass:(Class)layoutExampleClass NS_DESIGNATED_INITIALIZER; -- (instancetype)initWithNode:(ASDisplayNode *)node NS_UNAVAILABLE; -@end diff --git a/submodules/AsyncDisplayKit/examples/LayoutSpecExamples/Sample/LayoutExampleViewController.m b/submodules/AsyncDisplayKit/examples/LayoutSpecExamples/Sample/LayoutExampleViewController.m deleted file mode 100644 index 71607a6f87..0000000000 --- a/submodules/AsyncDisplayKit/examples/LayoutSpecExamples/Sample/LayoutExampleViewController.m +++ /dev/null @@ -1,47 +0,0 @@ -// -// LayoutExampleViewController.m -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import "LayoutExampleViewController.h" -#import "LayoutExampleNodes.h" - -@interface LayoutExampleViewController () -@property (nonatomic, strong) LayoutExampleNode *customNode; -@end - -@implementation LayoutExampleViewController - -- (instancetype)initWithLayoutExampleClass:(Class)layoutExampleClass -{ - NSAssert([layoutExampleClass isSubclassOfClass:[LayoutExampleNode class]], @"Must pass a subclass of LayoutExampleNode."); - - self = [super initWithNode:[ASDisplayNode new]]; - - if (self) { - self.title = @"Layout Example"; - - _customNode = [layoutExampleClass new]; - [self.node addSubnode:_customNode]; - - BOOL needsOnlyYCentering = [layoutExampleClass isEqual:[HeaderWithRightAndLeftItems class]] || - [layoutExampleClass isEqual:[FlexibleSeparatorSurroundingContent class]]; - - self.node.backgroundColor = needsOnlyYCentering ? [UIColor lightGrayColor] : [UIColor whiteColor]; - - __weak __typeof(self) weakself = self; - self.node.layoutSpecBlock = ^ASLayoutSpec*(__kindof ASDisplayNode * _Nonnull node, ASSizeRange constrainedSize) { - return [ASCenterLayoutSpec centerLayoutSpecWithCenteringOptions:needsOnlyYCentering ? ASCenterLayoutSpecCenteringY : ASCenterLayoutSpecCenteringXY - sizingOptions:ASCenterLayoutSpecSizingOptionMinimumXY - child:weakself.customNode]; - }; - } - - return self; -} - -@end diff --git a/submodules/AsyncDisplayKit/examples/LayoutSpecExamples/Sample/OverviewCellNode.h b/submodules/AsyncDisplayKit/examples/LayoutSpecExamples/Sample/OverviewCellNode.h deleted file mode 100644 index 7a98c031cd..0000000000 --- a/submodules/AsyncDisplayKit/examples/LayoutSpecExamples/Sample/OverviewCellNode.h +++ /dev/null @@ -1,19 +0,0 @@ -// -// OverviewCellNode.h -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -@interface OverviewCellNode : ASCellNode - -@property (nonatomic, strong) Class layoutExampleClass; - -- (instancetype)initWithLayoutExampleClass:(Class)layoutExampleClass NS_DESIGNATED_INITIALIZER; -- (instancetype)init NS_UNAVAILABLE; - -@end diff --git a/submodules/AsyncDisplayKit/examples/LayoutSpecExamples/Sample/OverviewCellNode.m b/submodules/AsyncDisplayKit/examples/LayoutSpecExamples/Sample/OverviewCellNode.m deleted file mode 100644 index 6cd4eb845f..0000000000 --- a/submodules/AsyncDisplayKit/examples/LayoutSpecExamples/Sample/OverviewCellNode.m +++ /dev/null @@ -1,52 +0,0 @@ -// -// OverviewCellNode.m -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import "OverviewCellNode.h" -#import "LayoutExampleNodes.h" -#import "Utilities.h" - -@interface OverviewCellNode () -@property (nonatomic, strong) ASTextNode *titleNode; -@property (nonatomic, strong) ASTextNode *descriptionNode; -@end - -@implementation OverviewCellNode - -- (instancetype)initWithLayoutExampleClass:(Class)layoutExampleClass -{ - self = [super init]; - if (self) { - self.automaticallyManagesSubnodes = YES; - - _layoutExampleClass = layoutExampleClass; - - _titleNode = [[ASTextNode alloc] init]; - _titleNode.attributedText = [NSAttributedString attributedStringWithString:[layoutExampleClass title] - fontSize:16 - color:[UIColor blackColor]]; - - _descriptionNode = [[ASTextNode alloc] init]; - _descriptionNode.attributedText = [NSAttributedString attributedStringWithString:[layoutExampleClass descriptionTitle] - fontSize:12 - color:[UIColor lightGrayColor]]; - } - return self; -} - -- (ASLayoutSpec *)layoutSpecThatFits:(ASSizeRange)constrainedSize -{ - ASStackLayoutSpec *verticalStackSpec = [ASStackLayoutSpec verticalStackLayoutSpec]; - verticalStackSpec.alignItems = ASStackLayoutAlignItemsStart; - verticalStackSpec.spacing = 5.0; - verticalStackSpec.children = @[self.titleNode, self.descriptionNode]; - - return [ASInsetLayoutSpec insetLayoutSpecWithInsets:UIEdgeInsetsMake(10, 16, 10, 10) child:verticalStackSpec]; -} - -@end diff --git a/submodules/AsyncDisplayKit/examples/LayoutSpecExamples/Sample/OverviewViewController.h b/submodules/AsyncDisplayKit/examples/LayoutSpecExamples/Sample/OverviewViewController.h deleted file mode 100644 index 83381429a3..0000000000 --- a/submodules/AsyncDisplayKit/examples/LayoutSpecExamples/Sample/OverviewViewController.h +++ /dev/null @@ -1,15 +0,0 @@ -// -// OverviewViewController.h -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - - -@interface OverviewViewController : ASViewController - -@end diff --git a/submodules/AsyncDisplayKit/examples/LayoutSpecExamples/Sample/OverviewViewController.m b/submodules/AsyncDisplayKit/examples/LayoutSpecExamples/Sample/OverviewViewController.m deleted file mode 100644 index 9d9700f5e2..0000000000 --- a/submodules/AsyncDisplayKit/examples/LayoutSpecExamples/Sample/OverviewViewController.m +++ /dev/null @@ -1,77 +0,0 @@ -// -// OverviewViewController.m -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import "OverviewViewController.h" -#import "LayoutExampleNodes.h" -#import "LayoutExampleViewController.h" -#import "OverviewCellNode.h" - -@interface OverviewViewController () -@property (nonatomic, strong) NSArray *layoutExamples; -@property (nonatomic, strong) ASTableNode *tableNode; -@end - -@implementation OverviewViewController - -#pragma mark - Lifecycle Methods - -- (instancetype)init -{ - _tableNode = [ASTableNode new]; - self = [super initWithNode:_tableNode]; - - if (self) { - self.title = @"Layout Examples"; - self.navigationItem.backBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:@"" style:UIBarButtonItemStylePlain target:nil action:nil]; - - _tableNode.delegate = self; - _tableNode.dataSource = self; - - _layoutExamples = @[[HeaderWithRightAndLeftItems class], - [PhotoWithInsetTextOverlay class], - [PhotoWithOutsetIconOverlay class], - [FlexibleSeparatorSurroundingContent class], - [CornerLayoutExample class], - [UserProfileSample class] - ]; - } - - return self; -} - -- (void)viewWillAppear:(BOOL)animated -{ - [super viewWillAppear:animated]; - - NSIndexPath *indexPath = _tableNode.indexPathForSelectedRow; - if (indexPath != nil) { - [_tableNode deselectRowAtIndexPath:indexPath animated:YES]; - } -} - -#pragma mark - ASTableDelegate, ASTableDataSource - -- (NSInteger)tableNode:(ASTableNode *)tableNode numberOfRowsInSection:(NSInteger)section -{ - return [_layoutExamples count]; -} - -- (ASCellNode *)tableNode:(ASTableNode *)tableNode nodeForRowAtIndexPath:(NSIndexPath *)indexPath -{ - return [[OverviewCellNode alloc] initWithLayoutExampleClass:_layoutExamples[indexPath.row]]; -} - -- (void)tableNode:(ASTableNode *)tableNode didSelectRowAtIndexPath:(NSIndexPath *)indexPath -{ - Class layoutExampleClass = [[tableNode nodeForRowAtIndexPath:indexPath] layoutExampleClass]; - LayoutExampleViewController *detail = [[LayoutExampleViewController alloc] initWithLayoutExampleClass:layoutExampleClass]; - [self.navigationController pushViewController:detail animated:YES]; -} - -@end diff --git a/submodules/AsyncDisplayKit/examples/LayoutSpecExamples/Sample/Utilities.h b/submodules/AsyncDisplayKit/examples/LayoutSpecExamples/Sample/Utilities.h deleted file mode 100644 index 5719a4ab85..0000000000 --- a/submodules/AsyncDisplayKit/examples/LayoutSpecExamples/Sample/Utilities.h +++ /dev/null @@ -1,25 +0,0 @@ -// -// Utilities.h -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import -#import - -@interface UIColor (Additions) -+ (UIColor *)darkBlueColor; -+ (UIColor *)lightBlueColor; -@end - -@interface UIImage (Additions) -- (UIImage *)makeCircularImageWithSize:(CGSize)size withBorderWidth:(CGFloat)width; -+ (UIImage *)imageWithSize:(CGSize)size fillColor:(UIColor *)fillColor shapeBlock:(UIBezierPath *(^)(void))shapeBlock; -@end - -@interface NSAttributedString (Additions) -+ (NSAttributedString *)attributedStringWithString:(NSString *)string fontSize:(CGFloat)size color:(UIColor *)color; -@end diff --git a/submodules/AsyncDisplayKit/examples/LayoutSpecExamples/Sample/Utilities.m b/submodules/AsyncDisplayKit/examples/LayoutSpecExamples/Sample/Utilities.m deleted file mode 100644 index d999ddd32d..0000000000 --- a/submodules/AsyncDisplayKit/examples/LayoutSpecExamples/Sample/Utilities.m +++ /dev/null @@ -1,99 +0,0 @@ -// -// Utilities.m -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import "Utilities.h" - -#define StrokeRoundedImages 0 - -@implementation UIColor (Additions) - -+ (UIColor *)darkBlueColor -{ - return [UIColor colorWithRed:18.0/255.0 green:86.0/255.0 blue:136.0/255.0 alpha:1.0]; -} - -+ (UIColor *)lightBlueColor -{ - return [UIColor colorWithRed:0.0 green:122.0/255.0 blue:1.0 alpha:1.0]; -} - -@end - -@implementation UIImage (Additions) - -- (UIImage *)makeCircularImageWithSize:(CGSize)size withBorderWidth:(CGFloat)width -{ - // make a CGRect with the image's size - CGRect circleRect = (CGRect) {CGPointZero, size}; - - // begin the image context since we're not in a drawRect: - UIGraphicsBeginImageContextWithOptions(circleRect.size, NO, 0); - - // create a UIBezierPath circle - UIBezierPath *circle = [UIBezierPath bezierPathWithRoundedRect:circleRect cornerRadius:circleRect.size.width/2]; - - // clip to the circle - [circle addClip]; - - [[UIColor whiteColor] set]; - [circle fill]; - - // draw the image in the circleRect *AFTER* the context is clipped - [self drawInRect:circleRect]; - - // create a border (for white background pictures) - if (width > 0) { - circle.lineWidth = width; - [[UIColor whiteColor] set]; - [circle stroke]; - } - - // get an image from the image context - UIImage *roundedImage = UIGraphicsGetImageFromCurrentImageContext(); - - // end the image context since we're not in a drawRect: - UIGraphicsEndImageContext(); - - return roundedImage; -} - -+ (UIImage *)imageWithSize:(CGSize)size fillColor:(UIColor *)fillColor shapeBlock:(UIBezierPath *(^)(void))shapeBlock -{ - UIGraphicsBeginImageContext(size); - [fillColor setFill]; - - UIBezierPath *path = shapeBlock(); - [path addClip]; - [path fill]; - - UIImage *image = UIGraphicsGetImageFromCurrentImageContext(); - UIGraphicsEndImageContext(); - - return image; -} - -@end - -@implementation NSAttributedString (Additions) - -+ (NSAttributedString *)attributedStringWithString:(NSString *)string fontSize:(CGFloat)size color:(nullable UIColor *)color -{ - if (string == nil) { - return nil; - } - - NSDictionary *attributes = @{NSForegroundColorAttributeName: color ? : [UIColor blackColor], - NSFontAttributeName: [UIFont boldSystemFontOfSize:size]}; - NSMutableAttributedString *attributedString = [[NSMutableAttributedString alloc] initWithString:string]; - [attributedString addAttributes:attributes range:NSMakeRange(0, string.length)]; - - return attributedString; -} - -@end diff --git a/submodules/AsyncDisplayKit/examples/LayoutSpecExamples/Sample/main.m b/submodules/AsyncDisplayKit/examples/LayoutSpecExamples/Sample/main.m deleted file mode 100644 index 0e5da05001..0000000000 --- a/submodules/AsyncDisplayKit/examples/LayoutSpecExamples/Sample/main.m +++ /dev/null @@ -1,17 +0,0 @@ -// -// main.m -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import -#import "AppDelegate.h" - -int main(int argc, char * argv[]) { - @autoreleasepool { - return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); - } -} diff --git a/submodules/AsyncDisplayKit/examples/PagerNode/Default-568h@2x.png b/submodules/AsyncDisplayKit/examples/PagerNode/Default-568h@2x.png deleted file mode 100644 index 6ee80b9393..0000000000 Binary files a/submodules/AsyncDisplayKit/examples/PagerNode/Default-568h@2x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/examples/PagerNode/Default-667h@2x.png b/submodules/AsyncDisplayKit/examples/PagerNode/Default-667h@2x.png deleted file mode 100644 index e7b975e21b..0000000000 Binary files a/submodules/AsyncDisplayKit/examples/PagerNode/Default-667h@2x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/examples/PagerNode/Default-736h@3x.png b/submodules/AsyncDisplayKit/examples/PagerNode/Default-736h@3x.png deleted file mode 100644 index c8949cae16..0000000000 Binary files a/submodules/AsyncDisplayKit/examples/PagerNode/Default-736h@3x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/examples/PagerNode/Podfile b/submodules/AsyncDisplayKit/examples/PagerNode/Podfile deleted file mode 100644 index 71a7f2c4b2..0000000000 --- a/submodules/AsyncDisplayKit/examples/PagerNode/Podfile +++ /dev/null @@ -1,5 +0,0 @@ -source 'https://github.com/CocoaPods/Specs.git' -platform :ios, '9.0' -target 'Sample' do - pod 'Texture', :path => '../..' -end diff --git a/submodules/AsyncDisplayKit/examples/PagerNode/Sample/AppDelegate.h b/submodules/AsyncDisplayKit/examples/PagerNode/Sample/AppDelegate.h deleted file mode 100644 index 19db03c153..0000000000 --- a/submodules/AsyncDisplayKit/examples/PagerNode/Sample/AppDelegate.h +++ /dev/null @@ -1,16 +0,0 @@ -// -// AppDelegate.h -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -@interface AppDelegate : UIResponder - -@property (strong, nonatomic) UIWindow *window; - -@end diff --git a/submodules/AsyncDisplayKit/examples/PagerNode/Sample/AppDelegate.m b/submodules/AsyncDisplayKit/examples/PagerNode/Sample/AppDelegate.m deleted file mode 100644 index f8437855b0..0000000000 --- a/submodules/AsyncDisplayKit/examples/PagerNode/Sample/AppDelegate.m +++ /dev/null @@ -1,25 +0,0 @@ -// -// AppDelegate.m -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import "AppDelegate.h" - -#import "ViewController.h" - -@implementation AppDelegate - -- (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 diff --git a/submodules/AsyncDisplayKit/examples/PagerNode/Sample/Info.plist b/submodules/AsyncDisplayKit/examples/PagerNode/Sample/Info.plist deleted file mode 100644 index fb4115c84c..0000000000 --- a/submodules/AsyncDisplayKit/examples/PagerNode/Sample/Info.plist +++ /dev/null @@ -1,36 +0,0 @@ - - - - - CFBundleDevelopmentRegion - en - CFBundleExecutable - $(EXECUTABLE_NAME) - CFBundleIdentifier - $(PRODUCT_BUNDLE_IDENTIFIER) - CFBundleInfoDictionaryVersion - 6.0 - CFBundleName - $(PRODUCT_NAME) - CFBundlePackageType - APPL - CFBundleShortVersionString - 1.0 - CFBundleSignature - ???? - CFBundleVersion - 1 - LSRequiresIPhoneOS - - UIRequiredDeviceCapabilities - - armv7 - - UISupportedInterfaceOrientations - - UIInterfaceOrientationPortrait - UIInterfaceOrientationLandscapeLeft - UIInterfaceOrientationLandscapeRight - - - diff --git a/submodules/AsyncDisplayKit/examples/PagerNode/Sample/PageNode.h b/submodules/AsyncDisplayKit/examples/PagerNode/Sample/PageNode.h deleted file mode 100644 index f4346289c5..0000000000 --- a/submodules/AsyncDisplayKit/examples/PagerNode/Sample/PageNode.h +++ /dev/null @@ -1,14 +0,0 @@ -// -// PageNode.h -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -@interface PageNode : ASCellNode - -@end diff --git a/submodules/AsyncDisplayKit/examples/PagerNode/Sample/PageNode.m b/submodules/AsyncDisplayKit/examples/PagerNode/Sample/PageNode.m deleted file mode 100644 index bedd46f0c0..0000000000 --- a/submodules/AsyncDisplayKit/examples/PagerNode/Sample/PageNode.m +++ /dev/null @@ -1,25 +0,0 @@ -// -// PageNode.m -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import "PageNode.h" - -@implementation PageNode - -- (CGSize)calculateSizeThatFits:(CGSize)constrainedSize -{ - return constrainedSize; -} - -- (void)didEnterPreloadState -{ - [super didEnterPreloadState]; - NSLog(@"didEnterPreloadState for node: %@", self); -} - -@end diff --git a/submodules/AsyncDisplayKit/examples/PagerNode/Sample/ViewController.h b/submodules/AsyncDisplayKit/examples/PagerNode/Sample/ViewController.h deleted file mode 100644 index 3af731c848..0000000000 --- a/submodules/AsyncDisplayKit/examples/PagerNode/Sample/ViewController.h +++ /dev/null @@ -1,14 +0,0 @@ -// -// ViewController.h -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -@interface ViewController : ASViewController - -@end diff --git a/submodules/AsyncDisplayKit/examples/PagerNode/Sample/ViewController.m b/submodules/AsyncDisplayKit/examples/PagerNode/Sample/ViewController.m deleted file mode 100644 index b55fa343f9..0000000000 --- a/submodules/AsyncDisplayKit/examples/PagerNode/Sample/ViewController.m +++ /dev/null @@ -1,73 +0,0 @@ -// -// ViewController.m -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import "ViewController.h" - -#import - -#import "PageNode.h" - -static UIColor *randomColor() { - 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]; -} - -@interface ViewController () - -@end - -@implementation ViewController - -- (instancetype)init -{ - self = [super initWithNode:[[ASPagerNode alloc] init]]; - if (self == nil) { - return self; - } - - self.title = @"Pages"; - self.node.dataSource = self; - - self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:@"Next" style:UIBarButtonItemStylePlain target:self action:@selector(scrollToNextPage:)]; - self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:@"Previous" style:UIBarButtonItemStylePlain target:self action:@selector(scrollToPreviousPage:)]; - self.automaticallyAdjustsScrollViewInsets = NO; - return self; -} - -#pragma mark - Actions - -- (void)scrollToNextPage:(id)sender -{ - [self.node scrollToPageAtIndex:self.node.currentPageIndex+1 animated:YES]; -} - -- (void)scrollToPreviousPage:(id)sender -{ - [self.node scrollToPageAtIndex:self.node.currentPageIndex-1 animated:YES]; -} - -#pragma mark - ASPagerNodeDataSource - -- (NSInteger)numberOfPagesInPagerNode:(ASPagerNode *)pagerNode -{ - return 5; -} - -- (ASCellNodeBlock)pagerNode:(ASPagerNode *)pagerNode nodeBlockAtIndex:(NSInteger)index -{ - return ^{ - PageNode *page = [[PageNode alloc] init]; - page.backgroundColor = randomColor(); - return page; - }; -} - -@end diff --git a/submodules/AsyncDisplayKit/examples/PagerNode/Sample/main.m b/submodules/AsyncDisplayKit/examples/PagerNode/Sample/main.m deleted file mode 100644 index 511cd1a7ac..0000000000 --- a/submodules/AsyncDisplayKit/examples/PagerNode/Sample/main.m +++ /dev/null @@ -1,18 +0,0 @@ -// -// main.m -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -#import "AppDelegate.h" - -int main(int argc, char * argv[]) { - @autoreleasepool { - return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); - } -} diff --git a/submodules/AsyncDisplayKit/examples/README.md b/submodules/AsyncDisplayKit/examples/README.md deleted file mode 100644 index 76c71a75d0..0000000000 --- a/submodules/AsyncDisplayKit/examples/README.md +++ /dev/null @@ -1,232 +0,0 @@ -# Sample projects - -## Building - -Run `pod install` in each sample project directory to set up their -dependencies. - -## Example Catalog - -### ASCollectionView [ObjC] - -![ASCollectionView Example App Screenshot](https://github.com/AsyncDisplayKit/Documentation/raw/master/docs/static/images/example-app-screenshots/ASCollectionView.png) - -Featuring: -- ASCollectionView with header/footer supplementary node support -- ASCollectionView batch API -- ASDelegateProxy - -### ASDKgram [ObjC] - -![ASDKgram Example App Screenshot](https://github.com/AsyncDisplayKit/Documentation/raw/master/docs/static/images/example-app-screenshots/ASDKgram.png) - -### ASDKLayoutTransition [ObjC] - -![ASDKLayoutTransition Example App](https://github.com/AsyncDisplayKit/Documentation/raw/master/docs/static/images/example-app-screenshots/ASDKLayoutTransition.gif) - -### ASDKTube [ObjC] - -![ASDKTube Example App](https://github.com/AsyncDisplayKit/Documentation/raw/master/docs/static/images/example-app-screenshots/ASDKTube.gif) - -### ASMapNode [ObjC] - -![ASMapNode Example App Screenshot](https://github.com/AsyncDisplayKit/Documentation/raw/master/docs/static/images/example-app-screenshots/ASMapNode.png) - -### ASTableViewStressTest [ObjC] - -![ASTableViewStressTest Example App Screenshot](https://github.com/AsyncDisplayKit/Documentation/raw/master/docs/static/images/example-app-screenshots/ASTableViewStressTest.png) - -### ASViewController [ObjC] - -![ASViewController Example App Screenshot](https://github.com/AsyncDisplayKit/Documentation/raw/master/docs/static/images/example-app-screenshots/ASViewController.png) - -Featuring: -- ASViewController -- ASTableView -- ASMultiplexImageNode -- ASLayoutSpec - -### AsyncDisplayKitOverview [ObjC] - -![AsyncDisplayKitOverview Example App Screenshot](https://github.com/AsyncDisplayKit/Documentation/raw/master/docs/static/images/example-app-screenshots/AsyncDisplayKitOverview.png) - -### BackgroundPropertySetting [Swift] - -![BackgroundPropertySetting Example App gif](https://github.com/AsyncDisplayKit/Documentation/raw/master/docs/static/images/example-app-screenshots/BackgroundPropertySetting.gif) - -Featuring: -- ASDK Swift compatibility -- ASViewController -- ASCollectionView -- thread affinity -- ASLayoutSpec - -### CarthageBuildTest -### CatDealsCollectionView [ObjC] - -![CatDealsCollectionView Example App Screenshot](https://github.com/AsyncDisplayKit/Documentation/raw/master/docs/static/images/example-app-screenshots/CatDealsCollectionView.png) - -Featuring: -- ASCollectionView -- ASRangeTuningParameters -- Placeholder Images -- ASLayoutSpec - -### CollectionViewWithViewControllerCells [ObjC] - -![CollectionViewWithViewControllerCells Example App Screenshot](https://github.com/AsyncDisplayKit/Documentation/raw/master/docs/static/images/example-app-screenshots/CollectionViewWithViewControllerCells.png) - -Featuring: -- custom collection view layout -- ASLayoutSpec -- ASMultiplexImageNode - -### CustomCollectionView [ObjC+Swift] - -![CustomCollectionView Example App gif](https://github.com/AsyncDisplayKit/Documentation/raw/master/docs/static/images/example-app-screenshots/CustomCollectionView.git) - -Featuring: -- custom collection view layout -- ASCollectionView with sections - -### EditableText [ObjC] - -![EditableText Example App Screenshot](https://github.com/AsyncDisplayKit/Documentation/raw/master/docs/static/images/example-app-screenshots/EditableText.png) - -Featuring: -- ASEditableTextNode - -### HorizontalwithinVerticalScrolling [ObjC] - -![HorizontalwithinVerticalScrolling Example App gif](https://github.com/AsyncDisplayKit/Documentation/raw/master/docs/static/images/example-app-screenshots/HorizontalwithinVerticalScrolling.gif) - -Featuring: -- UIViewController with ASTableView -- ASCollectionView -- ASCellNode - -### Kittens [ObjC] - -![Kittens Example App Screenshot](https://github.com/AsyncDisplayKit/Documentation/raw/master/docs/static/images/example-app-screenshots/Kittens.png) - -Featuring: -- UIViewController with ASTableView -- ASCellNodes with ASNetworkImageNode and ASTextNode - -### LayoutSpecPlayground [ObjC] - -![LayoutSpecPlayground Example App Screenshot](https://github.com/AsyncDisplayKit/Documentation/raw/master/docs/static/images/example-app-screenshots/LayoutSpecPlayground.png) - -### Multiplex [ObjC] - -![Multiplex Example App](https://github.com/AsyncDisplayKit/Documentation/raw/master/docs/static/images/example-app-screenshots/Multiplex.gif) - -Featuring: -- ASMultiplexImageNode (with artificial delay inserted) -- ASLayoutSpec - -### PagerNode [ObjC] - -![PagerNode Example App](https://github.com/AsyncDisplayKit/Documentation/raw/master/docs/static/images/example-app-screenshots/PagerNode.gif) - -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](https://github.com/AsyncDisplayKit/Documentation/raw/master/docs/static/images/example-app-screenshots/SocialAppLayout.png) - -Featuring: -- ASLayoutSpec -- UIViewController with ASTableView - -### Swift [Swift] - -![Swift Example App Screenshot](https://github.com/AsyncDisplayKit/Documentation/raw/master/docs/static/images/example-app-screenshots/Swift.png) - -Featuring: -- ASViewController with ASTableNode - -### SynchronousConcurrency [ObjC] - -![SynchronousConcurrency Example App Screenshot](https://github.com/AsyncDisplayKit/Documentation/raw/master/docs/static/images/example-app-screenshots/SynchronousConcurrency.png) - -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](https://github.com/AsyncDisplayKit/Documentation/raw/master/docs/static/images/example-app-screenshots/VerticalWithinHorizontalScrolling.gif) - -Features: -- UIViewController containing ASPagerNode containing ASTableNodes - -### Videos [ObjC] - -![VideoTableView Example App gif](https://github.com/AsyncDisplayKit/Documentation/raw/master/docs/static/images/example-app-screenshots/Videos.gif) - -Featuring: -- ASVideoNode - -### VideoTableView [ObjC] - -![VideoTableView Example App Screenshot](https://github.com/AsyncDisplayKit/Documentation/raw/master/docs/static/images/example-app-screenshots/VideoTableView.png) - -Featuring: -- ASVideoNode -- ASTableView -- ASCellNode - -### LayoutSpecExamples [ObjC] - -![Layout Spec Example App Screenshot](https://github.com/AsyncDisplayKit/Documentation/raw/master/docs/static/images/example-app-screenshots/ASCornerLayoutSpec.png) - -Featuring: -- ASStackLayoutSpec -- ASInsetLayoutSpec -- ASOverlayLayoutSpec -- ASAbsoluteLayoutSpec -- ASBackgroundLayoutSpec -- ASCornerLayoutSpec - -There is an associated swift version app: LayoutSpecExamples-Swift with same logic implementation. - -## License - - This file provided by Facebook is for non-commercial testing and evaluation - purposes only. Facebook reserves all rights not expressly granted. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN - ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - - diff --git a/submodules/AsyncDisplayKit/examples/SocialAppLayout-Inverted/Podfile b/submodules/AsyncDisplayKit/examples/SocialAppLayout-Inverted/Podfile deleted file mode 100644 index 71a7f2c4b2..0000000000 --- a/submodules/AsyncDisplayKit/examples/SocialAppLayout-Inverted/Podfile +++ /dev/null @@ -1,5 +0,0 @@ -source 'https://github.com/CocoaPods/Specs.git' -platform :ios, '9.0' -target 'Sample' do - pod 'Texture', :path => '../..' -end diff --git a/submodules/AsyncDisplayKit/examples/SocialAppLayout-Inverted/Sample/AppDelegate.h b/submodules/AsyncDisplayKit/examples/SocialAppLayout-Inverted/Sample/AppDelegate.h deleted file mode 100644 index 19db03c153..0000000000 --- a/submodules/AsyncDisplayKit/examples/SocialAppLayout-Inverted/Sample/AppDelegate.h +++ /dev/null @@ -1,16 +0,0 @@ -// -// AppDelegate.h -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -@interface AppDelegate : UIResponder - -@property (strong, nonatomic) UIWindow *window; - -@end diff --git a/submodules/AsyncDisplayKit/examples/SocialAppLayout-Inverted/Sample/AppDelegate.m b/submodules/AsyncDisplayKit/examples/SocialAppLayout-Inverted/Sample/AppDelegate.m deleted file mode 100644 index 73663a6919..0000000000 --- a/submodules/AsyncDisplayKit/examples/SocialAppLayout-Inverted/Sample/AppDelegate.m +++ /dev/null @@ -1,24 +0,0 @@ -// -// AppDelegate.m -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import "AppDelegate.h" -#import "ViewController.h" - -@implementation AppDelegate - -- (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 diff --git a/submodules/AsyncDisplayKit/examples/SocialAppLayout-Inverted/Sample/Assets.xcassets/AppIcon.appiconset/Contents.json b/submodules/AsyncDisplayKit/examples/SocialAppLayout-Inverted/Sample/Assets.xcassets/AppIcon.appiconset/Contents.json deleted file mode 100644 index 118c98f746..0000000000 --- a/submodules/AsyncDisplayKit/examples/SocialAppLayout-Inverted/Sample/Assets.xcassets/AppIcon.appiconset/Contents.json +++ /dev/null @@ -1,38 +0,0 @@ -{ - "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" - } -} \ No newline at end of file diff --git a/submodules/AsyncDisplayKit/examples/SocialAppLayout-Inverted/Sample/CommentsNode.h b/submodules/AsyncDisplayKit/examples/SocialAppLayout-Inverted/Sample/CommentsNode.h deleted file mode 100644 index 422460fe9e..0000000000 --- a/submodules/AsyncDisplayKit/examples/SocialAppLayout-Inverted/Sample/CommentsNode.h +++ /dev/null @@ -1,16 +0,0 @@ -// -// CommentsNode.h -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -@interface CommentsNode : ASControlNode - -- (instancetype)initWithCommentsCount:(NSInteger)comentsCount; - -@end diff --git a/submodules/AsyncDisplayKit/examples/SocialAppLayout-Inverted/Sample/CommentsNode.m b/submodules/AsyncDisplayKit/examples/SocialAppLayout-Inverted/Sample/CommentsNode.m deleted file mode 100644 index 96ba688881..0000000000 --- a/submodules/AsyncDisplayKit/examples/SocialAppLayout-Inverted/Sample/CommentsNode.m +++ /dev/null @@ -1,62 +0,0 @@ -// -// CommentsNode.m -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import "CommentsNode.h" -#import "TextStyles.h" - -@interface CommentsNode () -@property (nonatomic, strong) ASImageNode *iconNode; -@property (nonatomic, strong) ASTextNode *countNode; -@property (nonatomic, assign) NSInteger commentsCount; -@end - -@implementation CommentsNode - -- (instancetype)initWithCommentsCount:(NSInteger)comentsCount -{ - self = [super init]; - if (self) { - _commentsCount = comentsCount; - - _iconNode = [[ASImageNode alloc] init]; - _iconNode.image = [UIImage imageNamed:@"icon_comment.png"]; - [self addSubnode:_iconNode]; - - _countNode = [[ASTextNode alloc] init]; - if (_commentsCount > 0) { - _countNode.attributedText = [[NSAttributedString alloc] initWithString:[NSString stringWithFormat:@"%zd", _commentsCount] attributes:[TextStyles cellControlStyle]]; - } - [self addSubnode:_countNode]; - - // make it tappable easily - self.hitTestSlop = UIEdgeInsetsMake(-10, -10, -10, -10); - } - - return self; - -} - -- (ASLayoutSpec *)layoutSpecThatFits:(ASSizeRange)constrainedSize -{ - ASStackLayoutSpec *mainStack = - [ASStackLayoutSpec - stackLayoutSpecWithDirection:ASStackLayoutDirectionHorizontal - spacing:6.0 - justifyContent:ASStackLayoutJustifyContentStart - alignItems:ASStackLayoutAlignItemsCenter - children:@[_iconNode, _countNode]]; - - // Adjust size - mainStack.style.minWidth = ASDimensionMakeWithPoints(60.0); - mainStack.style.maxHeight = ASDimensionMakeWithPoints(40.0); - - return mainStack; -} - -@end diff --git a/submodules/AsyncDisplayKit/examples/SocialAppLayout-Inverted/Sample/Default-568h@2x.png b/submodules/AsyncDisplayKit/examples/SocialAppLayout-Inverted/Sample/Default-568h@2x.png deleted file mode 100644 index 6ee80b9393..0000000000 Binary files a/submodules/AsyncDisplayKit/examples/SocialAppLayout-Inverted/Sample/Default-568h@2x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/examples/SocialAppLayout-Inverted/Sample/Default-667h@2x.png b/submodules/AsyncDisplayKit/examples/SocialAppLayout-Inverted/Sample/Default-667h@2x.png deleted file mode 100644 index e7b975e21b..0000000000 Binary files a/submodules/AsyncDisplayKit/examples/SocialAppLayout-Inverted/Sample/Default-667h@2x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/examples/SocialAppLayout-Inverted/Sample/Default-736h@3x.png b/submodules/AsyncDisplayKit/examples/SocialAppLayout-Inverted/Sample/Default-736h@3x.png deleted file mode 100644 index c8949cae16..0000000000 Binary files a/submodules/AsyncDisplayKit/examples/SocialAppLayout-Inverted/Sample/Default-736h@3x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/examples/SocialAppLayout-Inverted/Sample/Info.plist b/submodules/AsyncDisplayKit/examples/SocialAppLayout-Inverted/Sample/Info.plist deleted file mode 100644 index ed1c9acf9b..0000000000 --- a/submodules/AsyncDisplayKit/examples/SocialAppLayout-Inverted/Sample/Info.plist +++ /dev/null @@ -1,41 +0,0 @@ - - - - - CFBundleDevelopmentRegion - en - CFBundleExecutable - $(EXECUTABLE_NAME) - CFBundleIdentifier - $(PRODUCT_BUNDLE_IDENTIFIER) - CFBundleInfoDictionaryVersion - 6.0 - CFBundleName - $(PRODUCT_NAME) - CFBundlePackageType - APPL - CFBundleShortVersionString - 1.0 - CFBundleSignature - ???? - CFBundleVersion - 1 - LSRequiresIPhoneOS - - NSAppTransportSecurity - - NSAllowsArbitraryLoads - - - UIRequiredDeviceCapabilities - - armv7 - - UISupportedInterfaceOrientations - - UIInterfaceOrientationPortrait - UIInterfaceOrientationLandscapeLeft - UIInterfaceOrientationLandscapeRight - - - diff --git a/submodules/AsyncDisplayKit/examples/SocialAppLayout-Inverted/Sample/LikesNode.h b/submodules/AsyncDisplayKit/examples/SocialAppLayout-Inverted/Sample/LikesNode.h deleted file mode 100644 index 1dbbc191e1..0000000000 --- a/submodules/AsyncDisplayKit/examples/SocialAppLayout-Inverted/Sample/LikesNode.h +++ /dev/null @@ -1,16 +0,0 @@ -// -// LikesNode.h -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -@interface LikesNode : ASControlNode - -- (instancetype)initWithLikesCount:(NSInteger)likesCount; - -@end diff --git a/submodules/AsyncDisplayKit/examples/SocialAppLayout-Inverted/Sample/LikesNode.m b/submodules/AsyncDisplayKit/examples/SocialAppLayout-Inverted/Sample/LikesNode.m deleted file mode 100644 index cd5ade1db4..0000000000 --- a/submodules/AsyncDisplayKit/examples/SocialAppLayout-Inverted/Sample/LikesNode.m +++ /dev/null @@ -1,75 +0,0 @@ -// -// LikesNode.m -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import "LikesNode.h" -#import "TextStyles.h" - -@interface LikesNode () -@property (nonatomic, strong) ASImageNode *iconNode; -@property (nonatomic, strong) ASTextNode *countNode; -@property (nonatomic, assign) NSInteger likesCount; -@property (nonatomic, assign) BOOL liked; -@end - -@implementation LikesNode - -- (instancetype)initWithLikesCount:(NSInteger)likesCount -{ - self = [super init]; - if (self) { - _likesCount = likesCount; - _liked = (_likesCount > 0) ? [LikesNode getYesOrNo] : NO; - - _iconNode = [[ASImageNode alloc] init]; - _iconNode.image = (_liked) ? [UIImage imageNamed:@"icon_liked.png"] : [UIImage imageNamed:@"icon_like.png"]; - [self addSubnode:_iconNode]; - - _countNode = [[ASTextNode alloc] init]; - if (_likesCount > 0) { - - NSDictionary *attributes = _liked ? [TextStyles cellControlColoredStyle] : [TextStyles cellControlStyle]; - _countNode.attributedText = [[NSAttributedString alloc] initWithString:[NSString stringWithFormat:@"%ld", (long)_likesCount] attributes:attributes]; - - } - [self addSubnode:_countNode]; - - // make it tappable easily - self.hitTestSlop = UIEdgeInsetsMake(-10, -10, -10, -10); - } - - return self; - -} - -+ (BOOL)getYesOrNo -{ - int tmp = (arc4random() % 30)+1; - if (tmp % 5 == 0) { - return YES; - } - return NO; -} - -- (ASLayoutSpec *)layoutSpecThatFits:(ASSizeRange)constrainedSize -{ - ASStackLayoutSpec *mainStack = - [ASStackLayoutSpec - stackLayoutSpecWithDirection:ASStackLayoutDirectionHorizontal - spacing:6.0 - justifyContent:ASStackLayoutJustifyContentStart - alignItems:ASStackLayoutAlignItemsCenter - children:@[_iconNode, _countNode]]; - - mainStack.style.minWidth = ASDimensionMakeWithPoints(60.0); - mainStack.style.maxHeight = ASDimensionMakeWithPoints(40.0); - - return mainStack; -} - -@end diff --git a/submodules/AsyncDisplayKit/examples/SocialAppLayout-Inverted/Sample/Post.h b/submodules/AsyncDisplayKit/examples/SocialAppLayout-Inverted/Sample/Post.h deleted file mode 100644 index c8259237b8..0000000000 --- a/submodules/AsyncDisplayKit/examples/SocialAppLayout-Inverted/Sample/Post.h +++ /dev/null @@ -1,25 +0,0 @@ -// -// Post.h -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -@interface Post : NSObject - -@property (nonatomic, copy) NSString *username; -@property (nonatomic, copy) NSString *name; -@property (nonatomic, copy) NSString *photo; -@property (nonatomic, copy) NSString *post; -@property (nonatomic, copy) NSString *time; -@property (nonatomic, copy) NSString *media; -@property (nonatomic, assign) NSInteger via; - -@property (nonatomic, assign) NSInteger likes; -@property (nonatomic, assign) NSInteger comments; - -@end diff --git a/submodules/AsyncDisplayKit/examples/SocialAppLayout-Inverted/Sample/Post.m b/submodules/AsyncDisplayKit/examples/SocialAppLayout-Inverted/Sample/Post.m deleted file mode 100644 index fc61c5bf82..0000000000 --- a/submodules/AsyncDisplayKit/examples/SocialAppLayout-Inverted/Sample/Post.m +++ /dev/null @@ -1,13 +0,0 @@ -// -// Post.m -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import "Post.h" - -@implementation Post -@end diff --git a/submodules/AsyncDisplayKit/examples/SocialAppLayout-Inverted/Sample/PostNode.h b/submodules/AsyncDisplayKit/examples/SocialAppLayout-Inverted/Sample/PostNode.h deleted file mode 100644 index b558158e31..0000000000 --- a/submodules/AsyncDisplayKit/examples/SocialAppLayout-Inverted/Sample/PostNode.h +++ /dev/null @@ -1,18 +0,0 @@ -// -// PostNode.h -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -@class Post; - -@interface PostNode : ASCellNode - -- (instancetype)initWithPost:(Post *)post; - -@end diff --git a/submodules/AsyncDisplayKit/examples/SocialAppLayout-Inverted/Sample/PostNode.m b/submodules/AsyncDisplayKit/examples/SocialAppLayout-Inverted/Sample/PostNode.m deleted file mode 100644 index defafc0061..0000000000 --- a/submodules/AsyncDisplayKit/examples/SocialAppLayout-Inverted/Sample/PostNode.m +++ /dev/null @@ -1,337 +0,0 @@ -// -// PostNode.m -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import "PostNode.h" -#import "Post.h" -#import "TextStyles.h" -#import "LikesNode.h" -#import "CommentsNode.h" - -#define PostNodeDividerColor [UIColor lightGrayColor] - -@interface PostNode() - -@property (strong, nonatomic) Post *post; -@property (strong, nonatomic) ASDisplayNode *divider; -@property (strong, nonatomic) ASTextNode *nameNode; -@property (strong, nonatomic) ASTextNode *usernameNode; -@property (strong, nonatomic) ASTextNode *timeNode; -@property (strong, nonatomic) ASTextNode *postNode; -@property (strong, nonatomic) ASImageNode *viaNode; -@property (strong, nonatomic) ASNetworkImageNode *avatarNode; -@property (strong, nonatomic) ASNetworkImageNode *mediaNode; -@property (strong, nonatomic) LikesNode *likesNode; -@property (strong, nonatomic) CommentsNode *commentsNode; -@property (strong, nonatomic) ASImageNode *optionsNode; - -@end - -@implementation PostNode - -#pragma mark - Lifecycle - -- (instancetype)initWithPost:(Post *)post -{ - self = [super init]; - if (self) { - _post = post; - - self.selectionStyle = UITableViewCellSelectionStyleNone; - - // Name node - _nameNode = [[ASTextNode alloc] init]; - _nameNode.attributedText = [[NSAttributedString alloc] initWithString:_post.name attributes:[TextStyles nameStyle]]; - _nameNode.maximumNumberOfLines = 1; - [self addSubnode:_nameNode]; - - // Username node - _usernameNode = [[ASTextNode alloc] init]; - _usernameNode.attributedText = [[NSAttributedString alloc] initWithString:_post.username attributes:[TextStyles usernameStyle]]; - _usernameNode.style.flexShrink = 1.0; //if name and username don't fit to cell width, allow username shrink - _usernameNode.truncationMode = NSLineBreakByTruncatingTail; - _usernameNode.maximumNumberOfLines = 1; - [self addSubnode:_usernameNode]; - - // Time node - _timeNode = [[ASTextNode alloc] init]; - _timeNode.attributedText = [[NSAttributedString alloc] initWithString:_post.time attributes:[TextStyles timeStyle]]; - [self addSubnode:_timeNode]; - - // Post node - _postNode = [[ASTextNode alloc] init]; - - // Processing URLs in post - NSString *kLinkAttributeName = @"TextLinkAttributeName"; - - if (![_post.post isEqualToString:@""]) { - - NSMutableAttributedString *attrString = [[NSMutableAttributedString alloc] initWithString:_post.post attributes:[TextStyles postStyle]]; - - NSDataDetector *urlDetector = [NSDataDetector dataDetectorWithTypes:NSTextCheckingTypeLink error:nil]; - - [urlDetector enumerateMatchesInString:attrString.string options:kNilOptions range:NSMakeRange(0, attrString.string.length) usingBlock:^(NSTextCheckingResult *result, NSMatchingFlags flags, BOOL *stop){ - - if (result.resultType == NSTextCheckingTypeLink) { - - NSMutableDictionary *linkAttributes = [[NSMutableDictionary alloc] initWithDictionary:[TextStyles postLinkStyle]]; - linkAttributes[kLinkAttributeName] = [NSURL URLWithString:result.URL.absoluteString]; - - [attrString addAttributes:linkAttributes range:result.range]; - - } - - }]; - - // Configure node to support tappable links - _postNode.delegate = self; - _postNode.userInteractionEnabled = YES; - _postNode.linkAttributeNames = @[ kLinkAttributeName ]; - _postNode.attributedText = attrString; - _postNode.passthroughNonlinkTouches = YES; // passes touches through when they aren't on a link - - } - - [self addSubnode:_postNode]; - - - // Media - if (![_post.media isEqualToString:@""]) { - - _mediaNode = [[ASNetworkImageNode alloc] init]; - _mediaNode.backgroundColor = ASDisplayNodeDefaultPlaceholderColor(); - _mediaNode.cornerRadius = 4.0; - _mediaNode.URL = [NSURL URLWithString:_post.media]; - _mediaNode.delegate = self; - _mediaNode.imageModificationBlock = ^UIImage *(UIImage *image) { - - UIImage *modifiedImage; - CGRect rect = CGRectMake(0, 0, image.size.width, image.size.height); - - UIGraphicsBeginImageContextWithOptions(image.size, false, [[UIScreen mainScreen] scale]); - - [[UIBezierPath bezierPathWithRoundedRect:rect cornerRadius:8.0] addClip]; - [image drawInRect:rect]; - modifiedImage = UIGraphicsGetImageFromCurrentImageContext(); - - UIGraphicsEndImageContext(); - - return modifiedImage; - - }; - [self addSubnode:_mediaNode]; - } - - // User pic - _avatarNode = [[ASNetworkImageNode alloc] init]; - _avatarNode.backgroundColor = ASDisplayNodeDefaultPlaceholderColor(); - _avatarNode.style.width = ASDimensionMakeWithPoints(44); - _avatarNode.style.height = ASDimensionMakeWithPoints(44); - _avatarNode.cornerRadius = 22.0; - _avatarNode.URL = [NSURL URLWithString:_post.photo]; - _avatarNode.imageModificationBlock = ^UIImage *(UIImage *image) { - - UIImage *modifiedImage; - CGRect rect = CGRectMake(0, 0, image.size.width, image.size.height); - - UIGraphicsBeginImageContextWithOptions(image.size, false, [[UIScreen mainScreen] scale]); - - [[UIBezierPath bezierPathWithRoundedRect:rect cornerRadius:44.0] addClip]; - [image drawInRect:rect]; - modifiedImage = UIGraphicsGetImageFromCurrentImageContext(); - - UIGraphicsEndImageContext(); - - return modifiedImage; - - }; - [self addSubnode:_avatarNode]; - - // Hairline cell separator - _divider = [[ASDisplayNode alloc] init]; - [self updateDividerColor]; - [self addSubnode:_divider]; - - // Via - if (_post.via != 0) { - _viaNode = [[ASImageNode alloc] init]; - _viaNode.image = (_post.via == 1) ? [UIImage imageNamed:@"icon_ios.png"] : [UIImage imageNamed:@"icon_android.png"]; - [self addSubnode:_viaNode]; - } - - // Bottom controls - _likesNode = [[LikesNode alloc] initWithLikesCount:_post.likes]; - [self addSubnode:_likesNode]; - - _commentsNode = [[CommentsNode alloc] initWithCommentsCount:_post.comments]; - [self addSubnode:_commentsNode]; - - _optionsNode = [[ASImageNode alloc] init]; - _optionsNode.image = [UIImage imageNamed:@"icon_more"]; - [self addSubnode:_optionsNode]; - - for (ASDisplayNode *node in self.subnodes) { - // ASTextNode with embedded links doesn't support layer backing - if (node.supportsLayerBacking) { - node.layerBacked = YES; - } - } - } - return self; -} - -- (void)updateDividerColor -{ - /* - * UITableViewCell traverses through all its descendant views and adjusts their background color accordingly - * either to [UIColor clearColor], although potentially it could use the same color as the selection highlight itself. - * After selection, the same trick is performed again in reverse, putting all the backgrounds back as they used to be. - * But in our case, we don't want to have the background color disappearing so we reset it after highlighting or - * selection is done. - */ - _divider.backgroundColor = PostNodeDividerColor; -} - -#pragma mark - ASDisplayNode - -- (void)didLoad -{ - // enable highlighting now that self.layer has loaded -- see ASHighlightOverlayLayer.h - self.layer.as_allowsHighlightDrawing = YES; - - [super didLoad]; -} - -- (ASLayoutSpec *)layoutSpecThatFits:(ASSizeRange)constrainedSize -{ - // Flexible spacer between username and time - ASLayoutSpec *spacer = [[ASLayoutSpec alloc] init]; - spacer.style.flexGrow = 1.0; - - // Horizontal stack for name, username, via icon and time - NSMutableArray *layoutSpecChildren = [@[_nameNode, _usernameNode, spacer] mutableCopy]; - if (_post.via != 0) { - [layoutSpecChildren addObject:_viaNode]; - } - [layoutSpecChildren addObject:_timeNode]; - - ASStackLayoutSpec *nameStack = - [ASStackLayoutSpec - stackLayoutSpecWithDirection:ASStackLayoutDirectionHorizontal - spacing:5.0 - justifyContent:ASStackLayoutJustifyContentStart - alignItems:ASStackLayoutAlignItemsCenter - children:layoutSpecChildren]; - nameStack.style.alignSelf = ASStackLayoutAlignSelfStretch; - - // bottom controls horizontal stack - ASStackLayoutSpec *controlsStack = - [ASStackLayoutSpec - stackLayoutSpecWithDirection:ASStackLayoutDirectionHorizontal - spacing:10 - justifyContent:ASStackLayoutJustifyContentStart - alignItems:ASStackLayoutAlignItemsCenter - children:@[_likesNode, _commentsNode, _optionsNode]]; - - // Add more gaps for control line - controlsStack.style.spacingAfter = 3.0; - controlsStack.style.spacingBefore = 3.0; - - NSMutableArray *mainStackContent = [[NSMutableArray alloc] init]; - [mainStackContent addObject:nameStack]; - [mainStackContent addObject:_postNode]; - - - if (![_post.media isEqualToString:@""]){ - - // Only add the media node if an image is present - if (_mediaNode.image != nil) { - ASRatioLayoutSpec *imagePlace = - [ASRatioLayoutSpec - ratioLayoutSpecWithRatio:0.5 - child:_mediaNode]; - imagePlace.style.spacingAfter = 3.0; - imagePlace.style.spacingBefore = 3.0; - - [mainStackContent addObject:imagePlace]; - } - } - [mainStackContent addObject:controlsStack]; - - // Vertical spec of cell main content - ASStackLayoutSpec *contentSpec = - [ASStackLayoutSpec - stackLayoutSpecWithDirection:ASStackLayoutDirectionVertical - spacing:8.0 - justifyContent:ASStackLayoutJustifyContentStart - alignItems:ASStackLayoutAlignItemsStretch - children:mainStackContent]; - contentSpec.style.flexShrink = 1.0; - - // Horizontal spec for avatar - ASStackLayoutSpec *avatarContentSpec = - [ASStackLayoutSpec - stackLayoutSpecWithDirection:ASStackLayoutDirectionHorizontal - spacing:8.0 - justifyContent:ASStackLayoutJustifyContentStart - alignItems:ASStackLayoutAlignItemsStart - children:@[_avatarNode, contentSpec]]; - - return [ASInsetLayoutSpec - insetLayoutSpecWithInsets:UIEdgeInsetsMake(10, 10, 10, 10) - child:avatarContentSpec]; - -} - -- (void)layout -{ - [super layout]; - - // Manually layout the divider. - CGFloat pixelHeight = 1.0f / [[UIScreen mainScreen] scale]; - _divider.frame = CGRectMake(0.0f, 0.0f, self.calculatedSize.width, pixelHeight); -} - -#pragma mark - ASCellNode - -- (void)setHighlighted:(BOOL)highlighted -{ - [super setHighlighted:highlighted]; - - [self updateDividerColor]; -} - -- (void)setSelected:(BOOL)selected -{ - [super setSelected:selected]; - - [self updateDividerColor]; -} - -#pragma mark - - -- (BOOL)textNode:(ASTextNode *)richTextNode shouldHighlightLinkAttribute:(NSString *)attribute value:(id)value atPoint:(CGPoint)point -{ - // Opt into link highlighting -- tap and hold the link to try it! must enable highlighting on a layer, see -didLoad - return YES; -} - -- (void)textNode:(ASTextNode *)richTextNode tappedLinkAttribute:(NSString *)attribute value:(NSURL *)URL atPoint:(CGPoint)point textRange:(NSRange)textRange -{ - // The node tapped a link, open it - [[UIApplication sharedApplication] openURL:URL]; -} - -#pragma mark - ASNetworkImageNodeDelegate methods. - -- (void)imageNode:(ASNetworkImageNode *)imageNode didLoadImage:(UIImage *)image -{ - [self setNeedsLayout]; -} - -@end diff --git a/submodules/AsyncDisplayKit/examples/SocialAppLayout-Inverted/Sample/TextStyles.h b/submodules/AsyncDisplayKit/examples/SocialAppLayout-Inverted/Sample/TextStyles.h deleted file mode 100644 index 2a975bdea3..0000000000 --- a/submodules/AsyncDisplayKit/examples/SocialAppLayout-Inverted/Sample/TextStyles.h +++ /dev/null @@ -1,23 +0,0 @@ -// -// TextStyles.h -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import -#import - -@interface TextStyles : NSObject - -+ (NSDictionary *)nameStyle; -+ (NSDictionary *)usernameStyle; -+ (NSDictionary *)timeStyle; -+ (NSDictionary *)postStyle; -+ (NSDictionary *)postLinkStyle; -+ (NSDictionary *)cellControlStyle; -+ (NSDictionary *)cellControlColoredStyle; - -@end diff --git a/submodules/AsyncDisplayKit/examples/SocialAppLayout-Inverted/Sample/TextStyles.m b/submodules/AsyncDisplayKit/examples/SocialAppLayout-Inverted/Sample/TextStyles.m deleted file mode 100644 index ad7798c445..0000000000 --- a/submodules/AsyncDisplayKit/examples/SocialAppLayout-Inverted/Sample/TextStyles.m +++ /dev/null @@ -1,71 +0,0 @@ -// -// TextStyles.m -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import "TextStyles.h" - -@implementation TextStyles - -+ (NSDictionary *)nameStyle -{ - return @{ - NSFontAttributeName : [UIFont boldSystemFontOfSize:15.0], - NSForegroundColorAttributeName: [UIColor blackColor] - }; -} - -+ (NSDictionary *)usernameStyle -{ - return @{ - NSFontAttributeName : [UIFont systemFontOfSize:13.0], - NSForegroundColorAttributeName: [UIColor lightGrayColor] - }; -} - -+ (NSDictionary *)timeStyle -{ - return @{ - NSFontAttributeName : [UIFont systemFontOfSize:13.0], - NSForegroundColorAttributeName: [UIColor grayColor] - }; -} - -+ (NSDictionary *)postStyle -{ - return @{ - NSFontAttributeName : [UIFont systemFontOfSize:15.0], - NSForegroundColorAttributeName: [UIColor blackColor] - }; -} - -+ (NSDictionary *)postLinkStyle -{ - return @{ - NSFontAttributeName : [UIFont systemFontOfSize:15.0], - NSForegroundColorAttributeName: [UIColor colorWithRed:59.0/255.0 green:89.0/255.0 blue:152.0/255.0 alpha:1.0], - NSUnderlineStyleAttributeName: @(NSUnderlineStyleSingle) - }; -} - -+ (NSDictionary *)cellControlStyle -{ - return @{ - NSFontAttributeName : [UIFont systemFontOfSize:13.0], - NSForegroundColorAttributeName: [UIColor lightGrayColor] - }; -} - -+ (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] - }; -} - -@end diff --git a/submodules/AsyncDisplayKit/examples/SocialAppLayout-Inverted/Sample/ViewController.h b/submodules/AsyncDisplayKit/examples/SocialAppLayout-Inverted/Sample/ViewController.h deleted file mode 100644 index 6416242247..0000000000 --- a/submodules/AsyncDisplayKit/examples/SocialAppLayout-Inverted/Sample/ViewController.h +++ /dev/null @@ -1,13 +0,0 @@ -// -// ViewController.h -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -@interface ViewController : ASViewController -@end diff --git a/submodules/AsyncDisplayKit/examples/SocialAppLayout-Inverted/Sample/ViewController.m b/submodules/AsyncDisplayKit/examples/SocialAppLayout-Inverted/Sample/ViewController.m deleted file mode 100644 index efc9d06e4a..0000000000 --- a/submodules/AsyncDisplayKit/examples/SocialAppLayout-Inverted/Sample/ViewController.m +++ /dev/null @@ -1,144 +0,0 @@ -// -// ViewController.m -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import "ViewController.h" -#import "Post.h" -#import "PostNode.h" - -#import -#import - -#include - -@interface ViewController () - -@property (nonatomic, strong) ASTableNode *tableNode; -@property (nonatomic, strong) NSMutableArray *socialAppDataSource; - -@end - -#pragma mark - Lifecycle - -@implementation ViewController - -- (instancetype)init -{ - _tableNode = [[ASTableNode alloc] initWithStyle:UITableViewStylePlain]; - _tableNode.inverted = YES; - self = [super initWithNode:_tableNode]; - - - if (self) { - - _tableNode.delegate = self; - _tableNode.dataSource = self; - self.title = @"Timeline"; - - [self createSocialAppDataSource]; - } - - return self; -} - -- (void)viewWillAppear:(BOOL)animated -{ - [super viewWillAppear:animated]; - CGFloat inset = [self topBarsHeight]; - self.tableNode.view.contentInset = UIEdgeInsetsMake(-inset, 0, inset, 0); - self.tableNode.view.scrollIndicatorInsets = UIEdgeInsetsMake(-inset, 0, inset, 0); -} - -- (void)viewDidLoad -{ - [super viewDidLoad]; - // SocialAppNode has its own separator - self.tableNode.view.separatorStyle = UITableViewCellSeparatorStyleNone; -} - -- (CGFloat)topBarsHeight -{ - // No need to adjust if the edge isn't available - if ((self.edgesForExtendedLayout & UIRectEdgeTop) == 0) { - return 0.0; - } - return CGRectGetHeight(self.navigationController.navigationBar.frame) + CGRectGetHeight([UIApplication sharedApplication].statusBarFrame); -} - - -#pragma mark - Data Model - -- (void)createSocialAppDataSource -{ - _socialAppDataSource = [[NSMutableArray alloc] init]; - - Post *newPost = [[Post alloc] init]; - newPost.name = @"Apple Guy"; - newPost.username = @"@appleguy"; - newPost.photo = @"https://avatars1.githubusercontent.com/u/565251?v=3&s=96"; - newPost.post = @"Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat."; - newPost.time = @"3s"; - newPost.media = @""; - newPost.via = 0; - newPost.likes = arc4random_uniform(74); - newPost.comments = arc4random_uniform(40); - [_socialAppDataSource addObject:newPost]; - - newPost = [[Post alloc] init]; - newPost.name = @"Huy Nguyen"; - newPost.username = @"@nguyenhuy"; - newPost.photo = @"https://avatars2.githubusercontent.com/u/587874?v=3&s=96"; - newPost.post = @"Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua."; - newPost.time = @"1m"; - newPost.media = @""; - newPost.via = 1; - newPost.likes = arc4random_uniform(74); - newPost.comments = arc4random_uniform(40); - [_socialAppDataSource addObject:newPost]; - - newPost = [[Post alloc] init]; - newPost.name = @"Alex Long Name"; - newPost.username = @"@veryyyylongusername"; - newPost.photo = @"https://avatars1.githubusercontent.com/u/8086633?v=3&s=96"; - newPost.post = @"Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua."; - newPost.time = @"3:02"; - newPost.media = @"http://www.ngmag.ru/upload/iblock/f93/f9390efc34151456598077c1ba44a94d.jpg"; - newPost.via = 2; - newPost.likes = arc4random_uniform(74); - newPost.comments = arc4random_uniform(40); - [_socialAppDataSource addObject:newPost]; - - newPost = [[Post alloc] init]; - newPost.name = @"Vitaly Baev"; - newPost.username = @"@vitalybaev"; - newPost.photo = @"https://avatars0.githubusercontent.com/u/724423?v=3&s=96"; - newPost.post = @"Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. https://github.com/facebook/AsyncDisplayKit Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua."; - newPost.time = @"yesterday"; - newPost.media = @""; - newPost.via = 1; - newPost.likes = arc4random_uniform(74); - newPost.comments = arc4random_uniform(40); - [_socialAppDataSource addObject:newPost]; -} - -#pragma mark - ASTableNode - -- (ASCellNodeBlock)tableNode:(ASTableNode *)tableNode nodeBlockForRowAtIndexPath:(NSIndexPath *)indexPath -{ - Post *post = self.socialAppDataSource[indexPath.row]; - return ^{ - return [[PostNode alloc] initWithPost:post]; - }; -} - -- (NSInteger)tableNode:(ASTableNode *)tableNode numberOfRowsInSection:(NSInteger)section -{ - return self.socialAppDataSource.count; -} - -@end diff --git a/submodules/AsyncDisplayKit/examples/SocialAppLayout-Inverted/Sample/icon_android.png b/submodules/AsyncDisplayKit/examples/SocialAppLayout-Inverted/Sample/icon_android.png deleted file mode 100644 index 6d30985339..0000000000 Binary files a/submodules/AsyncDisplayKit/examples/SocialAppLayout-Inverted/Sample/icon_android.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/examples/SocialAppLayout-Inverted/Sample/icon_android@2x.png b/submodules/AsyncDisplayKit/examples/SocialAppLayout-Inverted/Sample/icon_android@2x.png deleted file mode 100644 index c0dd2f5977..0000000000 Binary files a/submodules/AsyncDisplayKit/examples/SocialAppLayout-Inverted/Sample/icon_android@2x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/examples/SocialAppLayout-Inverted/Sample/icon_android@3x.png b/submodules/AsyncDisplayKit/examples/SocialAppLayout-Inverted/Sample/icon_android@3x.png deleted file mode 100644 index d3e83e9334..0000000000 Binary files a/submodules/AsyncDisplayKit/examples/SocialAppLayout-Inverted/Sample/icon_android@3x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/examples/SocialAppLayout-Inverted/Sample/icon_comment.png b/submodules/AsyncDisplayKit/examples/SocialAppLayout-Inverted/Sample/icon_comment.png deleted file mode 100644 index 59ccfe43c1..0000000000 Binary files a/submodules/AsyncDisplayKit/examples/SocialAppLayout-Inverted/Sample/icon_comment.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/examples/SocialAppLayout-Inverted/Sample/icon_comment@2x.png b/submodules/AsyncDisplayKit/examples/SocialAppLayout-Inverted/Sample/icon_comment@2x.png deleted file mode 100644 index bedd0593c0..0000000000 Binary files a/submodules/AsyncDisplayKit/examples/SocialAppLayout-Inverted/Sample/icon_comment@2x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/examples/SocialAppLayout-Inverted/Sample/icon_comment@3x.png b/submodules/AsyncDisplayKit/examples/SocialAppLayout-Inverted/Sample/icon_comment@3x.png deleted file mode 100644 index eb8a0d7660..0000000000 Binary files a/submodules/AsyncDisplayKit/examples/SocialAppLayout-Inverted/Sample/icon_comment@3x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/examples/SocialAppLayout-Inverted/Sample/icon_ios.png b/submodules/AsyncDisplayKit/examples/SocialAppLayout-Inverted/Sample/icon_ios.png deleted file mode 100644 index 0cd417d446..0000000000 Binary files a/submodules/AsyncDisplayKit/examples/SocialAppLayout-Inverted/Sample/icon_ios.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/examples/SocialAppLayout-Inverted/Sample/icon_ios@2x.png b/submodules/AsyncDisplayKit/examples/SocialAppLayout-Inverted/Sample/icon_ios@2x.png deleted file mode 100644 index f73561fd09..0000000000 Binary files a/submodules/AsyncDisplayKit/examples/SocialAppLayout-Inverted/Sample/icon_ios@2x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/examples/SocialAppLayout-Inverted/Sample/icon_ios@3x.png b/submodules/AsyncDisplayKit/examples/SocialAppLayout-Inverted/Sample/icon_ios@3x.png deleted file mode 100644 index 35d2bb2b37..0000000000 Binary files a/submodules/AsyncDisplayKit/examples/SocialAppLayout-Inverted/Sample/icon_ios@3x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/examples/SocialAppLayout-Inverted/Sample/icon_like.png b/submodules/AsyncDisplayKit/examples/SocialAppLayout-Inverted/Sample/icon_like.png deleted file mode 100644 index 43110b9d59..0000000000 Binary files a/submodules/AsyncDisplayKit/examples/SocialAppLayout-Inverted/Sample/icon_like.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/examples/SocialAppLayout-Inverted/Sample/icon_like@2x.png b/submodules/AsyncDisplayKit/examples/SocialAppLayout-Inverted/Sample/icon_like@2x.png deleted file mode 100644 index 1b535d748b..0000000000 Binary files a/submodules/AsyncDisplayKit/examples/SocialAppLayout-Inverted/Sample/icon_like@2x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/examples/SocialAppLayout-Inverted/Sample/icon_like@3x.png b/submodules/AsyncDisplayKit/examples/SocialAppLayout-Inverted/Sample/icon_like@3x.png deleted file mode 100644 index 8c80507335..0000000000 Binary files a/submodules/AsyncDisplayKit/examples/SocialAppLayout-Inverted/Sample/icon_like@3x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/examples/SocialAppLayout-Inverted/Sample/icon_liked.png b/submodules/AsyncDisplayKit/examples/SocialAppLayout-Inverted/Sample/icon_liked.png deleted file mode 100644 index b1c1ade901..0000000000 Binary files a/submodules/AsyncDisplayKit/examples/SocialAppLayout-Inverted/Sample/icon_liked.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/examples/SocialAppLayout-Inverted/Sample/icon_liked@2x.png b/submodules/AsyncDisplayKit/examples/SocialAppLayout-Inverted/Sample/icon_liked@2x.png deleted file mode 100644 index d9dc5988ea..0000000000 Binary files a/submodules/AsyncDisplayKit/examples/SocialAppLayout-Inverted/Sample/icon_liked@2x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/examples/SocialAppLayout-Inverted/Sample/icon_liked@3x.png b/submodules/AsyncDisplayKit/examples/SocialAppLayout-Inverted/Sample/icon_liked@3x.png deleted file mode 100644 index 00578ac63e..0000000000 Binary files a/submodules/AsyncDisplayKit/examples/SocialAppLayout-Inverted/Sample/icon_liked@3x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/examples/SocialAppLayout-Inverted/Sample/icon_more.png b/submodules/AsyncDisplayKit/examples/SocialAppLayout-Inverted/Sample/icon_more.png deleted file mode 100644 index 013126d291..0000000000 Binary files a/submodules/AsyncDisplayKit/examples/SocialAppLayout-Inverted/Sample/icon_more.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/examples/SocialAppLayout-Inverted/Sample/icon_more@2x.png b/submodules/AsyncDisplayKit/examples/SocialAppLayout-Inverted/Sample/icon_more@2x.png deleted file mode 100644 index 3d183df436..0000000000 Binary files a/submodules/AsyncDisplayKit/examples/SocialAppLayout-Inverted/Sample/icon_more@2x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/examples/SocialAppLayout-Inverted/Sample/icon_more@3x.png b/submodules/AsyncDisplayKit/examples/SocialAppLayout-Inverted/Sample/icon_more@3x.png deleted file mode 100644 index d5f829ab11..0000000000 Binary files a/submodules/AsyncDisplayKit/examples/SocialAppLayout-Inverted/Sample/icon_more@3x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/examples/SocialAppLayout-Inverted/Sample/main.m b/submodules/AsyncDisplayKit/examples/SocialAppLayout-Inverted/Sample/main.m deleted file mode 100644 index 0e5da05001..0000000000 --- a/submodules/AsyncDisplayKit/examples/SocialAppLayout-Inverted/Sample/main.m +++ /dev/null @@ -1,17 +0,0 @@ -// -// main.m -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import -#import "AppDelegate.h" - -int main(int argc, char * argv[]) { - @autoreleasepool { - return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); - } -} diff --git a/submodules/AsyncDisplayKit/examples/SocialAppLayout/Podfile b/submodules/AsyncDisplayKit/examples/SocialAppLayout/Podfile deleted file mode 100644 index 71a7f2c4b2..0000000000 --- a/submodules/AsyncDisplayKit/examples/SocialAppLayout/Podfile +++ /dev/null @@ -1,5 +0,0 @@ -source 'https://github.com/CocoaPods/Specs.git' -platform :ios, '9.0' -target 'Sample' do - pod 'Texture', :path => '../..' -end diff --git a/submodules/AsyncDisplayKit/examples/SocialAppLayout/Sample/AppDelegate.h b/submodules/AsyncDisplayKit/examples/SocialAppLayout/Sample/AppDelegate.h deleted file mode 100644 index 19db03c153..0000000000 --- a/submodules/AsyncDisplayKit/examples/SocialAppLayout/Sample/AppDelegate.h +++ /dev/null @@ -1,16 +0,0 @@ -// -// AppDelegate.h -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -@interface AppDelegate : UIResponder - -@property (strong, nonatomic) UIWindow *window; - -@end diff --git a/submodules/AsyncDisplayKit/examples/SocialAppLayout/Sample/AppDelegate.m b/submodules/AsyncDisplayKit/examples/SocialAppLayout/Sample/AppDelegate.m deleted file mode 100644 index 73663a6919..0000000000 --- a/submodules/AsyncDisplayKit/examples/SocialAppLayout/Sample/AppDelegate.m +++ /dev/null @@ -1,24 +0,0 @@ -// -// AppDelegate.m -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import "AppDelegate.h" -#import "ViewController.h" - -@implementation AppDelegate - -- (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 diff --git a/submodules/AsyncDisplayKit/examples/SocialAppLayout/Sample/Assets.xcassets/AppIcon.appiconset/Contents.json b/submodules/AsyncDisplayKit/examples/SocialAppLayout/Sample/Assets.xcassets/AppIcon.appiconset/Contents.json deleted file mode 100644 index 118c98f746..0000000000 --- a/submodules/AsyncDisplayKit/examples/SocialAppLayout/Sample/Assets.xcassets/AppIcon.appiconset/Contents.json +++ /dev/null @@ -1,38 +0,0 @@ -{ - "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" - } -} \ No newline at end of file diff --git a/submodules/AsyncDisplayKit/examples/SocialAppLayout/Sample/CommentsNode.h b/submodules/AsyncDisplayKit/examples/SocialAppLayout/Sample/CommentsNode.h deleted file mode 100644 index 422460fe9e..0000000000 --- a/submodules/AsyncDisplayKit/examples/SocialAppLayout/Sample/CommentsNode.h +++ /dev/null @@ -1,16 +0,0 @@ -// -// CommentsNode.h -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -@interface CommentsNode : ASControlNode - -- (instancetype)initWithCommentsCount:(NSInteger)comentsCount; - -@end diff --git a/submodules/AsyncDisplayKit/examples/SocialAppLayout/Sample/CommentsNode.m b/submodules/AsyncDisplayKit/examples/SocialAppLayout/Sample/CommentsNode.m deleted file mode 100644 index 96ba688881..0000000000 --- a/submodules/AsyncDisplayKit/examples/SocialAppLayout/Sample/CommentsNode.m +++ /dev/null @@ -1,62 +0,0 @@ -// -// CommentsNode.m -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import "CommentsNode.h" -#import "TextStyles.h" - -@interface CommentsNode () -@property (nonatomic, strong) ASImageNode *iconNode; -@property (nonatomic, strong) ASTextNode *countNode; -@property (nonatomic, assign) NSInteger commentsCount; -@end - -@implementation CommentsNode - -- (instancetype)initWithCommentsCount:(NSInteger)comentsCount -{ - self = [super init]; - if (self) { - _commentsCount = comentsCount; - - _iconNode = [[ASImageNode alloc] init]; - _iconNode.image = [UIImage imageNamed:@"icon_comment.png"]; - [self addSubnode:_iconNode]; - - _countNode = [[ASTextNode alloc] init]; - if (_commentsCount > 0) { - _countNode.attributedText = [[NSAttributedString alloc] initWithString:[NSString stringWithFormat:@"%zd", _commentsCount] attributes:[TextStyles cellControlStyle]]; - } - [self addSubnode:_countNode]; - - // make it tappable easily - self.hitTestSlop = UIEdgeInsetsMake(-10, -10, -10, -10); - } - - return self; - -} - -- (ASLayoutSpec *)layoutSpecThatFits:(ASSizeRange)constrainedSize -{ - ASStackLayoutSpec *mainStack = - [ASStackLayoutSpec - stackLayoutSpecWithDirection:ASStackLayoutDirectionHorizontal - spacing:6.0 - justifyContent:ASStackLayoutJustifyContentStart - alignItems:ASStackLayoutAlignItemsCenter - children:@[_iconNode, _countNode]]; - - // Adjust size - mainStack.style.minWidth = ASDimensionMakeWithPoints(60.0); - mainStack.style.maxHeight = ASDimensionMakeWithPoints(40.0); - - return mainStack; -} - -@end diff --git a/submodules/AsyncDisplayKit/examples/SocialAppLayout/Sample/Default-568h@2x.png b/submodules/AsyncDisplayKit/examples/SocialAppLayout/Sample/Default-568h@2x.png deleted file mode 100644 index 6ee80b9393..0000000000 Binary files a/submodules/AsyncDisplayKit/examples/SocialAppLayout/Sample/Default-568h@2x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/examples/SocialAppLayout/Sample/Default-667h@2x.png b/submodules/AsyncDisplayKit/examples/SocialAppLayout/Sample/Default-667h@2x.png deleted file mode 100644 index e7b975e21b..0000000000 Binary files a/submodules/AsyncDisplayKit/examples/SocialAppLayout/Sample/Default-667h@2x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/examples/SocialAppLayout/Sample/Default-736h@3x.png b/submodules/AsyncDisplayKit/examples/SocialAppLayout/Sample/Default-736h@3x.png deleted file mode 100644 index c8949cae16..0000000000 Binary files a/submodules/AsyncDisplayKit/examples/SocialAppLayout/Sample/Default-736h@3x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/examples/SocialAppLayout/Sample/Info.plist b/submodules/AsyncDisplayKit/examples/SocialAppLayout/Sample/Info.plist deleted file mode 100644 index ed1c9acf9b..0000000000 --- a/submodules/AsyncDisplayKit/examples/SocialAppLayout/Sample/Info.plist +++ /dev/null @@ -1,41 +0,0 @@ - - - - - CFBundleDevelopmentRegion - en - CFBundleExecutable - $(EXECUTABLE_NAME) - CFBundleIdentifier - $(PRODUCT_BUNDLE_IDENTIFIER) - CFBundleInfoDictionaryVersion - 6.0 - CFBundleName - $(PRODUCT_NAME) - CFBundlePackageType - APPL - CFBundleShortVersionString - 1.0 - CFBundleSignature - ???? - CFBundleVersion - 1 - LSRequiresIPhoneOS - - NSAppTransportSecurity - - NSAllowsArbitraryLoads - - - UIRequiredDeviceCapabilities - - armv7 - - UISupportedInterfaceOrientations - - UIInterfaceOrientationPortrait - UIInterfaceOrientationLandscapeLeft - UIInterfaceOrientationLandscapeRight - - - diff --git a/submodules/AsyncDisplayKit/examples/SocialAppLayout/Sample/LikesNode.h b/submodules/AsyncDisplayKit/examples/SocialAppLayout/Sample/LikesNode.h deleted file mode 100644 index 1dbbc191e1..0000000000 --- a/submodules/AsyncDisplayKit/examples/SocialAppLayout/Sample/LikesNode.h +++ /dev/null @@ -1,16 +0,0 @@ -// -// LikesNode.h -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -@interface LikesNode : ASControlNode - -- (instancetype)initWithLikesCount:(NSInteger)likesCount; - -@end diff --git a/submodules/AsyncDisplayKit/examples/SocialAppLayout/Sample/LikesNode.m b/submodules/AsyncDisplayKit/examples/SocialAppLayout/Sample/LikesNode.m deleted file mode 100644 index cd5ade1db4..0000000000 --- a/submodules/AsyncDisplayKit/examples/SocialAppLayout/Sample/LikesNode.m +++ /dev/null @@ -1,75 +0,0 @@ -// -// LikesNode.m -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import "LikesNode.h" -#import "TextStyles.h" - -@interface LikesNode () -@property (nonatomic, strong) ASImageNode *iconNode; -@property (nonatomic, strong) ASTextNode *countNode; -@property (nonatomic, assign) NSInteger likesCount; -@property (nonatomic, assign) BOOL liked; -@end - -@implementation LikesNode - -- (instancetype)initWithLikesCount:(NSInteger)likesCount -{ - self = [super init]; - if (self) { - _likesCount = likesCount; - _liked = (_likesCount > 0) ? [LikesNode getYesOrNo] : NO; - - _iconNode = [[ASImageNode alloc] init]; - _iconNode.image = (_liked) ? [UIImage imageNamed:@"icon_liked.png"] : [UIImage imageNamed:@"icon_like.png"]; - [self addSubnode:_iconNode]; - - _countNode = [[ASTextNode alloc] init]; - if (_likesCount > 0) { - - NSDictionary *attributes = _liked ? [TextStyles cellControlColoredStyle] : [TextStyles cellControlStyle]; - _countNode.attributedText = [[NSAttributedString alloc] initWithString:[NSString stringWithFormat:@"%ld", (long)_likesCount] attributes:attributes]; - - } - [self addSubnode:_countNode]; - - // make it tappable easily - self.hitTestSlop = UIEdgeInsetsMake(-10, -10, -10, -10); - } - - return self; - -} - -+ (BOOL)getYesOrNo -{ - int tmp = (arc4random() % 30)+1; - if (tmp % 5 == 0) { - return YES; - } - return NO; -} - -- (ASLayoutSpec *)layoutSpecThatFits:(ASSizeRange)constrainedSize -{ - ASStackLayoutSpec *mainStack = - [ASStackLayoutSpec - stackLayoutSpecWithDirection:ASStackLayoutDirectionHorizontal - spacing:6.0 - justifyContent:ASStackLayoutJustifyContentStart - alignItems:ASStackLayoutAlignItemsCenter - children:@[_iconNode, _countNode]]; - - mainStack.style.minWidth = ASDimensionMakeWithPoints(60.0); - mainStack.style.maxHeight = ASDimensionMakeWithPoints(40.0); - - return mainStack; -} - -@end diff --git a/submodules/AsyncDisplayKit/examples/SocialAppLayout/Sample/Post.h b/submodules/AsyncDisplayKit/examples/SocialAppLayout/Sample/Post.h deleted file mode 100644 index c8259237b8..0000000000 --- a/submodules/AsyncDisplayKit/examples/SocialAppLayout/Sample/Post.h +++ /dev/null @@ -1,25 +0,0 @@ -// -// Post.h -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -@interface Post : NSObject - -@property (nonatomic, copy) NSString *username; -@property (nonatomic, copy) NSString *name; -@property (nonatomic, copy) NSString *photo; -@property (nonatomic, copy) NSString *post; -@property (nonatomic, copy) NSString *time; -@property (nonatomic, copy) NSString *media; -@property (nonatomic, assign) NSInteger via; - -@property (nonatomic, assign) NSInteger likes; -@property (nonatomic, assign) NSInteger comments; - -@end diff --git a/submodules/AsyncDisplayKit/examples/SocialAppLayout/Sample/Post.m b/submodules/AsyncDisplayKit/examples/SocialAppLayout/Sample/Post.m deleted file mode 100644 index fc61c5bf82..0000000000 --- a/submodules/AsyncDisplayKit/examples/SocialAppLayout/Sample/Post.m +++ /dev/null @@ -1,13 +0,0 @@ -// -// Post.m -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import "Post.h" - -@implementation Post -@end diff --git a/submodules/AsyncDisplayKit/examples/SocialAppLayout/Sample/PostNode.h b/submodules/AsyncDisplayKit/examples/SocialAppLayout/Sample/PostNode.h deleted file mode 100644 index b558158e31..0000000000 --- a/submodules/AsyncDisplayKit/examples/SocialAppLayout/Sample/PostNode.h +++ /dev/null @@ -1,18 +0,0 @@ -// -// PostNode.h -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -@class Post; - -@interface PostNode : ASCellNode - -- (instancetype)initWithPost:(Post *)post; - -@end diff --git a/submodules/AsyncDisplayKit/examples/SocialAppLayout/Sample/PostNode.m b/submodules/AsyncDisplayKit/examples/SocialAppLayout/Sample/PostNode.m deleted file mode 100644 index defafc0061..0000000000 --- a/submodules/AsyncDisplayKit/examples/SocialAppLayout/Sample/PostNode.m +++ /dev/null @@ -1,337 +0,0 @@ -// -// PostNode.m -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import "PostNode.h" -#import "Post.h" -#import "TextStyles.h" -#import "LikesNode.h" -#import "CommentsNode.h" - -#define PostNodeDividerColor [UIColor lightGrayColor] - -@interface PostNode() - -@property (strong, nonatomic) Post *post; -@property (strong, nonatomic) ASDisplayNode *divider; -@property (strong, nonatomic) ASTextNode *nameNode; -@property (strong, nonatomic) ASTextNode *usernameNode; -@property (strong, nonatomic) ASTextNode *timeNode; -@property (strong, nonatomic) ASTextNode *postNode; -@property (strong, nonatomic) ASImageNode *viaNode; -@property (strong, nonatomic) ASNetworkImageNode *avatarNode; -@property (strong, nonatomic) ASNetworkImageNode *mediaNode; -@property (strong, nonatomic) LikesNode *likesNode; -@property (strong, nonatomic) CommentsNode *commentsNode; -@property (strong, nonatomic) ASImageNode *optionsNode; - -@end - -@implementation PostNode - -#pragma mark - Lifecycle - -- (instancetype)initWithPost:(Post *)post -{ - self = [super init]; - if (self) { - _post = post; - - self.selectionStyle = UITableViewCellSelectionStyleNone; - - // Name node - _nameNode = [[ASTextNode alloc] init]; - _nameNode.attributedText = [[NSAttributedString alloc] initWithString:_post.name attributes:[TextStyles nameStyle]]; - _nameNode.maximumNumberOfLines = 1; - [self addSubnode:_nameNode]; - - // Username node - _usernameNode = [[ASTextNode alloc] init]; - _usernameNode.attributedText = [[NSAttributedString alloc] initWithString:_post.username attributes:[TextStyles usernameStyle]]; - _usernameNode.style.flexShrink = 1.0; //if name and username don't fit to cell width, allow username shrink - _usernameNode.truncationMode = NSLineBreakByTruncatingTail; - _usernameNode.maximumNumberOfLines = 1; - [self addSubnode:_usernameNode]; - - // Time node - _timeNode = [[ASTextNode alloc] init]; - _timeNode.attributedText = [[NSAttributedString alloc] initWithString:_post.time attributes:[TextStyles timeStyle]]; - [self addSubnode:_timeNode]; - - // Post node - _postNode = [[ASTextNode alloc] init]; - - // Processing URLs in post - NSString *kLinkAttributeName = @"TextLinkAttributeName"; - - if (![_post.post isEqualToString:@""]) { - - NSMutableAttributedString *attrString = [[NSMutableAttributedString alloc] initWithString:_post.post attributes:[TextStyles postStyle]]; - - NSDataDetector *urlDetector = [NSDataDetector dataDetectorWithTypes:NSTextCheckingTypeLink error:nil]; - - [urlDetector enumerateMatchesInString:attrString.string options:kNilOptions range:NSMakeRange(0, attrString.string.length) usingBlock:^(NSTextCheckingResult *result, NSMatchingFlags flags, BOOL *stop){ - - if (result.resultType == NSTextCheckingTypeLink) { - - NSMutableDictionary *linkAttributes = [[NSMutableDictionary alloc] initWithDictionary:[TextStyles postLinkStyle]]; - linkAttributes[kLinkAttributeName] = [NSURL URLWithString:result.URL.absoluteString]; - - [attrString addAttributes:linkAttributes range:result.range]; - - } - - }]; - - // Configure node to support tappable links - _postNode.delegate = self; - _postNode.userInteractionEnabled = YES; - _postNode.linkAttributeNames = @[ kLinkAttributeName ]; - _postNode.attributedText = attrString; - _postNode.passthroughNonlinkTouches = YES; // passes touches through when they aren't on a link - - } - - [self addSubnode:_postNode]; - - - // Media - if (![_post.media isEqualToString:@""]) { - - _mediaNode = [[ASNetworkImageNode alloc] init]; - _mediaNode.backgroundColor = ASDisplayNodeDefaultPlaceholderColor(); - _mediaNode.cornerRadius = 4.0; - _mediaNode.URL = [NSURL URLWithString:_post.media]; - _mediaNode.delegate = self; - _mediaNode.imageModificationBlock = ^UIImage *(UIImage *image) { - - UIImage *modifiedImage; - CGRect rect = CGRectMake(0, 0, image.size.width, image.size.height); - - UIGraphicsBeginImageContextWithOptions(image.size, false, [[UIScreen mainScreen] scale]); - - [[UIBezierPath bezierPathWithRoundedRect:rect cornerRadius:8.0] addClip]; - [image drawInRect:rect]; - modifiedImage = UIGraphicsGetImageFromCurrentImageContext(); - - UIGraphicsEndImageContext(); - - return modifiedImage; - - }; - [self addSubnode:_mediaNode]; - } - - // User pic - _avatarNode = [[ASNetworkImageNode alloc] init]; - _avatarNode.backgroundColor = ASDisplayNodeDefaultPlaceholderColor(); - _avatarNode.style.width = ASDimensionMakeWithPoints(44); - _avatarNode.style.height = ASDimensionMakeWithPoints(44); - _avatarNode.cornerRadius = 22.0; - _avatarNode.URL = [NSURL URLWithString:_post.photo]; - _avatarNode.imageModificationBlock = ^UIImage *(UIImage *image) { - - UIImage *modifiedImage; - CGRect rect = CGRectMake(0, 0, image.size.width, image.size.height); - - UIGraphicsBeginImageContextWithOptions(image.size, false, [[UIScreen mainScreen] scale]); - - [[UIBezierPath bezierPathWithRoundedRect:rect cornerRadius:44.0] addClip]; - [image drawInRect:rect]; - modifiedImage = UIGraphicsGetImageFromCurrentImageContext(); - - UIGraphicsEndImageContext(); - - return modifiedImage; - - }; - [self addSubnode:_avatarNode]; - - // Hairline cell separator - _divider = [[ASDisplayNode alloc] init]; - [self updateDividerColor]; - [self addSubnode:_divider]; - - // Via - if (_post.via != 0) { - _viaNode = [[ASImageNode alloc] init]; - _viaNode.image = (_post.via == 1) ? [UIImage imageNamed:@"icon_ios.png"] : [UIImage imageNamed:@"icon_android.png"]; - [self addSubnode:_viaNode]; - } - - // Bottom controls - _likesNode = [[LikesNode alloc] initWithLikesCount:_post.likes]; - [self addSubnode:_likesNode]; - - _commentsNode = [[CommentsNode alloc] initWithCommentsCount:_post.comments]; - [self addSubnode:_commentsNode]; - - _optionsNode = [[ASImageNode alloc] init]; - _optionsNode.image = [UIImage imageNamed:@"icon_more"]; - [self addSubnode:_optionsNode]; - - for (ASDisplayNode *node in self.subnodes) { - // ASTextNode with embedded links doesn't support layer backing - if (node.supportsLayerBacking) { - node.layerBacked = YES; - } - } - } - return self; -} - -- (void)updateDividerColor -{ - /* - * UITableViewCell traverses through all its descendant views and adjusts their background color accordingly - * either to [UIColor clearColor], although potentially it could use the same color as the selection highlight itself. - * After selection, the same trick is performed again in reverse, putting all the backgrounds back as they used to be. - * But in our case, we don't want to have the background color disappearing so we reset it after highlighting or - * selection is done. - */ - _divider.backgroundColor = PostNodeDividerColor; -} - -#pragma mark - ASDisplayNode - -- (void)didLoad -{ - // enable highlighting now that self.layer has loaded -- see ASHighlightOverlayLayer.h - self.layer.as_allowsHighlightDrawing = YES; - - [super didLoad]; -} - -- (ASLayoutSpec *)layoutSpecThatFits:(ASSizeRange)constrainedSize -{ - // Flexible spacer between username and time - ASLayoutSpec *spacer = [[ASLayoutSpec alloc] init]; - spacer.style.flexGrow = 1.0; - - // Horizontal stack for name, username, via icon and time - NSMutableArray *layoutSpecChildren = [@[_nameNode, _usernameNode, spacer] mutableCopy]; - if (_post.via != 0) { - [layoutSpecChildren addObject:_viaNode]; - } - [layoutSpecChildren addObject:_timeNode]; - - ASStackLayoutSpec *nameStack = - [ASStackLayoutSpec - stackLayoutSpecWithDirection:ASStackLayoutDirectionHorizontal - spacing:5.0 - justifyContent:ASStackLayoutJustifyContentStart - alignItems:ASStackLayoutAlignItemsCenter - children:layoutSpecChildren]; - nameStack.style.alignSelf = ASStackLayoutAlignSelfStretch; - - // bottom controls horizontal stack - ASStackLayoutSpec *controlsStack = - [ASStackLayoutSpec - stackLayoutSpecWithDirection:ASStackLayoutDirectionHorizontal - spacing:10 - justifyContent:ASStackLayoutJustifyContentStart - alignItems:ASStackLayoutAlignItemsCenter - children:@[_likesNode, _commentsNode, _optionsNode]]; - - // Add more gaps for control line - controlsStack.style.spacingAfter = 3.0; - controlsStack.style.spacingBefore = 3.0; - - NSMutableArray *mainStackContent = [[NSMutableArray alloc] init]; - [mainStackContent addObject:nameStack]; - [mainStackContent addObject:_postNode]; - - - if (![_post.media isEqualToString:@""]){ - - // Only add the media node if an image is present - if (_mediaNode.image != nil) { - ASRatioLayoutSpec *imagePlace = - [ASRatioLayoutSpec - ratioLayoutSpecWithRatio:0.5 - child:_mediaNode]; - imagePlace.style.spacingAfter = 3.0; - imagePlace.style.spacingBefore = 3.0; - - [mainStackContent addObject:imagePlace]; - } - } - [mainStackContent addObject:controlsStack]; - - // Vertical spec of cell main content - ASStackLayoutSpec *contentSpec = - [ASStackLayoutSpec - stackLayoutSpecWithDirection:ASStackLayoutDirectionVertical - spacing:8.0 - justifyContent:ASStackLayoutJustifyContentStart - alignItems:ASStackLayoutAlignItemsStretch - children:mainStackContent]; - contentSpec.style.flexShrink = 1.0; - - // Horizontal spec for avatar - ASStackLayoutSpec *avatarContentSpec = - [ASStackLayoutSpec - stackLayoutSpecWithDirection:ASStackLayoutDirectionHorizontal - spacing:8.0 - justifyContent:ASStackLayoutJustifyContentStart - alignItems:ASStackLayoutAlignItemsStart - children:@[_avatarNode, contentSpec]]; - - return [ASInsetLayoutSpec - insetLayoutSpecWithInsets:UIEdgeInsetsMake(10, 10, 10, 10) - child:avatarContentSpec]; - -} - -- (void)layout -{ - [super layout]; - - // Manually layout the divider. - CGFloat pixelHeight = 1.0f / [[UIScreen mainScreen] scale]; - _divider.frame = CGRectMake(0.0f, 0.0f, self.calculatedSize.width, pixelHeight); -} - -#pragma mark - ASCellNode - -- (void)setHighlighted:(BOOL)highlighted -{ - [super setHighlighted:highlighted]; - - [self updateDividerColor]; -} - -- (void)setSelected:(BOOL)selected -{ - [super setSelected:selected]; - - [self updateDividerColor]; -} - -#pragma mark - - -- (BOOL)textNode:(ASTextNode *)richTextNode shouldHighlightLinkAttribute:(NSString *)attribute value:(id)value atPoint:(CGPoint)point -{ - // Opt into link highlighting -- tap and hold the link to try it! must enable highlighting on a layer, see -didLoad - return YES; -} - -- (void)textNode:(ASTextNode *)richTextNode tappedLinkAttribute:(NSString *)attribute value:(NSURL *)URL atPoint:(CGPoint)point textRange:(NSRange)textRange -{ - // The node tapped a link, open it - [[UIApplication sharedApplication] openURL:URL]; -} - -#pragma mark - ASNetworkImageNodeDelegate methods. - -- (void)imageNode:(ASNetworkImageNode *)imageNode didLoadImage:(UIImage *)image -{ - [self setNeedsLayout]; -} - -@end diff --git a/submodules/AsyncDisplayKit/examples/SocialAppLayout/Sample/TextStyles.h b/submodules/AsyncDisplayKit/examples/SocialAppLayout/Sample/TextStyles.h deleted file mode 100644 index 2a975bdea3..0000000000 --- a/submodules/AsyncDisplayKit/examples/SocialAppLayout/Sample/TextStyles.h +++ /dev/null @@ -1,23 +0,0 @@ -// -// TextStyles.h -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import -#import - -@interface TextStyles : NSObject - -+ (NSDictionary *)nameStyle; -+ (NSDictionary *)usernameStyle; -+ (NSDictionary *)timeStyle; -+ (NSDictionary *)postStyle; -+ (NSDictionary *)postLinkStyle; -+ (NSDictionary *)cellControlStyle; -+ (NSDictionary *)cellControlColoredStyle; - -@end diff --git a/submodules/AsyncDisplayKit/examples/SocialAppLayout/Sample/TextStyles.m b/submodules/AsyncDisplayKit/examples/SocialAppLayout/Sample/TextStyles.m deleted file mode 100644 index ad7798c445..0000000000 --- a/submodules/AsyncDisplayKit/examples/SocialAppLayout/Sample/TextStyles.m +++ /dev/null @@ -1,71 +0,0 @@ -// -// TextStyles.m -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import "TextStyles.h" - -@implementation TextStyles - -+ (NSDictionary *)nameStyle -{ - return @{ - NSFontAttributeName : [UIFont boldSystemFontOfSize:15.0], - NSForegroundColorAttributeName: [UIColor blackColor] - }; -} - -+ (NSDictionary *)usernameStyle -{ - return @{ - NSFontAttributeName : [UIFont systemFontOfSize:13.0], - NSForegroundColorAttributeName: [UIColor lightGrayColor] - }; -} - -+ (NSDictionary *)timeStyle -{ - return @{ - NSFontAttributeName : [UIFont systemFontOfSize:13.0], - NSForegroundColorAttributeName: [UIColor grayColor] - }; -} - -+ (NSDictionary *)postStyle -{ - return @{ - NSFontAttributeName : [UIFont systemFontOfSize:15.0], - NSForegroundColorAttributeName: [UIColor blackColor] - }; -} - -+ (NSDictionary *)postLinkStyle -{ - return @{ - NSFontAttributeName : [UIFont systemFontOfSize:15.0], - NSForegroundColorAttributeName: [UIColor colorWithRed:59.0/255.0 green:89.0/255.0 blue:152.0/255.0 alpha:1.0], - NSUnderlineStyleAttributeName: @(NSUnderlineStyleSingle) - }; -} - -+ (NSDictionary *)cellControlStyle -{ - return @{ - NSFontAttributeName : [UIFont systemFontOfSize:13.0], - NSForegroundColorAttributeName: [UIColor lightGrayColor] - }; -} - -+ (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] - }; -} - -@end diff --git a/submodules/AsyncDisplayKit/examples/SocialAppLayout/Sample/ViewController.h b/submodules/AsyncDisplayKit/examples/SocialAppLayout/Sample/ViewController.h deleted file mode 100644 index 6416242247..0000000000 --- a/submodules/AsyncDisplayKit/examples/SocialAppLayout/Sample/ViewController.h +++ /dev/null @@ -1,13 +0,0 @@ -// -// ViewController.h -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -@interface ViewController : ASViewController -@end diff --git a/submodules/AsyncDisplayKit/examples/SocialAppLayout/Sample/ViewController.m b/submodules/AsyncDisplayKit/examples/SocialAppLayout/Sample/ViewController.m deleted file mode 100644 index 1eebcb516c..0000000000 --- a/submodules/AsyncDisplayKit/examples/SocialAppLayout/Sample/ViewController.m +++ /dev/null @@ -1,128 +0,0 @@ -// -// ViewController.m -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import "ViewController.h" -#import "Post.h" -#import "PostNode.h" - -#import -#import - -#include - -@interface ViewController () - -@property (nonatomic, strong) ASTableNode *tableNode; -@property (nonatomic, strong) NSMutableArray *socialAppDataSource; - -@end - -#pragma mark - Lifecycle - -@implementation ViewController - -- (instancetype)init -{ - _tableNode = [[ASTableNode alloc] initWithStyle:UITableViewStylePlain]; - - self = [super initWithNode:_tableNode]; - - if (self) { - - _tableNode.delegate = self; - _tableNode.dataSource = self; - _tableNode.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight; - - self.title = @"Timeline"; - - [self createSocialAppDataSource]; - } - - return self; -} - -- (void)viewDidLoad -{ - [super viewDidLoad]; - - // SocialAppNode has its own separator - self.tableNode.view.separatorStyle = UITableViewCellSeparatorStyleNone; -} - -#pragma mark - Data Model - -- (void)createSocialAppDataSource -{ - _socialAppDataSource = [[NSMutableArray alloc] init]; - - Post *newPost = [[Post alloc] init]; - newPost.name = @"Apple Guy"; - newPost.username = @"@appleguy"; - newPost.photo = @"https://avatars1.githubusercontent.com/u/565251?v=3&s=96"; - newPost.post = @"Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat."; - newPost.time = @"3s"; - newPost.media = @""; - newPost.via = 0; - newPost.likes = arc4random_uniform(74); - newPost.comments = arc4random_uniform(40); - [_socialAppDataSource addObject:newPost]; - - newPost = [[Post alloc] init]; - newPost.name = @"Huy Nguyen"; - newPost.username = @"@nguyenhuy"; - newPost.photo = @"https://avatars2.githubusercontent.com/u/587874?v=3&s=96"; - newPost.post = @"Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua."; - newPost.time = @"1m"; - newPost.media = @""; - newPost.via = 1; - newPost.likes = arc4random_uniform(74); - newPost.comments = arc4random_uniform(40); - [_socialAppDataSource addObject:newPost]; - - newPost = [[Post alloc] init]; - newPost.name = @"Alex Long Name"; - newPost.username = @"@veryyyylongusername"; - newPost.photo = @"https://avatars1.githubusercontent.com/u/8086633?v=3&s=96"; - newPost.post = @"Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua."; - newPost.time = @"3:02"; - newPost.media = @"http://www.ngmag.ru/upload/iblock/f93/f9390efc34151456598077c1ba44a94d.jpg"; - newPost.via = 2; - newPost.likes = arc4random_uniform(74); - newPost.comments = arc4random_uniform(40); - [_socialAppDataSource addObject:newPost]; - - newPost = [[Post alloc] init]; - newPost.name = @"Vitaly Baev"; - newPost.username = @"@vitalybaev"; - newPost.photo = @"https://avatars0.githubusercontent.com/u/724423?v=3&s=96"; - newPost.post = @"Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. https://github.com/facebook/AsyncDisplayKit Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua."; - newPost.time = @"yesterday"; - newPost.media = @""; - newPost.via = 1; - newPost.likes = arc4random_uniform(74); - newPost.comments = arc4random_uniform(40); - [_socialAppDataSource addObject:newPost]; -} - -#pragma mark - ASTableNode - -- (ASCellNodeBlock)tableNode:(ASTableNode *)tableNode nodeBlockForRowAtIndexPath:(NSIndexPath *)indexPath -{ - Post *post = self.socialAppDataSource[indexPath.row]; - return ^{ - return [[PostNode alloc] initWithPost:post]; - }; -} - -- (NSInteger)tableNode:(ASTableNode *)tableNode numberOfRowsInSection:(NSInteger)section -{ - return self.socialAppDataSource.count; -} - -@end diff --git a/submodules/AsyncDisplayKit/examples/SocialAppLayout/Sample/icon_android.png b/submodules/AsyncDisplayKit/examples/SocialAppLayout/Sample/icon_android.png deleted file mode 100644 index 6d30985339..0000000000 Binary files a/submodules/AsyncDisplayKit/examples/SocialAppLayout/Sample/icon_android.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/examples/SocialAppLayout/Sample/icon_android@2x.png b/submodules/AsyncDisplayKit/examples/SocialAppLayout/Sample/icon_android@2x.png deleted file mode 100644 index c0dd2f5977..0000000000 Binary files a/submodules/AsyncDisplayKit/examples/SocialAppLayout/Sample/icon_android@2x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/examples/SocialAppLayout/Sample/icon_android@3x.png b/submodules/AsyncDisplayKit/examples/SocialAppLayout/Sample/icon_android@3x.png deleted file mode 100644 index d3e83e9334..0000000000 Binary files a/submodules/AsyncDisplayKit/examples/SocialAppLayout/Sample/icon_android@3x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/examples/SocialAppLayout/Sample/icon_comment.png b/submodules/AsyncDisplayKit/examples/SocialAppLayout/Sample/icon_comment.png deleted file mode 100644 index 59ccfe43c1..0000000000 Binary files a/submodules/AsyncDisplayKit/examples/SocialAppLayout/Sample/icon_comment.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/examples/SocialAppLayout/Sample/icon_comment@2x.png b/submodules/AsyncDisplayKit/examples/SocialAppLayout/Sample/icon_comment@2x.png deleted file mode 100644 index bedd0593c0..0000000000 Binary files a/submodules/AsyncDisplayKit/examples/SocialAppLayout/Sample/icon_comment@2x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/examples/SocialAppLayout/Sample/icon_comment@3x.png b/submodules/AsyncDisplayKit/examples/SocialAppLayout/Sample/icon_comment@3x.png deleted file mode 100644 index eb8a0d7660..0000000000 Binary files a/submodules/AsyncDisplayKit/examples/SocialAppLayout/Sample/icon_comment@3x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/examples/SocialAppLayout/Sample/icon_ios.png b/submodules/AsyncDisplayKit/examples/SocialAppLayout/Sample/icon_ios.png deleted file mode 100644 index 0cd417d446..0000000000 Binary files a/submodules/AsyncDisplayKit/examples/SocialAppLayout/Sample/icon_ios.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/examples/SocialAppLayout/Sample/icon_ios@2x.png b/submodules/AsyncDisplayKit/examples/SocialAppLayout/Sample/icon_ios@2x.png deleted file mode 100644 index f73561fd09..0000000000 Binary files a/submodules/AsyncDisplayKit/examples/SocialAppLayout/Sample/icon_ios@2x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/examples/SocialAppLayout/Sample/icon_ios@3x.png b/submodules/AsyncDisplayKit/examples/SocialAppLayout/Sample/icon_ios@3x.png deleted file mode 100644 index 35d2bb2b37..0000000000 Binary files a/submodules/AsyncDisplayKit/examples/SocialAppLayout/Sample/icon_ios@3x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/examples/SocialAppLayout/Sample/icon_like.png b/submodules/AsyncDisplayKit/examples/SocialAppLayout/Sample/icon_like.png deleted file mode 100644 index 43110b9d59..0000000000 Binary files a/submodules/AsyncDisplayKit/examples/SocialAppLayout/Sample/icon_like.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/examples/SocialAppLayout/Sample/icon_like@2x.png b/submodules/AsyncDisplayKit/examples/SocialAppLayout/Sample/icon_like@2x.png deleted file mode 100644 index 1b535d748b..0000000000 Binary files a/submodules/AsyncDisplayKit/examples/SocialAppLayout/Sample/icon_like@2x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/examples/SocialAppLayout/Sample/icon_like@3x.png b/submodules/AsyncDisplayKit/examples/SocialAppLayout/Sample/icon_like@3x.png deleted file mode 100644 index 8c80507335..0000000000 Binary files a/submodules/AsyncDisplayKit/examples/SocialAppLayout/Sample/icon_like@3x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/examples/SocialAppLayout/Sample/icon_liked.png b/submodules/AsyncDisplayKit/examples/SocialAppLayout/Sample/icon_liked.png deleted file mode 100644 index b1c1ade901..0000000000 Binary files a/submodules/AsyncDisplayKit/examples/SocialAppLayout/Sample/icon_liked.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/examples/SocialAppLayout/Sample/icon_liked@2x.png b/submodules/AsyncDisplayKit/examples/SocialAppLayout/Sample/icon_liked@2x.png deleted file mode 100644 index d9dc5988ea..0000000000 Binary files a/submodules/AsyncDisplayKit/examples/SocialAppLayout/Sample/icon_liked@2x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/examples/SocialAppLayout/Sample/icon_liked@3x.png b/submodules/AsyncDisplayKit/examples/SocialAppLayout/Sample/icon_liked@3x.png deleted file mode 100644 index 00578ac63e..0000000000 Binary files a/submodules/AsyncDisplayKit/examples/SocialAppLayout/Sample/icon_liked@3x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/examples/SocialAppLayout/Sample/icon_more.png b/submodules/AsyncDisplayKit/examples/SocialAppLayout/Sample/icon_more.png deleted file mode 100644 index 013126d291..0000000000 Binary files a/submodules/AsyncDisplayKit/examples/SocialAppLayout/Sample/icon_more.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/examples/SocialAppLayout/Sample/icon_more@2x.png b/submodules/AsyncDisplayKit/examples/SocialAppLayout/Sample/icon_more@2x.png deleted file mode 100644 index 3d183df436..0000000000 Binary files a/submodules/AsyncDisplayKit/examples/SocialAppLayout/Sample/icon_more@2x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/examples/SocialAppLayout/Sample/icon_more@3x.png b/submodules/AsyncDisplayKit/examples/SocialAppLayout/Sample/icon_more@3x.png deleted file mode 100644 index d5f829ab11..0000000000 Binary files a/submodules/AsyncDisplayKit/examples/SocialAppLayout/Sample/icon_more@3x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/examples/SocialAppLayout/Sample/main.m b/submodules/AsyncDisplayKit/examples/SocialAppLayout/Sample/main.m deleted file mode 100644 index 0e5da05001..0000000000 --- a/submodules/AsyncDisplayKit/examples/SocialAppLayout/Sample/main.m +++ /dev/null @@ -1,17 +0,0 @@ -// -// main.m -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import -#import "AppDelegate.h" - -int main(int argc, char * argv[]) { - @autoreleasepool { - return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); - } -} diff --git a/submodules/AsyncDisplayKit/examples/Swift/Default-568h@2x.png b/submodules/AsyncDisplayKit/examples/Swift/Default-568h@2x.png deleted file mode 100644 index 1547a98454..0000000000 Binary files a/submodules/AsyncDisplayKit/examples/Swift/Default-568h@2x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/examples/Swift/Default-667h@2x.png b/submodules/AsyncDisplayKit/examples/Swift/Default-667h@2x.png deleted file mode 100644 index 988ea56bab..0000000000 Binary files a/submodules/AsyncDisplayKit/examples/Swift/Default-667h@2x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/examples/Swift/Default-736h@3x.png b/submodules/AsyncDisplayKit/examples/Swift/Default-736h@3x.png deleted file mode 100644 index d19eb325a2..0000000000 Binary files a/submodules/AsyncDisplayKit/examples/Swift/Default-736h@3x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/examples/Swift/Podfile b/submodules/AsyncDisplayKit/examples/Swift/Podfile deleted file mode 100644 index 83d2cae8bf..0000000000 --- a/submodules/AsyncDisplayKit/examples/Swift/Podfile +++ /dev/null @@ -1,8 +0,0 @@ -source 'https://github.com/CocoaPods/Specs.git' -platform :ios, '9.0' - -use_frameworks! - -target 'Sample' do - pod 'Texture', :path => '../..' -end diff --git a/submodules/AsyncDisplayKit/examples/Swift/Sample.xcworkspace/contents.xcworkspacedata b/submodules/AsyncDisplayKit/examples/Swift/Sample.xcworkspace/contents.xcworkspacedata deleted file mode 100644 index 7b5a2f3050..0000000000 --- a/submodules/AsyncDisplayKit/examples/Swift/Sample.xcworkspace/contents.xcworkspacedata +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - diff --git a/submodules/AsyncDisplayKit/examples/Swift/Sample/AppDelegate.swift b/submodules/AsyncDisplayKit/examples/Swift/Sample/AppDelegate.swift deleted file mode 100644 index df48167298..0000000000 --- a/submodules/AsyncDisplayKit/examples/Swift/Sample/AppDelegate.swift +++ /dev/null @@ -1,26 +0,0 @@ -// -// AppDelegate.swift -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -import UIKit - -@UIApplicationMain -class AppDelegate: UIResponder, UIApplicationDelegate { - - var window: UIWindow? - - func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool { - let window = UIWindow(frame: UIScreen.main.bounds) - window.backgroundColor = UIColor.white - window.rootViewController = UINavigationController(rootViewController: ViewController()) - window.makeKeyAndVisible() - self.window = window - return true - } - -} diff --git a/submodules/AsyncDisplayKit/examples/Swift/Sample/Info.plist b/submodules/AsyncDisplayKit/examples/Swift/Sample/Info.plist deleted file mode 100644 index fb4115c84c..0000000000 --- a/submodules/AsyncDisplayKit/examples/Swift/Sample/Info.plist +++ /dev/null @@ -1,36 +0,0 @@ - - - - - CFBundleDevelopmentRegion - en - CFBundleExecutable - $(EXECUTABLE_NAME) - CFBundleIdentifier - $(PRODUCT_BUNDLE_IDENTIFIER) - CFBundleInfoDictionaryVersion - 6.0 - CFBundleName - $(PRODUCT_NAME) - CFBundlePackageType - APPL - CFBundleShortVersionString - 1.0 - CFBundleSignature - ???? - CFBundleVersion - 1 - LSRequiresIPhoneOS - - UIRequiredDeviceCapabilities - - armv7 - - UISupportedInterfaceOrientations - - UIInterfaceOrientationPortrait - UIInterfaceOrientationLandscapeLeft - UIInterfaceOrientationLandscapeRight - - - diff --git a/submodules/AsyncDisplayKit/examples/Swift/Sample/TailLoadingCellNode.swift b/submodules/AsyncDisplayKit/examples/Swift/Sample/TailLoadingCellNode.swift deleted file mode 100644 index 5b586e7086..0000000000 --- a/submodules/AsyncDisplayKit/examples/Swift/Sample/TailLoadingCellNode.swift +++ /dev/null @@ -1,62 +0,0 @@ -// -// TailLoadingCellNode.swift -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -import AsyncDisplayKit -import UIKit - -final class TailLoadingCellNode: ASCellNode { - let spinner = SpinnerNode() - let text = ASTextNode() - - override init() { - super.init() - - addSubnode(text) - text.attributedText = NSAttributedString( - string: "Loading…", - attributes: [ - NSFontAttributeName: UIFont.systemFont(ofSize: 12), - NSForegroundColorAttributeName: UIColor.lightGray, - NSKernAttributeName: -0.3 - ]) - addSubnode(spinner) - } - - override func layoutSpecThatFits(_ constrainedSize: ASSizeRange) -> ASLayoutSpec { - - return ASStackLayoutSpec( - direction: .horizontal, - spacing: 16, - justifyContent: .center, - alignItems: .center, - children: [ text, spinner ]) - } -} - -final class SpinnerNode: ASDisplayNode { - var activityIndicatorView: UIActivityIndicatorView { - return view as! UIActivityIndicatorView - } - - override init() { - super.init() - setViewBlock { - UIActivityIndicatorView(activityIndicatorStyle: .gray) - } - - // Set spinner node to default size of the activitiy indicator view - self.style.preferredSize = CGSize(width: 20.0, height: 20.0) - } - - override func didLoad() { - super.didLoad() - - activityIndicatorView.startAnimating() - } -} diff --git a/submodules/AsyncDisplayKit/examples/Swift/Sample/ViewController.swift b/submodules/AsyncDisplayKit/examples/Swift/Sample/ViewController.swift deleted file mode 100644 index e68c178ad5..0000000000 --- a/submodules/AsyncDisplayKit/examples/Swift/Sample/ViewController.swift +++ /dev/null @@ -1,142 +0,0 @@ -// -// ViewController.swift -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -import UIKit -import AsyncDisplayKit - -final class ViewController: ASViewController, ASTableDataSource, ASTableDelegate { - - struct State { - var itemCount: Int - var fetchingMore: Bool - static let empty = State(itemCount: 20, fetchingMore: false) - } - - enum Action { - case beginBatchFetch - case endBatchFetch(resultCount: Int) - } - - var tableNode: ASTableNode { - return node as! ASTableNode - } - - fileprivate(set) var state: State = .empty - - init() { - super.init(node: ASTableNode()) - tableNode.delegate = self - tableNode.dataSource = self - } - - required init?(coder aDecoder: NSCoder) { - fatalError("storyboards are incompatible with truth and beauty") - } - - // MARK: ASTableNode data source and delegate. - - func tableNode(_ tableNode: ASTableNode, nodeForRowAt indexPath: IndexPath) -> ASCellNode { - // Should read the row count directly from table view but - // https://github.com/facebook/AsyncDisplayKit/issues/1159 - let rowCount = self.tableNode(tableNode, numberOfRowsInSection: 0) - - if state.fetchingMore && indexPath.row == rowCount - 1 { - let node = TailLoadingCellNode() - node.style.height = ASDimensionMake(44.0) - return node; - } - - let node = ASTextCellNode() - node.text = String(format: "[%ld.%ld] says hello!", indexPath.section, indexPath.row) - - return node - } - - func numberOfSections(in tableNode: ASTableNode) -> Int { - return 1 - } - - func tableNode(_ tableNode: ASTableNode, numberOfRowsInSection section: Int) -> Int { - var count = state.itemCount - if state.fetchingMore { - count += 1 - } - return count - } - - func tableNode(_ tableNode: ASTableNode, willBeginBatchFetchWith context: ASBatchContext) { - /// This call will come in on a background thread. Switch to main - /// to add our spinner, then fire off our fetch. - DispatchQueue.main.async { - let oldState = self.state - self.state = ViewController.handleAction(.beginBatchFetch, fromState: oldState) - self.renderDiff(oldState) - } - - ViewController.fetchDataWithCompletion { resultCount in - let action = Action.endBatchFetch(resultCount: resultCount) - let oldState = self.state - self.state = ViewController.handleAction(action, fromState: oldState) - self.renderDiff(oldState) - context.completeBatchFetching(true) - } - } - - fileprivate func renderDiff(_ oldState: State) { - - self.tableNode.performBatchUpdates({ - - // Add or remove items - let rowCountChange = state.itemCount - oldState.itemCount - if rowCountChange > 0 { - let indexPaths = (oldState.itemCount.. Void) { - let time = DispatchTime.now() + Double(Int64(TimeInterval(NSEC_PER_SEC) * 1.0)) / Double(NSEC_PER_SEC) - DispatchQueue.main.asyncAfter(deadline: time) { - let resultCount = Int(arc4random_uniform(20)) - completion(resultCount) - } - } - - fileprivate static func handleAction(_ action: Action, fromState state: State) -> State { - var state = state - switch action { - case .beginBatchFetch: - state.fetchingMore = true - case let .endBatchFetch(resultCount): - state.itemCount += resultCount - state.fetchingMore = false - } - return state - } -} diff --git a/submodules/AsyncDisplayKit/examples/VerticalWithinHorizontalScrolling/Default-568h@2x.png b/submodules/AsyncDisplayKit/examples/VerticalWithinHorizontalScrolling/Default-568h@2x.png deleted file mode 100644 index 6ee80b9393..0000000000 Binary files a/submodules/AsyncDisplayKit/examples/VerticalWithinHorizontalScrolling/Default-568h@2x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/examples/VerticalWithinHorizontalScrolling/Default-667h@2x.png b/submodules/AsyncDisplayKit/examples/VerticalWithinHorizontalScrolling/Default-667h@2x.png deleted file mode 100644 index e7b975e21b..0000000000 Binary files a/submodules/AsyncDisplayKit/examples/VerticalWithinHorizontalScrolling/Default-667h@2x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/examples/VerticalWithinHorizontalScrolling/Default-736h@3x.png b/submodules/AsyncDisplayKit/examples/VerticalWithinHorizontalScrolling/Default-736h@3x.png deleted file mode 100644 index c8949cae16..0000000000 Binary files a/submodules/AsyncDisplayKit/examples/VerticalWithinHorizontalScrolling/Default-736h@3x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/examples/VerticalWithinHorizontalScrolling/Podfile b/submodules/AsyncDisplayKit/examples/VerticalWithinHorizontalScrolling/Podfile deleted file mode 100644 index 71a7f2c4b2..0000000000 --- a/submodules/AsyncDisplayKit/examples/VerticalWithinHorizontalScrolling/Podfile +++ /dev/null @@ -1,5 +0,0 @@ -source 'https://github.com/CocoaPods/Specs.git' -platform :ios, '9.0' -target 'Sample' do - pod 'Texture', :path => '../..' -end diff --git a/submodules/AsyncDisplayKit/examples/VerticalWithinHorizontalScrolling/Sample/AppDelegate.h b/submodules/AsyncDisplayKit/examples/VerticalWithinHorizontalScrolling/Sample/AppDelegate.h deleted file mode 100644 index c30a27f4dc..0000000000 --- a/submodules/AsyncDisplayKit/examples/VerticalWithinHorizontalScrolling/Sample/AppDelegate.h +++ /dev/null @@ -1,18 +0,0 @@ -// -// AppDelegate.h -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -#define UseAutomaticLayout 1 - -@interface AppDelegate : UIResponder - -@property (strong, nonatomic) UIWindow *window; - -@end diff --git a/submodules/AsyncDisplayKit/examples/VerticalWithinHorizontalScrolling/Sample/AppDelegate.m b/submodules/AsyncDisplayKit/examples/VerticalWithinHorizontalScrolling/Sample/AppDelegate.m deleted file mode 100644 index faa44dc60b..0000000000 --- a/submodules/AsyncDisplayKit/examples/VerticalWithinHorizontalScrolling/Sample/AppDelegate.m +++ /dev/null @@ -1,28 +0,0 @@ -// -// AppDelegate.m -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import "AppDelegate.h" - -#import "ViewController.h" - -#import -#import - -@implementation AppDelegate - -- (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 diff --git a/submodules/AsyncDisplayKit/examples/VerticalWithinHorizontalScrolling/Sample/GradientTableNode.h b/submodules/AsyncDisplayKit/examples/VerticalWithinHorizontalScrolling/Sample/GradientTableNode.h deleted file mode 100644 index e679beb7d7..0000000000 --- a/submodules/AsyncDisplayKit/examples/VerticalWithinHorizontalScrolling/Sample/GradientTableNode.h +++ /dev/null @@ -1,22 +0,0 @@ -// -// GradientTableNode.h -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -/** - * This ASCellNode contains an ASTableNode. It intelligently interacts with a containing ASCollectionView, - * to preload and clean up contents as the user scrolls around both vertically and horizontally — in a way that minimizes memory usage. - */ -@interface GradientTableNode : ASCellNode - -- (instancetype)initWithElementSize:(CGSize)size; - -@property (nonatomic) NSInteger pageNumber; - -@end diff --git a/submodules/AsyncDisplayKit/examples/VerticalWithinHorizontalScrolling/Sample/GradientTableNode.mm b/submodules/AsyncDisplayKit/examples/VerticalWithinHorizontalScrolling/Sample/GradientTableNode.mm deleted file mode 100644 index af36ca637c..0000000000 --- a/submodules/AsyncDisplayKit/examples/VerticalWithinHorizontalScrolling/Sample/GradientTableNode.mm +++ /dev/null @@ -1,79 +0,0 @@ -// -// GradientTableNode.mm -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import "GradientTableNode.h" -#import "RandomCoreGraphicsNode.h" -#import "AppDelegate.h" - -#import - -#import -#import - - -@interface GradientTableNode () -{ - ASTableNode *_tableNode; - CGSize _elementSize; -} - -@end - - -@implementation GradientTableNode - -- (instancetype)initWithElementSize:(CGSize)size -{ - if (!(self = [super init])) - return nil; - - _elementSize = size; - - _tableNode = [[ASTableNode alloc] initWithStyle:UITableViewStylePlain]; - _tableNode.delegate = self; - _tableNode.dataSource = self; - - ASRangeTuningParameters rangeTuningParameters; - rangeTuningParameters.leadingBufferScreenfuls = 1.0; - rangeTuningParameters.trailingBufferScreenfuls = 0.5; - [_tableNode setTuningParameters:rangeTuningParameters forRangeType:ASLayoutRangeTypeDisplay]; - - [self addSubnode:_tableNode]; - - return self; -} - -- (NSInteger)tableNode:(ASTableNode *)tableNode numberOfRowsInSection:(NSInteger)section -{ - return 100; -} - -- (ASCellNode *)tableNode:(ASTableNode *)tableNode nodeForRowAtIndexPath:(NSIndexPath *)indexPath -{ - RandomCoreGraphicsNode *elementNode = [[RandomCoreGraphicsNode alloc] init]; - elementNode.style.preferredSize = _elementSize; - elementNode.indexPath = [NSIndexPath indexPathForRow:indexPath.row inSection:_pageNumber]; - - return elementNode; -} - -- (void)tableNode:(ASTableNode *)tableNode didSelectRowAtIndexPath:(NSIndexPath *)indexPath -{ - [tableNode deselectRowAtIndexPath:indexPath animated:NO]; - [_tableNode reloadRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationNone]; -} - -- (void)layout -{ - [super layout]; - - _tableNode.frame = self.bounds; -} - -@end diff --git a/submodules/AsyncDisplayKit/examples/VerticalWithinHorizontalScrolling/Sample/Info.plist b/submodules/AsyncDisplayKit/examples/VerticalWithinHorizontalScrolling/Sample/Info.plist deleted file mode 100644 index 35d842827b..0000000000 --- a/submodules/AsyncDisplayKit/examples/VerticalWithinHorizontalScrolling/Sample/Info.plist +++ /dev/null @@ -1,36 +0,0 @@ - - - - - CFBundleDevelopmentRegion - en - CFBundleExecutable - $(EXECUTABLE_NAME) - CFBundleIdentifier - com.facebook.AsyncDisplayKit.$(PRODUCT_NAME:rfc1034identifier) - CFBundleInfoDictionaryVersion - 6.0 - CFBundleName - $(PRODUCT_NAME) - CFBundlePackageType - APPL - CFBundleShortVersionString - 1.0 - CFBundleSignature - ???? - CFBundleVersion - 1 - LSRequiresIPhoneOS - - UIRequiredDeviceCapabilities - - armv7 - - UISupportedInterfaceOrientations - - UIInterfaceOrientationPortrait - UIInterfaceOrientationLandscapeLeft - UIInterfaceOrientationLandscapeRight - - - diff --git a/submodules/AsyncDisplayKit/examples/VerticalWithinHorizontalScrolling/Sample/RandomCoreGraphicsNode.h b/submodules/AsyncDisplayKit/examples/VerticalWithinHorizontalScrolling/Sample/RandomCoreGraphicsNode.h deleted file mode 100644 index c07752ab1a..0000000000 --- a/submodules/AsyncDisplayKit/examples/VerticalWithinHorizontalScrolling/Sample/RandomCoreGraphicsNode.h +++ /dev/null @@ -1,19 +0,0 @@ -// -// RandomCoreGraphicsNode.h -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -@interface RandomCoreGraphicsNode : ASCellNode -{ - ASTextNode *_indexPathTextNode; -} - -@property NSIndexPath *indexPath; - -@end diff --git a/submodules/AsyncDisplayKit/examples/VerticalWithinHorizontalScrolling/Sample/RandomCoreGraphicsNode.m b/submodules/AsyncDisplayKit/examples/VerticalWithinHorizontalScrolling/Sample/RandomCoreGraphicsNode.m deleted file mode 100644 index bf114349e5..0000000000 --- a/submodules/AsyncDisplayKit/examples/VerticalWithinHorizontalScrolling/Sample/RandomCoreGraphicsNode.m +++ /dev/null @@ -1,103 +0,0 @@ -// -// RandomCoreGraphicsNode.m -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import "RandomCoreGraphicsNode.h" -#import - -@implementation RandomCoreGraphicsNode - -@synthesize indexPath = _indexPath; - -+ (UIColor *)randomColor -{ - 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]; -} - -+ (void)drawRect:(CGRect)bounds withParameters:(id)parameters isCancelled:(asdisplaynode_iscancelled_block_t)isCancelledBlock isRasterizing:(BOOL)isRasterizing -{ - CGFloat locations[3]; - NSMutableArray *colors = [NSMutableArray arrayWithCapacity:3]; - [colors addObject:(id)[[RandomCoreGraphicsNode randomColor] CGColor]]; - locations[0] = 0.0; - [colors addObject:(id)[[RandomCoreGraphicsNode randomColor] CGColor]]; - locations[1] = 1.0; - [colors addObject:(id)[[RandomCoreGraphicsNode randomColor] CGColor]]; - locations[2] = ( arc4random() % 256 / 256.0 ); - - - CGContextRef ctx = UIGraphicsGetCurrentContext(); - CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB(); - CGGradientRef gradient = CGGradientCreateWithColors(colorSpace, (CFArrayRef)colors, locations); - - CGContextDrawLinearGradient(ctx, gradient, CGPointZero, CGPointMake(bounds.size.width, bounds.size.height), 0); - - CGGradientRelease(gradient); - CGColorSpaceRelease(colorSpace); -} - -- (instancetype)init -{ - if (!(self = [super init])) { - return nil; - } - - _indexPathTextNode = [[ASTextNode alloc] init]; - [self addSubnode:_indexPathTextNode]; - - return self; -} - -- (void)setIndexPath:(NSIndexPath *)indexPath -{ - @synchronized (self) { - _indexPath = indexPath; - _indexPathTextNode.attributedText = [[NSAttributedString alloc] initWithString:[indexPath description] attributes:nil]; - } -} - -- (NSIndexPath *)indexPath -{ - NSIndexPath *indexPath = nil; - @synchronized (self) { - indexPath = _indexPath; - } - return indexPath; -} - -- (void)layout -{ - [super layout]; - - _indexPathTextNode.frame = self.bounds; -} - -#if 0 -- (void)fetchData -{ - NSLog(@"fetchData - %@, %@", self, self.indexPath); - [super fetchData]; -} - -- (void)clearFetchedData -{ - NSLog(@"clearFetchedData - %@, %@", self, self.indexPath); - [super clearFetchedData]; -} - -- (void)visibilityDidChange:(BOOL)isVisible -{ - NSLog(@"visibilityDidChange:%d - %@, %@", isVisible, self, self.indexPath); - [super visibilityDidChange:isVisible]; -} -#endif - -@end diff --git a/submodules/AsyncDisplayKit/examples/VerticalWithinHorizontalScrolling/Sample/ViewController.h b/submodules/AsyncDisplayKit/examples/VerticalWithinHorizontalScrolling/Sample/ViewController.h deleted file mode 100644 index c8a0626291..0000000000 --- a/submodules/AsyncDisplayKit/examples/VerticalWithinHorizontalScrolling/Sample/ViewController.h +++ /dev/null @@ -1,14 +0,0 @@ -// -// ViewController.h -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -@interface ViewController : UIViewController - -@end diff --git a/submodules/AsyncDisplayKit/examples/VerticalWithinHorizontalScrolling/Sample/ViewController.m b/submodules/AsyncDisplayKit/examples/VerticalWithinHorizontalScrolling/Sample/ViewController.m deleted file mode 100644 index 7e852414c4..0000000000 --- a/submodules/AsyncDisplayKit/examples/VerticalWithinHorizontalScrolling/Sample/ViewController.m +++ /dev/null @@ -1,86 +0,0 @@ -// -// ViewController.m -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import -#import "ViewController.h" -#import "GradientTableNode.h" - -@interface ViewController () -{ - ASPagerNode *_pagerNode; -} - -@end - -@implementation ViewController - -#pragma mark - -#pragma mark UIViewController. - -- (instancetype)init -{ - if (!(self = [super init])) - return nil; - - _pagerNode = [[ASPagerNode alloc] init]; - _pagerNode.dataSource = self; - _pagerNode.delegate = self; - ASDisplayNode.shouldShowRangeDebugOverlay = YES; - - // Could implement ASCollectionDelegate if we wanted extra callbacks, like from UIScrollView. - //_pagerNode.delegate = self; - - self.title = @"Paging Table Nodes"; - self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemRedo - target:self - action:@selector(reloadEverything)]; - - return self; -} - -- (void)reloadEverything -{ - [_pagerNode reloadData]; -} - -- (void)viewDidLoad -{ - [super viewDidLoad]; - - [self.view addSubnode:_pagerNode]; -} - -- (void)viewWillLayoutSubviews -{ - _pagerNode.frame = self.view.bounds; -} - -#pragma mark - -#pragma mark ASPagerNode. - -- (ASCellNode *)pagerNode:(ASPagerNode *)pagerNode nodeAtIndex:(NSInteger)index -{ - CGSize boundsSize = pagerNode.bounds.size; - CGSize gradientRowSize = CGSizeMake(boundsSize.width, 100); - GradientTableNode *node = [[GradientTableNode alloc] initWithElementSize:gradientRowSize]; - node.pageNumber = index; - return node; -} - -- (ASSizeRange)pagerNode:(ASPagerNode *)pagerNode constrainedSizeForNodeAtIndex:(NSInteger)index; -{ - return ASSizeRangeMake(pagerNode.bounds.size); -} - -- (NSInteger)numberOfPagesInPagerNode:(ASPagerNode *)pagerNode -{ - return 10; -} - -@end diff --git a/submodules/AsyncDisplayKit/examples/VerticalWithinHorizontalScrolling/Sample/main.m b/submodules/AsyncDisplayKit/examples/VerticalWithinHorizontalScrolling/Sample/main.m deleted file mode 100644 index 511cd1a7ac..0000000000 --- a/submodules/AsyncDisplayKit/examples/VerticalWithinHorizontalScrolling/Sample/main.m +++ /dev/null @@ -1,18 +0,0 @@ -// -// main.m -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -#import "AppDelegate.h" - -int main(int argc, char * argv[]) { - @autoreleasepool { - return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); - } -} diff --git a/submodules/AsyncDisplayKit/examples/Videos/Default-568h@2x.png b/submodules/AsyncDisplayKit/examples/Videos/Default-568h@2x.png deleted file mode 100644 index 6ee80b9393..0000000000 Binary files a/submodules/AsyncDisplayKit/examples/Videos/Default-568h@2x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/examples/Videos/Default-667h@2x.png b/submodules/AsyncDisplayKit/examples/Videos/Default-667h@2x.png deleted file mode 100644 index e7b975e21b..0000000000 Binary files a/submodules/AsyncDisplayKit/examples/Videos/Default-667h@2x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/examples/Videos/Default-736h@3x.png b/submodules/AsyncDisplayKit/examples/Videos/Default-736h@3x.png deleted file mode 100644 index c8949cae16..0000000000 Binary files a/submodules/AsyncDisplayKit/examples/Videos/Default-736h@3x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/examples/Videos/Podfile b/submodules/AsyncDisplayKit/examples/Videos/Podfile deleted file mode 100644 index 71a7f2c4b2..0000000000 --- a/submodules/AsyncDisplayKit/examples/Videos/Podfile +++ /dev/null @@ -1,5 +0,0 @@ -source 'https://github.com/CocoaPods/Specs.git' -platform :ios, '9.0' -target 'Sample' do - pod 'Texture', :path => '../..' -end diff --git a/submodules/AsyncDisplayKit/examples/Videos/Sample/ASVideoNode.h b/submodules/AsyncDisplayKit/examples/Videos/Sample/ASVideoNode.h deleted file mode 100644 index bec76ccc57..0000000000 --- a/submodules/AsyncDisplayKit/examples/Videos/Sample/ASVideoNode.h +++ /dev/null @@ -1,37 +0,0 @@ -// -// ASVideoNode.h -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -typedef NS_ENUM(NSUInteger, ASVideoGravity) { - ASVideoGravityResizeAspect, - ASVideoGravityResizeAspectFill, - ASVideoGravityResize -}; - -// set up boolean to repeat video -// set up delegate methods to provide play button -// tapping should play and pause - -@interface ASVideoNode : ASDisplayNode -@property (nonatomic) NSURL *URL; -@property (nonatomic) BOOL shouldRepeat; -@property (nonatomic) ASVideoGravity gravity; - -- (instancetype)initWithURL:(NSURL *)URL; -- (instancetype)initWithURL:(NSURL *)URL videoGravity:(ASVideoGravity)gravity; - -- (void)play; -- (void)pause; - -@end - -@protocol ASVideoNodeDelegate - -@end diff --git a/submodules/AsyncDisplayKit/examples/Videos/Sample/ASVideoNode.m b/submodules/AsyncDisplayKit/examples/Videos/Sample/ASVideoNode.m deleted file mode 100644 index f7db712b5b..0000000000 --- a/submodules/AsyncDisplayKit/examples/Videos/Sample/ASVideoNode.m +++ /dev/null @@ -1,80 +0,0 @@ -// -// ASVideoNode.m -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - - -#import "ASVideoNode.h" - -@interface ASVideoNode () -@property (nonatomic) AVPlayer *player; -@end - -@implementation ASVideoNode - -- (instancetype)initWithURL:(NSURL *)URL; -{ - return [self initWithURL:URL videoGravity:ASVideoGravityResizeAspect]; -} - -- (instancetype)initWithURL:(NSURL *)URL videoGravity:(ASVideoGravity)gravity; -{ - if (!(self = [super initWithLayerBlock:^CALayer *{ - AVPlayerLayer *layer = [[AVPlayerLayer alloc] init]; - AVPlayerItem *item = [[AVPlayerItem alloc] initWithURL:URL]; - - layer.player = [[AVPlayer alloc] initWithPlayerItem:item]; - - return layer; - }])) { return nil; } - - self.gravity = gravity; - - return self; -} - -- (void)setGravity:(ASVideoGravity)gravity; -{ - switch (gravity) { - case ASVideoGravityResize: - ((AVPlayerLayer *)self.layer).videoGravity = AVLayerVideoGravityResize; - break; - case ASVideoGravityResizeAspect: - ((AVPlayerLayer *)self.layer).videoGravity = AVLayerVideoGravityResizeAspect; - break; - case ASVideoGravityResizeAspectFill: - ((AVPlayerLayer *)self.layer).videoGravity = AVLayerVideoGravityResizeAspectFill; - break; - default: - ((AVPlayerLayer *)self.layer).videoGravity = AVLayerVideoGravityResizeAspect; - break; - } -} - -- (ASVideoGravity)gravity; -{ - if ([((AVPlayerLayer *)self.layer).contentsGravity isEqualToString:AVLayerVideoGravityResize]) { - return ASVideoGravityResize; - } - if ([((AVPlayerLayer *)self.layer).contentsGravity isEqualToString:AVLayerVideoGravityResizeAspectFill]) { - return ASVideoGravityResizeAspectFill; - } - - return ASVideoGravityResizeAspect; -} - -- (void)play; -{ - [[((AVPlayerLayer *)self.layer) player] play]; -} - -- (void)pause; -{ - [[((AVPlayerLayer *)self.layer) player] pause]; -} - -@end diff --git a/submodules/AsyncDisplayKit/examples/Videos/Sample/AppDelegate.h b/submodules/AsyncDisplayKit/examples/Videos/Sample/AppDelegate.h deleted file mode 100644 index 19db03c153..0000000000 --- a/submodules/AsyncDisplayKit/examples/Videos/Sample/AppDelegate.h +++ /dev/null @@ -1,16 +0,0 @@ -// -// AppDelegate.h -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -@interface AppDelegate : UIResponder - -@property (strong, nonatomic) UIWindow *window; - -@end diff --git a/submodules/AsyncDisplayKit/examples/Videos/Sample/AppDelegate.m b/submodules/AsyncDisplayKit/examples/Videos/Sample/AppDelegate.m deleted file mode 100644 index d0fd66f775..0000000000 --- a/submodules/AsyncDisplayKit/examples/Videos/Sample/AppDelegate.m +++ /dev/null @@ -1,25 +0,0 @@ -// -// AppDelegate.m -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import "AppDelegate.h" - -#import "ViewController.h" - -@implementation AppDelegate - -- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions -{ - self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; - self.window.backgroundColor = [UIColor whiteColor]; - self.window.rootViewController = [[ViewController alloc] init]; - [self.window makeKeyAndVisible]; - return YES; -} - -@end diff --git a/submodules/AsyncDisplayKit/examples/Videos/Sample/Info.plist b/submodules/AsyncDisplayKit/examples/Videos/Sample/Info.plist deleted file mode 100644 index 35d842827b..0000000000 --- a/submodules/AsyncDisplayKit/examples/Videos/Sample/Info.plist +++ /dev/null @@ -1,36 +0,0 @@ - - - - - CFBundleDevelopmentRegion - en - CFBundleExecutable - $(EXECUTABLE_NAME) - CFBundleIdentifier - com.facebook.AsyncDisplayKit.$(PRODUCT_NAME:rfc1034identifier) - CFBundleInfoDictionaryVersion - 6.0 - CFBundleName - $(PRODUCT_NAME) - CFBundlePackageType - APPL - CFBundleShortVersionString - 1.0 - CFBundleSignature - ???? - CFBundleVersion - 1 - LSRequiresIPhoneOS - - UIRequiredDeviceCapabilities - - armv7 - - UISupportedInterfaceOrientations - - UIInterfaceOrientationPortrait - UIInterfaceOrientationLandscapeLeft - UIInterfaceOrientationLandscapeRight - - - diff --git a/submodules/AsyncDisplayKit/examples/Videos/Sample/ViewController.h b/submodules/AsyncDisplayKit/examples/Videos/Sample/ViewController.h deleted file mode 100644 index 40cc00f2fc..0000000000 --- a/submodules/AsyncDisplayKit/examples/Videos/Sample/ViewController.h +++ /dev/null @@ -1,13 +0,0 @@ -// -// ViewController.h -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// -#import - -@interface ViewController : UIViewController - -@end diff --git a/submodules/AsyncDisplayKit/examples/Videos/Sample/ViewController.m b/submodules/AsyncDisplayKit/examples/Videos/Sample/ViewController.m deleted file mode 100644 index 988b3579b8..0000000000 --- a/submodules/AsyncDisplayKit/examples/Videos/Sample/ViewController.m +++ /dev/null @@ -1,200 +0,0 @@ -// -// ViewController.m -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import "ViewController.h" -#import - -@interface ViewController() -@property (nonatomic, strong) ASDisplayNode *rootNode; -@property (nonatomic, strong) ASVideoNode *guitarVideoNode; -@end - -@implementation ViewController - -#pragma mark - UIViewController - -- (void)viewDidLoad -{ - [super viewDidLoad]; - - // Root node for the view controller - _rootNode = [ASDisplayNode new]; - _rootNode.frame = self.view.bounds; - _rootNode.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight; - - ASVideoNode *guitarVideoNode = self.guitarVideoNode; - [_rootNode addSubnode:self.guitarVideoNode]; - - ASVideoNode *nicCageVideoNode = self.nicCageVideoNode; - [_rootNode addSubnode:nicCageVideoNode]; - - // Video node with custom play button - ASVideoNode *simonVideoNode = self.simonVideoNode; - [_rootNode addSubnode:simonVideoNode]; - - ASVideoNode *hlsVideoNode = self.hlsVideoNode; - [_rootNode addSubnode:hlsVideoNode]; - - CGSize mainScreenBoundsSize = [UIScreen mainScreen].bounds.size; - - _rootNode.layoutSpecBlock = ^ASLayoutSpec *(ASDisplayNode * _Nonnull node, ASSizeRange constrainedSize) { - - // Layout all nodes absolute in a static layout spec - guitarVideoNode.style.preferredSize = CGSizeMake(mainScreenBoundsSize.width, mainScreenBoundsSize.height / 3.0); - guitarVideoNode.style.layoutPosition = CGPointMake(0, 0); - - nicCageVideoNode.style.preferredSize = CGSizeMake(mainScreenBoundsSize.width/2, mainScreenBoundsSize.height / 3.0); - nicCageVideoNode.style.layoutPosition = CGPointMake(mainScreenBoundsSize.width / 2.0, mainScreenBoundsSize.height / 3.0); - - simonVideoNode.style.preferredSize = CGSizeMake(mainScreenBoundsSize.width/2, mainScreenBoundsSize.height / 3.0); - simonVideoNode.style.layoutPosition = CGPointMake(0.0, mainScreenBoundsSize.height - (mainScreenBoundsSize.height / 3.0)); - - hlsVideoNode.style.preferredSize = CGSizeMake(mainScreenBoundsSize.width / 2.0, mainScreenBoundsSize.height / 3.0); - hlsVideoNode.style.layoutPosition = CGPointMake(0.0, mainScreenBoundsSize.height / 3.0); - - return [ASAbsoluteLayoutSpec absoluteLayoutSpecWithChildren:@[guitarVideoNode, nicCageVideoNode, simonVideoNode, hlsVideoNode]]; - }; - - // Delay setting video asset for testing that the transition between the placeholder and setting/playing the asset is seamless. - dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(3 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ - hlsVideoNode.asset = [AVAsset assetWithURL:[NSURL URLWithString:@"http://devimages.apple.com/iphone/samples/bipbop/gear1/prog_index.m3u8"]]; - [hlsVideoNode play]; - }); - - [self.view addSubnode:_rootNode]; -} - -#pragma mark - Getter / Setter - -- (ASVideoNode *)guitarVideoNode; -{ - if (_guitarVideoNode) { - return _guitarVideoNode; - } - - _guitarVideoNode = [[ASVideoNode alloc] init]; - _guitarVideoNode.asset = [AVAsset assetWithURL:[NSURL URLWithString:@"https://files.parsetfss.com/8a8a3b0c-619e-4e4d-b1d5-1b5ba9bf2b42/tfss-3045b261-7e93-4492-b7e5-5d6358376c9f-editedLiveAndDie.mov"]]; - _guitarVideoNode.gravity = AVLayerVideoGravityResizeAspectFill; - _guitarVideoNode.backgroundColor = [UIColor lightGrayColor]; - _guitarVideoNode.periodicTimeObserverTimescale = 1; //Default is 100 - _guitarVideoNode.delegate = self; - - return _guitarVideoNode; -} - -- (ASVideoNode *)nicCageVideoNode; -{ - ASVideoNode *nicCageVideoNode = [[ASVideoNode alloc] init]; - nicCageVideoNode.delegate = self; - nicCageVideoNode.asset = [AVAsset assetWithURL:[NSURL URLWithString:@"https://files.parsetfss.com/8a8a3b0c-619e-4e4d-b1d5-1b5ba9bf2b42/tfss-753fe655-86bb-46da-89b7-aa59c60e49c0-niccage.mp4"]]; - nicCageVideoNode.gravity = AVLayerVideoGravityResize; - nicCageVideoNode.backgroundColor = [UIColor lightGrayColor]; - nicCageVideoNode.shouldAutorepeat = YES; - nicCageVideoNode.shouldAutoplay = YES; - nicCageVideoNode.muted = YES; - - return nicCageVideoNode; -} - -- (ASVideoNode *)simonVideoNode -{ - ASVideoNode *simonVideoNode = [[ASVideoNode alloc] init]; - - NSURL *url = [NSURL fileURLWithPath:[[NSBundle mainBundle] pathForResource:@"simon" ofType:@"mp4"]]; - simonVideoNode.asset = [AVAsset assetWithURL:url]; - simonVideoNode.gravity = AVLayerVideoGravityResizeAspect; - simonVideoNode.backgroundColor = [UIColor lightGrayColor]; - simonVideoNode.shouldAutorepeat = YES; - simonVideoNode.shouldAutoplay = YES; - simonVideoNode.muted = YES; - - return simonVideoNode; -} - -- (ASVideoNode *)hlsVideoNode; -{ - ASVideoNode *hlsVideoNode = [[ASVideoNode alloc] init]; - - hlsVideoNode.delegate = self; - hlsVideoNode.gravity = AVLayerVideoGravityResize; - hlsVideoNode.backgroundColor = [UIColor redColor]; // Should not be seen after placeholder image is loaded - hlsVideoNode.shouldAutorepeat = YES; - hlsVideoNode.shouldAutoplay = YES; - hlsVideoNode.muted = YES; - - // Placeholder image - hlsVideoNode.URL = [NSURL URLWithString:@"https://upload.wikimedia.org/wikipedia/en/5/52/Testcard_F.jpg"]; - - return hlsVideoNode; -} - -- (ASButtonNode *)playButton; -{ - ASButtonNode *playButtonNode = [[ASButtonNode alloc] init]; - - UIImage *image = [UIImage imageNamed:@"playButton@2x.png"]; - [playButtonNode setImage:image forState:UIControlStateNormal]; - [playButtonNode setImage:[UIImage imageNamed:@"playButtonSelected@2x.png"] forState:UIControlStateHighlighted]; - - // Change placement of play button if necessary - //playButtonNode.contentHorizontalAlignment = ASHorizontalAlignmentStart; - //playButtonNode.contentVerticalAlignment = ASVerticalAlignmentCenter; - - return playButtonNode; -} - -#pragma mark - Actions - -- (void)didTapVideoNode:(ASVideoNode *)videoNode -{ - if (videoNode == self.guitarVideoNode) { - if (videoNode.playerState == ASVideoNodePlayerStatePlaying) { - [videoNode pause]; - } else if(videoNode.playerState == ASVideoNodePlayerStateLoading) { - [videoNode pause]; - } else { - [videoNode play]; - } - return; - } - if (videoNode.player.muted == YES) { - videoNode.player.muted = NO; - } else { - videoNode.player.muted = YES; - } -} - -#pragma mark - ASVideoNodeDelegate - -- (void)videoNode:(ASVideoNode *)videoNode willChangePlayerState:(ASVideoNodePlayerState)state toState:(ASVideoNodePlayerState)toState -{ - //Ignore nicCageVideo - if (videoNode != _guitarVideoNode) { - return; - } - - if (toState == ASVideoNodePlayerStatePlaying) { - NSLog(@"guitarVideoNode is playing"); - } else if (toState == ASVideoNodePlayerStateFinished) { - NSLog(@"guitarVideoNode finished"); - } else if (toState == ASVideoNodePlayerStateLoading) { - NSLog(@"guitarVideoNode is buffering"); - } -} - -- (void)videoNode:(ASVideoNode *)videoNode didPlayToTimeInterval:(NSTimeInterval)timeInterval -{ - if (videoNode != _guitarVideoNode) { - return; - } - - NSLog(@"guitarVideoNode playback time is: %f",timeInterval); -} - -@end diff --git a/submodules/AsyncDisplayKit/examples/Videos/Sample/bearacrat@2x.jpg b/submodules/AsyncDisplayKit/examples/Videos/Sample/bearacrat@2x.jpg deleted file mode 100644 index a083949d6f..0000000000 Binary files a/submodules/AsyncDisplayKit/examples/Videos/Sample/bearacrat@2x.jpg and /dev/null differ diff --git a/submodules/AsyncDisplayKit/examples/Videos/Sample/main.m b/submodules/AsyncDisplayKit/examples/Videos/Sample/main.m deleted file mode 100644 index 511cd1a7ac..0000000000 --- a/submodules/AsyncDisplayKit/examples/Videos/Sample/main.m +++ /dev/null @@ -1,18 +0,0 @@ -// -// main.m -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -#import "AppDelegate.h" - -int main(int argc, char * argv[]) { - @autoreleasepool { - return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); - } -} diff --git a/submodules/AsyncDisplayKit/examples/Videos/Sample/playButton@2x.png b/submodules/AsyncDisplayKit/examples/Videos/Sample/playButton@2x.png deleted file mode 100644 index 9ac2481afe..0000000000 Binary files a/submodules/AsyncDisplayKit/examples/Videos/Sample/playButton@2x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/examples/Videos/Sample/playButtonSelected@2x.png b/submodules/AsyncDisplayKit/examples/Videos/Sample/playButtonSelected@2x.png deleted file mode 100644 index f22ebc0f81..0000000000 Binary files a/submodules/AsyncDisplayKit/examples/Videos/Sample/playButtonSelected@2x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/examples/Videos/Sample/simon.mp4 b/submodules/AsyncDisplayKit/examples/Videos/Sample/simon.mp4 deleted file mode 100644 index 95a4176c82..0000000000 Binary files a/submodules/AsyncDisplayKit/examples/Videos/Sample/simon.mp4 and /dev/null differ diff --git a/submodules/AsyncDisplayKit/examples_extra/ASDKgram-Swift/ASDKgram-Swift.xcworkspace/contents.xcworkspacedata b/submodules/AsyncDisplayKit/examples_extra/ASDKgram-Swift/ASDKgram-Swift.xcworkspace/contents.xcworkspacedata deleted file mode 100644 index 102e5c6013..0000000000 --- a/submodules/AsyncDisplayKit/examples_extra/ASDKgram-Swift/ASDKgram-Swift.xcworkspace/contents.xcworkspacedata +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - diff --git a/submodules/AsyncDisplayKit/examples_extra/ASDKgram-Swift/ASDKgram-Swift.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/submodules/AsyncDisplayKit/examples_extra/ASDKgram-Swift/ASDKgram-Swift.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist deleted file mode 100644 index 18d981003d..0000000000 --- a/submodules/AsyncDisplayKit/examples_extra/ASDKgram-Swift/ASDKgram-Swift.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +++ /dev/null @@ -1,8 +0,0 @@ - - - - - IDEDidComputeMac32BitWarning - - - diff --git a/submodules/AsyncDisplayKit/examples_extra/ASDKgram-Swift/ASDKgram-Swift/AppDelegate.swift b/submodules/AsyncDisplayKit/examples_extra/ASDKgram-Swift/ASDKgram-Swift/AppDelegate.swift deleted file mode 100644 index 990773f687..0000000000 --- a/submodules/AsyncDisplayKit/examples_extra/ASDKgram-Swift/ASDKgram-Swift/AppDelegate.swift +++ /dev/null @@ -1,51 +0,0 @@ -// -// AppDelegate.swift -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -import UIKit -import AsyncDisplayKit - -@UIApplicationMain -class AppDelegate: UIResponder, UIApplicationDelegate { - - var window: UIWindow? - - func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool { - - // UIKit Home Feed viewController & navController - - let UIKitNavController = UINavigationController(rootViewController: PhotoFeedTableViewController()) - UIKitNavController.tabBarItem.title = "UIKit" - - // ASDK Home Feed viewController & navController - - let ASDKNavController = UINavigationController(rootViewController: PhotoFeedTableNodeController()) - ASDKNavController.tabBarItem.title = "ASDK" - - // UITabBarController - - let tabBarController = UITabBarController() - tabBarController.viewControllers = [UIKitNavController, ASDKNavController] - tabBarController.selectedIndex = 1 - tabBarController.tabBar.tintColor = UIColor.mainBarTintColor - - // Nav Bar appearance - - UINavigationBar.appearance().barTintColor = UIColor.mainBarTintColor - - // UIWindow - - window = UIWindow() - window?.backgroundColor = .white - window?.rootViewController = tabBarController - window?.makeKeyAndVisible() - - return true - } - -} diff --git a/submodules/AsyncDisplayKit/examples_extra/ASDKgram-Swift/ASDKgram-Swift/Assets.xcassets/AppIcon.appiconset/Contents.json b/submodules/AsyncDisplayKit/examples_extra/ASDKgram-Swift/ASDKgram-Swift/Assets.xcassets/AppIcon.appiconset/Contents.json deleted file mode 100644 index 1d060ed288..0000000000 --- a/submodules/AsyncDisplayKit/examples_extra/ASDKgram-Swift/ASDKgram-Swift/Assets.xcassets/AppIcon.appiconset/Contents.json +++ /dev/null @@ -1,93 +0,0 @@ -{ - "images" : [ - { - "idiom" : "iphone", - "size" : "20x20", - "scale" : "2x" - }, - { - "idiom" : "iphone", - "size" : "20x20", - "scale" : "3x" - }, - { - "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" : "20x20", - "scale" : "1x" - }, - { - "idiom" : "ipad", - "size" : "20x20", - "scale" : "2x" - }, - { - "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" - } -} \ No newline at end of file diff --git a/submodules/AsyncDisplayKit/examples_extra/ASDKgram-Swift/ASDKgram-Swift/Base.lproj/LaunchScreen.storyboard b/submodules/AsyncDisplayKit/examples_extra/ASDKgram-Swift/ASDKgram-Swift/Base.lproj/LaunchScreen.storyboard deleted file mode 100644 index c1191aaf8d..0000000000 --- a/submodules/AsyncDisplayKit/examples_extra/ASDKgram-Swift/ASDKgram-Swift/Base.lproj/LaunchScreen.storyboard +++ /dev/null @@ -1,43 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/submodules/AsyncDisplayKit/examples_extra/ASDKgram-Swift/ASDKgram-Swift/Base.lproj/Main.storyboard b/submodules/AsyncDisplayKit/examples_extra/ASDKgram-Swift/ASDKgram-Swift/Base.lproj/Main.storyboard deleted file mode 100644 index 273375fc70..0000000000 --- a/submodules/AsyncDisplayKit/examples_extra/ASDKgram-Swift/ASDKgram-Swift/Base.lproj/Main.storyboard +++ /dev/null @@ -1,26 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/submodules/AsyncDisplayKit/examples_extra/ASDKgram-Swift/ASDKgram-Swift/Constants.swift b/submodules/AsyncDisplayKit/examples_extra/ASDKgram-Swift/ASDKgram-Swift/Constants.swift deleted file mode 100644 index f4da709f26..0000000000 --- a/submodules/AsyncDisplayKit/examples_extra/ASDKgram-Swift/ASDKgram-Swift/Constants.swift +++ /dev/null @@ -1,34 +0,0 @@ -// -// Constants.swift -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -import UIKit - -struct Constants { - struct Unsplash { - struct URLS { - static let Host = "https://api.unsplash.com/" - static let PopularEndpoint = "photos?order_by=popular" - static let SearchEndpoint = "photos/search?geo=" //latitude,longitude,radius - static let UserEndpoint = "photos?user_id=" - static let ConsumerKey = "&client_id=3b99a69cee09770a4a0bbb870b437dbda53efb22f6f6de63714b71c4df7c9642" - static let ImagesPerPage = 30 - } - } - - struct CellLayout { - static let FontSize: CGFloat = 14 - static let HeaderHeight: CGFloat = 50 - static let UserImageHeight: CGFloat = 30 - static let HorizontalBuffer: CGFloat = 10 - static let VerticalBuffer: CGFloat = 5 - static let InsetForAvatar = UIEdgeInsets(top: HorizontalBuffer, left: 0, bottom: HorizontalBuffer, right: HorizontalBuffer) - static let InsetForHeader = UIEdgeInsets(top: 0, left: HorizontalBuffer, bottom: 0, right: HorizontalBuffer) - static let InsetForFooter = UIEdgeInsets(top: VerticalBuffer, left: HorizontalBuffer, bottom: VerticalBuffer, right: HorizontalBuffer) - } -} diff --git a/submodules/AsyncDisplayKit/examples_extra/ASDKgram-Swift/ASDKgram-Swift/Date.swift b/submodules/AsyncDisplayKit/examples_extra/ASDKgram-Swift/ASDKgram-Swift/Date.swift deleted file mode 100644 index d367584b10..0000000000 --- a/submodules/AsyncDisplayKit/examples_extra/ASDKgram-Swift/ASDKgram-Swift/Date.swift +++ /dev/null @@ -1,39 +0,0 @@ -// -// Date.swift -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -import Foundation - -extension Date { - static let iso8601Formatter: DateFormatter = { - let formatter = DateFormatter() - formatter.calendar = Calendar(identifier: .iso8601) - formatter.locale = Locale(identifier: "en_US_POSIX") - formatter.timeZone = TimeZone(secondsFromGMT: 0) - formatter.dateFormat = "yyyy-MM-dd'T'HH:mm:ssZZZZZ" - return formatter - }() - - static func timeStringSince(fromConverted date: Date) -> String { - let diffDates = NSCalendar.current.dateComponents([.day, .hour, .second], from: date, to: Date()) - - if let week = diffDates.day, week > 7 { - return "\(week / 7)w" - } else if let day = diffDates.day, day > 0 { - return "\(day)d" - } else if let hour = diffDates.hour, hour > 0 { - return "\(hour)h" - } else if let second = diffDates.second, second > 0 { - return "\(second)s" - } else if let zero = diffDates.second, zero == 0 { - return "1s" - } else { - return "ERROR" - } - } -} diff --git a/submodules/AsyncDisplayKit/examples_extra/ASDKgram-Swift/ASDKgram-Swift/Info.plist b/submodules/AsyncDisplayKit/examples_extra/ASDKgram-Swift/ASDKgram-Swift/Info.plist deleted file mode 100644 index c12df3b8a9..0000000000 --- a/submodules/AsyncDisplayKit/examples_extra/ASDKgram-Swift/ASDKgram-Swift/Info.plist +++ /dev/null @@ -1,43 +0,0 @@ - - - - - CFBundleDevelopmentRegion - en - CFBundleExecutable - $(EXECUTABLE_NAME) - CFBundleIdentifier - $(PRODUCT_BUNDLE_IDENTIFIER) - CFBundleInfoDictionaryVersion - 6.0 - CFBundleName - $(PRODUCT_NAME) - CFBundlePackageType - APPL - CFBundleShortVersionString - 1.0 - CFBundleVersion - 1 - LSRequiresIPhoneOS - - UILaunchStoryboardName - LaunchScreen - UIRequiredDeviceCapabilities - - armv7 - - UISupportedInterfaceOrientations - - UIInterfaceOrientationPortrait - UIInterfaceOrientationLandscapeLeft - UIInterfaceOrientationLandscapeRight - - UISupportedInterfaceOrientations~ipad - - UIInterfaceOrientationPortrait - UIInterfaceOrientationPortraitUpsideDown - UIInterfaceOrientationLandscapeLeft - UIInterfaceOrientationLandscapeRight - - - diff --git a/submodules/AsyncDisplayKit/examples_extra/ASDKgram-Swift/ASDKgram-Swift/NetworkImageView.swift b/submodules/AsyncDisplayKit/examples_extra/ASDKgram-Swift/ASDKgram-Swift/NetworkImageView.swift deleted file mode 100644 index 937f87fadf..0000000000 --- a/submodules/AsyncDisplayKit/examples_extra/ASDKgram-Swift/ASDKgram-Swift/NetworkImageView.swift +++ /dev/null @@ -1,47 +0,0 @@ -// -// NetworkImageView.swift -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -import UIKit - -let imageCache = NSCache() - -class NetworkImageView: UIImageView { - - var imageUrlString: String? - - func loadImageUsingUrlString(urlString: String) { - - imageUrlString = urlString - - let url = URL(string: urlString) - - image = nil - - if let imageFromCache = imageCache.object(forKey: urlString as NSString) { - self.image = imageFromCache - return - } - - URLSession.shared.dataTask(with: url!, completionHandler: { (data, respones, error) in - - if error != nil { - print(error!) - return - } - - DispatchQueue.main.async { - let imageToCache = UIImage(data: data!) - if self.imageUrlString == urlString { - self.image = imageToCache - } - imageCache.setObject(imageToCache!, forKey: urlString as NSString) - } - }).resume() - } -} diff --git a/submodules/AsyncDisplayKit/examples_extra/ASDKgram-Swift/ASDKgram-Swift/NumberFormatter.swift b/submodules/AsyncDisplayKit/examples_extra/ASDKgram-Swift/ASDKgram-Swift/NumberFormatter.swift deleted file mode 100644 index 246f398b94..0000000000 --- a/submodules/AsyncDisplayKit/examples_extra/ASDKgram-Swift/ASDKgram-Swift/NumberFormatter.swift +++ /dev/null @@ -1,18 +0,0 @@ -// -// NumberFormatter.swift -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -import Foundation - -extension NumberFormatter { - static let decimalNumberFormatter: NumberFormatter = { - let formatter = NumberFormatter() - formatter.numberStyle = .decimal - return formatter - }() -} diff --git a/submodules/AsyncDisplayKit/examples_extra/ASDKgram-Swift/ASDKgram-Swift/OrderedDictionary/OrderedDictionary+Codable.swift b/submodules/AsyncDisplayKit/examples_extra/ASDKgram-Swift/ASDKgram-Swift/OrderedDictionary/OrderedDictionary+Codable.swift deleted file mode 100644 index 45e5de48f7..0000000000 --- a/submodules/AsyncDisplayKit/examples_extra/ASDKgram-Swift/ASDKgram-Swift/OrderedDictionary/OrderedDictionary+Codable.swift +++ /dev/null @@ -1,142 +0,0 @@ -// -// OrderedDictionary+Codable.swift -// Texture -// -// Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#if swift(>=4.1) - -extension OrderedDictionary: Encodable where Key: Encodable, Value: Encodable { - - /// __inheritdoc__ - public func encode(to encoder: Encoder) throws { - // Encode the ordered dictionary as an array of alternating key-value pairs. - var container = encoder.unkeyedContainer() - - for (key, value) in self { - try container.encode(key) - try container.encode(value) - } - } - -} - -extension OrderedDictionary: Decodable where Key: Decodable, Value: Decodable { - - /// __inheritdoc__ - public init(from decoder: Decoder) throws { - // Decode the ordered dictionary from an array of alternating key-value pairs. - self.init() - - var container = try decoder.unkeyedContainer() - - while !container.isAtEnd { - let key = try container.decode(Key.self) - guard !container.isAtEnd else { throw DecodingError.unkeyedContainerReachedEndBeforeValue(decoder.codingPath) } - let value = try container.decode(Value.self) - - self[key] = value - } - } - -} - -#else - -extension OrderedDictionary: Encodable { - - /// __inheritdoc__ - public func encode(to encoder: Encoder) throws { - // Since Swift 4.0 lacks the protocol conditional conformance support, we have to make the - // whole OrderedDictionary type conform to Encodable and assert that the key and value - // types conform to Encodable. Furthermore, we leverage a trick of super encoders to be - // able to encode objects without knowing their exact types. This trick was used in the - // standard library for encoding/decoding Dictionary before Swift 4.1. - - _assertTypeIsEncodable(Key.self, in: type(of: self)) - _assertTypeIsEncodable(Value.self, in: type(of: self)) - - var container = encoder.unkeyedContainer() - - for (key, value) in self { - let keyEncoder = container.superEncoder() - try (key as! Encodable).encode(to: keyEncoder) - - let valueEncoder = container.superEncoder() - try (value as! Encodable).encode(to: valueEncoder) - } - } - - private func _assertTypeIsEncodable(_ type: T.Type, in wrappingType: Any.Type) { - guard T.self is Encodable.Type else { - if T.self == Encodable.self || T.self == Codable.self { - preconditionFailure("\(wrappingType) does not conform to Encodable because Encodable does not conform to itself. You must use a concrete type to encode or decode.") - } else { - preconditionFailure("\(wrappingType) does not conform to Encodable because \(T.self) does not conform to Encodable.") - } - } - } - -} - -extension OrderedDictionary: Decodable { - - /// __inheritdoc__ - public init(from decoder: Decoder) throws { - // Since Swift 4.0 lacks the protocol conditional conformance support, we have to make the - // whole OrderedDictionary type conform to Decodable and assert that the key and value - // types conform to Decodable. Furthermore, we leverage a trick of super decoders to be - // able to decode objects without knowing their exact types. This trick was used in the - // standard library for encoding/decoding Dictionary before Swift 4.1. - - self.init() - - _assertTypeIsDecodable(Key.self, in: type(of: self)) - _assertTypeIsDecodable(Value.self, in: type(of: self)) - - var container = try decoder.unkeyedContainer() - - let keyMetaType = (Key.self as! Decodable.Type) - let valueMetaType = (Value.self as! Decodable.Type) - - while !container.isAtEnd { - let keyDecoder = try container.superDecoder() - let key = try keyMetaType.init(from: keyDecoder) as! Key - - guard !container.isAtEnd else { throw DecodingError.unkeyedContainerReachedEndBeforeValue(decoder.codingPath) } - - let valueDecoder = try container.superDecoder() - let value = try valueMetaType.init(from: valueDecoder) as! Value - - self[key] = value - } - } - - private func _assertTypeIsDecodable(_ type: T.Type, in wrappingType: Any.Type) { - guard T.self is Decodable.Type else { - if T.self == Decodable.self || T.self == Codable.self { - preconditionFailure("\(wrappingType) does not conform to Decodable because Decodable does not conform to itself. You must use a concrete type to encode or decode.") - } else { - preconditionFailure("\(wrappingType) does not conform to Decodable because \(T.self) does not conform to Decodable.") - } - } - } - -} - -#endif - -fileprivate extension DecodingError { - - fileprivate static func unkeyedContainerReachedEndBeforeValue(_ codingPath: [CodingKey]) -> DecodingError { - return DecodingError.dataCorrupted( - DecodingError.Context( - codingPath: codingPath, - debugDescription: "Unkeyed container reached end before value in key-value pair." - ) - ) - } - -} diff --git a/submodules/AsyncDisplayKit/examples_extra/ASDKgram-Swift/ASDKgram-Swift/OrderedDictionary/OrderedDictionary+Description.swift b/submodules/AsyncDisplayKit/examples_extra/ASDKgram-Swift/ASDKgram-Swift/OrderedDictionary/OrderedDictionary+Description.swift deleted file mode 100644 index 604dbac119..0000000000 --- a/submodules/AsyncDisplayKit/examples_extra/ASDKgram-Swift/ASDKgram-Swift/OrderedDictionary/OrderedDictionary+Description.swift +++ /dev/null @@ -1,58 +0,0 @@ -// -// OrderedDictionary+Description.swift -// Texture -// -// Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -extension OrderedDictionary: CustomStringConvertible { - - /// A textual representation of the ordered dictionary. - public var description: String { - return makeDescription(debug: false) - } - -} - -extension OrderedDictionary: CustomDebugStringConvertible { - - /// A textual representation of the ordered dictionary, suitable for debugging. - public var debugDescription: String { - return makeDescription(debug: true) - } - -} - -extension OrderedDictionary { - - fileprivate func makeDescription(debug: Bool) -> String { - // The implementation of the description is inspired by zwaldowski's implementation of the - // ordered dictionary. See http://bit.ly/2iqGhrb - - if isEmpty { return "[:]" } - - let printFunction: (Any, inout String) -> () = { - if debug { - return { debugPrint($0, separator: "", terminator: "", to: &$1) } - } else { - return { print($0, separator: "", terminator: "", to: &$1) } - } - }() - - let descriptionForItem: (Any) -> String = { item in - var description = "" - printFunction(item, &description) - return description - } - - let bodyComponents = map { element in - return descriptionForItem(element.key) + ": " + descriptionForItem(element.value) - } - - let body = bodyComponents.joined(separator: ", ") - - return "[\(body)]" - } - -} diff --git a/submodules/AsyncDisplayKit/examples_extra/ASDKgram-Swift/ASDKgram-Swift/OrderedDictionary/OrderedDictionary.swift b/submodules/AsyncDisplayKit/examples_extra/ASDKgram-Swift/ASDKgram-Swift/OrderedDictionary/OrderedDictionary.swift deleted file mode 100644 index 38bb9853f2..0000000000 --- a/submodules/AsyncDisplayKit/examples_extra/ASDKgram-Swift/ASDKgram-Swift/OrderedDictionary/OrderedDictionary.swift +++ /dev/null @@ -1,618 +0,0 @@ -// -// OrderedDictionary.swift -// Texture -// -// Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -/// A generic collection for storing key-value pairs in an ordered manner. -/// -/// Same as in a dictionary all keys in the collection are unique and have an associated value. -/// Same as in an array, all key-value pairs (elements) are kept sorted and accessible by -/// a zero-based integer index. -public struct OrderedDictionary: BidirectionalCollection { - - // ======================================================= // - // MARK: - Type Aliases - // ======================================================= // - - /// The type of the key-value pair stored in the ordered dictionary. - public typealias Element = (key: Key, value: Value) - - /// The type of the index. - public typealias Index = Int - - /// The type of the indices collection. - public typealias Indices = CountableRange - - /// The type of the contiguous subrange of the ordered dictionary's elements. - /// - /// - SeeAlso: OrderedDictionarySlice - public typealias SubSequence = OrderedDictionarySlice - - // ======================================================= // - // MARK: - Initialization - // ======================================================= // - - /// Creates an empty ordered dictionary. - public init() {} - - /// Creates an ordered dictionary from a sequence of values keyed by a key which gets extracted - /// from the value in the provided closure. - /// - /// - Parameter values: The sequence of values. - /// - Parameter getKey: The closure which provides a key for the given value from the values - /// sequence. - public init(values: Values, keyedBy getKey: (Value) -> Key) where Values.Element == Value { - self.init(values.map { (getKey($0), $0) }) - } - - /// Creates an ordered dictionary from a sequence of values keyed by a key loaded from the value - /// at the given key path. - /// - /// - Parameter values: The sequence of values. - /// - Parameter keyPath: The key path for the value to locate its key at. - public init(values: [Value], keyedBy keyPath: KeyPath) { - self.init(values.map { ($0[keyPath: keyPath], $0) }) - } - - /// Creates an ordered dictionary from a regular unsorted dictionary by sorting it using the - /// the given sort function. - /// - /// - Parameter unsorted: The unsorted dictionary. - /// - Parameter areInIncreasingOrder: The sort function which compares the key-value pairs. - public init(unsorted: Dictionary, areInIncreasingOrder: (Element, Element) -> Bool) { - let elements = unsorted - .map { (key: $0.key, value: $0.value) } - .sorted(by: areInIncreasingOrder) - - self.init(elements) - } - - /// Creates an ordered dictionary from a sequence of key-value pairs. - /// - /// - Parameter elements: The key-value pairs that will make up the new ordered dictionary. - /// Each key in `elements` must be unique. - public init(_ elements: S) where S.Element == Element { - for (key, value) in elements { - precondition(!containsKey(key), "Elements sequence contains duplicate keys") - self[key] = value - } - } - - // ======================================================= // - // MARK: - Ordered Keys & Values - // ======================================================= // - - /// A collection containing just the keys of the ordered dictionary in the correct order. - public var orderedKeys: OrderedDictionaryKeys { - return self.lazy.map { $0.key } - } - - /// A collection containing just the values of the ordered dictionary in the correct order. - public var orderedValues: OrderedDictionaryValues { - return self.lazy.map { $0.value } - } - - // ======================================================= // - // MARK: - Dictionary - // ======================================================= // - - /// Converts itself to a common unsorted dictionary. - public var unorderedDictionary: Dictionary { - return _keysToValues - } - - // ======================================================= // - // MARK: - Key-based Access - // ======================================================= // - - /// Accesses the value associated with the given key for reading and writing. - /// - /// This key-based subscript returns the value for the given key if the key is found in the - /// ordered dictionary, or `nil` if the key is not found. - /// - /// When you assign a value for a key and that key already exists, the ordered dictionary - /// overwrites the existing value and preservers the index of the key-value pair. If the ordered - /// dictionary does not contain the key, a new key-value pair is appended to the end of the - /// ordered dictionary. - /// - /// If you assign `nil` as the value for the given key, the ordered dictionary removes that key - /// and its associated value if it exists. - /// - /// - Parameter key: The key to find in the ordered dictionary. - /// - Returns: The value associated with `key` if `key` is in the ordered dictionary; otherwise, - /// `nil`. - public subscript(key: Key) -> Value? { - get { - return value(forKey: key) - } - set(newValue) { - if let newValue = newValue { - updateValue(newValue, forKey: key) - } else { - removeValue(forKey: key) - } - } - } - - /// Returns a Boolean value indicating whether the ordered dictionary contains the given key. - /// - /// - Parameter key: The key to be looked up. - /// - Returns: `true` if the ordered dictionary contains the given key; otherwise, `false`. - public func containsKey(_ key: Key) -> Bool { - return _keysToValues[key] != nil - } - - /// Returns the value associated with the given key if the key is found in the ordered - /// dictionary, or `nil` if the key is not found. - /// - /// - Parameter key: The key to find in the ordered dictionary. - /// - Returns: The value associated with `key` if `key` is in the ordered dictionary; otherwise, - /// `nil`. - public func value(forKey key: Key) -> Value? { - return _keysToValues[key] - } - - /// Updates the value stored in the ordered dictionary for the given key, or appends a new - /// key-value pair if the key does not exist. - /// - /// - Parameter value: The new value to add to the ordered dictionary. - /// - Parameter key: The key to associate with `value`. If `key` already exists in the ordered - /// dictionary, `value` replaces the existing associated value. If `key` is not already a key - /// of the ordered dictionary, the `(key, value)` pair is appended at the end of the ordered - /// dictionary. - @discardableResult - public mutating func updateValue(_ value: Value, forKey key: Key) -> Value? { - if containsKey(key) { - let currentValue = _unsafeValue(forKey: key) - - _keysToValues[key] = value - - return currentValue - } else { - _orderedKeys.append(key) - _keysToValues[key] = value - - return nil - } - } - - /// Removes the given key and its associated value from the ordered dictionary. - /// - /// If the key is found in the ordered dictionary, this method returns the key's associated - /// value. On removal, the indices of the ordered dictionary are invalidated. If the key is - /// not found in the ordered dictionary, this method returns `nil`. - /// - /// - Parameter key: The key to remove along with its associated value. - /// - Returns: The value that was removed, or `nil` if the key was not present in the - /// ordered dictionary. - /// - /// - SeeAlso: remove(at:) - @discardableResult - public mutating func removeValue(forKey key: Key) -> Value? { - guard let index = index(forKey: key) else { return nil } - - let currentValue = self[index].value - - _orderedKeys.remove(at: index) - _keysToValues[key] = nil - - return currentValue - } - - /// Removes all key-value pairs from the ordered dictionary and invalidates all indices. - /// - /// - Parameter keepCapacity: Whether the ordered dictionary should keep its underlying storage. - /// If you pass `true`, the operation preserves the storage capacity that the collection has, - /// otherwise the underlying storage is released. The default is `false`. - public mutating func removeAll(keepingCapacity keepCapacity: Bool = false) { - _orderedKeys.removeAll(keepingCapacity: keepCapacity) - _keysToValues.removeAll(keepingCapacity: keepCapacity) - } - - private func _unsafeValue(forKey key: Key) -> Value { - let value = _keysToValues[key] - precondition(value != nil, "Inconsistency error occurred in OrderedDictionary") - return value! - } - - // ======================================================= // - // MARK: - Index-based Access - // ======================================================= // - - /// Accesses the key-value pair at the specified position. - /// - /// The specified position has to be a valid index of the ordered dictionary. The index-base - /// subscript returns the key-value pair corresponding to the index. - /// - /// - Parameter position: The position of the key-value pair to access. `position` must be - /// a valid index of the ordered dictionary and not equal to `endIndex`. - /// - Returns: A tuple containing the key-value pair corresponding to `position`. - /// - /// - SeeAlso: update(:at:) - public subscript(position: Index) -> Element { - precondition(indices.contains(position), "OrderedDictionary index is out of range") - - let key = _orderedKeys[position] - let value = _unsafeValue(forKey: key) - - return (key, value) - } - - /// Returns the index for the given key. - /// - /// - Parameter key: The key to find in the ordered dictionary. - /// - Returns: The index for `key` and its associated value if `key` is in the ordered - /// dictionary; otherwise, `nil`. - public func index(forKey key: Key) -> Index? { - return _orderedKeys.index(of: key) - } - - /// Returns the key-value pair at the specified index, or `nil` if there is no key-value pair - /// at that index. - /// - /// - Parameter index: The index of the key-value pair to be looked up. `index` does not have to - /// be a valid index. - /// - Returns: A tuple containing the key-value pair corresponding to `index` if the index is - /// valid; otherwise, `nil`. - public func elementAt(_ index: Index) -> Element? { - return indices.contains(index) ? self[index] : nil - } - - /// Checks whether the given key-value pair can be inserted into to ordered dictionary by - /// validating the presence of the key. - /// - /// - Parameter newElement: The key-value pair to be inserted into the ordered dictionary. - /// - Returns: `true` if the key-value pair can be safely inserted; otherwise, `false`. - /// - /// - SeeAlso: canInsert(key:) - /// - SeeAlso: canInsert(at:) - @available(*, deprecated, message: "Use canInsert(key:) with the element's key instead") - public func canInsert(_ newElement: Element) -> Bool { - return canInsert(key: newElement.key) - } - - /// Checks whether a key-value pair with the given key can be inserted into the ordered - /// dictionary by validating its presence. - /// - /// - Parameter key: The key to be inserted into the ordered dictionary. - /// - Returns: `true` if the key can safely be inserted; ortherwise, `false`. - /// - /// - SeeAlso: canInsert(at:) - public func canInsert(key: Key) -> Bool { - return !containsKey(key) - } - - /// Checks whether a new key-value pair can be inserted into the ordered dictionary at the - /// given index. - /// - /// - Parameter index: The index the new key-value pair should be inserted at. - /// - Returns: `true` if a new key-value pair can be inserted at the specified index; otherwise, - /// `false`. - /// - /// - SeeAlso: canInsert(key:) - public func canInsert(at index: Index) -> Bool { - return index >= startIndex && index <= endIndex - } - - /// Inserts a new key-value pair at the specified position. - /// - /// If the key of the inserted pair already exists in the ordered dictionary, a runtime error - /// is triggered. Use `canInsert(_:)` for performing a check first, so that this method can - /// be executed safely. - /// - /// - Parameter newElement: The new key-value pair to insert into the ordered dictionary. The - /// key contained in the pair must not be already present in the ordered dictionary. - /// - Parameter index: The position at which to insert the new key-value pair. `index` must be - /// a valid index of the ordered dictionary or equal to `endIndex` property. - /// - /// - SeeAlso: canInsert(key:) - /// - SeeAlso: canInsert(at:) - /// - SeeAlso: update(:at:) - public mutating func insert(_ newElement: Element, at index: Index) { - precondition(canInsert(key: newElement.key), "Cannot insert duplicate key in OrderedDictionary") - precondition(canInsert(at: index), "Cannot insert at invalid index in OrderedDictionary") - - let (key, value) = newElement - - _orderedKeys.insert(key, at: index) - _keysToValues[key] = value - } - - /// Checks whether the key-value pair at the given index can be updated with the given key-value - /// pair. This is not the case if the key of the updated element is already present in the - /// ordered dictionary and located at another index than the updated one. - /// - /// Although this is a checking method, a valid index has to be provided. - /// - /// - Parameter newElement: The key-value pair to be set at the specified position. - /// - Parameter index: The position at which to set the key-value pair. `index` must be a valid - /// index of the ordered dictionary. - public func canUpdate(_ newElement: Element, at index: Index) -> Bool { - var keyPresentAtIndex = false - return _canUpdate(newElement, at: index, keyPresentAtIndex: &keyPresentAtIndex) - } - - /// Updates the key-value pair located at the specified position. - /// - /// If the key of the updated pair already exists in the ordered dictionary *and* is located at - /// a different position than the specified one, a runtime error is triggered. Use - /// `canUpdate(_:at:)` for performing a check first, so that this method can be executed safely. - /// - /// - Parameter newElement: The key-value pair to be set at the specified position. - /// - Parameter index: The position at which to set the key-value pair. `index` must be a valid - /// index of the ordered dictionary. - /// - /// - SeeAlso: canUpdate(_:at:) - /// - SeeAlso: insert(:at:) - @discardableResult - public mutating func update(_ newElement: Element, at index: Index) -> Element? { - // Store the flag indicating whether the key of the inserted element - // is present at the updated index - var keyPresentAtIndex = false - - precondition( - _canUpdate(newElement, at: index, keyPresentAtIndex: &keyPresentAtIndex), - "OrderedDictionary update duplicates key" - ) - - // Decompose the element - let (key, value) = newElement - - // Load the current element at the index - let replacedElement = self[index] - - // If its key differs, remove its associated value - if (!keyPresentAtIndex) { - _keysToValues.removeValue(forKey: replacedElement.key) - } - - // Store the new position of the key and the new value associated with the key - _orderedKeys[index] = key - _keysToValues[key] = value - - return replacedElement - } - - /// Removes and returns the key-value pair at the specified position if there is any key-value - /// pair, or `nil` if there is none. - /// - /// - Parameter index: The position of the key-value pair to remove. - /// - Returns: The element at the specified index, or `nil` if the position is not taken. - /// - /// - SeeAlso: removeValue(forKey:) - @discardableResult - public mutating func remove(at index: Index) -> Element? { - guard let element = elementAt(index) else { return nil } - - _orderedKeys.remove(at: index) - _keysToValues.removeValue(forKey: element.key) - - return element - } - - private func _canUpdate(_ newElement: Element, at index: Index, keyPresentAtIndex: inout Bool) -> Bool { - precondition(indices.contains(index), "OrderedDictionary index is out of range") - - let currentIndexOfKey = self.index(forKey: newElement.key) - - let keyNotPresent = currentIndexOfKey == nil - keyPresentAtIndex = currentIndexOfKey == index - - return keyNotPresent || keyPresentAtIndex - } - - // ======================================================= // - // MARK: - Moving Elements - // ======================================================= // - - /// Moves an existing key-value pair specified by the given key to the new index by removing it - /// from its original index first and inserting it at the new index. If the movement is - /// actually performed, the previous index of the key-value pair is returned. Otherwise, `nil` - /// is returned. - /// - /// - Parameter key: The key specifying the key-value pair to move. - /// - Parameter newIndex: The new index the key-value pair should be moved to. - /// - Returns: The previous index of the key-value pair if it was sucessfully moved. - @discardableResult - public mutating func moveElement(forKey key: Key, to newIndex: Index) -> Index? { - // Load the previous index and return nil if the index is not found. - guard let previousIndex = index(forKey: key) else { return nil } - - // If the previous and new indices match, threat it as if the movement was already - // performed. - guard previousIndex != newIndex else { return previousIndex } - - // Remove the value for the key at its original index. - let value = removeValue(forKey: key)! - - // Validate the new index. - precondition(canInsert(at: newIndex), "Cannot move to invalid index in OrderedDictionary") - - // Insert the element at the new index. - insert((key: key, value: value), at: newIndex) - - return previousIndex - } - - // ======================================================= // - // MARK: - Sorting Elements - // ======================================================= // - - /// Sorts the ordered dictionary in place, using the given predicate as the comparison between - /// elements. - /// - /// The predicate must be a *strict weak ordering* over the elements. - /// - /// - Parameter areInIncreasingOrder: A predicate that returns `true` if its first argument - /// should be ordered before its second argument; otherwise, `false`. - /// - /// - SeeAlso: MutableCollection.sort(by:), sorted(by:) - public mutating func sort(by areInIncreasingOrder: (Element, Element) -> Bool) { - _orderedKeys = _sortedElements(by: areInIncreasingOrder).map { $0.key } - } - - /// Returns a new ordered dictionary, sorted using the given predicate as the comparison between - /// elements. - /// - /// The predicate must be a *strict weak ordering* over the elements. - /// - /// - Parameter areInIncreasingOrder: A predicate that returns `true` if its first argument - /// should be ordered before its second argument; otherwise, `false`. - /// - Returns: A new ordered dictionary sorted according to the predicate. - /// - /// - SeeAlso: MutableCollection.sorted(by:), sort(by:) - /// - MutatingVariant: sort - public func sorted(by areInIncreasingOrder: (Element, Element) -> Bool) -> OrderedDictionary { - return OrderedDictionary(_sortedElements(by: areInIncreasingOrder)) - } - - private func _sortedElements(by areInIncreasingOrder: (Element, Element) -> Bool) -> [Element] { - return sorted(by: areInIncreasingOrder) - } - - // ======================================================= // - // MARK: - Slices - // ======================================================= // - - /// Accesses a contiguous subrange of the ordered dictionary. - /// - /// - Parameter bounds: A range of the ordered dictionary's indices. The bounds of the range - /// must be valid indices of the ordered dictionary. - /// - Returns: The slice view at the ordered dictionary in the specified subrange. - public subscript(bounds: Range) -> SubSequence { - return OrderedDictionarySlice(base: self, bounds: bounds) - } - - // ======================================================= // - // MARK: - Indices - // ======================================================= // - - /// The indices that are valid for subscripting the ordered dictionary. - public var indices: Indices { - return _orderedKeys.indices - } - - /// The position of the first key-value pair in a non-empty ordered dictionary. - public var startIndex: Index { - return _orderedKeys.startIndex - } - - /// The position which is one greater than the position of the last valid key-value pair in the - /// ordered dictionary. - public var endIndex: Index { - return _orderedKeys.endIndex - } - - /// Returns the position immediately after the given index. - public func index(after i: Index) -> Index { - return _orderedKeys.index(after: i) - } - - /// Returns the position immediately before the given index. - public func index(before i: Index) -> Index { - return _orderedKeys.index(before: i) - } - - // ======================================================= // - // MARK: - Internal Storage - // ======================================================= // - - /// The backing storage for the ordered keys. - fileprivate var _orderedKeys = [Key]() - - /// The backing storage for the mapping of keys to values. - fileprivate var _keysToValues = [Key: Value]() - -} - -// ======================================================= // -// MARK: - Subtypes -// ======================================================= // - -#if swift(>=4.1) - -/// A view into an ordered dictionary whose indices are a subrange of the indices of the ordered -/// dictionary. -public typealias OrderedDictionarySlice = Slice> - -/// A collection containing the keys of the ordered dictionary. -/// -/// Under the hood this is a lazily evaluated bidirectional collection deriving the keys from -/// the base ordered dictionary on-the-fly. -public typealias OrderedDictionaryKeys = LazyMapCollection, Key> - -/// A collection containing the values of the ordered dictionary. -/// -/// Under the hood this is a lazily evaluated bidirectional collection deriving the values from -/// the base ordered dictionary on-the-fly. -public typealias OrderedDictionaryValues = LazyMapCollection, Value> - -#else - -/// A view into an ordered dictionary whose indices are a subrange of the indices of the ordered -/// dictionary. -public typealias OrderedDictionarySlice = Slice> - -/// A collection containing the keys of the ordered dictionary. -/// -/// Under the hood this is a lazily evaluated bidirectional collection deriving the keys from -/// the base ordered dictionary on-the-fly. -public typealias OrderedDictionaryKeys = LazyMapCollection, Key> - -/// A collection containing the values of the ordered dictionary. -/// -/// Under the hood this is a lazily evaluated bidirectional collection deriving the values from -/// the base ordered dictionary on-the-fly. -public typealias OrderedDictionaryValues = LazyMapCollection, Value> - -#endif - -// ======================================================= // -// MARK: - Literals -// ======================================================= // - -extension OrderedDictionary: ExpressibleByArrayLiteral { - - /// Creates an ordered dictionary initialized from an array literal containing a list of - /// key-value pairs. - public init(arrayLiteral elements: Element...) { - self.init(elements) - } - -} - -extension OrderedDictionary: ExpressibleByDictionaryLiteral { - - /// Creates an ordered dictionary initialized from a dictionary literal. - public init(dictionaryLiteral elements: (Key, Value)...) { - self.init(elements.map { element in - let (key, value) = element - return (key: key, value: value) - }) - } - -} - -// ======================================================= // -// MARK: - Equatable Conformance -// ======================================================= // - -#if swift(>=4.1) - -extension OrderedDictionary: Equatable where Value: Equatable {} - -#endif - -extension OrderedDictionary where Value: Equatable { - - /// Returns a Boolean value that indicates whether the two given ordered dictionaries with - /// equatable values are equal. - public static func == (lhs: OrderedDictionary, rhs: OrderedDictionary) -> Bool { - return lhs._orderedKeys == rhs._orderedKeys - && lhs._keysToValues == rhs._keysToValues - } - -} diff --git a/submodules/AsyncDisplayKit/examples_extra/ASDKgram-Swift/ASDKgram-Swift/PX500Convenience.swift b/submodules/AsyncDisplayKit/examples_extra/ASDKgram-Swift/ASDKgram-Swift/PX500Convenience.swift deleted file mode 100644 index a8754d695b..0000000000 --- a/submodules/AsyncDisplayKit/examples_extra/ASDKgram-Swift/ASDKgram-Swift/PX500Convenience.swift +++ /dev/null @@ -1,24 +0,0 @@ -// -// PX500Convenience.swift -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -import Foundation - -func parsePopularPage(withURL: URL) -> Resource { - - let parse = Resource(url: withURL, parseJSON: { jsonData in - - guard let json = jsonData as? JSONDictionary, let photos = json["photos"] as? [JSONDictionary] else { return .failure(.errorParsingJSON) } - - guard let model = PopularPageModel(dictionary: json, photosArray: photos.flatMap(PhotoModel.init)) else { return .failure(.errorParsingJSON) } - - return .success(model) - }) - - return parse -} diff --git a/submodules/AsyncDisplayKit/examples_extra/ASDKgram-Swift/ASDKgram-Swift/ParseResponse.swift b/submodules/AsyncDisplayKit/examples_extra/ASDKgram-Swift/ASDKgram-Swift/ParseResponse.swift deleted file mode 100644 index 0870651e89..0000000000 --- a/submodules/AsyncDisplayKit/examples_extra/ASDKgram-Swift/ASDKgram-Swift/ParseResponse.swift +++ /dev/null @@ -1,23 +0,0 @@ -// -// ParseResponse.swift -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -import Foundation - -func parsePopularPage(withURL: URL, page: Int) -> Resource { - let parse = Resource(url: withURL, page: page) { metaData, jsonData in - do { - let photos = try JSONDecoder().decode([PhotoModel].self, from: jsonData) - return .success(PopularPageModel(metaData: metaData, photos: photos)) - } catch { - return .failure(.errorParsingJSON) - } - } - - return parse -} diff --git a/submodules/AsyncDisplayKit/examples_extra/ASDKgram-Swift/ASDKgram-Swift/PhotoFeedModel.swift b/submodules/AsyncDisplayKit/examples_extra/ASDKgram-Swift/ASDKgram-Swift/PhotoFeedModel.swift deleted file mode 100644 index edfe37ff37..0000000000 --- a/submodules/AsyncDisplayKit/examples_extra/ASDKgram-Swift/ASDKgram-Swift/PhotoFeedModel.swift +++ /dev/null @@ -1,119 +0,0 @@ -// -// PhotoFeedModel.swift -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -import UIKit - -final class PhotoFeedModel { - - // MARK: Properties - - public private(set) var photoFeedModelType: PhotoFeedModelType - - private var orderedPhotos: OrderedDictionary = [:] - private var currentPage: Int = 0 - private var totalPages: Int = 0 - private var totalItems: Int = 0 - private var fetchPageInProgress: Bool = false - - // MARK: Lifecycle - - init(photoFeedModelType: PhotoFeedModelType) { - self.photoFeedModelType = photoFeedModelType - } - - // MARK: API - - lazy var url: URL = { - return URL.URLForFeedModelType(feedModelType: self.photoFeedModelType) - }() - - var numberOfItems: Int { - return orderedPhotos.count - } - - func itemAtIndexPath(_ indexPath: IndexPath) -> PhotoModel { - return orderedPhotos[indexPath.row].value - } - - // return in completion handler the number of additions and the status of internet connection - - func updateNewBatchOfPopularPhotos(additionsAndConnectionStatusCompletion: @escaping (Int, InternetStatus) -> ()) { - - // For this example let's use the main thread as locking queue - DispatchQueue.main.async { - guard !self.fetchPageInProgress else { - return - } - - self.fetchPageInProgress = true - self.fetchNextPageOfPopularPhotos(replaceData: false) { [unowned self] additions, error in - self.fetchPageInProgress = false - - if let error = error { - switch error { - case .noInternetConnection: - additionsAndConnectionStatusCompletion(0, .noConnection) - default: - additionsAndConnectionStatusCompletion(0, .connected) - } - } else { - additionsAndConnectionStatusCompletion(additions, .connected) - } - } - } - } - - private func fetchNextPageOfPopularPhotos(replaceData: Bool, numberOfAdditionsCompletion: @escaping (Int, NetworkingError?) -> ()) { - if currentPage == totalPages, currentPage != 0 { - numberOfAdditionsCompletion(0, .customError("No pages left to parse")) - return - } - - let pageToFetch = currentPage + 1 - WebService().load(resource: parsePopularPage(withURL: url, page: pageToFetch)) { [unowned self] result in - // Callback will happen on main for now - switch result { - case .success(let itemsPage): - // Update current state - self.totalItems = itemsPage.totalNumberOfItems - self.totalPages = itemsPage.totalPages - self.currentPage = itemsPage.page - - // Update photos - if replaceData { - self.orderedPhotos = [] - } - var insertedItems = 0 - for photo in itemsPage.photos { - if !self.orderedPhotos.containsKey(photo.photoID) { - // Append a new key-value pair by setting a value for an non-existent key - self.orderedPhotos[photo.photoID] = photo - insertedItems += 1 - } - } - - numberOfAdditionsCompletion(insertedItems, nil) - case .failure(let fail): - print(fail) - numberOfAdditionsCompletion(0, fail) - } - } - } -} - -enum PhotoFeedModelType { - case photoFeedModelTypePopular - case photoFeedModelTypeLocation - case photoFeedModelTypeUserPhotos -} - -enum InternetStatus { - case connected - case noConnection -} diff --git a/submodules/AsyncDisplayKit/examples_extra/ASDKgram-Swift/ASDKgram-Swift/PhotoFeedTableNodeController.swift b/submodules/AsyncDisplayKit/examples_extra/ASDKgram-Swift/ASDKgram-Swift/PhotoFeedTableNodeController.swift deleted file mode 100644 index 6c2fe39f14..0000000000 --- a/submodules/AsyncDisplayKit/examples_extra/ASDKgram-Swift/ASDKgram-Swift/PhotoFeedTableNodeController.swift +++ /dev/null @@ -1,106 +0,0 @@ -// -// PhotoFeedTableNodeController.swift -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -import AsyncDisplayKit - -class PhotoFeedTableNodeController: ASViewController { - - // MARK: Lifecycle - - private lazy var activityIndicatorView: UIActivityIndicatorView = { - return UIActivityIndicatorView(activityIndicatorStyle: .gray) - }() - - var photoFeedModel = PhotoFeedModel(photoFeedModelType: .photoFeedModelTypePopular) - - init() { - super.init(node: ASTableNode()) - - navigationItem.title = "ASDK" - } - - required init?(coder aDecoder: NSCoder) { - fatalError("init(coder:) has not been implemented") - } - - // MAKR: UIViewController - - override func viewDidLoad() { - super.viewDidLoad() - - node.allowsSelection = false - node.dataSource = self - node.delegate = self - node.leadingScreensForBatching = 2.5 - node.view.separatorStyle = .none - - navigationController?.hidesBarsOnSwipe = true - - node.view.addSubview(activityIndicatorView) - } - - override func viewDidLayoutSubviews() { - super.viewDidLayoutSubviews() - - // Center the activity indicator view - let bounds = node.bounds - activityIndicatorView.frame.origin = CGPoint( - x: (bounds.width - activityIndicatorView.frame.width) / 2.0, - y: (bounds.height - activityIndicatorView.frame.height) / 2.0 - ) - } - - func fetchNewBatchWithContext(_ context: ASBatchContext?) { - DispatchQueue.main.async { - self.activityIndicatorView.startAnimating() - } - - photoFeedModel.updateNewBatchOfPopularPhotos() { additions, connectionStatus in - switch connectionStatus { - case .connected: - self.activityIndicatorView.stopAnimating() - self.addRowsIntoTableNode(newPhotoCount: additions) - context?.completeBatchFetching(true) - case .noConnection: - self.activityIndicatorView.stopAnimating() - context?.completeBatchFetching(true) - } - } - } - - func addRowsIntoTableNode(newPhotoCount newPhotos: Int) { - let indexRange = (photoFeedModel.numberOfItems - newPhotos.. Int { - return photoFeedModel.numberOfItems - } - - func tableNode(_ tableNode: ASTableNode, nodeBlockForRowAt indexPath: IndexPath) -> ASCellNodeBlock { - let photo = photoFeedModel.itemAtIndexPath(indexPath) - let nodeBlock: ASCellNodeBlock = { _ in - return PhotoTableNodeCell(photoModel: photo) - } - return nodeBlock - } - - func shouldBatchFetchForCollectionNode(collectionNode: ASCollectionNode) -> Bool { - return true - } - - func tableNode(_ tableNode: ASTableNode, willBeginBatchFetchWith context: ASBatchContext) { - fetchNewBatchWithContext(context) - } -} diff --git a/submodules/AsyncDisplayKit/examples_extra/ASDKgram-Swift/ASDKgram-Swift/PhotoFeedTableViewController.swift b/submodules/AsyncDisplayKit/examples_extra/ASDKgram-Swift/ASDKgram-Swift/PhotoFeedTableViewController.swift deleted file mode 100644 index 1f19fe8dc9..0000000000 --- a/submodules/AsyncDisplayKit/examples_extra/ASDKgram-Swift/ASDKgram-Swift/PhotoFeedTableViewController.swift +++ /dev/null @@ -1,108 +0,0 @@ -// -// PhotoFeedTableViewController.swift -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -import UIKit - -class PhotoFeedTableViewController: UITableViewController { - - var activityIndicator: UIActivityIndicatorView! - var photoFeed = PhotoFeedModel(photoFeedModelType: .photoFeedModelTypePopular) - - init() { - super.init(nibName: nil, bundle: nil) - - navigationItem.title = "UIKit" - } - - required init?(coder aDecoder: NSCoder) { - fatalError("init(coder:) has not been implemented") - } - - override func viewDidLoad() { - super.viewDidLoad() - - navigationController?.hidesBarsOnSwipe = true - setupActivityIndicator() - configureTableView() - fetchNewBatch() - } - - func fetchNewBatch() { - activityIndicator.startAnimating() - photoFeed.updateNewBatchOfPopularPhotos() { additions, connectionStatus in - switch connectionStatus { - case .connected: - self.activityIndicator.stopAnimating() - self.addRowsIntoTableView(newPhotoCount: additions) - case .noConnection: - self.activityIndicator.stopAnimating() - break - } - } - } - - // Helper functions - func setupActivityIndicator() { - let activityIndicator = UIActivityIndicatorView(activityIndicatorStyle: .gray) - activityIndicator.translatesAutoresizingMaskIntoConstraints = false - self.activityIndicator = activityIndicator - self.tableView.addSubview(activityIndicator) - - NSLayoutConstraint.activate([ - activityIndicator.centerXAnchor.constraint(equalTo: self.tableView.centerXAnchor), - activityIndicator.centerYAnchor.constraint(equalTo: self.tableView.centerYAnchor) - ]) - } - - func configureTableView() { - tableView.register(PhotoTableViewCell.self, forCellReuseIdentifier: "photoCell") - tableView.allowsSelection = false - tableView.rowHeight = UITableViewAutomaticDimension - tableView.separatorStyle = .none - } -} - -extension PhotoFeedTableViewController { - - func addRowsIntoTableView(newPhotoCount newPhotos: Int) { - - let indexRange = (photoFeed.numberOfItems - newPhotos.. Int { - return photoFeed.numberOfItems - } - - override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { - guard let cell = tableView.dequeueReusableCell(withIdentifier: "photoCell", for: indexPath) as? PhotoTableViewCell else { fatalError("Wrong cell type") } - cell.photoModel = photoFeed.itemAtIndexPath(indexPath) - return cell - } - - override func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat { - return PhotoTableViewCell.height( - for: photoFeed.itemAtIndexPath(indexPath), - withWidth: self.view.frame.size.width - ) - } - - override func scrollViewDidScroll(_ scrollView: UIScrollView) { - let currentOffSetY = scrollView.contentOffset.y - let contentHeight = scrollView.contentSize.height - let screenHeight = UIScreen.main.bounds.height - let screenfullsBeforeBottom = (contentHeight - currentOffSetY) / screenHeight - if screenfullsBeforeBottom < 2.5 { - self.fetchNewBatch() - } - } -} diff --git a/submodules/AsyncDisplayKit/examples_extra/ASDKgram-Swift/ASDKgram-Swift/PhotoModel.swift b/submodules/AsyncDisplayKit/examples_extra/ASDKgram-Swift/ASDKgram-Swift/PhotoModel.swift deleted file mode 100644 index 5f5c5bbe71..0000000000 --- a/submodules/AsyncDisplayKit/examples_extra/ASDKgram-Swift/ASDKgram-Swift/PhotoModel.swift +++ /dev/null @@ -1,133 +0,0 @@ -// -// PhotoModel.swift -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -import UIKit - -// MARK: ProfileImage - -struct ProfileImage: Codable { - let large: String - let medium: String - let small: String -} - -// MARK: UserModel - -struct UserModel: Codable { - let userName: String - let profileImages: ProfileImage - - enum CodingKeys: String, CodingKey { - case userName = "username" - case profileImages = "profile_image" - } -} - -extension UserModel { - var profileImage: String { - return profileImages.medium - } -} - -// MARK: PhotoURL - -struct PhotoURL: Codable { - let full: String - let raw: String - let regular: String - let small: String - let thumb: String -} - -// MARK: PhotoModel - -struct PhotoModel: Codable { - let urls: PhotoURL - let photoID: String - let uploadedDateString: String - let descriptionText: String? - let likesCount: Int - let width: Int - let height: Int - let user: UserModel - - enum CodingKeys: String, CodingKey { - case photoID = "id" - case urls = "urls" - case uploadedDateString = "created_at" - case descriptionText = "description" - case likesCount = "likes" - case width = "width" - case height = "height" - case user = "user" - } -} - -extension PhotoModel { - var url: String { - return urls.regular - } -} - -extension PhotoModel { - - // MARK: - Attributed Strings - - func attributedStringForUserName(withSize size: CGFloat) -> NSAttributedString { - let attributes = [ - NSForegroundColorAttributeName : UIColor.darkGray, - NSFontAttributeName: UIFont.boldSystemFont(ofSize: size) - ] - return NSAttributedString(string: user.userName, attributes: attributes) - } - - func attributedStringForDescription(withSize size: CGFloat) -> NSAttributedString { - let attributes = [ - NSForegroundColorAttributeName : UIColor.darkGray, - NSFontAttributeName: UIFont.systemFont(ofSize: size) - ] - return NSAttributedString(string: descriptionText ?? "", attributes: attributes) - } - - func attributedStringLikes(withSize size: CGFloat) -> NSAttributedString { - guard let formattedLikesNumber = NumberFormatter.decimalNumberFormatter.string(from: NSNumber(value: likesCount)) else { - return NSAttributedString() - } - - let likesAttributes = [ - NSForegroundColorAttributeName : UIColor.mainBarTintColor, - NSFontAttributeName: UIFont.systemFont(ofSize: size) - ] - let likesAttrString = NSAttributedString(string: "\(formattedLikesNumber) Likes", attributes: likesAttributes) - - let heartAttributes = [ - NSForegroundColorAttributeName : UIColor.red, - NSFontAttributeName: UIFont.systemFont(ofSize: size) - ] - let heartAttrString = NSAttributedString(string: "♥︎ ", attributes: heartAttributes) - - let combine = NSMutableAttributedString() - combine.append(heartAttrString) - combine.append(likesAttrString) - return combine - } - - func attributedStringForTimeSinceString(withSize size: CGFloat) -> NSAttributedString { - guard let date = Date.iso8601Formatter.date(from: self.uploadedDateString) else { - return NSAttributedString(); - } - - let attributes = [ - NSForegroundColorAttributeName : UIColor.mainBarTintColor, - NSFontAttributeName: UIFont.systemFont(ofSize: size) - ] - - return NSAttributedString(string: Date.timeStringSince(fromConverted: date), attributes: attributes) - } -} diff --git a/submodules/AsyncDisplayKit/examples_extra/ASDKgram-Swift/ASDKgram-Swift/PhotoTableNodeCell.swift b/submodules/AsyncDisplayKit/examples_extra/ASDKgram-Swift/ASDKgram-Swift/PhotoTableNodeCell.swift deleted file mode 100644 index 58f2a7086c..0000000000 --- a/submodules/AsyncDisplayKit/examples_extra/ASDKgram-Swift/ASDKgram-Swift/PhotoTableNodeCell.swift +++ /dev/null @@ -1,89 +0,0 @@ -// -// PhotoTableNodeCell.swift -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -import Foundation -import AsyncDisplayKit - -class PhotoTableNodeCell: ASCellNode { - - // MARK: Properties - - let usernameLabel = ASTextNode() - let timeIntervalLabel = ASTextNode() - let photoLikesLabel = ASTextNode() - let photoDescriptionLabel = ASTextNode() - - let avatarImageNode: ASNetworkImageNode = { - let node = ASNetworkImageNode() - node.contentMode = .scaleAspectFill - // Set the imageModificationBlock for a rounded avatar - node.imageModificationBlock = ASImageNodeRoundBorderModificationBlock(0, nil) - return node - }() - - let photoImageNode: ASNetworkImageNode = { - let node = ASNetworkImageNode() - node.contentMode = .scaleAspectFill - return node - }() - - // MARK: Lifecycle - - init(photoModel: PhotoModel) { - super.init() - - automaticallyManagesSubnodes = true - photoImageNode.url = URL(string: photoModel.url) - avatarImageNode.url = URL(string: photoModel.user.profileImage) - usernameLabel.attributedText = photoModel.attributedStringForUserName(withSize: Constants.CellLayout.FontSize) - timeIntervalLabel.attributedText = photoModel.attributedStringForTimeSinceString(withSize: Constants.CellLayout.FontSize) - photoLikesLabel.attributedText = photoModel.attributedStringLikes(withSize: Constants.CellLayout.FontSize) - photoDescriptionLabel.attributedText = photoModel.attributedStringForDescription(withSize: Constants.CellLayout.FontSize) - } - - // MARK: ASDisplayNode - - override func layoutSpecThatFits(_ constrainedSize: ASSizeRange) -> ASLayoutSpec { - - // Header Stack - - var headerChildren: [ASLayoutElement] = [] - - let headerStack = ASStackLayoutSpec.horizontal() - headerStack.alignItems = .center - avatarImageNode.style.preferredSize = CGSize( - width: Constants.CellLayout.UserImageHeight, - height: Constants.CellLayout.UserImageHeight - ) - headerChildren.append(ASInsetLayoutSpec(insets: Constants.CellLayout.InsetForAvatar, child: avatarImageNode)) - - usernameLabel.style.flexShrink = 1.0 - headerChildren.append(usernameLabel) - - let spacer = ASLayoutSpec() - spacer.style.flexGrow = 1.0 - headerChildren.append(spacer) - - timeIntervalLabel.style.spacingBefore = Constants.CellLayout.HorizontalBuffer - headerChildren.append(timeIntervalLabel) - - let footerStack = ASStackLayoutSpec.vertical() - footerStack.spacing = Constants.CellLayout.VerticalBuffer - footerStack.children = [photoLikesLabel, photoDescriptionLabel] - headerStack.children = headerChildren - - let verticalStack = ASStackLayoutSpec.vertical() - verticalStack.children = [ - ASInsetLayoutSpec(insets: Constants.CellLayout.InsetForHeader, child: headerStack), - ASRatioLayoutSpec(ratio: 1.0, child: photoImageNode), - ASInsetLayoutSpec(insets: Constants.CellLayout.InsetForFooter, child: footerStack) - ] - return verticalStack - } -} diff --git a/submodules/AsyncDisplayKit/examples_extra/ASDKgram-Swift/ASDKgram-Swift/PhotoTableViewCell.swift b/submodules/AsyncDisplayKit/examples_extra/ASDKgram-Swift/ASDKgram-Swift/PhotoTableViewCell.swift deleted file mode 100644 index 0698ff2cee..0000000000 --- a/submodules/AsyncDisplayKit/examples_extra/ASDKgram-Swift/ASDKgram-Swift/PhotoTableViewCell.swift +++ /dev/null @@ -1,132 +0,0 @@ -// -// PhotoTableViewCell.swift -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -import UIKit - -class PhotoTableViewCell: UITableViewCell { - - var photoModel: PhotoModel? { - didSet { - if let model = photoModel { - photoImageView.loadImageUsingUrlString(urlString: model.url) - avatarImageView.loadImageUsingUrlString(urlString: model.user.profileImage) - photoLikesLabel.attributedText = model.attributedStringLikes(withSize: Constants.CellLayout.FontSize) - usernameLabel.attributedText = model.attributedStringForUserName(withSize: Constants.CellLayout.FontSize) - timeIntervalLabel.attributedText = model.attributedStringForTimeSinceString(withSize: Constants.CellLayout.FontSize) - photoDescriptionLabel.attributedText = model.attributedStringForDescription(withSize: Constants.CellLayout.FontSize) - photoDescriptionLabel.sizeToFit() - var rect = photoDescriptionLabel.frame - let availableWidth = self.bounds.size.width - Constants.CellLayout.HorizontalBuffer * 2 - rect.size = model.attributedStringForDescription(withSize: Constants.CellLayout.FontSize).boundingRect(with: CGSize(width: availableWidth, height: CGFloat.greatestFiniteMagnitude), options: .usesLineFragmentOrigin, context: nil).size - photoDescriptionLabel.frame = rect - } - } - } - - let photoImageView: NetworkImageView = { - let imageView = NetworkImageView() - imageView.contentMode = .scaleAspectFill - imageView.translatesAutoresizingMaskIntoConstraints = false - return imageView - }() - - let avatarImageView: NetworkImageView = { - let imageView = NetworkImageView() - imageView.contentMode = .scaleAspectFill - imageView.translatesAutoresizingMaskIntoConstraints = false - imageView.layer.cornerRadius = Constants.CellLayout.UserImageHeight / 2 - imageView.clipsToBounds = true - return imageView - }() - - let usernameLabel: UILabel = { - let label = UILabel() - label.translatesAutoresizingMaskIntoConstraints = false - return label - }() - - let timeIntervalLabel: UILabel = { - let label = UILabel() - label.translatesAutoresizingMaskIntoConstraints = false - return label - }() - - let photoLikesLabel: UILabel = { - let label = UILabel() - label.translatesAutoresizingMaskIntoConstraints = false - return label - }() - - let photoDescriptionLabel: UILabel = { - let label = UILabel() - label.translatesAutoresizingMaskIntoConstraints = false - label.numberOfLines = 3 - return label - }() - - override init(style: UITableViewCellStyle, reuseIdentifier: String?) { - super.init(style: style, reuseIdentifier: reuseIdentifier) - setupViews() - } - - required init?(coder aDecoder: NSCoder) { - fatalError("init(coder:) has not been implemented") - } - - func setupViews() { - addSubview(photoImageView) - addSubview(avatarImageView) - addSubview(usernameLabel) - addSubview(timeIntervalLabel) - addSubview(photoLikesLabel) - addSubview(photoDescriptionLabel) - setupConstraints() - } - - func setupConstraints() { - - NSLayoutConstraint.activate ([ - //photoImageView - photoImageView.topAnchor.constraint(equalTo: topAnchor, constant: Constants.CellLayout.HeaderHeight), - photoImageView.widthAnchor.constraint(equalTo: widthAnchor), - photoImageView.heightAnchor.constraint(equalTo: photoImageView.widthAnchor), - // avatarImageView - avatarImageView.leftAnchor.constraint(equalTo: leftAnchor, constant: Constants.CellLayout.HorizontalBuffer), - avatarImageView.topAnchor.constraint(equalTo: topAnchor, constant: Constants.CellLayout.HorizontalBuffer), - avatarImageView.heightAnchor.constraint(equalToConstant: Constants.CellLayout.UserImageHeight), - avatarImageView.widthAnchor.constraint(equalTo: avatarImageView.heightAnchor), - // usernameLabel - usernameLabel.leftAnchor.constraint(equalTo: avatarImageView.rightAnchor, constant: Constants.CellLayout.HorizontalBuffer), - usernameLabel.rightAnchor.constraint(equalTo: timeIntervalLabel.leftAnchor, constant: -Constants.CellLayout.HorizontalBuffer), - usernameLabel.centerYAnchor.constraint(equalTo: avatarImageView.centerYAnchor), - // timeIntervalLabel - timeIntervalLabel.rightAnchor.constraint(equalTo: rightAnchor, constant: -Constants.CellLayout.HorizontalBuffer), - timeIntervalLabel.centerYAnchor.constraint(equalTo: avatarImageView.centerYAnchor), - // photoLikesLabel - photoLikesLabel.topAnchor.constraint(equalTo: photoImageView.bottomAnchor, constant: Constants.CellLayout.VerticalBuffer), - photoLikesLabel.leftAnchor.constraint(equalTo: leftAnchor, constant: Constants.CellLayout.HorizontalBuffer), - // photoDescriptionLabel - photoDescriptionLabel.topAnchor.constraint(equalTo: photoLikesLabel.bottomAnchor, constant: Constants.CellLayout.VerticalBuffer), - photoDescriptionLabel.leftAnchor.constraint(equalTo: leftAnchor, constant: Constants.CellLayout.HorizontalBuffer), - photoDescriptionLabel.rightAnchor.constraint(equalTo: rightAnchor, constant: -Constants.CellLayout.HorizontalBuffer), - photoDescriptionLabel.bottomAnchor.constraint(equalTo: bottomAnchor, constant: -Constants.CellLayout.VerticalBuffer) - ]) - } - - class func height(for photo: PhotoModel, withWidth width: CGFloat) -> CGFloat { - let photoHeight = width - let font = UIFont.systemFont(ofSize: Constants.CellLayout.FontSize) - let likesHeight = round(font.lineHeight) - let descriptionAttrString = photo.attributedStringForDescription(withSize: Constants.CellLayout.FontSize) - let availableWidth = width - Constants.CellLayout.HorizontalBuffer * 2 - let descriptionHeight = descriptionAttrString.boundingRect(with: CGSize(width: availableWidth, height: CGFloat.greatestFiniteMagnitude), options: .usesLineFragmentOrigin, context: nil).size.height - - return likesHeight + descriptionHeight + photoHeight + Constants.CellLayout.HeaderHeight + Constants.CellLayout.VerticalBuffer * 3 - } -} diff --git a/submodules/AsyncDisplayKit/examples_extra/ASDKgram-Swift/ASDKgram-Swift/PopularPageModel.swift b/submodules/AsyncDisplayKit/examples_extra/ASDKgram-Swift/ASDKgram-Swift/PopularPageModel.swift deleted file mode 100644 index 048b219211..0000000000 --- a/submodules/AsyncDisplayKit/examples_extra/ASDKgram-Swift/ASDKgram-Swift/PopularPageModel.swift +++ /dev/null @@ -1,24 +0,0 @@ -// -// PopularPageModel.swift -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -import Foundation - -struct PopularPageModel { - let page: Int - let totalPages: Int - let totalNumberOfItems: Int - let photos: [PhotoModel] - - init(metaData: ResponseMetadata, photos:[PhotoModel]) { - self.page = metaData.currentPage - self.totalPages = metaData.pagesTotal - self.totalNumberOfItems = metaData.itemsTotal - self.photos = photos - } -} diff --git a/submodules/AsyncDisplayKit/examples_extra/ASDKgram-Swift/ASDKgram-Swift/UIColor.swift b/submodules/AsyncDisplayKit/examples_extra/ASDKgram-Swift/ASDKgram-Swift/UIColor.swift deleted file mode 100644 index 5498f07ce9..0000000000 --- a/submodules/AsyncDisplayKit/examples_extra/ASDKgram-Swift/ASDKgram-Swift/UIColor.swift +++ /dev/null @@ -1,16 +0,0 @@ -// -// UIColor.swift -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -import UIKit - -extension UIColor { - static var mainBarTintColor: UIColor { - return UIColor(red: 69/255, green: 142/255, blue: 255/255, alpha: 1) - } -} diff --git a/submodules/AsyncDisplayKit/examples_extra/ASDKgram-Swift/ASDKgram-Swift/URL.swift b/submodules/AsyncDisplayKit/examples_extra/ASDKgram-Swift/ASDKgram-Swift/URL.swift deleted file mode 100644 index be9b4a49e9..0000000000 --- a/submodules/AsyncDisplayKit/examples_extra/ASDKgram-Swift/ASDKgram-Swift/URL.swift +++ /dev/null @@ -1,29 +0,0 @@ -// -// URL.swift -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -import UIKit - -extension URL { - static func URLForFeedModelType(feedModelType: PhotoFeedModelType) -> URL { - switch feedModelType { - case .photoFeedModelTypePopular: - return URL(string: assembleUnsplashURLString(endpoint: Constants.Unsplash.URLS.PopularEndpoint))! - - case .photoFeedModelTypeLocation: - return URL(string: assembleUnsplashURLString(endpoint: Constants.Unsplash.URLS.SearchEndpoint))! - - case .photoFeedModelTypeUserPhotos: - return URL(string: assembleUnsplashURLString(endpoint: Constants.Unsplash.URLS.UserEndpoint))! - } - } - - private static func assembleUnsplashURLString(endpoint: String) -> String { - return Constants.Unsplash.URLS.Host + endpoint + Constants.Unsplash.URLS.ConsumerKey - } -} diff --git a/submodules/AsyncDisplayKit/examples_extra/ASDKgram-Swift/ASDKgram-Swift/Webservice.swift b/submodules/AsyncDisplayKit/examples_extra/ASDKgram-Swift/ASDKgram-Swift/Webservice.swift deleted file mode 100644 index a103d21653..0000000000 --- a/submodules/AsyncDisplayKit/examples_extra/ASDKgram-Swift/ASDKgram-Swift/Webservice.swift +++ /dev/null @@ -1,109 +0,0 @@ -// -// Webservice.swift -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -import UIKit - -final class WebService { - /// Load a new resource. Callback is called on main - func load(resource: Resource, completion: @escaping (Result) -> ()) { - URLSession.shared.dataTask(with: resource.url) { data, response, error in - // Check for errors in responses. - let result = self.checkForNetworkErrors(data, response, error) - DispatchQueue.main.async { - // Parsing should happen off main - switch result { - case .success(let data): - completion(resource.parse(data, response)) - case .failure(let error): - completion(.failure(error)) - } - } - }.resume() - } -} - -extension WebService { - /// // Check for errors in responses. - fileprivate func checkForNetworkErrors(_ data: Data?, _ response: URLResponse?, _ error: Error?) -> Result { - if let error = error { - switch error { - case URLError.notConnectedToInternet, URLError.timedOut: - return .failure(.noInternetConnection) - default: - return .failure(.returnedError(error)) - } - } - - if let response = response as? HTTPURLResponse, response.statusCode <= 200 && response.statusCode >= 299 { - return .failure((.invalidStatusCode("Request returned status code other than 2xx \(response)"))) - } - - guard let data = data else { - return .failure(.dataReturnedNil) - } - - return .success(data) - } -} - -struct ResponseMetadata { - let currentPage: Int - let itemsTotal: Int - let itemsPerPage: Int -} - -extension ResponseMetadata { - var pagesTotal: Int { - return itemsTotal / itemsPerPage - } -} - -struct Resource { - let url: URL - let parse: (Data, URLResponse?) -> Result -} - -extension Resource { - init(url: URL, page: Int, parseResponse: @escaping (ResponseMetadata, Data) -> Result) { - // Append extra data to url for paging - guard let url = URL(string: url.absoluteString.appending("&page=\(page)")) else { - fatalError("Malformed URL given"); - } - self.url = url - self.parse = { data, response in - // Parse out metadata from header - guard let httpUrlResponse = response as? HTTPURLResponse, - let xTotalString = httpUrlResponse.allHeaderFields["x-total"] as? String, - let xTotal = Int(xTotalString), - let xPerPageString = httpUrlResponse.allHeaderFields["x-per-page"] as? String, - let xPerPage = Int(xPerPageString) - else { - return .failure(.errorParsingResponse) - } - - let metadata = ResponseMetadata(currentPage: page, itemsTotal: xTotal, itemsPerPage: xPerPage) - return parseResponse(metadata, data) - } - } -} - -enum Result { - case success(T) - case failure(NetworkingError) -} - -enum NetworkingError: Error { - case errorParsingResponse - case errorParsingJSON - case noInternetConnection - case dataReturnedNil - case returnedError(Error) - case invalidStatusCode(String) - case customError(String) -} diff --git a/submodules/AsyncDisplayKit/examples_extra/ASDKgram-Swift/Podfile b/submodules/AsyncDisplayKit/examples_extra/ASDKgram-Swift/Podfile deleted file mode 100644 index 5510b59d9e..0000000000 --- a/submodules/AsyncDisplayKit/examples_extra/ASDKgram-Swift/Podfile +++ /dev/null @@ -1,9 +0,0 @@ -source 'https://github.com/CocoaPods/Specs.git' -platform :ios, '9.0' -target 'ASDKgram-Swift' do - use_frameworks! - inhibit_all_warnings! - - pod 'Texture/PINRemoteImage', :path => '../..' - -end diff --git a/submodules/AsyncDisplayKit/examples_extra/ASLayoutSpecPlayground-Swift/Podfile b/submodules/AsyncDisplayKit/examples_extra/ASLayoutSpecPlayground-Swift/Podfile deleted file mode 100644 index 3b379097a0..0000000000 --- a/submodules/AsyncDisplayKit/examples_extra/ASLayoutSpecPlayground-Swift/Podfile +++ /dev/null @@ -1,6 +0,0 @@ -source 'https://github.com/CocoaPods/Specs.git' -platform :ios, '9.0' -use_frameworks! -target 'Sample' do - pod 'Texture', :path => '../..' -end diff --git a/submodules/AsyncDisplayKit/examples_extra/ASLayoutSpecPlayground-Swift/Sample.xcworkspace/contents.xcworkspacedata b/submodules/AsyncDisplayKit/examples_extra/ASLayoutSpecPlayground-Swift/Sample.xcworkspace/contents.xcworkspacedata deleted file mode 100644 index 7b5a2f3050..0000000000 --- a/submodules/AsyncDisplayKit/examples_extra/ASLayoutSpecPlayground-Swift/Sample.xcworkspace/contents.xcworkspacedata +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - diff --git a/submodules/AsyncDisplayKit/examples_extra/ASLayoutSpecPlayground-Swift/Sample/Info.plist b/submodules/AsyncDisplayKit/examples_extra/ASLayoutSpecPlayground-Swift/Sample/Info.plist deleted file mode 100644 index fbe1e6b314..0000000000 --- a/submodules/AsyncDisplayKit/examples_extra/ASLayoutSpecPlayground-Swift/Sample/Info.plist +++ /dev/null @@ -1,24 +0,0 @@ - - - - - CFBundleDevelopmentRegion - en - CFBundleExecutable - $(EXECUTABLE_NAME) - CFBundleIdentifier - $(PRODUCT_BUNDLE_IDENTIFIER) - CFBundleInfoDictionaryVersion - 6.0 - CFBundleName - $(PRODUCT_NAME) - CFBundlePackageType - FMWK - CFBundleShortVersionString - 1.0 - CFBundleVersion - $(CURRENT_PROJECT_VERSION) - NSPrincipalClass - - - diff --git a/submodules/AsyncDisplayKit/examples_extra/ASLayoutSpecPlayground-Swift/Sample/Sample.h b/submodules/AsyncDisplayKit/examples_extra/ASLayoutSpecPlayground-Swift/Sample/Sample.h deleted file mode 100644 index d80265a099..0000000000 --- a/submodules/AsyncDisplayKit/examples_extra/ASLayoutSpecPlayground-Swift/Sample/Sample.h +++ /dev/null @@ -1,19 +0,0 @@ -// -// Sample.h -// Texture -// -// Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -//! Project version number for Sample. -FOUNDATION_EXPORT double SampleVersionNumber; - -//! Project version string for Sample. -FOUNDATION_EXPORT const unsigned char SampleVersionString[]; - -// In this header, you should import all the public headers of your framework using statements like #import - - diff --git a/submodules/AsyncDisplayKit/examples_extra/ASLayoutSpecPlayground-Swift/Sample/Sample.playground/Pages/HorizontalStackWithSpacer.xcplaygroundpage/Contents.swift b/submodules/AsyncDisplayKit/examples_extra/ASLayoutSpecPlayground-Swift/Sample/Sample.playground/Pages/HorizontalStackWithSpacer.xcplaygroundpage/Contents.swift deleted file mode 100644 index 43cf09026e..0000000000 --- a/submodules/AsyncDisplayKit/examples_extra/ASLayoutSpecPlayground-Swift/Sample/Sample.playground/Pages/HorizontalStackWithSpacer.xcplaygroundpage/Contents.swift +++ /dev/null @@ -1,52 +0,0 @@ -// -// Contents.swift -// Texture -// -// Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -import AsyncDisplayKit - -extension HorizontalStackWithSpacer { - - override public func layoutSpecThatFits(_ constrainedSize: ASSizeRange) -> ASLayoutSpec { - usernameNode.style.flexShrink = 1.0 - postLocationNode.style.flexShrink = 1.0 - - let verticalStackSpec = ASStackLayoutSpec.vertical() - verticalStackSpec.style.flexShrink = 1.0 - - // if fetching post location data from server, check if it is available yet - if postLocationNode.attributedText != nil { - verticalStackSpec.children = [usernameNode, postLocationNode] - } else { - verticalStackSpec.children = [usernameNode] - } - - let spacerSpec = ASLayoutSpec() - spacerSpec.style.flexGrow = 1.0 - spacerSpec.style.flexShrink = 1.0 - - // horizontal stack - let horizontalStack = ASStackLayoutSpec.horizontal() - horizontalStack.alignItems = .center // center items vertically in horiz stack - horizontalStack.justifyContent = .start // justify content to left - horizontalStack.style.flexShrink = 1.0 - horizontalStack.style.flexGrow = 1.0 - horizontalStack.children = [verticalStackSpec, spacerSpec, postTimeNode] - - // inset horizontal stack - let insets = UIEdgeInsets(top: 0, left: 10, bottom: 0, right: 10) - let headerInsetSpec = ASInsetLayoutSpec(insets: insets, child: horizontalStack) - headerInsetSpec.style.flexShrink = 1.0 - headerInsetSpec.style.flexGrow = 1.0 - - return headerInsetSpec - } - -} - -HorizontalStackWithSpacer().show() - -//: [Index](Index) diff --git a/submodules/AsyncDisplayKit/examples_extra/ASLayoutSpecPlayground-Swift/Sample/Sample.playground/Pages/Index.xcplaygroundpage/Contents.swift b/submodules/AsyncDisplayKit/examples_extra/ASLayoutSpecPlayground-Swift/Sample/Sample.playground/Pages/Index.xcplaygroundpage/Contents.swift deleted file mode 100644 index 655f86b0f5..0000000000 --- a/submodules/AsyncDisplayKit/examples_extra/ASLayoutSpecPlayground-Swift/Sample/Sample.playground/Pages/Index.xcplaygroundpage/Contents.swift +++ /dev/null @@ -1,7 +0,0 @@ -// -// Contents.swift -// Texture -// -// Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// diff --git a/submodules/AsyncDisplayKit/examples_extra/ASLayoutSpecPlayground-Swift/Sample/Sample.playground/Pages/PhotoWithInsetTextOverlay.xcplaygroundpage/Contents.swift b/submodules/AsyncDisplayKit/examples_extra/ASLayoutSpecPlayground-Swift/Sample/Sample.playground/Pages/PhotoWithInsetTextOverlay.xcplaygroundpage/Contents.swift deleted file mode 100644 index 88360fd4fb..0000000000 --- a/submodules/AsyncDisplayKit/examples_extra/ASLayoutSpecPlayground-Swift/Sample/Sample.playground/Pages/PhotoWithInsetTextOverlay.xcplaygroundpage/Contents.swift +++ /dev/null @@ -1,32 +0,0 @@ -// -// Contents.swift -// Texture -// -// Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -import AsyncDisplayKit - -let userImageHeight = 60 - -extension PhotoWithInsetTextOverlay { - - override public func layoutSpecThatFits(_ constrainedSize: ASSizeRange) -> ASLayoutSpec { - photoNode.style.preferredSize = CGSize(width: userImageHeight * 2, height: userImageHeight * 2) - let backgroundImageAbsoluteSpec = ASAbsoluteLayoutSpec(children: [photoNode]) - - let insets = UIEdgeInsets(top: CGFloat.infinity, left: 12, bottom: 12, right: 12) - let textInsetSpec = ASInsetLayoutSpec(insets: insets, - child: titleNode) - - let textOverlaySpec = ASOverlayLayoutSpec(child: backgroundImageAbsoluteSpec, overlay: textInsetSpec) - - return textOverlaySpec - } - -} - -PhotoWithInsetTextOverlay().show() - -//: [Photo With Outset Icon Overlay](PhotoWithOutsetIconOverlay) diff --git a/submodules/AsyncDisplayKit/examples_extra/ASLayoutSpecPlayground-Swift/Sample/Sample.playground/Pages/PhotoWithOutsetIconOverlay.xcplaygroundpage/Contents.swift b/submodules/AsyncDisplayKit/examples_extra/ASLayoutSpecPlayground-Swift/Sample/Sample.playground/Pages/PhotoWithOutsetIconOverlay.xcplaygroundpage/Contents.swift deleted file mode 100644 index ba866f3b6d..0000000000 --- a/submodules/AsyncDisplayKit/examples_extra/ASLayoutSpecPlayground-Swift/Sample/Sample.playground/Pages/PhotoWithOutsetIconOverlay.xcplaygroundpage/Contents.swift +++ /dev/null @@ -1,34 +0,0 @@ -// -// Contents.swift -// Texture -// -// Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -import AsyncDisplayKit - -extension PhotoWithOutsetIconOverlay { - - override public func layoutSpecThatFits(_ constrainedSize: ASSizeRange) -> ASLayoutSpec { - let iconWidth: CGFloat = 40 - let iconHeight: CGFloat = 40 - - iconNode.style.preferredSize = CGSize(width: iconWidth, height: iconWidth) - photoNode.style.preferredSize = CGSize(width: 150, height: 150) - - let x: CGFloat = 150 - let y: CGFloat = 0 - - iconNode.style.layoutPosition = CGPoint(x: x, y: y) - photoNode.style.layoutPosition = CGPoint(x: iconWidth * 0.5, y: iconHeight * 0.5); - - let absoluteLayoutSpec = ASAbsoluteLayoutSpec(children: [photoNode, iconNode]) - return absoluteLayoutSpec; - } - -} - -PhotoWithOutsetIconOverlay().show() - -//: [Horizontal Stack With Spacer](HorizontalStackWithSpacer) diff --git a/submodules/AsyncDisplayKit/examples_extra/ASLayoutSpecPlayground-Swift/Sample/Sample.playground/Pages/StackLayout.xcplaygroundpage/Contents.swift b/submodules/AsyncDisplayKit/examples_extra/ASLayoutSpecPlayground-Swift/Sample/Sample.playground/Pages/StackLayout.xcplaygroundpage/Contents.swift deleted file mode 100644 index ec63def40a..0000000000 --- a/submodules/AsyncDisplayKit/examples_extra/ASLayoutSpecPlayground-Swift/Sample/Sample.playground/Pages/StackLayout.xcplaygroundpage/Contents.swift +++ /dev/null @@ -1,34 +0,0 @@ -// -// Contents.swift -// Texture -// -// Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// -import AsyncDisplayKit - -extension StackLayout { - - override public func layoutSpecThatFits(_ constrainedSize: ASSizeRange) -> ASLayoutSpec { - // Try commenting out the flexShrink to see its consequences. - subtitleNode.style.flexShrink = 1.0 - - let stackSpec = ASStackLayoutSpec(direction: .horizontal, - spacing: 5, - justifyContent: .start, - alignItems: .start, - children: [titleNode, subtitleNode]) - - let insetSpec = ASInsetLayoutSpec(insets: UIEdgeInsets(top: 5, - left: 5, - bottom: 5, - right: 5), - child: stackSpec) - return insetSpec - } - -} - -StackLayout().show() - -//: [Photo With Inset Text Overlay](PhotoWithInsetTextOverlay) diff --git a/submodules/AsyncDisplayKit/examples_extra/ASLayoutSpecPlayground-Swift/Sample/Sample.playground/Sources/ASPlayground.swift b/submodules/AsyncDisplayKit/examples_extra/ASLayoutSpecPlayground-Swift/Sample/Sample.playground/Sources/ASPlayground.swift deleted file mode 100644 index 1edf7db0bb..0000000000 --- a/submodules/AsyncDisplayKit/examples_extra/ASLayoutSpecPlayground-Swift/Sample/Sample.playground/Sources/ASPlayground.swift +++ /dev/null @@ -1,33 +0,0 @@ -// -// ASPlayground.swift -// Texture -// -// Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// -import PlaygroundSupport -import AsyncDisplayKit - -public protocol ASPlayground: class { - func display(inRect: CGRect) -} - -extension ASPlayground { - public func display(inRect rect: CGRect) { - var rect = rect - if rect.size == .zero { - rect.size = CGSize(width: 400, height: 400) - } - - guard let nodeSelf = self as? ASDisplayNode else { - assertionFailure("Class inheriting ASPlayground must be an ASDisplayNode") - return - } - - let constrainedSize = ASSizeRange(min: rect.size, max: rect.size) - _ = ASCalculateRootLayout(nodeSelf, constrainedSize) - nodeSelf.frame = rect - PlaygroundPage.current.needsIndefiniteExecution = true - PlaygroundPage.current.liveView = nodeSelf.view - } -} diff --git a/submodules/AsyncDisplayKit/examples_extra/ASLayoutSpecPlayground-Swift/Sample/Sample.playground/Sources/HorizontalStackWithSpacer.swift b/submodules/AsyncDisplayKit/examples_extra/ASLayoutSpecPlayground-Swift/Sample/Sample.playground/Sources/HorizontalStackWithSpacer.swift deleted file mode 100644 index 84b38c8e4d..0000000000 --- a/submodules/AsyncDisplayKit/examples_extra/ASLayoutSpecPlayground-Swift/Sample/Sample.playground/Sources/HorizontalStackWithSpacer.swift +++ /dev/null @@ -1,45 +0,0 @@ -// -// HorizontalStackWithSpacer.swift -// Texture -// -// Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// -import AsyncDisplayKit - -fileprivate let fontSize: CGFloat = 20 - -public class HorizontalStackWithSpacer: ASDisplayNode, ASPlayground { - public let usernameNode = ASTextNode() - public let postLocationNode = ASTextNode() - public let postTimeNode = ASTextNode() - - override public init() { - super.init() - backgroundColor = .white - - automaticallyManagesSubnodes = true - setupNodes() - } - - private func setupNodes() { - usernameNode.backgroundColor = .yellow - usernameNode.attributedText = NSAttributedString.attributedString(string: "hannahmbanana", fontSize: fontSize, color: .darkBlueColor(), firstWordColor: nil) - - postLocationNode.backgroundColor = .lightGray - postLocationNode.maximumNumberOfLines = 1; - postLocationNode.attributedText = NSAttributedString.attributedString(string: "San Fransisco, CA", fontSize: fontSize, color: .lightBlueColor(), firstWordColor: nil) - - postTimeNode.backgroundColor = .brown - postTimeNode.attributedText = NSAttributedString.attributedString(string: "30m", fontSize: fontSize, color: .lightGray, firstWordColor: nil) - } - - // This is used to expose this function for overriding in extensions - override public func layoutSpecThatFits(_ constrainedSize: ASSizeRange) -> ASLayoutSpec { - return ASLayoutSpec() - } - - public func show() { - display(inRect: CGRect(x: 0, y: 0, width: 450, height: 100)) - } -} diff --git a/submodules/AsyncDisplayKit/examples_extra/ASLayoutSpecPlayground-Swift/Sample/Sample.playground/Sources/PhotoWithInsetTextOverlay.swift b/submodules/AsyncDisplayKit/examples_extra/ASLayoutSpecPlayground-Swift/Sample/Sample.playground/Sources/PhotoWithInsetTextOverlay.swift deleted file mode 100644 index 2a9736446c..0000000000 --- a/submodules/AsyncDisplayKit/examples_extra/ASLayoutSpecPlayground-Swift/Sample/Sample.playground/Sources/PhotoWithInsetTextOverlay.swift +++ /dev/null @@ -1,40 +0,0 @@ -// -// PhotoWithInsetTextOverlay.swift -// Texture -// -// Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// -import AsyncDisplayKit - -public class PhotoWithInsetTextOverlay: ASDisplayNode, ASPlayground { - public let photoNode = ASNetworkImageNode() - public let titleNode = ASTextNode() - - override public init() { - super.init() - backgroundColor = .white - - automaticallyManagesSubnodes = true - setupNodes() - } - - private func setupNodes() { - photoNode.url = URL(string: "http://asyncdisplaykit.org/static/images/layout-examples-photo-with-inset-text-overlay-photo.png") - photoNode.backgroundColor = .black - - titleNode.backgroundColor = .blue - titleNode.maximumNumberOfLines = 2 - titleNode.truncationAttributedText = NSAttributedString.attributedString(string: "...", fontSize: 16, color: .white, firstWordColor: nil) - titleNode.attributedText = NSAttributedString.attributedString(string: "family fall hikes", fontSize: 16, color: .white, firstWordColor: nil) - } - - // This is used to expose this function for overriding in extensions - override public func layoutSpecThatFits(_ constrainedSize: ASSizeRange) -> ASLayoutSpec { - return ASLayoutSpec() - } - - public func show() { - display(inRect: CGRect(x: 0, y: 0, width: 120, height: 120)) - } -} diff --git a/submodules/AsyncDisplayKit/examples_extra/ASLayoutSpecPlayground-Swift/Sample/Sample.playground/Sources/PhotoWithOutsetIconOverlay.swift b/submodules/AsyncDisplayKit/examples_extra/ASLayoutSpecPlayground-Swift/Sample/Sample.playground/Sources/PhotoWithOutsetIconOverlay.swift deleted file mode 100644 index 9a8c9f3ab3..0000000000 --- a/submodules/AsyncDisplayKit/examples_extra/ASLayoutSpecPlayground-Swift/Sample/Sample.playground/Sources/PhotoWithOutsetIconOverlay.swift +++ /dev/null @@ -1,40 +0,0 @@ -// -// PhotoWithOutsetIconOverlay.swift -// Texture -// -// Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// -import AsyncDisplayKit - -fileprivate let userImageHeight = 60 - -public class PhotoWithOutsetIconOverlay: ASDisplayNode, ASPlayground { - public let photoNode = ASNetworkImageNode() - public let iconNode = ASNetworkImageNode() - - override public init() { - super.init() - backgroundColor = .white - - automaticallyManagesSubnodes = true - setupNodes() - } - - private func setupNodes() { - photoNode.url = URL(string: "http://asyncdisplaykit.org/static/images/layout-examples-photo-with-outset-icon-overlay-photo.png") - photoNode.backgroundColor = .black - - iconNode.url = URL(string: "http://asyncdisplaykit.org/static/images/layout-examples-photo-with-outset-icon-overlay-icon.png") - iconNode.imageModificationBlock = ASImageNodeRoundBorderModificationBlock(10, .white) - } - - // This is used to expose this function for overriding in extensions - override public func layoutSpecThatFits(_ constrainedSize: ASSizeRange) -> ASLayoutSpec { - return ASLayoutSpec() - } - - public func show() { - display(inRect: CGRect(x: 0, y: 0, width: 190, height: 190)) - } -} diff --git a/submodules/AsyncDisplayKit/examples_extra/ASLayoutSpecPlayground-Swift/Sample/Sample.playground/Sources/StackLayout.swift b/submodules/AsyncDisplayKit/examples_extra/ASLayoutSpecPlayground-Swift/Sample/Sample.playground/Sources/StackLayout.swift deleted file mode 100644 index 871252e0fc..0000000000 --- a/submodules/AsyncDisplayKit/examples_extra/ASLayoutSpecPlayground-Swift/Sample/Sample.playground/Sources/StackLayout.swift +++ /dev/null @@ -1,38 +0,0 @@ -// -// StackLayout.swift -// Texture -// -// Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// -import AsyncDisplayKit - -public class StackLayout: ASDisplayNode, ASPlayground { - public let titleNode = ASTextNode() - public let subtitleNode = ASTextNode() - - override public init() { - super.init() - backgroundColor = .white - - automaticallyManagesSubnodes = true - setupNodes() - } - - private func setupNodes() { - titleNode.backgroundColor = .blue - titleNode.attributedText = NSAttributedString.attributedString(string: "Headline!", fontSize: 14, color: .white, firstWordColor: nil) - - subtitleNode.backgroundColor = .yellow - subtitleNode.attributedText = NSAttributedString(string: "Lorem ipsum dolor sit amet, sed ex laudem utroque meliore, at cum lucilius vituperata. Ludus mollis consulatu mei eu, esse vocent epicurei sed at. Ut cum recusabo prodesset. Ut cetero periculis sed, mundi senserit est ut. Nam ut sonet mandamus intellegebat, summo voluptaria vim ad.") - } - - // This is used to expose this function for overriding in extensions - override public func layoutSpecThatFits(_ constrainedSize: ASSizeRange) -> ASLayoutSpec { - return ASLayoutSpec() - } - - public func show() { - display(inRect: .zero) - } -} diff --git a/submodules/AsyncDisplayKit/examples_extra/ASLayoutSpecPlayground-Swift/Sample/Sample.playground/Sources/Utilities.swift b/submodules/AsyncDisplayKit/examples_extra/ASLayoutSpecPlayground-Swift/Sample/Sample.playground/Sources/Utilities.swift deleted file mode 100644 index ab2cccc798..0000000000 --- a/submodules/AsyncDisplayKit/examples_extra/ASLayoutSpecPlayground-Swift/Sample/Sample.playground/Sources/Utilities.swift +++ /dev/null @@ -1,50 +0,0 @@ -// -// Utilities.swift -// Texture -// -// Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// -import UIKit -import Foundation - -extension UIColor { - - static func darkBlueColor() -> UIColor { - return UIColor(red: 18.0/255.0, green: 86.0/255.0, blue: 136.0/255.0, alpha: 1.0) - } - - - static func lightBlueColor() -> UIColor { - return UIColor(red: 0.0, green: 122.0/255.0, blue: 1.0, alpha: 1.0) - } - - static func duskColor() -> UIColor { - return UIColor(red: 255/255.0, green: 181/255.0, blue: 68/255.0, alpha: 1.0) - } - - static func customOrangeColor() -> UIColor { - return UIColor(red: 40/255.0, green: 43/255.0, blue: 53/255.0, alpha: 1.0) - } - -} - -extension NSAttributedString { - - static func attributedString(string: String, fontSize size: CGFloat, color: UIColor?, firstWordColor: UIColor?) -> NSAttributedString { - let attributes = [NSForegroundColorAttributeName: color ?? UIColor.black, - NSFontAttributeName: UIFont.boldSystemFont(ofSize: size)] - - let attributedString = NSMutableAttributedString(string: string, attributes: attributes) - - if let firstWordColor = firstWordColor { - let nsString = string as NSString - let firstSpaceRange = nsString.rangeOfCharacter(from: NSCharacterSet.whitespaces) - let firstWordRange = NSMakeRange(0, firstSpaceRange.location) - attributedString.addAttribute(NSForegroundColorAttributeName, value: firstWordColor, range: firstWordRange) - } - - return attributedString - } - -} diff --git a/submodules/AsyncDisplayKit/examples_extra/ASLayoutSpecPlayground-Swift/Sample/Sample.playground/contents.xcplayground b/submodules/AsyncDisplayKit/examples_extra/ASLayoutSpecPlayground-Swift/Sample/Sample.playground/contents.xcplayground deleted file mode 100644 index c7f819f0e3..0000000000 --- a/submodules/AsyncDisplayKit/examples_extra/ASLayoutSpecPlayground-Swift/Sample/Sample.playground/contents.xcplayground +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - - - - diff --git a/submodules/AsyncDisplayKit/examples_extra/ASTableViewStressTest/Default-568h@2x.png b/submodules/AsyncDisplayKit/examples_extra/ASTableViewStressTest/Default-568h@2x.png deleted file mode 100644 index 6ee80b9393..0000000000 Binary files a/submodules/AsyncDisplayKit/examples_extra/ASTableViewStressTest/Default-568h@2x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/examples_extra/ASTableViewStressTest/Default-667h@2x.png b/submodules/AsyncDisplayKit/examples_extra/ASTableViewStressTest/Default-667h@2x.png deleted file mode 100644 index e7b975e21b..0000000000 Binary files a/submodules/AsyncDisplayKit/examples_extra/ASTableViewStressTest/Default-667h@2x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/examples_extra/ASTableViewStressTest/Default-736h@3x.png b/submodules/AsyncDisplayKit/examples_extra/ASTableViewStressTest/Default-736h@3x.png deleted file mode 100644 index c8949cae16..0000000000 Binary files a/submodules/AsyncDisplayKit/examples_extra/ASTableViewStressTest/Default-736h@3x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/examples_extra/ASTableViewStressTest/Podfile b/submodules/AsyncDisplayKit/examples_extra/ASTableViewStressTest/Podfile deleted file mode 100644 index 71a7f2c4b2..0000000000 --- a/submodules/AsyncDisplayKit/examples_extra/ASTableViewStressTest/Podfile +++ /dev/null @@ -1,5 +0,0 @@ -source 'https://github.com/CocoaPods/Specs.git' -platform :ios, '9.0' -target 'Sample' do - pod 'Texture', :path => '../..' -end diff --git a/submodules/AsyncDisplayKit/examples_extra/ASTableViewStressTest/Sample.xcworkspace/contents.xcworkspacedata b/submodules/AsyncDisplayKit/examples_extra/ASTableViewStressTest/Sample.xcworkspace/contents.xcworkspacedata deleted file mode 100644 index 7b5a2f3050..0000000000 --- a/submodules/AsyncDisplayKit/examples_extra/ASTableViewStressTest/Sample.xcworkspace/contents.xcworkspacedata +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - diff --git a/submodules/AsyncDisplayKit/examples_extra/ASTableViewStressTest/Sample/AppDelegate.h b/submodules/AsyncDisplayKit/examples_extra/ASTableViewStressTest/Sample/AppDelegate.h deleted file mode 100644 index 19db03c153..0000000000 --- a/submodules/AsyncDisplayKit/examples_extra/ASTableViewStressTest/Sample/AppDelegate.h +++ /dev/null @@ -1,16 +0,0 @@ -// -// AppDelegate.h -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -@interface AppDelegate : UIResponder - -@property (strong, nonatomic) UIWindow *window; - -@end diff --git a/submodules/AsyncDisplayKit/examples_extra/ASTableViewStressTest/Sample/AppDelegate.m b/submodules/AsyncDisplayKit/examples_extra/ASTableViewStressTest/Sample/AppDelegate.m deleted file mode 100644 index 1a89581c33..0000000000 --- a/submodules/AsyncDisplayKit/examples_extra/ASTableViewStressTest/Sample/AppDelegate.m +++ /dev/null @@ -1,47 +0,0 @@ -// -// AppDelegate.m -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import "AppDelegate.h" - -#import "ViewController.h" - -#import -#import - -@implementation AppDelegate - -- (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] init]; - - [self pushNewViewControllerAnimated:NO]; - - [self.window makeKeyAndVisible]; - - return YES; -} - -- (void)pushNewViewControllerAnimated:(BOOL)animated -{ - UINavigationController *navController = (UINavigationController *)self.window.rootViewController; - - UIViewController *viewController = [[ViewController alloc] init]; - viewController.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:@"Push Another Copy" style:UIBarButtonItemStylePlain target:self action:@selector(pushNewViewController)]; - - [navController pushViewController:viewController animated:animated]; -} - -- (void)pushNewViewController -{ - [self pushNewViewControllerAnimated:YES]; -} - -@end diff --git a/submodules/AsyncDisplayKit/examples_extra/ASTableViewStressTest/Sample/Info.plist b/submodules/AsyncDisplayKit/examples_extra/ASTableViewStressTest/Sample/Info.plist deleted file mode 100644 index ad825d6e33..0000000000 --- a/submodules/AsyncDisplayKit/examples_extra/ASTableViewStressTest/Sample/Info.plist +++ /dev/null @@ -1,36 +0,0 @@ - - - - - CFBundleDevelopmentRegion - en - CFBundleExecutable - $(EXECUTABLE_NAME) - CFBundleIdentifier - org.AsyncDisplayKit.$(PRODUCT_NAME:rfc1034identifier) - CFBundleInfoDictionaryVersion - 6.0 - CFBundleName - $(PRODUCT_NAME) - CFBundlePackageType - APPL - CFBundleShortVersionString - 1.0 - CFBundleSignature - ???? - CFBundleVersion - 1 - LSRequiresIPhoneOS - - UIRequiredDeviceCapabilities - - armv7 - - UISupportedInterfaceOrientations - - UIInterfaceOrientationPortrait - UIInterfaceOrientationLandscapeLeft - UIInterfaceOrientationLandscapeRight - - - diff --git a/submodules/AsyncDisplayKit/examples_extra/ASTableViewStressTest/Sample/ViewController.h b/submodules/AsyncDisplayKit/examples_extra/ASTableViewStressTest/Sample/ViewController.h deleted file mode 100644 index c8a0626291..0000000000 --- a/submodules/AsyncDisplayKit/examples_extra/ASTableViewStressTest/Sample/ViewController.h +++ /dev/null @@ -1,14 +0,0 @@ -// -// ViewController.h -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -@interface ViewController : UIViewController - -@end diff --git a/submodules/AsyncDisplayKit/examples_extra/ASTableViewStressTest/Sample/ViewController.m b/submodules/AsyncDisplayKit/examples_extra/ASTableViewStressTest/Sample/ViewController.m deleted file mode 100644 index d75f9ac3ef..0000000000 --- a/submodules/AsyncDisplayKit/examples_extra/ASTableViewStressTest/Sample/ViewController.m +++ /dev/null @@ -1,192 +0,0 @@ -// -// ViewController.m -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import "ViewController.h" - -#import -#import - -#define NumberOfSections 10 -#define NumberOfRowsPerSection 20 -#define NumberOfReloadIterations 50 - -typedef enum : NSUInteger { - ReloadData, - ReloadRows, - ReloadSections, - ReloadTypeMax -} ReloadType; - -@interface ViewController () -{ - ASTableView *_tableView; - NSMutableArray *_sections; // Contains arrays of indexPaths representing rows -} - -@end - - -@implementation ViewController - -- (instancetype)init -{ - if (!(self = [super init])) - return nil; - - _tableView = [[ASTableView alloc] initWithFrame:CGRectZero style:UITableViewStylePlain]; - _tableView.asyncDataSource = self; - _tableView.asyncDelegate = self; - _tableView.separatorStyle = UITableViewCellSeparatorStyleNone; - - _sections = [NSMutableArray arrayWithCapacity:NumberOfSections]; - for (int i = 0; i < NumberOfSections; i++) { - NSMutableArray *rowsArray = [NSMutableArray arrayWithCapacity:NumberOfRowsPerSection]; - for (int j = 0; j < NumberOfRowsPerSection; j++) { - [rowsArray addObject:[NSIndexPath indexPathForRow:j inSection:i]]; - } - [_sections addObject:rowsArray]; - } - - return self; -} - -- (void)viewDidLoad -{ - [super viewDidLoad]; - - [self.view addSubview:_tableView]; -} - -- (void)viewWillLayoutSubviews -{ - _tableView.frame = self.view.bounds; -} - -- (void)viewDidAppear:(BOOL)animated -{ - [super viewDidAppear:animated]; - - [self thrashTableView]; -} - -- (NSIndexSet *)randomIndexSet -{ - u_int32_t upperBound = (u_int32_t)_sections.count - 1; - u_int32_t randA = arc4random_uniform(upperBound); - u_int32_t randB = arc4random_uniform(upperBound); - - return [NSIndexSet indexSetWithIndexesInRange:NSMakeRange(MIN(randA, randB), MAX(randA, randB) - MIN(randA, randB))]; -} - -- (NSArray *)randomIndexPathsExisting:(BOOL)existing -{ - NSMutableArray *indexPaths = [NSMutableArray array]; - [[self randomIndexSet] enumerateIndexesUsingBlock:^(NSUInteger idx, BOOL *stop) { - NSUInteger rowNum = [self tableView:_tableView numberOfRowsInSection:idx]; - NSIndexPath *sectionIndex = [[NSIndexPath alloc] initWithIndex:idx]; - for (NSUInteger i = (existing ? 0 : rowNum); i < (existing ? rowNum : rowNum * 2); i++) { - // Maximize evility by sporadically skipping indicies 1/3rd of the time, but only if reloading existing rows - if (existing && arc4random_uniform(2) == 0) { - continue; - } - - NSIndexPath *indexPath = [sectionIndex indexPathByAddingIndex:i]; - [indexPaths addObject:indexPath]; - } - }]; - return indexPaths; -} - -- (void)thrashTableView -{ - [_tableView reloadData]; - - NSArray *indexPathsAddedAndRemoved = nil; - - for (int i = 0; i < NumberOfReloadIterations; ++i) { - UITableViewRowAnimation rowAnimation = (arc4random_uniform(1) == 0 ? UITableViewRowAnimationMiddle : UITableViewRowAnimationNone); - - BOOL animatedScroll = (arc4random_uniform(2) == 0 ? YES : NO); - ReloadType reloadType = (arc4random_uniform(ReloadTypeMax)); - BOOL letRunloopProceed = (arc4random_uniform(2) == 0 ? YES : NO); - BOOL useBeginEndUpdates = (arc4random_uniform(3) == 0 ? YES : NO); - - // FIXME: Need to revise the logic to support mutating the data source rather than just reload thrashing. - // UITableView itself does not support deleting a row in the same edit transaction as reloading it, for example. - BOOL addIndexPaths = NO; //(arc4random_uniform(2) == 0 ? YES : NO); - - if (useBeginEndUpdates) { - [_tableView beginUpdates]; - } - - switch (reloadType) { - case ReloadData: - [_tableView reloadData]; - break; - - case ReloadRows: - [_tableView reloadRowsAtIndexPaths:[self randomIndexPathsExisting:YES] withRowAnimation:rowAnimation]; - break; - - case ReloadSections: - [_tableView reloadSections:[self randomIndexSet] withRowAnimation:rowAnimation]; - break; - - default: - break; - } - - if (addIndexPaths && !indexPathsAddedAndRemoved) { - indexPathsAddedAndRemoved = [self randomIndexPathsExisting:NO]; - for (NSIndexPath *indexPath in indexPathsAddedAndRemoved) { - [_sections[indexPath.section] addObject:indexPath]; - } - [_tableView insertRowsAtIndexPaths:indexPathsAddedAndRemoved withRowAnimation:rowAnimation]; - } - - [_tableView setContentOffset:CGPointMake(0, arc4random_uniform(_tableView.contentSize.height - _tableView.bounds.size.height)) animated:animatedScroll]; - - if (letRunloopProceed) { - // Run other stuff on the main queue for between 2ms and 1000ms. - [[NSRunLoop currentRunLoop] runUntilDate:[NSDate dateWithTimeIntervalSinceNow:(1 / (1 + arc4random_uniform(500)))]]; - - if (indexPathsAddedAndRemoved) { - for (NSIndexPath *indexPath in indexPathsAddedAndRemoved) { - [_sections[indexPath.section] removeObjectIdenticalTo:indexPath]; - } - [_tableView deleteRowsAtIndexPaths:indexPathsAddedAndRemoved withRowAnimation:rowAnimation]; - indexPathsAddedAndRemoved = nil; - } - } - - if (useBeginEndUpdates) { - [_tableView endUpdates]; - } - } -} - -- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView -{ - return _sections.count; -} - -- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section -{ - return [(NSArray *)[_sections objectAtIndex:section] count]; -} - -- (ASCellNode *)tableView:(ASTableView *)tableView nodeForRowAtIndexPath:(NSIndexPath *)indexPath -{ - ASTextCellNode *textCellNode = [ASTextCellNode new]; - textCellNode.text = indexPath.description; - - return textCellNode; -} - -@end diff --git a/submodules/AsyncDisplayKit/examples_extra/ASTableViewStressTest/Sample/main.m b/submodules/AsyncDisplayKit/examples_extra/ASTableViewStressTest/Sample/main.m deleted file mode 100644 index 511cd1a7ac..0000000000 --- a/submodules/AsyncDisplayKit/examples_extra/ASTableViewStressTest/Sample/main.m +++ /dev/null @@ -1,18 +0,0 @@ -// -// main.m -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -#import "AppDelegate.h" - -int main(int argc, char * argv[]) { - @autoreleasepool { - return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); - } -} diff --git a/submodules/AsyncDisplayKit/examples_extra/ASTraitCollection/Podfile b/submodules/AsyncDisplayKit/examples_extra/ASTraitCollection/Podfile deleted file mode 100644 index 71a7f2c4b2..0000000000 --- a/submodules/AsyncDisplayKit/examples_extra/ASTraitCollection/Podfile +++ /dev/null @@ -1,5 +0,0 @@ -source 'https://github.com/CocoaPods/Specs.git' -platform :ios, '9.0' -target 'Sample' do - pod 'Texture', :path => '../..' -end diff --git a/submodules/AsyncDisplayKit/examples_extra/ASTraitCollection/Sample.xcworkspace/contents.xcworkspacedata b/submodules/AsyncDisplayKit/examples_extra/ASTraitCollection/Sample.xcworkspace/contents.xcworkspacedata deleted file mode 100644 index 7b5a2f3050..0000000000 --- a/submodules/AsyncDisplayKit/examples_extra/ASTraitCollection/Sample.xcworkspace/contents.xcworkspacedata +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - diff --git a/submodules/AsyncDisplayKit/examples_extra/ASTraitCollection/Sample/AppDelegate.h b/submodules/AsyncDisplayKit/examples_extra/ASTraitCollection/Sample/AppDelegate.h deleted file mode 100644 index c30a27f4dc..0000000000 --- a/submodules/AsyncDisplayKit/examples_extra/ASTraitCollection/Sample/AppDelegate.h +++ /dev/null @@ -1,18 +0,0 @@ -// -// AppDelegate.h -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -#define UseAutomaticLayout 1 - -@interface AppDelegate : UIResponder - -@property (strong, nonatomic) UIWindow *window; - -@end diff --git a/submodules/AsyncDisplayKit/examples_extra/ASTraitCollection/Sample/AppDelegate.m b/submodules/AsyncDisplayKit/examples_extra/ASTraitCollection/Sample/AppDelegate.m deleted file mode 100644 index 0a4654ae14..0000000000 --- a/submodules/AsyncDisplayKit/examples_extra/ASTraitCollection/Sample/AppDelegate.m +++ /dev/null @@ -1,29 +0,0 @@ -// -// AppDelegate.m -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import "AppDelegate.h" - -#import "ViewController.h" -#import "TableViewController.h" -#import "CollectionViewController.h" - -@implementation AppDelegate - -- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions -{ - self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; - self.window.backgroundColor = [UIColor whiteColor]; - UITabBarController *tabController = [[UITabBarController alloc] init]; - [tabController setViewControllers:@[[[ViewController alloc] init], [[TableViewController alloc] init], [[CollectionViewController alloc] init]]]; - self.window.rootViewController = tabController; - [self.window makeKeyAndVisible]; - return YES; -} - -@end diff --git a/submodules/AsyncDisplayKit/examples_extra/ASTraitCollection/Sample/CollectionViewController.h b/submodules/AsyncDisplayKit/examples_extra/ASTraitCollection/Sample/CollectionViewController.h deleted file mode 100644 index 0528310b79..0000000000 --- a/submodules/AsyncDisplayKit/examples_extra/ASTraitCollection/Sample/CollectionViewController.h +++ /dev/null @@ -1,13 +0,0 @@ -// -// CollectionViewController.h -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -@interface CollectionViewController : ASViewController -@end diff --git a/submodules/AsyncDisplayKit/examples_extra/ASTraitCollection/Sample/CollectionViewController.m b/submodules/AsyncDisplayKit/examples_extra/ASTraitCollection/Sample/CollectionViewController.m deleted file mode 100644 index 7e57f74434..0000000000 --- a/submodules/AsyncDisplayKit/examples_extra/ASTraitCollection/Sample/CollectionViewController.m +++ /dev/null @@ -1,71 +0,0 @@ -// -// CollectionViewController.m -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import "CollectionViewController.h" -#import "KittenNode.h" -#import - -@interface CollectionViewController () -@property (nonatomic, strong) ASCollectionNode *collectionNode; -@end - -@implementation CollectionViewController - -- (instancetype)init -{ - UICollectionViewFlowLayout *layout = [[UICollectionViewFlowLayout alloc] init]; - layout.minimumLineSpacing = 10; - layout.minimumInteritemSpacing = 10; - - ASCollectionNode *collectionNode = [[ASCollectionNode alloc] initWithCollectionViewLayout:layout]; - - if (!(self = [super initWithNode:collectionNode])) - return nil; - - self.title = @"Collection Node"; - _collectionNode = collectionNode; - collectionNode.dataSource = self; - collectionNode.delegate = self; - return self; -} - -- (void)viewDidLoad -{ - [super viewDidLoad]; - self.collectionNode.view.contentInset = UIEdgeInsetsMake(20, 10, CGRectGetHeight(self.tabBarController.tabBar.frame), 10); -} - -#pragma mark - ASCollectionDataSource - -- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section -{ - return 50; -} - -- (ASCellNode *)collectionView:(ASCollectionView *)collectionView nodeForItemAtIndexPath:(NSIndexPath *)indexPath -{ - KittenNode *cell = [[KittenNode alloc] init]; - cell.textNode.maximumNumberOfLines = 3; - cell.imageTappedBlock = ^{ - [KittenNode defaultImageTappedAction:self]; - }; - return cell; -} - -- (ASSizeRange)collectionView:(ASCollectionView *)collectionView constrainedSizeForNodeAtIndexPath:(NSIndexPath *)indexPath -{ - ASTraitCollection *traitCollection = [self.collectionNode asyncTraitCollection]; - - if (traitCollection.horizontalSizeClass == UIUserInterfaceSizeClassRegular) { - return ASSizeRangeMake(CGSizeMake(200, 120), CGSizeMake(200, 120)); - } - return ASSizeRangeMake(CGSizeMake(132, 180), CGSizeMake(132, 180)); -} - -@end diff --git a/submodules/AsyncDisplayKit/examples_extra/ASTraitCollection/Sample/Info.plist b/submodules/AsyncDisplayKit/examples_extra/ASTraitCollection/Sample/Info.plist deleted file mode 100644 index acc713cc71..0000000000 --- a/submodules/AsyncDisplayKit/examples_extra/ASTraitCollection/Sample/Info.plist +++ /dev/null @@ -1,39 +0,0 @@ - - - - - CFBundleDevelopmentRegion - en - CFBundleExecutable - $(EXECUTABLE_NAME) - CFBundleIdentifier - com.facebook.AsyncDisplayKit.$(PRODUCT_NAME:rfc1034identifier) - CFBundleInfoDictionaryVersion - 6.0 - CFBundleName - $(PRODUCT_NAME) - CFBundlePackageType - APPL - CFBundleShortVersionString - 1.0 - CFBundleSignature - ???? - CFBundleVersion - 1 - LSRequiresIPhoneOS - - UILaunchStoryboardName - Launch Screen - UIRequiredDeviceCapabilities - - armv7 - - UISupportedInterfaceOrientations - - UIInterfaceOrientationPortrait - UIInterfaceOrientationLandscapeLeft - UIInterfaceOrientationLandscapeRight - UIInterfaceOrientationPortraitUpsideDown - - - diff --git a/submodules/AsyncDisplayKit/examples_extra/ASTraitCollection/Sample/KittenNode.h b/submodules/AsyncDisplayKit/examples_extra/ASTraitCollection/Sample/KittenNode.h deleted file mode 100644 index 17655e0765..0000000000 --- a/submodules/AsyncDisplayKit/examples_extra/ASTraitCollection/Sample/KittenNode.h +++ /dev/null @@ -1,21 +0,0 @@ -// -// KittenNode.h -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -@interface KittenNode : ASCellNode -@property (nonatomic, strong, readonly) ASNetworkImageNode *imageNode; -@property (nonatomic, strong, readonly) ASTextNode *textNode; - -@property (nonatomic, copy) dispatch_block_t imageTappedBlock; - -// The default action when an image node is tapped. This action will create an -// OverrideVC and override its display traits to always be compact. -+ (void)defaultImageTappedAction:(ASViewController *)sourceViewController; -@end diff --git a/submodules/AsyncDisplayKit/examples_extra/ASTraitCollection/Sample/KittenNode.m b/submodules/AsyncDisplayKit/examples_extra/ASTraitCollection/Sample/KittenNode.m deleted file mode 100644 index 1526563e04..0000000000 --- a/submodules/AsyncDisplayKit/examples_extra/ASTraitCollection/Sample/KittenNode.m +++ /dev/null @@ -1,167 +0,0 @@ -// -// KittenNode.m -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import "KittenNode.h" -#import "OverrideViewController.h" - -#import - -static const CGFloat kOuterPadding = 16.0f; -static const CGFloat kInnerPadding = 10.0f; - -@interface KittenNode () -{ - CGSize _kittenSize; -} - -@end - - -@implementation KittenNode - -// lorem ipsum text courtesy https://kittyipsum.com/ <3 -+ (NSArray *)placeholders -{ - static NSArray *placeholders = nil; - - static dispatch_once_t once; - dispatch_once(&once, ^{ - placeholders = @[ - @"Kitty ipsum dolor sit amet, purr sleep on your face lay down in your way biting, sniff tincidunt a etiam fluffy fur judging you stuck in a tree kittens.", - @"Lick tincidunt a biting eat the grass, egestas enim ut lick leap puking climb the curtains lick.", - @"Lick quis nunc toss the mousie vel, tortor pellentesque sunbathe orci turpis non tail flick suscipit sleep in the sink.", - @"Orci turpis litter box et stuck in a tree, egestas ac tempus et aliquam elit.", - @"Hairball iaculis dolor dolor neque, nibh adipiscing vehicula egestas dolor aliquam.", - @"Sunbathe fluffy fur tortor faucibus pharetra jump, enim jump on the table I don't like that food catnip toss the mousie scratched.", - @"Quis nunc nam sleep in the sink quis nunc purr faucibus, chase the red dot consectetur bat sagittis.", - @"Lick tail flick jump on the table stretching purr amet, rhoncus scratched jump on the table run.", - @"Suspendisse aliquam vulputate feed me sleep on your keyboard, rip the couch faucibus sleep on your keyboard tristique give me fish dolor.", - @"Rip the couch hiss attack your ankles biting pellentesque puking, enim suspendisse enim mauris a.", - @"Sollicitudin iaculis vestibulum toss the mousie biting attack your ankles, puking nunc jump adipiscing in viverra.", - @"Nam zzz amet neque, bat tincidunt a iaculis sniff hiss bibendum leap nibh.", - @"Chase the red dot enim puking chuf, tristique et egestas sniff sollicitudin pharetra enim ut mauris a.", - @"Sagittis scratched et lick, hairball leap attack adipiscing catnip tail flick iaculis lick.", - @"Neque neque sleep in the sink neque sleep on your face, climb the curtains chuf tail flick sniff tortor non.", - @"Ac etiam kittens claw toss the mousie jump, pellentesque rhoncus litter box give me fish adipiscing mauris a.", - @"Pharetra egestas sunbathe faucibus ac fluffy fur, hiss feed me give me fish accumsan.", - @"Tortor leap tristique accumsan rutrum sleep in the sink, amet sollicitudin adipiscing dolor chase the red dot.", - @"Knock over the lamp pharetra vehicula sleep on your face rhoncus, jump elit cras nec quis quis nunc nam.", - @"Sollicitudin feed me et ac in viverra catnip, nunc eat I don't like that food iaculis give me fish.", - ]; - }); - - return placeholders; -} - -- (instancetype)init -{ - if (!(self = [super init])) - return nil; - - _kittenSize = CGSizeMake(100,100); - - // kitten image, with a solid background colour serving as placeholder - _imageNode = [[ASNetworkImageNode alloc] init]; - _imageNode.backgroundColor = ASDisplayNodeDefaultPlaceholderColor(); - _imageNode.style.preferredSize = _kittenSize; - [_imageNode addTarget:self action:@selector(imageTapped:) forControlEvents:ASControlNodeEventTouchUpInside]; - - CGFloat scale = [UIScreen mainScreen].scale; - _imageNode.URL = [NSURL URLWithString:[NSString stringWithFormat:@"https://placekitten.com/%zd/%zd?image=%zd", - (NSInteger)roundl(_kittenSize.width * scale), - (NSInteger)roundl(_kittenSize.height * scale), - (NSInteger)arc4random_uniform(20)]]; - [self addSubnode:_imageNode]; - - // lorem ipsum text, plus some nice styling - _textNode = [[ASTextNode alloc] init]; - _textNode.attributedText = [[NSAttributedString alloc] initWithString:[self kittyIpsum] - attributes:[self textStyle]]; - _textNode.style.flexShrink = 1.0; - _textNode.style.flexGrow = 1.0; - [self addSubnode:_textNode]; - - return self; -} - -- (void)imageTapped:(id)sender -{ - if (self.imageTappedBlock) { - self.imageTappedBlock(); - } -} - -- (NSString *)kittyIpsum -{ - NSArray *placeholders = [KittenNode placeholders]; - u_int32_t ipsumCount = (u_int32_t)[placeholders count]; - u_int32_t location = arc4random_uniform(ipsumCount); - u_int32_t length = arc4random_uniform(ipsumCount - location); - - NSMutableString *string = [placeholders[location] mutableCopy]; - for (u_int32_t i = location + 1; i < location + length; i++) { - [string appendString:(i % 2 == 0) ? @"\n" : @" "]; - [string appendString:placeholders[i]]; - } - - return string; -} - -- (NSDictionary *)textStyle -{ - UIFont *font = [UIFont fontWithName:@"HelveticaNeue" size:12.0f]; - - NSMutableParagraphStyle *style = [[NSParagraphStyle defaultParagraphStyle] mutableCopy]; - style.paragraphSpacing = 0.5 * font.lineHeight; - style.hyphenationFactor = 1.0; - - return @{ NSFontAttributeName: font, - NSParagraphStyleAttributeName: style, - ASTextNodeWordKerningAttributeName : @.5}; -} - -- (ASLayoutSpec *)layoutSpecThatFits:(ASSizeRange)constrainedSize -{ - ASStackLayoutSpec *stackSpec = [[ASStackLayoutSpec alloc] init]; - stackSpec.spacing = kInnerPadding; - [stackSpec setChildren:@[_imageNode, _textNode]]; - - if (self.asyncTraitCollection.horizontalSizeClass == UIUserInterfaceSizeClassRegular) { - _imageNode.style.alignSelf = ASStackLayoutAlignSelfStart; - stackSpec.direction = ASStackLayoutDirectionHorizontal; - } else { - _imageNode.style.alignSelf = ASStackLayoutAlignSelfCenter; - stackSpec.direction = ASStackLayoutDirectionVertical; - } - - return [ASInsetLayoutSpec insetLayoutSpecWithInsets:UIEdgeInsetsMake(kOuterPadding, kOuterPadding, kOuterPadding, kOuterPadding) child:stackSpec]; -} - -+ (void)defaultImageTappedAction:(ASViewController *)sourceViewController -{ - OverrideViewController *overrideVC = [[OverrideViewController alloc] init]; - - __weak OverrideViewController *weakOverrideVC = overrideVC; - overrideVC.overrideDisplayTraitsWithTraitCollection = ^(UITraitCollection *traitCollection) { - ASTraitCollection *asyncTraitCollection = [ASTraitCollection traitCollectionWithDisplayScale:traitCollection.displayScale - userInterfaceIdiom:traitCollection.userInterfaceIdiom - horizontalSizeClass:UIUserInterfaceSizeClassCompact - verticalSizeClass:UIUserInterfaceSizeClassCompact - forceTouchCapability:traitCollection.forceTouchCapability - containerSize:weakOverrideVC.view.bounds.size]; - return asyncTraitCollection; - }; - - [sourceViewController presentViewController:overrideVC animated:YES completion:nil]; - overrideVC.closeBlock = ^{ - [sourceViewController dismissViewControllerAnimated:YES completion:nil]; - }; -} - -@end diff --git a/submodules/AsyncDisplayKit/examples_extra/ASTraitCollection/Sample/Launch Screen.storyboard b/submodules/AsyncDisplayKit/examples_extra/ASTraitCollection/Sample/Launch Screen.storyboard deleted file mode 100644 index 95c8ef474d..0000000000 --- a/submodules/AsyncDisplayKit/examples_extra/ASTraitCollection/Sample/Launch Screen.storyboard +++ /dev/null @@ -1,50 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/submodules/AsyncDisplayKit/examples_extra/ASTraitCollection/Sample/OverrideViewController.h b/submodules/AsyncDisplayKit/examples_extra/ASTraitCollection/Sample/OverrideViewController.h deleted file mode 100644 index f5de270ae5..0000000000 --- a/submodules/AsyncDisplayKit/examples_extra/ASTraitCollection/Sample/OverrideViewController.h +++ /dev/null @@ -1,27 +0,0 @@ -// -// OverrideViewController.h -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -/* - * A simple node that displays the attribution for the kitties in the app. Note that - * for a regular horizontal size class it does something stupid and sets the font size to 100. - * It's VC, OverrideViewController, will have its display traits overridden such that - * it will always have a compact horizontal size class. - */ -@interface OverrideNode : ASDisplayNode -@end - -/* - * This is a fairly stupid VC that's main purpose is to show how to override ASDisplayTraits. - * Take a look at `defaultImageTappedAction` in KittenNode to see how this is accomplished. - */ -@interface OverrideViewController : ASViewController -@property (nonatomic, copy) dispatch_block_t closeBlock; -@end diff --git a/submodules/AsyncDisplayKit/examples_extra/ASTraitCollection/Sample/OverrideViewController.m b/submodules/AsyncDisplayKit/examples_extra/ASTraitCollection/Sample/OverrideViewController.m deleted file mode 100644 index 3e9fcc305e..0000000000 --- a/submodules/AsyncDisplayKit/examples_extra/ASTraitCollection/Sample/OverrideViewController.m +++ /dev/null @@ -1,95 +0,0 @@ -// -// OverrideViewController.m -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import "OverrideViewController.h" -#import - -static NSString *kLinkAttributeName = @"PlaceKittenNodeLinkAttributeName"; - -@interface OverrideNode() -@property (nonatomic, strong) ASTextNode *textNode; -@property (nonatomic, strong) ASButtonNode *buttonNode; -@end - -@implementation OverrideNode - -- (instancetype)init -{ - if (!(self = [super init])) - return nil; - - _textNode = [[ASTextNode alloc] init]; - _textNode.style.flexGrow = 1.0; - _textNode.style.flexShrink = 1.0; - _textNode.maximumNumberOfLines = 3; - [self addSubnode:_textNode]; - - _buttonNode = [[ASButtonNode alloc] init]; - [_buttonNode setAttributedTitle:[[NSAttributedString alloc] initWithString:@"Close"] forState:UIControlStateNormal]; - [self addSubnode:_buttonNode]; - - self.backgroundColor = [UIColor lightGrayColor]; - - return self; -} - -- (ASLayoutSpec *)layoutSpecThatFits:(ASSizeRange)constrainedSize -{ - CGFloat pointSize = 16.f; - ASTraitCollection *traitCollection = [self asyncTraitCollection]; - if (traitCollection.horizontalSizeClass == UIUserInterfaceSizeClassRegular) { - // This should never happen because we override the VC's display traits to always be compact. - pointSize = 100; - } - - NSString *blurb = @"kittens courtesy placekitten.com"; - NSMutableAttributedString *string = [[NSMutableAttributedString alloc] initWithString:blurb]; - [string addAttribute:NSFontAttributeName value:[UIFont fontWithName:@"HelveticaNeue" size:pointSize] range:NSMakeRange(0, blurb.length)]; - [string addAttributes:@{ - kLinkAttributeName: [NSURL URLWithString:@"http://placekitten.com/"], - NSForegroundColorAttributeName: [UIColor grayColor], - NSUnderlineStyleAttributeName: @(NSUnderlineStyleSingle | NSUnderlinePatternDot), - } - range:[blurb rangeOfString:@"placekitten.com"]]; - - _textNode.attributedText = string; - - ASStackLayoutSpec *stackSpec = [ASStackLayoutSpec verticalStackLayoutSpec]; - stackSpec.children = @[_textNode, _buttonNode]; - stackSpec.spacing = 10; - return [ASInsetLayoutSpec insetLayoutSpecWithInsets:UIEdgeInsetsMake(40, 20, 20, 20) child:stackSpec]; -} - -@end - -@interface OverrideViewController () - -@end - -@implementation OverrideViewController - -- (instancetype)init -{ - OverrideNode *overrideNode = [[OverrideNode alloc] init]; - - if (!(self = [super initWithNode:overrideNode])) - return nil; - - [overrideNode.buttonNode addTarget:self action:@selector(closeTapped:) forControlEvents:ASControlNodeEventTouchUpInside]; - return self; -} - -- (void)closeTapped:(id)sender -{ - if (self.closeBlock) { - self.closeBlock(); - } -} - -@end diff --git a/submodules/AsyncDisplayKit/examples_extra/ASTraitCollection/Sample/TableViewController.h b/submodules/AsyncDisplayKit/examples_extra/ASTraitCollection/Sample/TableViewController.h deleted file mode 100644 index bfb5fad618..0000000000 --- a/submodules/AsyncDisplayKit/examples_extra/ASTraitCollection/Sample/TableViewController.h +++ /dev/null @@ -1,14 +0,0 @@ -// -// TableViewController.h -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -@interface TableViewController : ASViewController - -@end diff --git a/submodules/AsyncDisplayKit/examples_extra/ASTraitCollection/Sample/TableViewController.m b/submodules/AsyncDisplayKit/examples_extra/ASTraitCollection/Sample/TableViewController.m deleted file mode 100644 index 3a91be7588..0000000000 --- a/submodules/AsyncDisplayKit/examples_extra/ASTraitCollection/Sample/TableViewController.m +++ /dev/null @@ -1,60 +0,0 @@ -// -// TableViewController.m -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import "TableViewController.h" -#import "KittenNode.h" - -@interface TableViewController () -@property (nonatomic, strong) ASTableNode *tableNode; -@end - -@implementation TableViewController - -- (instancetype)init -{ - ASTableNode *tableNode = [[ASTableNode alloc] init]; - if (!(self = [super initWithNode:tableNode])) - return nil; - - _tableNode = tableNode; - tableNode.delegate = self; - tableNode.dataSource = self; - self.title = @"Table Node"; - return self; -} - -- (void)viewDidLoad -{ - [super viewDidLoad]; - self.tableNode.view.contentInset = UIEdgeInsetsMake(CGRectGetHeight([[UIApplication sharedApplication] statusBarFrame]), 0, CGRectGetHeight(self.tabBarController.tabBar.frame), 0); -} - -#pragma mark - -#pragma mark ASTableView. - -- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath -{ - [tableView deselectRowAtIndexPath:indexPath animated:YES]; -} - -- (ASCellNode *)tableView:(ASTableView *)tableView nodeForRowAtIndexPath:(NSIndexPath *)indexPath -{ - KittenNode *cell = [[KittenNode alloc] init]; - cell.imageTappedBlock = ^{ - [KittenNode defaultImageTappedAction:self]; - }; - return cell; -} - -- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section -{ - return 15; -} - -@end diff --git a/submodules/AsyncDisplayKit/examples_extra/ASTraitCollection/Sample/ViewController.h b/submodules/AsyncDisplayKit/examples_extra/ASTraitCollection/Sample/ViewController.h deleted file mode 100644 index 4499f93bab..0000000000 --- a/submodules/AsyncDisplayKit/examples_extra/ASTraitCollection/Sample/ViewController.h +++ /dev/null @@ -1,14 +0,0 @@ -// -// ViewController.h -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -@interface ViewController : ASViewController - -@end diff --git a/submodules/AsyncDisplayKit/examples_extra/ASTraitCollection/Sample/ViewController.m b/submodules/AsyncDisplayKit/examples_extra/ASTraitCollection/Sample/ViewController.m deleted file mode 100644 index ddb1d708f2..0000000000 --- a/submodules/AsyncDisplayKit/examples_extra/ASTraitCollection/Sample/ViewController.m +++ /dev/null @@ -1,43 +0,0 @@ -// -// ViewController.m -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import "ViewController.h" -#import "KittenNode.h" -#import "OverrideViewController.h" - -#import -#import - -@interface ViewController () -@end - -@implementation ViewController - -#pragma mark - -#pragma mark UIViewController. - -- (instancetype)init -{ - KittenNode *displayNode = [[KittenNode alloc] init]; - if (!(self = [super initWithNode:displayNode])) - return nil; - - self.title = @"Display Node"; - displayNode.imageTappedBlock = ^{ - [KittenNode defaultImageTappedAction:self]; - }; - return self; -} - -- (void)viewWillLayoutSubviews -{ - [super viewWillLayoutSubviews]; -} - -@end diff --git a/submodules/AsyncDisplayKit/examples_extra/ASTraitCollection/Sample/main.m b/submodules/AsyncDisplayKit/examples_extra/ASTraitCollection/Sample/main.m deleted file mode 100644 index 511cd1a7ac..0000000000 --- a/submodules/AsyncDisplayKit/examples_extra/ASTraitCollection/Sample/main.m +++ /dev/null @@ -1,18 +0,0 @@ -// -// main.m -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -#import "AppDelegate.h" - -int main(int argc, char * argv[]) { - @autoreleasepool { - return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); - } -} diff --git a/submodules/AsyncDisplayKit/examples_extra/BackgroundPropertySetting/Podfile b/submodules/AsyncDisplayKit/examples_extra/BackgroundPropertySetting/Podfile deleted file mode 100644 index 3b379097a0..0000000000 --- a/submodules/AsyncDisplayKit/examples_extra/BackgroundPropertySetting/Podfile +++ /dev/null @@ -1,6 +0,0 @@ -source 'https://github.com/CocoaPods/Specs.git' -platform :ios, '9.0' -use_frameworks! -target 'Sample' do - pod 'Texture', :path => '../..' -end diff --git a/submodules/AsyncDisplayKit/examples_extra/BackgroundPropertySetting/Sample/AppDelegate.swift b/submodules/AsyncDisplayKit/examples_extra/BackgroundPropertySetting/Sample/AppDelegate.swift deleted file mode 100644 index 5868314aaf..0000000000 --- a/submodules/AsyncDisplayKit/examples_extra/BackgroundPropertySetting/Sample/AppDelegate.swift +++ /dev/null @@ -1,51 +0,0 @@ -// -// AppDelegate.swift -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -import UIKit - -@UIApplicationMain -class AppDelegate: UIResponder, UIApplicationDelegate { - - var window: UIWindow? - - - func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool { - let window = UIWindow(frame: UIScreen.mainScreen().bounds) - self.window = window - let vc = ViewController() - window.rootViewController = UINavigationController(rootViewController: vc) - window.makeKeyAndVisible() - return true - } - - func applicationWillResignActive(application: UIApplication) { - // 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. - } - - func applicationDidEnterBackground(application: UIApplication) { - // 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. - } - - func applicationWillEnterForeground(application: UIApplication) { - // 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. - } - - func applicationDidBecomeActive(application: UIApplication) { - // 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. - } - - func applicationWillTerminate(application: UIApplication) { - // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. - } - - -} - diff --git a/submodules/AsyncDisplayKit/examples_extra/BackgroundPropertySetting/Sample/Assets.xcassets/AppIcon.appiconset/Contents.json b/submodules/AsyncDisplayKit/examples_extra/BackgroundPropertySetting/Sample/Assets.xcassets/AppIcon.appiconset/Contents.json deleted file mode 100644 index 118c98f746..0000000000 --- a/submodules/AsyncDisplayKit/examples_extra/BackgroundPropertySetting/Sample/Assets.xcassets/AppIcon.appiconset/Contents.json +++ /dev/null @@ -1,38 +0,0 @@ -{ - "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" - } -} \ No newline at end of file diff --git a/submodules/AsyncDisplayKit/examples_extra/BackgroundPropertySetting/Sample/Base.lproj/LaunchScreen.storyboard b/submodules/AsyncDisplayKit/examples_extra/BackgroundPropertySetting/Sample/Base.lproj/LaunchScreen.storyboard deleted file mode 100644 index 2e721e1833..0000000000 --- a/submodules/AsyncDisplayKit/examples_extra/BackgroundPropertySetting/Sample/Base.lproj/LaunchScreen.storyboard +++ /dev/null @@ -1,27 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/submodules/AsyncDisplayKit/examples_extra/BackgroundPropertySetting/Sample/DemoCellNode.swift b/submodules/AsyncDisplayKit/examples_extra/BackgroundPropertySetting/Sample/DemoCellNode.swift deleted file mode 100644 index 6c3e7e529b..0000000000 --- a/submodules/AsyncDisplayKit/examples_extra/BackgroundPropertySetting/Sample/DemoCellNode.swift +++ /dev/null @@ -1,88 +0,0 @@ -// -// DemoCellNode.swift -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -import UIKit -import AsyncDisplayKit - -final class DemoCellNode: ASCellNode { - let childA = ASDisplayNode() - let childB = ASDisplayNode() - var state = State.Right - - override init() { - super.init() - automaticallyManagesSubnodes = true - } - - override func layoutSpecThatFits(constrainedSize: ASSizeRange) -> ASLayoutSpec { - let specA = ASRatioLayoutSpec(ratio: 1, child: childA) - specA.style.flexBasis = ASDimensionMakeWithPoints(1) - specA.style.flexGrow = 1.0 - let specB = ASRatioLayoutSpec(ratio: 1, child: childB) - specB.style.flexBasis = ASDimensionMakeWithPoints(1) - specB.style.flexGrow = 1.0 - let children = state.isReverse ? [ specB, specA ] : [ specA, specB ] - let direction: ASStackLayoutDirection = state.isVertical ? .Vertical : .Horizontal - return ASStackLayoutSpec(direction: direction, - spacing: 20, - justifyContent: .SpaceAround, - alignItems: .Center, - children: children) - } - - override func animateLayoutTransition(context: ASContextTransitioning) { - childA.frame = context.initialFrameForNode(childA) - childB.frame = context.initialFrameForNode(childB) - let tinyDelay = drand48() / 10 - UIView.animateWithDuration(0.5, delay: tinyDelay, usingSpringWithDamping: 0.9, initialSpringVelocity: 1.5, options: .BeginFromCurrentState, animations: { () -> Void in - self.childA.frame = context.finalFrameForNode(self.childA) - self.childB.frame = context.finalFrameForNode(self.childB) - }, completion: { - context.completeTransition($0) - }) - } - - enum State { - case Right - case Up - case Left - case Down - - var isVertical: Bool { - switch self { - case .Up, .Down: - return true - default: - return false - } - } - - var isReverse: Bool { - switch self { - case .Left, .Up: - return true - default: - return false - } - } - - mutating func advance() { - switch self { - case .Right: - self = .Up - case .Up: - self = .Left - case .Left: - self = .Down - case .Down: - self = .Right - } - } - } -} diff --git a/submodules/AsyncDisplayKit/examples_extra/BackgroundPropertySetting/Sample/Info.plist b/submodules/AsyncDisplayKit/examples_extra/BackgroundPropertySetting/Sample/Info.plist deleted file mode 100644 index 61861abb1a..0000000000 --- a/submodules/AsyncDisplayKit/examples_extra/BackgroundPropertySetting/Sample/Info.plist +++ /dev/null @@ -1,36 +0,0 @@ - - - - - CFBundleDevelopmentRegion - en - CFBundleExecutable - $(EXECUTABLE_NAME) - CFBundleIdentifier - $(PRODUCT_BUNDLE_IDENTIFIER) - CFBundleInfoDictionaryVersion - 6.0 - CFBundleName - $(PRODUCT_NAME) - CFBundlePackageType - APPL - CFBundleShortVersionString - 1.0 - CFBundleSignature - ???? - CFBundleVersion - 1 - LSRequiresIPhoneOS - - UILaunchStoryboardName - LaunchScreen - UIRequiredDeviceCapabilities - - armv7 - - UISupportedInterfaceOrientations - - UIInterfaceOrientationPortrait - - - diff --git a/submodules/AsyncDisplayKit/examples_extra/BackgroundPropertySetting/Sample/Utilities.swift b/submodules/AsyncDisplayKit/examples_extra/BackgroundPropertySetting/Sample/Utilities.swift deleted file mode 100644 index f33065245c..0000000000 --- a/submodules/AsyncDisplayKit/examples_extra/BackgroundPropertySetting/Sample/Utilities.swift +++ /dev/null @@ -1,16 +0,0 @@ -// -// Utilities.swift -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -import UIKit - -extension UIColor { - static func random() -> UIColor { - return UIColor(red: CGFloat(drand48()), green: CGFloat(drand48()), blue: CGFloat(drand48()), alpha: 1.0) - } -} diff --git a/submodules/AsyncDisplayKit/examples_extra/BackgroundPropertySetting/Sample/ViewController.swift b/submodules/AsyncDisplayKit/examples_extra/BackgroundPropertySetting/Sample/ViewController.swift deleted file mode 100644 index 47faf4384e..0000000000 --- a/submodules/AsyncDisplayKit/examples_extra/BackgroundPropertySetting/Sample/ViewController.swift +++ /dev/null @@ -1,96 +0,0 @@ -// -// ViewController.swift -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -import UIKit -import AsyncDisplayKit - -final class ViewController: ASViewController, ASCollectionDelegate, ASCollectionDataSource { - let itemCount = 1000 - - let itemSize: CGSize - let padding: CGFloat - var collectionNode: ASCollectionNode { - return node as! ASCollectionNode - } - - init() { - let layout = UICollectionViewFlowLayout() - (padding, itemSize) = ViewController.computeLayoutSizesForMainScreen() - layout.minimumInteritemSpacing = padding - layout.minimumLineSpacing = padding - super.init(node: ASCollectionNode(collectionViewLayout: layout)) - navigationItem.rightBarButtonItem = UIBarButtonItem(title: "Color", style: .Plain, target: self, action: #selector(didTapColorsButton)) - navigationItem.leftBarButtonItem = UIBarButtonItem(title: "Layout", style: .Plain, target: self, action: #selector(didTapLayoutButton)) - collectionNode.delegate = self - collectionNode.dataSource = self - title = "Background Updating" - } - - required init?(coder aDecoder: NSCoder) { - fatalError("init(coder:) has not been implemented") - } - - // MARK: ASCollectionDataSource - - func collectionView(collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int { - return itemCount - } - - func collectionView(collectionView: ASCollectionView, nodeBlockForItemAtIndexPath indexPath: NSIndexPath) -> ASCellNodeBlock { - return { - let node = DemoCellNode() - node.backgroundColor = UIColor.random() - node.childA.backgroundColor = UIColor.random() - node.childB.backgroundColor = UIColor.random() - return node - } - } - - func collectionView(collectionView: ASCollectionView, constrainedSizeForNodeAtIndexPath indexPath: NSIndexPath) -> ASSizeRange { - return ASSizeRangeMake(itemSize, itemSize) - } - - // MARK: Action Handling - - @objc private func didTapColorsButton() { - let currentlyVisibleNodes = collectionNode.view.visibleNodes() - let queue = dispatch_get_global_queue(QOS_CLASS_DEFAULT, 0) - dispatch_async(queue) { - for case let node as DemoCellNode in currentlyVisibleNodes { - node.backgroundColor = UIColor.random() - } - } - } - - @objc private func didTapLayoutButton() { - let currentlyVisibleNodes = collectionNode.view.visibleNodes() - let queue = dispatch_get_global_queue(QOS_CLASS_DEFAULT, 0) - dispatch_async(queue) { - for case let node as DemoCellNode in currentlyVisibleNodes { - node.state.advance() - node.setNeedsLayout() - } - } - } - - // MARK: Static - - static func computeLayoutSizesForMainScreen() -> (padding: CGFloat, itemSize: CGSize) { - let numberOfColumns = 4 - let screen = UIScreen.mainScreen() - let scale = screen.scale - let screenWidth = Int(screen.bounds.width * screen.scale) - let itemWidthPx = (screenWidth - (numberOfColumns - 1)) / numberOfColumns - let leftover = screenWidth - itemWidthPx * numberOfColumns - let paddingPx = leftover / (numberOfColumns - 1) - let itemDimension = CGFloat(itemWidthPx) / scale - let padding = CGFloat(paddingPx) / scale - return (padding: padding, itemSize: CGSize(width: itemDimension, height: itemDimension)) - } -} diff --git a/submodules/AsyncDisplayKit/examples_extra/CarthageBuildTest/Cartfile b/submodules/AsyncDisplayKit/examples_extra/CarthageBuildTest/Cartfile deleted file mode 100644 index aa14143b00..0000000000 --- a/submodules/AsyncDisplayKit/examples_extra/CarthageBuildTest/Cartfile +++ /dev/null @@ -1 +0,0 @@ -github "facebook/AsyncDisplayKit" "master" diff --git a/submodules/AsyncDisplayKit/examples_extra/CarthageBuildTest/CarthageExample/AppDelegate.h b/submodules/AsyncDisplayKit/examples_extra/CarthageBuildTest/CarthageExample/AppDelegate.h deleted file mode 100644 index 8d58a13cbe..0000000000 --- a/submodules/AsyncDisplayKit/examples_extra/CarthageBuildTest/CarthageExample/AppDelegate.h +++ /dev/null @@ -1,18 +0,0 @@ -// -// AppDelegate.h -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -@interface AppDelegate : UIResponder - -@property (strong, nonatomic) UIWindow *window; - - -@end - diff --git a/submodules/AsyncDisplayKit/examples_extra/CarthageBuildTest/CarthageExample/AppDelegate.m b/submodules/AsyncDisplayKit/examples_extra/CarthageBuildTest/CarthageExample/AppDelegate.m deleted file mode 100644 index f4d3339633..0000000000 --- a/submodules/AsyncDisplayKit/examples_extra/CarthageBuildTest/CarthageExample/AppDelegate.m +++ /dev/null @@ -1,48 +0,0 @@ -// -// AppDelegate.m -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -@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 diff --git a/submodules/AsyncDisplayKit/examples_extra/CarthageBuildTest/CarthageExample/Assets.xcassets/AppIcon.appiconset/Contents.json b/submodules/AsyncDisplayKit/examples_extra/CarthageBuildTest/CarthageExample/Assets.xcassets/AppIcon.appiconset/Contents.json deleted file mode 100644 index 118c98f746..0000000000 --- a/submodules/AsyncDisplayKit/examples_extra/CarthageBuildTest/CarthageExample/Assets.xcassets/AppIcon.appiconset/Contents.json +++ /dev/null @@ -1,38 +0,0 @@ -{ - "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" - } -} \ No newline at end of file diff --git a/submodules/AsyncDisplayKit/examples_extra/CarthageBuildTest/CarthageExample/Base.lproj/LaunchScreen.storyboard b/submodules/AsyncDisplayKit/examples_extra/CarthageBuildTest/CarthageExample/Base.lproj/LaunchScreen.storyboard deleted file mode 100644 index ebf48f6039..0000000000 --- a/submodules/AsyncDisplayKit/examples_extra/CarthageBuildTest/CarthageExample/Base.lproj/LaunchScreen.storyboard +++ /dev/null @@ -1,27 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/submodules/AsyncDisplayKit/examples_extra/CarthageBuildTest/CarthageExample/Base.lproj/Main.storyboard b/submodules/AsyncDisplayKit/examples_extra/CarthageBuildTest/CarthageExample/Base.lproj/Main.storyboard deleted file mode 100644 index 82cf14be21..0000000000 --- a/submodules/AsyncDisplayKit/examples_extra/CarthageBuildTest/CarthageExample/Base.lproj/Main.storyboard +++ /dev/null @@ -1,26 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/submodules/AsyncDisplayKit/examples_extra/CarthageBuildTest/CarthageExample/Info.plist b/submodules/AsyncDisplayKit/examples_extra/CarthageBuildTest/CarthageExample/Info.plist deleted file mode 100644 index 6905cc67bb..0000000000 --- a/submodules/AsyncDisplayKit/examples_extra/CarthageBuildTest/CarthageExample/Info.plist +++ /dev/null @@ -1,40 +0,0 @@ - - - - - CFBundleDevelopmentRegion - en - CFBundleExecutable - $(EXECUTABLE_NAME) - CFBundleIdentifier - $(PRODUCT_BUNDLE_IDENTIFIER) - CFBundleInfoDictionaryVersion - 6.0 - CFBundleName - $(PRODUCT_NAME) - CFBundlePackageType - APPL - CFBundleShortVersionString - 1.0 - CFBundleSignature - ???? - CFBundleVersion - 1 - LSRequiresIPhoneOS - - UILaunchStoryboardName - LaunchScreen - UIMainStoryboardFile - Main - UIRequiredDeviceCapabilities - - armv7 - - UISupportedInterfaceOrientations - - UIInterfaceOrientationPortrait - UIInterfaceOrientationLandscapeLeft - UIInterfaceOrientationLandscapeRight - - - diff --git a/submodules/AsyncDisplayKit/examples_extra/CarthageBuildTest/CarthageExample/ViewController.h b/submodules/AsyncDisplayKit/examples_extra/CarthageBuildTest/CarthageExample/ViewController.h deleted file mode 100644 index 4627e29285..0000000000 --- a/submodules/AsyncDisplayKit/examples_extra/CarthageBuildTest/CarthageExample/ViewController.h +++ /dev/null @@ -1,16 +0,0 @@ -// -// ViewController.h -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -@interface ViewController : UIViewController - - -@end - diff --git a/submodules/AsyncDisplayKit/examples_extra/CarthageBuildTest/CarthageExample/ViewController.m b/submodules/AsyncDisplayKit/examples_extra/CarthageBuildTest/CarthageExample/ViewController.m deleted file mode 100644 index 993d6ac152..0000000000 --- a/submodules/AsyncDisplayKit/examples_extra/CarthageBuildTest/CarthageExample/ViewController.m +++ /dev/null @@ -1,36 +0,0 @@ -// -// ViewController.m -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import "ViewController.h" -#import - -@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.attributedText = [[NSAttributedString alloc] initWithString:@"hello world"]; - [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(), ^{ - [self.view addSubview:node.view]; - }); - }); -} - -@end diff --git a/submodules/AsyncDisplayKit/examples_extra/CarthageBuildTest/CarthageExample/main.m b/submodules/AsyncDisplayKit/examples_extra/CarthageBuildTest/CarthageExample/main.m deleted file mode 100644 index 0e5da05001..0000000000 --- a/submodules/AsyncDisplayKit/examples_extra/CarthageBuildTest/CarthageExample/main.m +++ /dev/null @@ -1,17 +0,0 @@ -// -// main.m -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import -#import "AppDelegate.h" - -int main(int argc, char * argv[]) { - @autoreleasepool { - return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); - } -} diff --git a/submodules/AsyncDisplayKit/examples_extra/CarthageBuildTest/README.md b/submodules/AsyncDisplayKit/examples_extra/CarthageBuildTest/README.md deleted file mode 100644 index 65ad6a6737..0000000000 --- a/submodules/AsyncDisplayKit/examples_extra/CarthageBuildTest/README.md +++ /dev/null @@ -1,7 +0,0 @@ -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 diff --git a/submodules/AsyncDisplayKit/examples_extra/CollectionViewWithViewControllerCells/Podfile b/submodules/AsyncDisplayKit/examples_extra/CollectionViewWithViewControllerCells/Podfile deleted file mode 100644 index 71a7f2c4b2..0000000000 --- a/submodules/AsyncDisplayKit/examples_extra/CollectionViewWithViewControllerCells/Podfile +++ /dev/null @@ -1,5 +0,0 @@ -source 'https://github.com/CocoaPods/Specs.git' -platform :ios, '9.0' -target 'Sample' do - pod 'Texture', :path => '../..' -end diff --git a/submodules/AsyncDisplayKit/examples_extra/CollectionViewWithViewControllerCells/Sample.xcworkspace/contents.xcworkspacedata b/submodules/AsyncDisplayKit/examples_extra/CollectionViewWithViewControllerCells/Sample.xcworkspace/contents.xcworkspacedata deleted file mode 100644 index 7b5a2f3050..0000000000 --- a/submodules/AsyncDisplayKit/examples_extra/CollectionViewWithViewControllerCells/Sample.xcworkspace/contents.xcworkspacedata +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - diff --git a/submodules/AsyncDisplayKit/examples_extra/CollectionViewWithViewControllerCells/Sample/AppDelegate.h b/submodules/AsyncDisplayKit/examples_extra/CollectionViewWithViewControllerCells/Sample/AppDelegate.h deleted file mode 100644 index 19db03c153..0000000000 --- a/submodules/AsyncDisplayKit/examples_extra/CollectionViewWithViewControllerCells/Sample/AppDelegate.h +++ /dev/null @@ -1,16 +0,0 @@ -// -// AppDelegate.h -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -@interface AppDelegate : UIResponder - -@property (strong, nonatomic) UIWindow *window; - -@end diff --git a/submodules/AsyncDisplayKit/examples_extra/CollectionViewWithViewControllerCells/Sample/AppDelegate.m b/submodules/AsyncDisplayKit/examples_extra/CollectionViewWithViewControllerCells/Sample/AppDelegate.m deleted file mode 100644 index 78de0a3151..0000000000 --- a/submodules/AsyncDisplayKit/examples_extra/CollectionViewWithViewControllerCells/Sample/AppDelegate.m +++ /dev/null @@ -1,27 +0,0 @@ -// -// AppDelegate.m -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import "AppDelegate.h" - -#import "ViewController.h" - -@implementation AppDelegate - -- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions -{ - self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; - self.window.backgroundColor = [UIColor whiteColor]; - self.window.rootViewController = [[ViewController alloc] init]; - - [self.window makeKeyAndVisible]; - - return YES; -} - -@end diff --git a/submodules/AsyncDisplayKit/examples_extra/CollectionViewWithViewControllerCells/Sample/ImageViewController.h b/submodules/AsyncDisplayKit/examples_extra/CollectionViewWithViewControllerCells/Sample/ImageViewController.h deleted file mode 100644 index 07000b0e3f..0000000000 --- a/submodules/AsyncDisplayKit/examples_extra/CollectionViewWithViewControllerCells/Sample/ImageViewController.h +++ /dev/null @@ -1,14 +0,0 @@ -// -// ImageViewController.h -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -@interface ImageViewController : UIViewController -- (instancetype)initWithImage:(UIImage *)image; -@end diff --git a/submodules/AsyncDisplayKit/examples_extra/CollectionViewWithViewControllerCells/Sample/ImageViewController.m b/submodules/AsyncDisplayKit/examples_extra/CollectionViewWithViewControllerCells/Sample/ImageViewController.m deleted file mode 100644 index 60e5027dae..0000000000 --- a/submodules/AsyncDisplayKit/examples_extra/CollectionViewWithViewControllerCells/Sample/ImageViewController.m +++ /dev/null @@ -1,48 +0,0 @@ -// -// ImageViewController.m -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - - -#import "ImageViewController.h" - -@interface ImageViewController () -@property (nonatomic) UIImageView *imageView; -@end - -@implementation ImageViewController - -- (instancetype)initWithImage:(UIImage *)image { - if (!(self = [super init])) { return nil; } - - self.imageView = [[UIImageView alloc] initWithImage:image]; - - return self; -} - -- (void)viewDidLoad { - [super viewDidLoad]; - - [self.view addSubview:self.imageView]; - - UIGestureRecognizer *tap = [[UIGestureRecognizer alloc] initWithTarget:self action:@selector(tapped)]; - [self.view addGestureRecognizer:tap]; - - self.imageView.contentMode = UIViewContentModeScaleAspectFill; -} - -- (void)tapped; -{ - NSLog(@"tapped!"); -} - -- (void)viewWillLayoutSubviews -{ - self.imageView.frame = self.view.bounds; -} - -@end diff --git a/submodules/AsyncDisplayKit/examples_extra/CollectionViewWithViewControllerCells/Sample/Images.xcassets/LaunchImage.launchimage/Contents.json b/submodules/AsyncDisplayKit/examples_extra/CollectionViewWithViewControllerCells/Sample/Images.xcassets/LaunchImage.launchimage/Contents.json deleted file mode 100644 index f0fce54771..0000000000 --- a/submodules/AsyncDisplayKit/examples_extra/CollectionViewWithViewControllerCells/Sample/Images.xcassets/LaunchImage.launchimage/Contents.json +++ /dev/null @@ -1,39 +0,0 @@ -{ - "images" : [ - { - "orientation" : "portrait", - "idiom" : "iphone", - "filename" : "Default-568h@2x.png", - "minimum-system-version" : "7.0", - "subtype" : "retina4", - "scale" : "2x" - }, - { - "idiom" : "iphone", - "scale" : "1x", - "orientation" : "portrait" - }, - { - "idiom" : "iphone", - "scale" : "2x", - "orientation" : "portrait" - }, - { - "orientation" : "portrait", - "idiom" : "iphone", - "filename" : "Default-568h@2x.png", - "subtype" : "retina4", - "scale" : "2x" - }, - { - "orientation" : "portrait", - "idiom" : "iphone", - "minimum-system-version" : "7.0", - "scale" : "2x" - } - ], - "info" : { - "version" : 1, - "author" : "xcode" - } -} \ No newline at end of file diff --git a/submodules/AsyncDisplayKit/examples_extra/CollectionViewWithViewControllerCells/Sample/Images.xcassets/LaunchImage.launchimage/Default-568h@2x.png b/submodules/AsyncDisplayKit/examples_extra/CollectionViewWithViewControllerCells/Sample/Images.xcassets/LaunchImage.launchimage/Default-568h@2x.png deleted file mode 100644 index 1547a98454..0000000000 Binary files a/submodules/AsyncDisplayKit/examples_extra/CollectionViewWithViewControllerCells/Sample/Images.xcassets/LaunchImage.launchimage/Default-568h@2x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/examples_extra/CollectionViewWithViewControllerCells/Sample/Images.xcassets/image_0.imageset/Contents.json b/submodules/AsyncDisplayKit/examples_extra/CollectionViewWithViewControllerCells/Sample/Images.xcassets/image_0.imageset/Contents.json deleted file mode 100644 index 4eaff61cc1..0000000000 --- a/submodules/AsyncDisplayKit/examples_extra/CollectionViewWithViewControllerCells/Sample/Images.xcassets/image_0.imageset/Contents.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "images" : [ - { - "idiom" : "universal", - "scale" : "1x", - "filename" : "image_0.jpg" - }, - { - "idiom" : "universal", - "scale" : "2x" - }, - { - "idiom" : "universal", - "scale" : "3x" - } - ], - "info" : { - "version" : 1, - "author" : "xcode" - } -} \ No newline at end of file diff --git a/submodules/AsyncDisplayKit/examples_extra/CollectionViewWithViewControllerCells/Sample/Images.xcassets/image_0.imageset/image_0.jpg b/submodules/AsyncDisplayKit/examples_extra/CollectionViewWithViewControllerCells/Sample/Images.xcassets/image_0.imageset/image_0.jpg deleted file mode 100644 index 4a365897ea..0000000000 Binary files a/submodules/AsyncDisplayKit/examples_extra/CollectionViewWithViewControllerCells/Sample/Images.xcassets/image_0.imageset/image_0.jpg and /dev/null differ diff --git a/submodules/AsyncDisplayKit/examples_extra/CollectionViewWithViewControllerCells/Sample/Images.xcassets/image_1.imageset/Contents.json b/submodules/AsyncDisplayKit/examples_extra/CollectionViewWithViewControllerCells/Sample/Images.xcassets/image_1.imageset/Contents.json deleted file mode 100644 index 80c90eca3e..0000000000 --- a/submodules/AsyncDisplayKit/examples_extra/CollectionViewWithViewControllerCells/Sample/Images.xcassets/image_1.imageset/Contents.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "images" : [ - { - "idiom" : "universal", - "scale" : "1x", - "filename" : "image_1.jpg" - }, - { - "idiom" : "universal", - "scale" : "2x" - }, - { - "idiom" : "universal", - "scale" : "3x" - } - ], - "info" : { - "version" : 1, - "author" : "xcode" - } -} \ No newline at end of file diff --git a/submodules/AsyncDisplayKit/examples_extra/CollectionViewWithViewControllerCells/Sample/Images.xcassets/image_1.imageset/image_1.jpg b/submodules/AsyncDisplayKit/examples_extra/CollectionViewWithViewControllerCells/Sample/Images.xcassets/image_1.imageset/image_1.jpg deleted file mode 100644 index 5cb4828f44..0000000000 Binary files a/submodules/AsyncDisplayKit/examples_extra/CollectionViewWithViewControllerCells/Sample/Images.xcassets/image_1.imageset/image_1.jpg and /dev/null differ diff --git a/submodules/AsyncDisplayKit/examples_extra/CollectionViewWithViewControllerCells/Sample/Images.xcassets/image_10.imageset/Contents.json b/submodules/AsyncDisplayKit/examples_extra/CollectionViewWithViewControllerCells/Sample/Images.xcassets/image_10.imageset/Contents.json deleted file mode 100644 index d61e934e39..0000000000 --- a/submodules/AsyncDisplayKit/examples_extra/CollectionViewWithViewControllerCells/Sample/Images.xcassets/image_10.imageset/Contents.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "images" : [ - { - "idiom" : "universal", - "scale" : "1x", - "filename" : "image_10.jpg" - }, - { - "idiom" : "universal", - "scale" : "2x" - }, - { - "idiom" : "universal", - "scale" : "3x" - } - ], - "info" : { - "version" : 1, - "author" : "xcode" - } -} \ No newline at end of file diff --git a/submodules/AsyncDisplayKit/examples_extra/CollectionViewWithViewControllerCells/Sample/Images.xcassets/image_10.imageset/image_10.jpg b/submodules/AsyncDisplayKit/examples_extra/CollectionViewWithViewControllerCells/Sample/Images.xcassets/image_10.imageset/image_10.jpg deleted file mode 100644 index ea5cd6d268..0000000000 Binary files a/submodules/AsyncDisplayKit/examples_extra/CollectionViewWithViewControllerCells/Sample/Images.xcassets/image_10.imageset/image_10.jpg and /dev/null differ diff --git a/submodules/AsyncDisplayKit/examples_extra/CollectionViewWithViewControllerCells/Sample/Images.xcassets/image_11.imageset/Contents.json b/submodules/AsyncDisplayKit/examples_extra/CollectionViewWithViewControllerCells/Sample/Images.xcassets/image_11.imageset/Contents.json deleted file mode 100644 index 94921077f9..0000000000 --- a/submodules/AsyncDisplayKit/examples_extra/CollectionViewWithViewControllerCells/Sample/Images.xcassets/image_11.imageset/Contents.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "images" : [ - { - "idiom" : "universal", - "scale" : "1x", - "filename" : "image_11.jpg" - }, - { - "idiom" : "universal", - "scale" : "2x" - }, - { - "idiom" : "universal", - "scale" : "3x" - } - ], - "info" : { - "version" : 1, - "author" : "xcode" - } -} \ No newline at end of file diff --git a/submodules/AsyncDisplayKit/examples_extra/CollectionViewWithViewControllerCells/Sample/Images.xcassets/image_11.imageset/image_11.jpg b/submodules/AsyncDisplayKit/examples_extra/CollectionViewWithViewControllerCells/Sample/Images.xcassets/image_11.imageset/image_11.jpg deleted file mode 100644 index e93c68e512..0000000000 Binary files a/submodules/AsyncDisplayKit/examples_extra/CollectionViewWithViewControllerCells/Sample/Images.xcassets/image_11.imageset/image_11.jpg and /dev/null differ diff --git a/submodules/AsyncDisplayKit/examples_extra/CollectionViewWithViewControllerCells/Sample/Images.xcassets/image_12.imageset/Contents.json b/submodules/AsyncDisplayKit/examples_extra/CollectionViewWithViewControllerCells/Sample/Images.xcassets/image_12.imageset/Contents.json deleted file mode 100644 index 61488a9fdc..0000000000 --- a/submodules/AsyncDisplayKit/examples_extra/CollectionViewWithViewControllerCells/Sample/Images.xcassets/image_12.imageset/Contents.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "images" : [ - { - "idiom" : "universal", - "scale" : "1x", - "filename" : "image_12.jpg" - }, - { - "idiom" : "universal", - "scale" : "2x" - }, - { - "idiom" : "universal", - "scale" : "3x" - } - ], - "info" : { - "version" : 1, - "author" : "xcode" - } -} \ No newline at end of file diff --git a/submodules/AsyncDisplayKit/examples_extra/CollectionViewWithViewControllerCells/Sample/Images.xcassets/image_12.imageset/image_12.jpg b/submodules/AsyncDisplayKit/examples_extra/CollectionViewWithViewControllerCells/Sample/Images.xcassets/image_12.imageset/image_12.jpg deleted file mode 100644 index d520b6d80f..0000000000 Binary files a/submodules/AsyncDisplayKit/examples_extra/CollectionViewWithViewControllerCells/Sample/Images.xcassets/image_12.imageset/image_12.jpg and /dev/null differ diff --git a/submodules/AsyncDisplayKit/examples_extra/CollectionViewWithViewControllerCells/Sample/Images.xcassets/image_13.imageset/Contents.json b/submodules/AsyncDisplayKit/examples_extra/CollectionViewWithViewControllerCells/Sample/Images.xcassets/image_13.imageset/Contents.json deleted file mode 100644 index 7f83f8a390..0000000000 --- a/submodules/AsyncDisplayKit/examples_extra/CollectionViewWithViewControllerCells/Sample/Images.xcassets/image_13.imageset/Contents.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "images" : [ - { - "idiom" : "universal", - "scale" : "1x", - "filename" : "image_13.jpg" - }, - { - "idiom" : "universal", - "scale" : "2x" - }, - { - "idiom" : "universal", - "scale" : "3x" - } - ], - "info" : { - "version" : 1, - "author" : "xcode" - } -} \ No newline at end of file diff --git a/submodules/AsyncDisplayKit/examples_extra/CollectionViewWithViewControllerCells/Sample/Images.xcassets/image_13.imageset/image_13.jpg b/submodules/AsyncDisplayKit/examples_extra/CollectionViewWithViewControllerCells/Sample/Images.xcassets/image_13.imageset/image_13.jpg deleted file mode 100644 index c0232370cd..0000000000 Binary files a/submodules/AsyncDisplayKit/examples_extra/CollectionViewWithViewControllerCells/Sample/Images.xcassets/image_13.imageset/image_13.jpg and /dev/null differ diff --git a/submodules/AsyncDisplayKit/examples_extra/CollectionViewWithViewControllerCells/Sample/Images.xcassets/image_2.imageset/Contents.json b/submodules/AsyncDisplayKit/examples_extra/CollectionViewWithViewControllerCells/Sample/Images.xcassets/image_2.imageset/Contents.json deleted file mode 100644 index 774cde7833..0000000000 --- a/submodules/AsyncDisplayKit/examples_extra/CollectionViewWithViewControllerCells/Sample/Images.xcassets/image_2.imageset/Contents.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "images" : [ - { - "idiom" : "universal", - "scale" : "1x", - "filename" : "image_2.jpg" - }, - { - "idiom" : "universal", - "scale" : "2x" - }, - { - "idiom" : "universal", - "scale" : "3x" - } - ], - "info" : { - "version" : 1, - "author" : "xcode" - } -} \ No newline at end of file diff --git a/submodules/AsyncDisplayKit/examples_extra/CollectionViewWithViewControllerCells/Sample/Images.xcassets/image_2.imageset/image_2.jpg b/submodules/AsyncDisplayKit/examples_extra/CollectionViewWithViewControllerCells/Sample/Images.xcassets/image_2.imageset/image_2.jpg deleted file mode 100644 index 175343454d..0000000000 Binary files a/submodules/AsyncDisplayKit/examples_extra/CollectionViewWithViewControllerCells/Sample/Images.xcassets/image_2.imageset/image_2.jpg and /dev/null differ diff --git a/submodules/AsyncDisplayKit/examples_extra/CollectionViewWithViewControllerCells/Sample/Images.xcassets/image_3.imageset/Contents.json b/submodules/AsyncDisplayKit/examples_extra/CollectionViewWithViewControllerCells/Sample/Images.xcassets/image_3.imageset/Contents.json deleted file mode 100644 index c0abe414cd..0000000000 --- a/submodules/AsyncDisplayKit/examples_extra/CollectionViewWithViewControllerCells/Sample/Images.xcassets/image_3.imageset/Contents.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "images" : [ - { - "idiom" : "universal", - "scale" : "1x", - "filename" : "image_3.jpg" - }, - { - "idiom" : "universal", - "scale" : "2x" - }, - { - "idiom" : "universal", - "scale" : "3x" - } - ], - "info" : { - "version" : 1, - "author" : "xcode" - } -} \ No newline at end of file diff --git a/submodules/AsyncDisplayKit/examples_extra/CollectionViewWithViewControllerCells/Sample/Images.xcassets/image_3.imageset/image_3.jpg b/submodules/AsyncDisplayKit/examples_extra/CollectionViewWithViewControllerCells/Sample/Images.xcassets/image_3.imageset/image_3.jpg deleted file mode 100644 index f5398cac79..0000000000 Binary files a/submodules/AsyncDisplayKit/examples_extra/CollectionViewWithViewControllerCells/Sample/Images.xcassets/image_3.imageset/image_3.jpg and /dev/null differ diff --git a/submodules/AsyncDisplayKit/examples_extra/CollectionViewWithViewControllerCells/Sample/Images.xcassets/image_4.imageset/Contents.json b/submodules/AsyncDisplayKit/examples_extra/CollectionViewWithViewControllerCells/Sample/Images.xcassets/image_4.imageset/Contents.json deleted file mode 100644 index 55a498a8a0..0000000000 --- a/submodules/AsyncDisplayKit/examples_extra/CollectionViewWithViewControllerCells/Sample/Images.xcassets/image_4.imageset/Contents.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "images" : [ - { - "idiom" : "universal", - "scale" : "1x", - "filename" : "image_4.jpg" - }, - { - "idiom" : "universal", - "scale" : "2x" - }, - { - "idiom" : "universal", - "scale" : "3x" - } - ], - "info" : { - "version" : 1, - "author" : "xcode" - } -} \ No newline at end of file diff --git a/submodules/AsyncDisplayKit/examples_extra/CollectionViewWithViewControllerCells/Sample/Images.xcassets/image_4.imageset/image_4.jpg b/submodules/AsyncDisplayKit/examples_extra/CollectionViewWithViewControllerCells/Sample/Images.xcassets/image_4.imageset/image_4.jpg deleted file mode 100644 index 2a6fe4c264..0000000000 Binary files a/submodules/AsyncDisplayKit/examples_extra/CollectionViewWithViewControllerCells/Sample/Images.xcassets/image_4.imageset/image_4.jpg and /dev/null differ diff --git a/submodules/AsyncDisplayKit/examples_extra/CollectionViewWithViewControllerCells/Sample/Images.xcassets/image_5.imageset/Contents.json b/submodules/AsyncDisplayKit/examples_extra/CollectionViewWithViewControllerCells/Sample/Images.xcassets/image_5.imageset/Contents.json deleted file mode 100644 index 9a1181e83b..0000000000 --- a/submodules/AsyncDisplayKit/examples_extra/CollectionViewWithViewControllerCells/Sample/Images.xcassets/image_5.imageset/Contents.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "images" : [ - { - "idiom" : "universal", - "scale" : "1x", - "filename" : "image_5.jpg" - }, - { - "idiom" : "universal", - "scale" : "2x" - }, - { - "idiom" : "universal", - "scale" : "3x" - } - ], - "info" : { - "version" : 1, - "author" : "xcode" - } -} \ No newline at end of file diff --git a/submodules/AsyncDisplayKit/examples_extra/CollectionViewWithViewControllerCells/Sample/Images.xcassets/image_5.imageset/image_5.jpg b/submodules/AsyncDisplayKit/examples_extra/CollectionViewWithViewControllerCells/Sample/Images.xcassets/image_5.imageset/image_5.jpg deleted file mode 100644 index 4e507b8064..0000000000 Binary files a/submodules/AsyncDisplayKit/examples_extra/CollectionViewWithViewControllerCells/Sample/Images.xcassets/image_5.imageset/image_5.jpg and /dev/null differ diff --git a/submodules/AsyncDisplayKit/examples_extra/CollectionViewWithViewControllerCells/Sample/Images.xcassets/image_6.imageset/Contents.json b/submodules/AsyncDisplayKit/examples_extra/CollectionViewWithViewControllerCells/Sample/Images.xcassets/image_6.imageset/Contents.json deleted file mode 100644 index 6aef7d6047..0000000000 --- a/submodules/AsyncDisplayKit/examples_extra/CollectionViewWithViewControllerCells/Sample/Images.xcassets/image_6.imageset/Contents.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "images" : [ - { - "idiom" : "universal", - "scale" : "1x", - "filename" : "image_6.jpg" - }, - { - "idiom" : "universal", - "scale" : "2x" - }, - { - "idiom" : "universal", - "scale" : "3x" - } - ], - "info" : { - "version" : 1, - "author" : "xcode" - } -} \ No newline at end of file diff --git a/submodules/AsyncDisplayKit/examples_extra/CollectionViewWithViewControllerCells/Sample/Images.xcassets/image_6.imageset/image_6.jpg b/submodules/AsyncDisplayKit/examples_extra/CollectionViewWithViewControllerCells/Sample/Images.xcassets/image_6.imageset/image_6.jpg deleted file mode 100644 index 35fe778b3a..0000000000 Binary files a/submodules/AsyncDisplayKit/examples_extra/CollectionViewWithViewControllerCells/Sample/Images.xcassets/image_6.imageset/image_6.jpg and /dev/null differ diff --git a/submodules/AsyncDisplayKit/examples_extra/CollectionViewWithViewControllerCells/Sample/Images.xcassets/image_7.imageset/Contents.json b/submodules/AsyncDisplayKit/examples_extra/CollectionViewWithViewControllerCells/Sample/Images.xcassets/image_7.imageset/Contents.json deleted file mode 100644 index acdb0e87f0..0000000000 --- a/submodules/AsyncDisplayKit/examples_extra/CollectionViewWithViewControllerCells/Sample/Images.xcassets/image_7.imageset/Contents.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "images" : [ - { - "idiom" : "universal", - "scale" : "1x", - "filename" : "image_7.jpg" - }, - { - "idiom" : "universal", - "scale" : "2x" - }, - { - "idiom" : "universal", - "scale" : "3x" - } - ], - "info" : { - "version" : 1, - "author" : "xcode" - } -} \ No newline at end of file diff --git a/submodules/AsyncDisplayKit/examples_extra/CollectionViewWithViewControllerCells/Sample/Images.xcassets/image_7.imageset/image_7.jpg b/submodules/AsyncDisplayKit/examples_extra/CollectionViewWithViewControllerCells/Sample/Images.xcassets/image_7.imageset/image_7.jpg deleted file mode 100644 index 8f5e037722..0000000000 Binary files a/submodules/AsyncDisplayKit/examples_extra/CollectionViewWithViewControllerCells/Sample/Images.xcassets/image_7.imageset/image_7.jpg and /dev/null differ diff --git a/submodules/AsyncDisplayKit/examples_extra/CollectionViewWithViewControllerCells/Sample/Images.xcassets/image_8.imageset/Contents.json b/submodules/AsyncDisplayKit/examples_extra/CollectionViewWithViewControllerCells/Sample/Images.xcassets/image_8.imageset/Contents.json deleted file mode 100644 index 40d616ed40..0000000000 --- a/submodules/AsyncDisplayKit/examples_extra/CollectionViewWithViewControllerCells/Sample/Images.xcassets/image_8.imageset/Contents.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "images" : [ - { - "idiom" : "universal", - "scale" : "1x", - "filename" : "image_8.jpg" - }, - { - "idiom" : "universal", - "scale" : "2x" - }, - { - "idiom" : "universal", - "scale" : "3x" - } - ], - "info" : { - "version" : 1, - "author" : "xcode" - } -} \ No newline at end of file diff --git a/submodules/AsyncDisplayKit/examples_extra/CollectionViewWithViewControllerCells/Sample/Images.xcassets/image_8.imageset/image_8.jpg b/submodules/AsyncDisplayKit/examples_extra/CollectionViewWithViewControllerCells/Sample/Images.xcassets/image_8.imageset/image_8.jpg deleted file mode 100644 index 5651436bb6..0000000000 Binary files a/submodules/AsyncDisplayKit/examples_extra/CollectionViewWithViewControllerCells/Sample/Images.xcassets/image_8.imageset/image_8.jpg and /dev/null differ diff --git a/submodules/AsyncDisplayKit/examples_extra/CollectionViewWithViewControllerCells/Sample/Images.xcassets/image_9.imageset/Contents.json b/submodules/AsyncDisplayKit/examples_extra/CollectionViewWithViewControllerCells/Sample/Images.xcassets/image_9.imageset/Contents.json deleted file mode 100644 index b3b3c74e12..0000000000 --- a/submodules/AsyncDisplayKit/examples_extra/CollectionViewWithViewControllerCells/Sample/Images.xcassets/image_9.imageset/Contents.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "images" : [ - { - "idiom" : "universal", - "scale" : "1x", - "filename" : "image_9.jpg" - }, - { - "idiom" : "universal", - "scale" : "2x" - }, - { - "idiom" : "universal", - "scale" : "3x" - } - ], - "info" : { - "version" : 1, - "author" : "xcode" - } -} \ No newline at end of file diff --git a/submodules/AsyncDisplayKit/examples_extra/CollectionViewWithViewControllerCells/Sample/Images.xcassets/image_9.imageset/image_9.jpg b/submodules/AsyncDisplayKit/examples_extra/CollectionViewWithViewControllerCells/Sample/Images.xcassets/image_9.imageset/image_9.jpg deleted file mode 100644 index 9fb6e47d3f..0000000000 Binary files a/submodules/AsyncDisplayKit/examples_extra/CollectionViewWithViewControllerCells/Sample/Images.xcassets/image_9.imageset/image_9.jpg and /dev/null differ diff --git a/submodules/AsyncDisplayKit/examples_extra/CollectionViewWithViewControllerCells/Sample/Info.plist b/submodules/AsyncDisplayKit/examples_extra/CollectionViewWithViewControllerCells/Sample/Info.plist deleted file mode 100644 index eeb71a8d35..0000000000 --- a/submodules/AsyncDisplayKit/examples_extra/CollectionViewWithViewControllerCells/Sample/Info.plist +++ /dev/null @@ -1,49 +0,0 @@ - - - - - CFBundleDevelopmentRegion - en - CFBundleExecutable - $(EXECUTABLE_NAME) - CFBundleIcons - - CFBundleIcons~ipad - - CFBundleIdentifier - com.facebook.AsyncDisplayKit.$(PRODUCT_NAME:rfc1034identifier) - CFBundleInfoDictionaryVersion - 6.0 - CFBundleName - $(PRODUCT_NAME) - CFBundlePackageType - APPL - CFBundleShortVersionString - 1.0 - CFBundleSignature - ???? - CFBundleVersion - 1 - LSRequiresIPhoneOS - - UILaunchStoryboardName - Launchboard - UIRequiredDeviceCapabilities - - armv7 - - UISupportedInterfaceOrientations - - UIInterfaceOrientationPortrait - UIInterfaceOrientationLandscapeLeft - UIInterfaceOrientationLandscapeRight - - UISupportedInterfaceOrientations~ipad - - UIInterfaceOrientationPortrait - UIInterfaceOrientationPortraitUpsideDown - UIInterfaceOrientationLandscapeLeft - UIInterfaceOrientationLandscapeRight - - - diff --git a/submodules/AsyncDisplayKit/examples_extra/CollectionViewWithViewControllerCells/Sample/Launchboard.storyboard b/submodules/AsyncDisplayKit/examples_extra/CollectionViewWithViewControllerCells/Sample/Launchboard.storyboard deleted file mode 100644 index 673e0f7e68..0000000000 --- a/submodules/AsyncDisplayKit/examples_extra/CollectionViewWithViewControllerCells/Sample/Launchboard.storyboard +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - diff --git a/submodules/AsyncDisplayKit/examples_extra/CollectionViewWithViewControllerCells/Sample/MosaicCollectionViewLayout.h b/submodules/AsyncDisplayKit/examples_extra/CollectionViewWithViewControllerCells/Sample/MosaicCollectionViewLayout.h deleted file mode 100644 index c7a9867fb5..0000000000 --- a/submodules/AsyncDisplayKit/examples_extra/CollectionViewWithViewControllerCells/Sample/MosaicCollectionViewLayout.h +++ /dev/null @@ -1,31 +0,0 @@ -// -// MosaicCollectionViewLayout.h -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import -#import - -@interface MosaicCollectionViewLayout : UICollectionViewLayout - -@property (assign, nonatomic) NSUInteger numberOfColumns; -@property (assign, nonatomic) CGFloat columnSpacing; -@property (assign, nonatomic) UIEdgeInsets sectionInset; -@property (assign, nonatomic) UIEdgeInsets interItemSpacing; -@property (assign, nonatomic) CGFloat headerHeight; - -@end - -@protocol MosaicCollectionViewLayoutDelegate - -- (CGSize)collectionView:(UICollectionView *)collectionView layout:(MosaicCollectionViewLayout *)layout originalItemSizeAtIndexPath:(NSIndexPath *)indexPath; - -@end - -@interface MosaicCollectionViewLayoutInspector : NSObject - -@end diff --git a/submodules/AsyncDisplayKit/examples_extra/CollectionViewWithViewControllerCells/Sample/MosaicCollectionViewLayout.m b/submodules/AsyncDisplayKit/examples_extra/CollectionViewWithViewControllerCells/Sample/MosaicCollectionViewLayout.m deleted file mode 100644 index bc48035100..0000000000 --- a/submodules/AsyncDisplayKit/examples_extra/CollectionViewWithViewControllerCells/Sample/MosaicCollectionViewLayout.m +++ /dev/null @@ -1,231 +0,0 @@ -// -// MosaicCollectionViewLayout.m -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import "MosaicCollectionViewLayout.h" - -@implementation MosaicCollectionViewLayout { - NSMutableArray *_columnHeights; - NSMutableArray *_itemAttributes; - NSMutableDictionary *_headerAttributes; - NSMutableArray *_allAttributes; -} - -- (instancetype)init -{ - self = [super init]; - if (self != nil) { - self.numberOfColumns = 3; - self.columnSpacing = 10.0; - self.sectionInset = UIEdgeInsetsMake(10.0, 10.0, 10.0, 10.0); - self.interItemSpacing = UIEdgeInsetsMake(10.0, 0, 10.0, 0); - } - return self; -} - -- (void)prepareLayout -{ - _itemAttributes = [NSMutableArray array]; - _columnHeights = [NSMutableArray array]; - _allAttributes = [NSMutableArray array]; - _headerAttributes = [NSMutableDictionary dictionary]; - - CGFloat top = 0; - - NSInteger numberOfSections = [self.collectionView numberOfSections]; - for (NSUInteger section = 0; section < numberOfSections; section++) { - NSInteger numberOfItems = [self.collectionView numberOfItemsInSection:section]; - - top += _sectionInset.top; - - if (_headerHeight > 0) { - CGSize headerSize = [self _headerSizeForSection:section]; - UICollectionViewLayoutAttributes *attributes = [UICollectionViewLayoutAttributes - layoutAttributesForSupplementaryViewOfKind:UICollectionElementKindSectionHeader - withIndexPath:[NSIndexPath indexPathForItem:0 inSection:section]]; - attributes.frame = CGRectMake(_sectionInset.left, top, headerSize.width, headerSize.height); - _headerAttributes[@(section)] = attributes; - [_allAttributes addObject:attributes]; - top = CGRectGetMaxY(attributes.frame); - } - - [_columnHeights addObject:[NSMutableArray array]]; - for (NSUInteger idx = 0; idx < self.numberOfColumns; idx++) { - [_columnHeights[section] addObject:@(top)]; - } - - CGFloat columnWidth = [self _columnWidthForSection:section]; - [_itemAttributes addObject:[NSMutableArray array]]; - for (NSUInteger idx = 0; idx < numberOfItems; idx++) { - NSUInteger columnIndex = [self _shortestColumnIndexInSection:section]; - NSIndexPath *indexPath = [NSIndexPath indexPathForItem:idx inSection:section]; - - CGSize itemSize = [self _itemSizeAtIndexPath:indexPath]; - CGFloat xOffset = _sectionInset.left + (columnWidth + _columnSpacing) * columnIndex; - CGFloat yOffset = [_columnHeights[section][columnIndex] floatValue]; - - UICollectionViewLayoutAttributes *attributes = [UICollectionViewLayoutAttributes - layoutAttributesForCellWithIndexPath:indexPath]; - attributes.frame = CGRectMake(xOffset, yOffset, itemSize.width, itemSize.height); - - _columnHeights[section][columnIndex] = @(CGRectGetMaxY(attributes.frame) + _interItemSpacing.bottom); - - [_itemAttributes[section] addObject:attributes]; - [_allAttributes addObject:attributes]; - } - - NSUInteger columnIndex = [self _tallestColumnIndexInSection:section]; - top = [_columnHeights[section][columnIndex] floatValue] - _interItemSpacing.bottom + _sectionInset.bottom; - - for (NSUInteger idx = 0; idx < [_columnHeights[section] count]; idx++) { - _columnHeights[section][idx] = @(top); - } - } -} - -- (NSArray *)layoutAttributesForElementsInRect:(CGRect)rect -{ - NSMutableArray *includedAttributes = [NSMutableArray array]; - // Slow search for small batches - for (UICollectionViewLayoutAttributes *attributes in _allAttributes) { - if (CGRectIntersectsRect(attributes.frame, rect)) { - [includedAttributes addObject:attributes]; - } - } - return includedAttributes; -} - -- (UICollectionViewLayoutAttributes *)layoutAttributesForItemAtIndexPath:(NSIndexPath *)indexPath -{ - if (indexPath.section >= _itemAttributes.count) { - return nil; - } else if (indexPath.item >= [_itemAttributes[indexPath.section] count]) { - return nil; - } - return _itemAttributes[indexPath.section][indexPath.item]; -} - -- (UICollectionViewLayoutAttributes *)layoutAttributesForSupplementaryViewOfKind:(NSString *)elementKind atIndexPath:(NSIndexPath *)indexPath -{ - if ([elementKind isEqualToString:UICollectionElementKindSectionHeader]) { - return _headerAttributes[@(indexPath.section)]; - } - return nil; -} - -- (BOOL)shouldInvalidateLayoutForBoundsChange:(CGRect)newBounds -{ - if (!CGRectEqualToRect(self.collectionView.bounds, newBounds)) { - return YES; - } - return NO; -} - -- (CGFloat)_widthForSection:(NSUInteger)section -{ - return self.collectionView.bounds.size.width - _sectionInset.left - _sectionInset.right; -} - -- (CGFloat)_columnWidthForSection:(NSUInteger)section -{ - return ([self _widthForSection:section] - ((_numberOfColumns - 1) * _columnSpacing)) / _numberOfColumns; -} - -- (CGSize)_itemSizeAtIndexPath:(NSIndexPath *)indexPath -{ - CGSize size = CGSizeMake([self _columnWidthForSection:indexPath.section], 0); - CGSize originalSize = [[self _delegate] collectionView:self.collectionView layout:self originalItemSizeAtIndexPath:indexPath]; - if (originalSize.height > 0 && originalSize.width > 0) { - size.height = originalSize.height / originalSize.width * size.width; - } - return size; -} - -- (CGSize)_headerSizeForSection:(NSUInteger)section -{ - return CGSizeMake([self _widthForSection:section], _headerHeight); -} - -- (CGSize)collectionViewContentSize -{ - CGFloat height = [[[_columnHeights lastObject] firstObject] floatValue]; - return CGSizeMake(self.collectionView.bounds.size.width, height); -} - -- (NSUInteger)_tallestColumnIndexInSection:(NSUInteger)section -{ - __block NSUInteger index = 0; - __block CGFloat tallestHeight = 0; - [_columnHeights[section] enumerateObjectsUsingBlock:^(NSNumber *height, NSUInteger idx, BOOL *stop) { - if (height.floatValue > tallestHeight) { - index = idx; - tallestHeight = height.floatValue; - } - }]; - return index; -} - -- (NSUInteger)_shortestColumnIndexInSection:(NSUInteger)section -{ - __block NSUInteger index = 0; - __block CGFloat shortestHeight = CGFLOAT_MAX; - [_columnHeights[section] enumerateObjectsUsingBlock:^(NSNumber *height, NSUInteger idx, BOOL *stop) { - if (height.floatValue < shortestHeight) { - index = idx; - shortestHeight = height.floatValue; - } - }]; - return index; -} - -- (id)_delegate -{ - return (id)self.collectionView.delegate; -} - -@end - -@implementation MosaicCollectionViewLayoutInspector - -- (ASSizeRange)collectionView:(ASCollectionView *)collectionView constrainedSizeForNodeAtIndexPath:(NSIndexPath *)indexPath -{ - MosaicCollectionViewLayout *layout = (MosaicCollectionViewLayout *)[collectionView collectionViewLayout]; - return ASSizeRangeMake(CGSizeZero, [layout _itemSizeAtIndexPath:indexPath]); -} - -- (ASSizeRange)collectionView:(ASCollectionView *)collectionView constrainedSizeForSupplementaryNodeOfKind:(NSString *)kind atIndexPath:(NSIndexPath *)indexPath -{ - MosaicCollectionViewLayout *layout = (MosaicCollectionViewLayout *)[collectionView collectionViewLayout]; - return ASSizeRangeMake(CGSizeZero, [layout _headerSizeForSection:indexPath.section]); -} - -/** - * Asks the inspector for the number of supplementary sections in the collection view for the given kind. - */ -- (NSUInteger)collectionView:(ASCollectionView *)collectionView numberOfSectionsForSupplementaryNodeOfKind:(NSString *)kind -{ - if ([kind isEqualToString:UICollectionElementKindSectionHeader]) { - return [[collectionView asyncDataSource] numberOfSectionsInCollectionView:collectionView]; - } else { - return 0; - } -} - -/** - * Asks the inspector for the number of supplementary views for the given kind in the specified section. - */ -- (NSUInteger)collectionView:(ASCollectionView *)collectionView supplementaryNodesOfKind:(NSString *)kind inSection:(NSUInteger)section -{ - if ([kind isEqualToString:UICollectionElementKindSectionHeader]) { - return 1; - } else { - return 0; - } -} - -@end diff --git a/submodules/AsyncDisplayKit/examples_extra/CollectionViewWithViewControllerCells/Sample/SupplementaryNode.h b/submodules/AsyncDisplayKit/examples_extra/CollectionViewWithViewControllerCells/Sample/SupplementaryNode.h deleted file mode 100644 index b29ec002b2..0000000000 --- a/submodules/AsyncDisplayKit/examples_extra/CollectionViewWithViewControllerCells/Sample/SupplementaryNode.h +++ /dev/null @@ -1,16 +0,0 @@ -// -// SupplementaryNode.h -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -@interface SupplementaryNode : ASCellNode - -- (instancetype)initWithText:(NSString *)text; - -@end diff --git a/submodules/AsyncDisplayKit/examples_extra/CollectionViewWithViewControllerCells/Sample/SupplementaryNode.m b/submodules/AsyncDisplayKit/examples_extra/CollectionViewWithViewControllerCells/Sample/SupplementaryNode.m deleted file mode 100644 index 47dfa786b5..0000000000 --- a/submodules/AsyncDisplayKit/examples_extra/CollectionViewWithViewControllerCells/Sample/SupplementaryNode.m +++ /dev/null @@ -1,50 +0,0 @@ -// -// SupplementaryNode.m -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import "SupplementaryNode.h" - -#import -#import -#import - -@implementation SupplementaryNode { - ASTextNode *_textNode; -} - -- (instancetype)initWithText:(NSString *)text -{ - self = [super init]; - if (self != nil) { - _textNode = [[ASTextNode alloc] init]; - _textNode.attributedText = [[NSAttributedString alloc] initWithString:text - attributes:[self textAttributes]]; - [self addSubnode:_textNode]; - } - return self; -} - -- (ASLayoutSpec *)layoutSpecThatFits:(ASSizeRange)constrainedSize -{ - ASCenterLayoutSpec *center = [[ASCenterLayoutSpec alloc] init]; - center.centeringOptions = ASCenterLayoutSpecCenteringY; - center.child = _textNode; - return center; -} - -#pragma mark - Text Formatting - -- (NSDictionary *)textAttributes -{ - return @{ - NSFontAttributeName: [UIFont preferredFontForTextStyle:UIFontTextStyleHeadline], - NSForegroundColorAttributeName: [UIColor grayColor], - }; -} - -@end diff --git a/submodules/AsyncDisplayKit/examples_extra/CollectionViewWithViewControllerCells/Sample/ViewController.h b/submodules/AsyncDisplayKit/examples_extra/CollectionViewWithViewControllerCells/Sample/ViewController.h deleted file mode 100644 index c8a0626291..0000000000 --- a/submodules/AsyncDisplayKit/examples_extra/CollectionViewWithViewControllerCells/Sample/ViewController.h +++ /dev/null @@ -1,14 +0,0 @@ -// -// ViewController.h -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -@interface ViewController : UIViewController - -@end diff --git a/submodules/AsyncDisplayKit/examples_extra/CollectionViewWithViewControllerCells/Sample/ViewController.m b/submodules/AsyncDisplayKit/examples_extra/CollectionViewWithViewControllerCells/Sample/ViewController.m deleted file mode 100644 index 60979faf3e..0000000000 --- a/submodules/AsyncDisplayKit/examples_extra/CollectionViewWithViewControllerCells/Sample/ViewController.m +++ /dev/null @@ -1,122 +0,0 @@ -// -// ViewController.m -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import "ViewController.h" - -#import -#import "MosaicCollectionViewLayout.h" -#import "SupplementaryNode.h" -#import "ImageViewController.h" - -static NSUInteger kNumberOfImages = 14; - -@interface ViewController () -{ - NSMutableArray *_sections; - ASCollectionView *_collectionView; - MosaicCollectionViewLayoutInspector *_layoutInspector; -} - -@end - -@implementation ViewController - -#pragma mark - -#pragma mark UIViewController. - -- (instancetype)init -{ - self = [super init]; - if (self) { - - _sections = [NSMutableArray array]; - [_sections addObject:[NSMutableArray array]]; - for (NSUInteger idx = 0, section = 0; idx < kNumberOfImages; idx++) { - NSString *name = [NSString stringWithFormat:@"image_%lu.jpg", (unsigned long)idx]; - [_sections[section] addObject:[UIImage imageNamed:name]]; - if ((idx + 1) % 5 == 0 && idx < kNumberOfImages - 1) { - section++; - [_sections addObject:[NSMutableArray array]]; - } - } - - } - return self; -} - -- (void)viewDidLoad -{ - [super viewDidLoad]; - - MosaicCollectionViewLayout *layout = [[MosaicCollectionViewLayout alloc] init]; - layout.numberOfColumns = 2; - layout.headerHeight = 44.0; - - _layoutInspector = [[MosaicCollectionViewLayoutInspector alloc] init]; - - _collectionView = [[ASCollectionView alloc] initWithFrame:self.view.bounds collectionViewLayout:layout]; - _collectionView.autoresizingMask = UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleWidth; - _collectionView.asyncDataSource = self; - _collectionView.asyncDelegate = self; - _collectionView.layoutInspector = _layoutInspector; - _collectionView.backgroundColor = [UIColor whiteColor]; - - [_collectionView registerSupplementaryNodeOfKind:UICollectionElementKindSectionHeader]; - [self.view addSubview:_collectionView]; -} - -- (void)dealloc -{ - _collectionView.asyncDataSource = nil; - _collectionView.asyncDelegate = nil; -} - -- (void)reloadTapped -{ - [_collectionView reloadData]; -} - -#pragma mark - -#pragma mark ASCollectionView data source. - -- (ASCellNodeBlock)collectionView:(ASCollectionView *)collectionView nodeBlockForItemAtIndexPath:(NSIndexPath *)indexPath -{ - UIImage *image = _sections[indexPath.section][indexPath.item]; - return ^{ - return [[ASCellNode alloc] initWithViewControllerBlock:^UIViewController *{ - return [[ImageViewController alloc] initWithImage:image]; - } didLoadBlock:^(ASDisplayNode * _Nonnull node) { - node.layer.borderWidth = 1.0; - node.layer.borderColor = [UIColor blackColor].CGColor; - }]; - }; -} - -- (ASCellNode *)collectionView:(ASCollectionView *)collectionView nodeForSupplementaryElementOfKind:(NSString *)kind atIndexPath:(NSIndexPath *)indexPath -{ - NSString *text = [NSString stringWithFormat:@"Section %d", (int)indexPath.section + 1]; - return [[SupplementaryNode alloc] initWithText:text]; -} - -- (NSInteger)numberOfSectionsInCollectionView:(UICollectionView *)collectionView -{ - return _sections.count; -} - -- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section -{ - return [_sections[section] count]; -} - -- (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout originalItemSizeAtIndexPath:(NSIndexPath *)indexPath -{ - return [(UIImage *)_sections[indexPath.section][indexPath.item] size]; -} - -@end diff --git a/submodules/AsyncDisplayKit/examples_extra/CollectionViewWithViewControllerCells/Sample/main.m b/submodules/AsyncDisplayKit/examples_extra/CollectionViewWithViewControllerCells/Sample/main.m deleted file mode 100644 index 65850400e4..0000000000 --- a/submodules/AsyncDisplayKit/examples_extra/CollectionViewWithViewControllerCells/Sample/main.m +++ /dev/null @@ -1,17 +0,0 @@ -// -// main.m -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import -#import "AppDelegate.h" - -int main(int argc, char * argv[]) { - @autoreleasepool { - return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); - } -} diff --git a/submodules/AsyncDisplayKit/examples_extra/EditableText/Default-568h@2x.png b/submodules/AsyncDisplayKit/examples_extra/EditableText/Default-568h@2x.png deleted file mode 100644 index 6ee80b9393..0000000000 Binary files a/submodules/AsyncDisplayKit/examples_extra/EditableText/Default-568h@2x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/examples_extra/EditableText/Default-667h@2x.png b/submodules/AsyncDisplayKit/examples_extra/EditableText/Default-667h@2x.png deleted file mode 100644 index e7b975e21b..0000000000 Binary files a/submodules/AsyncDisplayKit/examples_extra/EditableText/Default-667h@2x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/examples_extra/EditableText/Default-736h@3x.png b/submodules/AsyncDisplayKit/examples_extra/EditableText/Default-736h@3x.png deleted file mode 100644 index c8949cae16..0000000000 Binary files a/submodules/AsyncDisplayKit/examples_extra/EditableText/Default-736h@3x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/examples_extra/EditableText/Podfile b/submodules/AsyncDisplayKit/examples_extra/EditableText/Podfile deleted file mode 100644 index 08d1b7add6..0000000000 --- a/submodules/AsyncDisplayKit/examples_extra/EditableText/Podfile +++ /dev/null @@ -1,6 +0,0 @@ -source 'https://github.com/CocoaPods/Specs.git' -platform :ios, '9.0' -target 'Sample' do - pod 'Texture', :path => '../..' -end - diff --git a/submodules/AsyncDisplayKit/examples_extra/EditableText/Sample/AppDelegate.h b/submodules/AsyncDisplayKit/examples_extra/EditableText/Sample/AppDelegate.h deleted file mode 100644 index 19db03c153..0000000000 --- a/submodules/AsyncDisplayKit/examples_extra/EditableText/Sample/AppDelegate.h +++ /dev/null @@ -1,16 +0,0 @@ -// -// AppDelegate.h -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -@interface AppDelegate : UIResponder - -@property (strong, nonatomic) UIWindow *window; - -@end diff --git a/submodules/AsyncDisplayKit/examples_extra/EditableText/Sample/AppDelegate.m b/submodules/AsyncDisplayKit/examples_extra/EditableText/Sample/AppDelegate.m deleted file mode 100644 index d0fd66f775..0000000000 --- a/submodules/AsyncDisplayKit/examples_extra/EditableText/Sample/AppDelegate.m +++ /dev/null @@ -1,25 +0,0 @@ -// -// AppDelegate.m -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import "AppDelegate.h" - -#import "ViewController.h" - -@implementation AppDelegate - -- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions -{ - self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; - self.window.backgroundColor = [UIColor whiteColor]; - self.window.rootViewController = [[ViewController alloc] init]; - [self.window makeKeyAndVisible]; - return YES; -} - -@end diff --git a/submodules/AsyncDisplayKit/examples_extra/EditableText/Sample/Info.plist b/submodules/AsyncDisplayKit/examples_extra/EditableText/Sample/Info.plist deleted file mode 100644 index fb4115c84c..0000000000 --- a/submodules/AsyncDisplayKit/examples_extra/EditableText/Sample/Info.plist +++ /dev/null @@ -1,36 +0,0 @@ - - - - - CFBundleDevelopmentRegion - en - CFBundleExecutable - $(EXECUTABLE_NAME) - CFBundleIdentifier - $(PRODUCT_BUNDLE_IDENTIFIER) - CFBundleInfoDictionaryVersion - 6.0 - CFBundleName - $(PRODUCT_NAME) - CFBundlePackageType - APPL - CFBundleShortVersionString - 1.0 - CFBundleSignature - ???? - CFBundleVersion - 1 - LSRequiresIPhoneOS - - UIRequiredDeviceCapabilities - - armv7 - - UISupportedInterfaceOrientations - - UIInterfaceOrientationPortrait - UIInterfaceOrientationLandscapeLeft - UIInterfaceOrientationLandscapeRight - - - diff --git a/submodules/AsyncDisplayKit/examples_extra/EditableText/Sample/ViewController.h b/submodules/AsyncDisplayKit/examples_extra/EditableText/Sample/ViewController.h deleted file mode 100644 index c8a0626291..0000000000 --- a/submodules/AsyncDisplayKit/examples_extra/EditableText/Sample/ViewController.h +++ /dev/null @@ -1,14 +0,0 @@ -// -// ViewController.h -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -@interface ViewController : UIViewController - -@end diff --git a/submodules/AsyncDisplayKit/examples_extra/EditableText/Sample/ViewController.m b/submodules/AsyncDisplayKit/examples_extra/EditableText/Sample/ViewController.m deleted file mode 100644 index 0a9703b897..0000000000 --- a/submodules/AsyncDisplayKit/examples_extra/EditableText/Sample/ViewController.m +++ /dev/null @@ -1,94 +0,0 @@ -// -// ViewController.m -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import "ViewController.h" - -#import - - -@interface ViewController () -{ - ASEditableTextNode *_textNode; - - // These elements are a test case for ASTextNode truncation. - UILabel *_label; - ASTextNode *_node; -} - -@end - - -@implementation ViewController - -- (instancetype)init -{ - if (!(self = [super init])) - return nil; - - // simple editable text node. here we use it synchronously, but it fully supports async layout & display - _textNode = [[ASEditableTextNode alloc] init]; - _textNode.returnKeyType = UIReturnKeyDone; - _textNode.backgroundColor = [[UIColor lightGrayColor] colorWithAlphaComponent:0.1f]; - - // with placeholder text (displayed if the user hasn't entered text) - NSDictionary *placeholderAttrs = @{ NSFontAttributeName: [UIFont fontWithName:@"HelveticaNeue-LightItalic" size:18.0f] }; - _textNode.attributedPlaceholderText = [[NSAttributedString alloc] initWithString:@"Tap to type!" - attributes:placeholderAttrs]; - - // and typing attributes (style for any text the user enters) - _textNode.typingAttributes = @{ NSFontAttributeName: [UIFont fontWithName:@"HelveticaNeue-Light" size:18.0f] }; - - // 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.attributedText = 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; -} - -- (void)viewDidLoad -{ - [super viewDidLoad]; - - [self.view addSubnode:_textNode]; - [self.view addSubnode:_node]; - [self.view addSubview:_label]; - - [self.view addGestureRecognizer:[[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tap:)]]; -} - -- (void)viewWillLayoutSubviews -{ - // place the text node in the top half of the screen, with a bit of padding - _textNode.frame = CGRectMake(0, 20, self.view.bounds.size.width, (self.view.bounds.size.height / 2) - 40); -} - -- (void)tap:(UITapGestureRecognizer *)sender -{ - // dismiss the keyboard when we tap outside the text field - [_textNode resignFirstResponder]; -} - -@end diff --git a/submodules/AsyncDisplayKit/examples_extra/EditableText/Sample/main.m b/submodules/AsyncDisplayKit/examples_extra/EditableText/Sample/main.m deleted file mode 100644 index 511cd1a7ac..0000000000 --- a/submodules/AsyncDisplayKit/examples_extra/EditableText/Sample/main.m +++ /dev/null @@ -1,18 +0,0 @@ -// -// main.m -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -#import "AppDelegate.h" - -int main(int argc, char * argv[]) { - @autoreleasepool { - return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); - } -} diff --git a/submodules/AsyncDisplayKit/examples_extra/Multiplex/Default-568h@2x.png b/submodules/AsyncDisplayKit/examples_extra/Multiplex/Default-568h@2x.png deleted file mode 100644 index 6ee80b9393..0000000000 Binary files a/submodules/AsyncDisplayKit/examples_extra/Multiplex/Default-568h@2x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/examples_extra/Multiplex/Default-667h@2x.png b/submodules/AsyncDisplayKit/examples_extra/Multiplex/Default-667h@2x.png deleted file mode 100644 index e7b975e21b..0000000000 Binary files a/submodules/AsyncDisplayKit/examples_extra/Multiplex/Default-667h@2x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/examples_extra/Multiplex/Default-736h@3x.png b/submodules/AsyncDisplayKit/examples_extra/Multiplex/Default-736h@3x.png deleted file mode 100644 index c8949cae16..0000000000 Binary files a/submodules/AsyncDisplayKit/examples_extra/Multiplex/Default-736h@3x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/examples_extra/Multiplex/Podfile b/submodules/AsyncDisplayKit/examples_extra/Multiplex/Podfile deleted file mode 100644 index 71a7f2c4b2..0000000000 --- a/submodules/AsyncDisplayKit/examples_extra/Multiplex/Podfile +++ /dev/null @@ -1,5 +0,0 @@ -source 'https://github.com/CocoaPods/Specs.git' -platform :ios, '9.0' -target 'Sample' do - pod 'Texture', :path => '../..' -end diff --git a/submodules/AsyncDisplayKit/examples_extra/Multiplex/Sample/AppDelegate.h b/submodules/AsyncDisplayKit/examples_extra/Multiplex/Sample/AppDelegate.h deleted file mode 100644 index 19db03c153..0000000000 --- a/submodules/AsyncDisplayKit/examples_extra/Multiplex/Sample/AppDelegate.h +++ /dev/null @@ -1,16 +0,0 @@ -// -// AppDelegate.h -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -@interface AppDelegate : UIResponder - -@property (strong, nonatomic) UIWindow *window; - -@end diff --git a/submodules/AsyncDisplayKit/examples_extra/Multiplex/Sample/AppDelegate.m b/submodules/AsyncDisplayKit/examples_extra/Multiplex/Sample/AppDelegate.m deleted file mode 100644 index d0fd66f775..0000000000 --- a/submodules/AsyncDisplayKit/examples_extra/Multiplex/Sample/AppDelegate.m +++ /dev/null @@ -1,25 +0,0 @@ -// -// AppDelegate.m -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import "AppDelegate.h" - -#import "ViewController.h" - -@implementation AppDelegate - -- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions -{ - self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; - self.window.backgroundColor = [UIColor whiteColor]; - self.window.rootViewController = [[ViewController alloc] init]; - [self.window makeKeyAndVisible]; - return YES; -} - -@end diff --git a/submodules/AsyncDisplayKit/examples_extra/Multiplex/Sample/Info.plist b/submodules/AsyncDisplayKit/examples_extra/Multiplex/Sample/Info.plist deleted file mode 100644 index 35d842827b..0000000000 --- a/submodules/AsyncDisplayKit/examples_extra/Multiplex/Sample/Info.plist +++ /dev/null @@ -1,36 +0,0 @@ - - - - - CFBundleDevelopmentRegion - en - CFBundleExecutable - $(EXECUTABLE_NAME) - CFBundleIdentifier - com.facebook.AsyncDisplayKit.$(PRODUCT_NAME:rfc1034identifier) - CFBundleInfoDictionaryVersion - 6.0 - CFBundleName - $(PRODUCT_NAME) - CFBundlePackageType - APPL - CFBundleShortVersionString - 1.0 - CFBundleSignature - ???? - CFBundleVersion - 1 - LSRequiresIPhoneOS - - UIRequiredDeviceCapabilities - - armv7 - - UISupportedInterfaceOrientations - - UIInterfaceOrientationPortrait - UIInterfaceOrientationLandscapeLeft - UIInterfaceOrientationLandscapeRight - - - diff --git a/submodules/AsyncDisplayKit/examples_extra/Multiplex/Sample/ScreenNode.h b/submodules/AsyncDisplayKit/examples_extra/Multiplex/Sample/ScreenNode.h deleted file mode 100644 index 4ade23a06b..0000000000 --- a/submodules/AsyncDisplayKit/examples_extra/Multiplex/Sample/ScreenNode.h +++ /dev/null @@ -1,20 +0,0 @@ -// -// ScreenNode.h -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -@interface ScreenNode : ASDisplayNode - -@property (nonatomic, strong) ASMultiplexImageNode *imageNode; -@property (nonatomic, strong) ASButtonNode *buttonNode; - -- (void)start; -- (void)reload; - -@end diff --git a/submodules/AsyncDisplayKit/examples_extra/Multiplex/Sample/ScreenNode.m b/submodules/AsyncDisplayKit/examples_extra/Multiplex/Sample/ScreenNode.m deleted file mode 100644 index 345c5bed5d..0000000000 --- a/submodules/AsyncDisplayKit/examples_extra/Multiplex/Sample/ScreenNode.m +++ /dev/null @@ -1,159 +0,0 @@ -// -// ScreenNode.m -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import "ScreenNode.h" - -@interface ScreenNode() -@end - -@implementation ScreenNode - -- (instancetype)init -{ - if (!(self = [super init])) { - return nil; - } - - // multiplex image node! - // NB: we're using a custom downloader with an artificial delay for this demo, but ASPINRemoteImageDownloader works too! - _imageNode = [[ASMultiplexImageNode alloc] initWithCache:nil downloader:self]; - _imageNode.dataSource = self; - _imageNode.delegate = self; - - // placeholder colour - _imageNode.backgroundColor = ASDisplayNodeDefaultPlaceholderColor(); - - // load low-quality images before high-quality images - _imageNode.downloadsIntermediateImages = YES; - - // simple status label. Synchronous to avoid flicker / placeholder state when updating. - _buttonNode = [[ASButtonNode alloc] init]; - [_buttonNode addTarget:self action:@selector(reload) forControlEvents:ASControlNodeEventTouchUpInside]; - _buttonNode.titleNode.displaysAsynchronously = NO; - - [self addSubnode:_imageNode]; - [self addSubnode:_buttonNode]; - - return self; -} - -- (void)start -{ - [self setText:@"loading…"]; - _buttonNode.userInteractionEnabled = NO; - _imageNode.imageIdentifiers = @[ @"best", @"medium", @"worst" ]; // go! -} - -- (void)reload -{ - [self start]; - [_imageNode reloadImageIdentifierSources]; -} - -- (void)setText:(NSString *)text -{ - NSDictionary *attributes = @{NSFontAttributeName: [UIFont fontWithName:@"HelveticaNeue-Light" size:22.0f]}; - NSAttributedString *string = [[NSAttributedString alloc] initWithString:text - attributes:attributes]; - [_buttonNode setAttributedTitle:string forState:UIControlStateNormal]; - [self setNeedsLayout]; -} - -- (ASLayoutSpec *)layoutSpecThatFits:(ASSizeRange)constrainedSize -{ - ASRatioLayoutSpec *imagePlaceholder = [ASRatioLayoutSpec ratioLayoutSpecWithRatio:1 child:_imageNode]; - - ASStackLayoutSpec *verticalStack = [[ASStackLayoutSpec alloc] init]; - verticalStack.direction = ASStackLayoutDirectionVertical; - verticalStack.spacing = 10; - verticalStack.justifyContent = ASStackLayoutJustifyContentCenter; - verticalStack.alignItems = ASStackLayoutAlignItemsCenter; - verticalStack.children = @[imagePlaceholder, _buttonNode]; - - return [ASInsetLayoutSpec insetLayoutSpecWithInsets:UIEdgeInsetsMake(10, 10, 10, 10) child:verticalStack]; -} - -#pragma mark - -#pragma mark ASMultiplexImageNode data source & delegate. - -- (NSURL *)multiplexImageNode:(ASMultiplexImageNode *)imageNode URLForImageIdentifier:(id)imageIdentifier -{ - if ([imageIdentifier isEqualToString:@"worst"]) { - return [NSURL URLWithString:@"https://raw.githubusercontent.com/facebook/AsyncDisplayKit/master/examples_extra/Multiplex/worst.png"]; - } - - if ([imageIdentifier isEqualToString:@"medium"]) { - return [NSURL URLWithString:@"https://raw.githubusercontent.com/facebook/AsyncDisplayKit/master/examples_extra/Multiplex/medium.png"]; - } - - if ([imageIdentifier isEqualToString:@"best"]) { - return [NSURL URLWithString:@"https://raw.githubusercontent.com/facebook/AsyncDisplayKit/master/examples_extra/Multiplex/best.png"]; - } - - // unexpected identifier - return nil; -} - -- (void)multiplexImageNode:(ASMultiplexImageNode *)imageNode didFinishDownloadingImageWithIdentifier:(id)imageIdentifier error:(NSError *)error -{ - [self setText:[NSString stringWithFormat:@"loaded '%@'", imageIdentifier]]; - - if ([imageIdentifier isEqualToString:@"best"]) { - [self setText:[_buttonNode.titleNode.attributedText.string stringByAppendingString:@". tap to reload"]]; - _buttonNode.userInteractionEnabled = YES; - } -} - - -#pragma mark - -#pragma mark ASImageDownloaderProtocol. - -- (nullable id)downloadImageWithURL:(NSURL *)URL - callbackQueue:(dispatch_queue_t)callbackQueue - downloadProgress:(nullable ASImageDownloaderProgress)downloadProgressBlock - completion:(ASImageDownloaderCompletion)completion -{ - // if no callback queue is supplied, run on the main thread - if (callbackQueue == nil) { - callbackQueue = dispatch_get_main_queue(); - } - - // call completion blocks - void (^handler)(NSURLResponse *, NSData *, NSError *) = ^(NSURLResponse *response, NSData *data, NSError *connectionError) { - // add an artificial delay - usleep(1.0 * USEC_PER_SEC); - - // ASMultiplexImageNode callbacks - dispatch_async(callbackQueue, ^{ - if (downloadProgressBlock) { - downloadProgressBlock(1.0f); - } - - if (completion) { - completion([UIImage imageWithData:data], connectionError, nil, nil); - } - }); - }; - - // let NSURLConnection do the heavy lifting - NSURLRequest *request = [NSURLRequest requestWithURL:URL]; - [NSURLConnection sendAsynchronousRequest:request - queue:[[NSOperationQueue alloc] init] - completionHandler:handler]; - - // return nil, don't support cancellation - return nil; -} - -- (void)cancelImageDownloadForIdentifier:(id)downloadIdentifier -{ - // no-op, don't support cancellation -} - -@end diff --git a/submodules/AsyncDisplayKit/examples_extra/Multiplex/Sample/ViewController.h b/submodules/AsyncDisplayKit/examples_extra/Multiplex/Sample/ViewController.h deleted file mode 100644 index 27738fcbe1..0000000000 --- a/submodules/AsyncDisplayKit/examples_extra/Multiplex/Sample/ViewController.h +++ /dev/null @@ -1,14 +0,0 @@ -// -// ViewController.h -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -@interface ViewController : ASViewController - -@end diff --git a/submodules/AsyncDisplayKit/examples_extra/Multiplex/Sample/ViewController.m b/submodules/AsyncDisplayKit/examples_extra/Multiplex/Sample/ViewController.m deleted file mode 100644 index cd687f5bc7..0000000000 --- a/submodules/AsyncDisplayKit/examples_extra/Multiplex/Sample/ViewController.m +++ /dev/null @@ -1,40 +0,0 @@ -// -// ViewController.m -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import "ViewController.h" -#import "ScreenNode.h" - -@interface ViewController() -{ - ScreenNode *_screenNode; -} - -@end - -@implementation ViewController - -- (instancetype)init -{ - ScreenNode *node = [[ScreenNode alloc] init]; - if (!(self = [super initWithNode:node])) - return nil; - - _screenNode = node; - - return self; -} - -- (void)viewWillAppear:(BOOL)animated -{ - // This should be done before calling super's viewWillAppear which triggers data fetching on the node. - [_screenNode start]; - [super viewWillAppear:animated]; -} - -@end diff --git a/submodules/AsyncDisplayKit/examples_extra/Multiplex/Sample/main.m b/submodules/AsyncDisplayKit/examples_extra/Multiplex/Sample/main.m deleted file mode 100644 index 511cd1a7ac..0000000000 --- a/submodules/AsyncDisplayKit/examples_extra/Multiplex/Sample/main.m +++ /dev/null @@ -1,18 +0,0 @@ -// -// main.m -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -#import "AppDelegate.h" - -int main(int argc, char * argv[]) { - @autoreleasepool { - return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); - } -} diff --git a/submodules/AsyncDisplayKit/examples_extra/Multiplex/best.png b/submodules/AsyncDisplayKit/examples_extra/Multiplex/best.png deleted file mode 100644 index d50d8103a6..0000000000 Binary files a/submodules/AsyncDisplayKit/examples_extra/Multiplex/best.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/examples_extra/Multiplex/medium.png b/submodules/AsyncDisplayKit/examples_extra/Multiplex/medium.png deleted file mode 100644 index 7c08e0adc0..0000000000 Binary files a/submodules/AsyncDisplayKit/examples_extra/Multiplex/medium.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/examples_extra/Multiplex/worst.png b/submodules/AsyncDisplayKit/examples_extra/Multiplex/worst.png deleted file mode 100644 index 78727fa98f..0000000000 Binary files a/submodules/AsyncDisplayKit/examples_extra/Multiplex/worst.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/examples_extra/Placeholders/Default-568h@2x.png b/submodules/AsyncDisplayKit/examples_extra/Placeholders/Default-568h@2x.png deleted file mode 100644 index 6ee80b9393..0000000000 Binary files a/submodules/AsyncDisplayKit/examples_extra/Placeholders/Default-568h@2x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/examples_extra/Placeholders/Default-667h@2x.png b/submodules/AsyncDisplayKit/examples_extra/Placeholders/Default-667h@2x.png deleted file mode 100644 index e7b975e21b..0000000000 Binary files a/submodules/AsyncDisplayKit/examples_extra/Placeholders/Default-667h@2x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/examples_extra/Placeholders/Default-736h@3x.png b/submodules/AsyncDisplayKit/examples_extra/Placeholders/Default-736h@3x.png deleted file mode 100644 index c8949cae16..0000000000 Binary files a/submodules/AsyncDisplayKit/examples_extra/Placeholders/Default-736h@3x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/examples_extra/Placeholders/Podfile b/submodules/AsyncDisplayKit/examples_extra/Placeholders/Podfile deleted file mode 100644 index 71a7f2c4b2..0000000000 --- a/submodules/AsyncDisplayKit/examples_extra/Placeholders/Podfile +++ /dev/null @@ -1,5 +0,0 @@ -source 'https://github.com/CocoaPods/Specs.git' -platform :ios, '9.0' -target 'Sample' do - pod 'Texture', :path => '../..' -end diff --git a/submodules/AsyncDisplayKit/examples_extra/Placeholders/Sample/AppDelegate.h b/submodules/AsyncDisplayKit/examples_extra/Placeholders/Sample/AppDelegate.h deleted file mode 100644 index 19db03c153..0000000000 --- a/submodules/AsyncDisplayKit/examples_extra/Placeholders/Sample/AppDelegate.h +++ /dev/null @@ -1,16 +0,0 @@ -// -// AppDelegate.h -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -@interface AppDelegate : UIResponder - -@property (strong, nonatomic) UIWindow *window; - -@end diff --git a/submodules/AsyncDisplayKit/examples_extra/Placeholders/Sample/AppDelegate.m b/submodules/AsyncDisplayKit/examples_extra/Placeholders/Sample/AppDelegate.m deleted file mode 100644 index d0fd66f775..0000000000 --- a/submodules/AsyncDisplayKit/examples_extra/Placeholders/Sample/AppDelegate.m +++ /dev/null @@ -1,25 +0,0 @@ -// -// AppDelegate.m -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import "AppDelegate.h" - -#import "ViewController.h" - -@implementation AppDelegate - -- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions -{ - self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; - self.window.backgroundColor = [UIColor whiteColor]; - self.window.rootViewController = [[ViewController alloc] init]; - [self.window makeKeyAndVisible]; - return YES; -} - -@end diff --git a/submodules/AsyncDisplayKit/examples_extra/Placeholders/Sample/Info.plist b/submodules/AsyncDisplayKit/examples_extra/Placeholders/Sample/Info.plist deleted file mode 100644 index 35d842827b..0000000000 --- a/submodules/AsyncDisplayKit/examples_extra/Placeholders/Sample/Info.plist +++ /dev/null @@ -1,36 +0,0 @@ - - - - - CFBundleDevelopmentRegion - en - CFBundleExecutable - $(EXECUTABLE_NAME) - CFBundleIdentifier - com.facebook.AsyncDisplayKit.$(PRODUCT_NAME:rfc1034identifier) - CFBundleInfoDictionaryVersion - 6.0 - CFBundleName - $(PRODUCT_NAME) - CFBundlePackageType - APPL - CFBundleShortVersionString - 1.0 - CFBundleSignature - ???? - CFBundleVersion - 1 - LSRequiresIPhoneOS - - UIRequiredDeviceCapabilities - - armv7 - - UISupportedInterfaceOrientations - - UIInterfaceOrientationPortrait - UIInterfaceOrientationLandscapeLeft - UIInterfaceOrientationLandscapeRight - - - diff --git a/submodules/AsyncDisplayKit/examples_extra/Placeholders/Sample/PostNode.h b/submodules/AsyncDisplayKit/examples_extra/Placeholders/Sample/PostNode.h deleted file mode 100644 index 646f72232d..0000000000 --- a/submodules/AsyncDisplayKit/examples_extra/Placeholders/Sample/PostNode.h +++ /dev/null @@ -1,14 +0,0 @@ -// -// PostNode.h -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -@interface PostNode : ASDisplayNode - -@end diff --git a/submodules/AsyncDisplayKit/examples_extra/Placeholders/Sample/PostNode.m b/submodules/AsyncDisplayKit/examples_extra/Placeholders/Sample/PostNode.m deleted file mode 100644 index 5c8bbd6dad..0000000000 --- a/submodules/AsyncDisplayKit/examples_extra/Placeholders/Sample/PostNode.m +++ /dev/null @@ -1,92 +0,0 @@ -// -// PostNode.m -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import "PostNode.h" - -#import "SlowpokeShareNode.h" -#import "SlowpokeTextNode.h" -#import - -@interface PostNode () -{ - SlowpokeTextNode *_textNode; - SlowpokeShareNode *_needyChildNode; // this node slows down display -} - -@end - -@implementation PostNode - -// turn on to demo that the parent displays a placeholder even if it takes the longest -//+ (void)drawRect:(CGRect)bounds withParameters:(id)parameters isCancelled:(asdisplaynode_iscancelled_block_t)isCancelledBlock isRasterizing:(BOOL)isRasterizing -//{ -// usleep( (long)(1.2 * USEC_PER_SEC) ); // artificial delay of 1.2s -// -// // demonstrates that the parent node should also adhere to the placeholder -// [[UIColor colorWithWhite:0.95 alpha:1.0] setFill]; -// UIRectFill(bounds); -//} - -- (instancetype)init -{ - if (!(self = [super init])) - return nil; - - _textNode = [[SlowpokeTextNode alloc] init]; - _textNode.placeholderInsets = UIEdgeInsetsMake(3.0, 0.0, 3.0, 0.0); - _textNode.placeholderEnabled = YES; - - NSString *text = @"Etiam porta sem malesuada magna mollis euismod. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus. Etiam porta sem malesuada magna mollis euismod. Duis mollis, est non commodo luctus, nisi erat porttitor ligula, eget lacinia odio sem nec elit. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh."; - NSDictionary *attributes = @{ NSFontAttributeName: [UIFont systemFontOfSize:17.0] }; - _textNode.attributedText = [[NSAttributedString alloc] initWithString:text attributes:attributes]; - - _needyChildNode = [[SlowpokeShareNode alloc] init]; - _needyChildNode.opaque = NO; - - [self addSubnode:_textNode]; - [self addSubnode:_needyChildNode]; - - return self; -} - -- (UIImage *)placeholderImage -{ - CGSize size = self.calculatedSize; - if (CGSizeEqualToSize(size, CGSizeZero)) { - return nil; - } - - UIGraphicsBeginImageContext(size); - [[UIColor colorWithWhite:0.9 alpha:1] setFill]; - UIRectFill((CGRect){CGPointZero, size}); - UIImage *image = UIGraphicsGetImageFromCurrentImageContext(); - UIGraphicsEndImageContext(); - return image; -} - -- (CGSize)calculateSizeThatFits:(CGSize)constrainedSize -{ - CGSize textSize = [_textNode layoutThatFits:ASSizeRangeMake(CGSizeZero, constrainedSize)].size; - CGSize shareSize = [_needyChildNode layoutThatFits:ASSizeRangeMake(CGSizeZero, constrainedSize)].size; - - return CGSizeMake(constrainedSize.width, textSize.height + 10.0 + shareSize.height); -} - -- (void)layout -{ - [super layout]; - - CGSize textSize = _textNode.calculatedSize; - CGSize needyChildSize = _needyChildNode.calculatedSize; - - _textNode.frame = (CGRect){CGPointZero, textSize}; - _needyChildNode.frame = (CGRect){0.0, CGRectGetMaxY(_textNode.frame) + 10.0, needyChildSize}; -} - -@end diff --git a/submodules/AsyncDisplayKit/examples_extra/Placeholders/Sample/SlowpokeImageNode.h b/submodules/AsyncDisplayKit/examples_extra/Placeholders/Sample/SlowpokeImageNode.h deleted file mode 100644 index 9c6ef5c42d..0000000000 --- a/submodules/AsyncDisplayKit/examples_extra/Placeholders/Sample/SlowpokeImageNode.h +++ /dev/null @@ -1,14 +0,0 @@ -// -// SlowpokeImageNode.h -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -@interface SlowpokeImageNode : ASImageNode - -@end diff --git a/submodules/AsyncDisplayKit/examples_extra/Placeholders/Sample/SlowpokeImageNode.m b/submodules/AsyncDisplayKit/examples_extra/Placeholders/Sample/SlowpokeImageNode.m deleted file mode 100644 index 8bf0f25bdf..0000000000 --- a/submodules/AsyncDisplayKit/examples_extra/Placeholders/Sample/SlowpokeImageNode.m +++ /dev/null @@ -1,76 +0,0 @@ -// -// SlowpokeImageNode.m -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import "SlowpokeImageNode.h" - -#import - -static CGFloat const kASDKLogoAspectRatio = 2.79; - -@interface ASImageNode (ForwardWorkaround) -// This is a workaround until subclass overriding of custom drawing class methods is fixed -- (UIImage *)displayWithParameters:(id)parameters isCancelled:(asdisplaynode_iscancelled_block_t)isCancelledBlock; -@end - -@implementation SlowpokeImageNode - -- (UIImage *)displayWithParameters:(id)parameters isCancelled:(asdisplaynode_iscancelled_block_t)isCancelledBlock -{ - usleep( (long)(0.5 * USEC_PER_SEC) ); // artificial delay of 0.5s - - return [super displayWithParameters:parameters isCancelled:isCancelledBlock]; -} - -- (instancetype)init -{ - if (self = [super init]) { - self.placeholderEnabled = YES; - self.placeholderFadeDuration = 0.1; - } - return self; -} - -- (CGSize)calculateSizeThatFits:(CGSize)constrainedSize -{ - if (constrainedSize.width > 0.0) { - return CGSizeMake(constrainedSize.width, constrainedSize.width / kASDKLogoAspectRatio); - } else if (constrainedSize.height > 0.0) { - return CGSizeMake(constrainedSize.height * kASDKLogoAspectRatio, constrainedSize.height); - } - return CGSizeZero; -} - -- (UIImage *)placeholderImage -{ - CGSize size = self.calculatedSize; - if (CGSizeEqualToSize(size, CGSizeZero)) { - return nil; - } - - UIGraphicsBeginImageContext(size); - [[UIColor whiteColor] setFill]; - [[UIColor colorWithWhite:0.9 alpha:1] setStroke]; - - UIRectFill((CGRect){CGPointZero, size}); - - UIBezierPath *path = [UIBezierPath bezierPath]; - [path moveToPoint:CGPointZero]; - [path addLineToPoint:(CGPoint){size.width, size.height}]; - [path stroke]; - - [path moveToPoint:(CGPoint){size.width, 0.0}]; - [path addLineToPoint:(CGPoint){0.0, size.height}]; - [path stroke]; - - UIImage *image = UIGraphicsGetImageFromCurrentImageContext(); - UIGraphicsEndImageContext(); - return image; -} - -@end diff --git a/submodules/AsyncDisplayKit/examples_extra/Placeholders/Sample/SlowpokeShareNode.h b/submodules/AsyncDisplayKit/examples_extra/Placeholders/Sample/SlowpokeShareNode.h deleted file mode 100644 index 3742854276..0000000000 --- a/submodules/AsyncDisplayKit/examples_extra/Placeholders/Sample/SlowpokeShareNode.h +++ /dev/null @@ -1,14 +0,0 @@ -// -// SlowpokeShareNode.h -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -@interface SlowpokeShareNode : ASControlNode - -@end diff --git a/submodules/AsyncDisplayKit/examples_extra/Placeholders/Sample/SlowpokeShareNode.m b/submodules/AsyncDisplayKit/examples_extra/Placeholders/Sample/SlowpokeShareNode.m deleted file mode 100644 index 3d1e568756..0000000000 --- a/submodules/AsyncDisplayKit/examples_extra/Placeholders/Sample/SlowpokeShareNode.m +++ /dev/null @@ -1,41 +0,0 @@ -// -// SlowpokeShareNode.m -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import "SlowpokeShareNode.h" - -#import - -static NSUInteger const kRingCount = 3; -static CGFloat const kRingStrokeWidth = 1.0; -static CGSize const kIconSize = (CGSize){ 60.0, 17.0 }; - -@implementation SlowpokeShareNode - -+ (void)drawRect:(CGRect)bounds withParameters:(id)parameters isCancelled:(asdisplaynode_iscancelled_block_t)isCancelledBlock isRasterizing:(BOOL)isRasterizing -{ - usleep( (long)(0.8 * USEC_PER_SEC) ); // artificial delay of 0.8s - - [[UIColor colorWithRed:0.f green:122/255.f blue:1.f alpha:1.f] setStroke]; - - for (NSUInteger i = 0; i < kRingCount; i++) { - CGFloat x = i * kIconSize.width / kRingCount; - CGRect frame = CGRectMake(x, 0.f, kIconSize.height, kIconSize.height); - CGRect strokeFrame = CGRectInset(frame, kRingStrokeWidth, kRingStrokeWidth); - UIBezierPath *path = [UIBezierPath bezierPathWithRoundedRect:strokeFrame cornerRadius:kIconSize.height / 2.f]; - [path setLineWidth:kRingStrokeWidth]; - [path stroke]; - } -} - -- (CGSize)calculateSizeThatFits:(CGSize)constrainedSize -{ - return kIconSize; -} - -@end diff --git a/submodules/AsyncDisplayKit/examples_extra/Placeholders/Sample/SlowpokeTextNode.h b/submodules/AsyncDisplayKit/examples_extra/Placeholders/Sample/SlowpokeTextNode.h deleted file mode 100644 index 069833e53f..0000000000 --- a/submodules/AsyncDisplayKit/examples_extra/Placeholders/Sample/SlowpokeTextNode.h +++ /dev/null @@ -1,14 +0,0 @@ -// -// SlowpokeTextNode.h -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -@interface SlowpokeTextNode : ASTextNode - -@end diff --git a/submodules/AsyncDisplayKit/examples_extra/Placeholders/Sample/SlowpokeTextNode.m b/submodules/AsyncDisplayKit/examples_extra/Placeholders/Sample/SlowpokeTextNode.m deleted file mode 100644 index 81cedf3ccd..0000000000 --- a/submodules/AsyncDisplayKit/examples_extra/Placeholders/Sample/SlowpokeTextNode.m +++ /dev/null @@ -1,28 +0,0 @@ -// -// SlowpokeTextNode.m -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import "SlowpokeTextNode.h" - -#import - -@interface ASTextNode (ForwardWorkaround) -// This is a workaround until subclass overriding of custom drawing class methods is fixed -- (void)drawRect:(CGRect)bounds withParameters:(id)parameters isCancelled:(asdisplaynode_iscancelled_block_t)isCancelledBlock isRasterizing:(BOOL)isRasterizing; -@end - -@implementation SlowpokeTextNode - -- (void)drawRect:(CGRect)bounds withParameters:(id)parameters isCancelled:(asdisplaynode_iscancelled_block_t)isCancelledBlock isRasterizing:(BOOL)isRasterizing -{ - usleep( (long)(1.0 * USEC_PER_SEC) ); // artificial delay of 1.0 - - [super drawRect:bounds withParameters:parameters isCancelled:isCancelledBlock isRasterizing:isRasterizing]; -} - -@end diff --git a/submodules/AsyncDisplayKit/examples_extra/Placeholders/Sample/ViewController.h b/submodules/AsyncDisplayKit/examples_extra/Placeholders/Sample/ViewController.h deleted file mode 100644 index c8a0626291..0000000000 --- a/submodules/AsyncDisplayKit/examples_extra/Placeholders/Sample/ViewController.h +++ /dev/null @@ -1,14 +0,0 @@ -// -// ViewController.h -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -@interface ViewController : UIViewController - -@end diff --git a/submodules/AsyncDisplayKit/examples_extra/Placeholders/Sample/ViewController.m b/submodules/AsyncDisplayKit/examples_extra/Placeholders/Sample/ViewController.m deleted file mode 100644 index d10f83c55d..0000000000 --- a/submodules/AsyncDisplayKit/examples_extra/Placeholders/Sample/ViewController.m +++ /dev/null @@ -1,103 +0,0 @@ -// -// ViewController.m -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import "ViewController.h" - -#import - -#import "PostNode.h" -#import "SlowpokeImageNode.h" -#import - -@interface ViewController () -{ - PostNode *_postNode; - SlowpokeImageNode *_imageNode; - UIButton *_displayButton; -} - -@end - - -@implementation ViewController - -#pragma mark - -#pragma mark UIViewController - -- (instancetype)init -{ - if (!(self = [super init])) - return nil; - - _displayButton = [UIButton buttonWithType:UIButtonTypeCustom]; - [_displayButton setTitle:@"Display me!" forState:UIControlStateNormal]; - [_displayButton addTarget:self action:@selector(onDisplayButton:) forControlEvents:UIControlEventTouchUpInside]; - - UIColor *tintBlue = [UIColor colorWithRed:0 green:122/255.0 blue:1.0 alpha:1.0]; - [_displayButton setTitleColor:tintBlue forState:UIControlStateNormal]; - [_displayButton setTitleColor:[tintBlue colorWithAlphaComponent:0.5] forState:UIControlStateHighlighted]; - _displayButton.backgroundColor = [UIColor colorWithWhite:0.95 alpha:1.0]; - - return self; -} - -- (void)viewDidLoad -{ - [super viewDidLoad]; - - [self.view addSubview:_displayButton]; -} - -- (void)viewWillLayoutSubviews -{ - CGFloat padding = 20.0; - CGRect bounds = self.view.bounds; - CGFloat constrainedWidth = CGRectGetWidth(bounds); - CGSize constrainedSize = CGSizeMake(constrainedWidth - 2 * padding, CGFLOAT_MAX); - - CGSize postSize = [_postNode layoutThatFits:ASSizeRangeMake(CGSizeZero, constrainedSize)].size; - CGSize imageSize = [_imageNode layoutThatFits:ASSizeRangeMake(CGSizeZero, constrainedSize)].size; - - _imageNode.frame = (CGRect){padding, padding, imageSize}; - _postNode.frame = (CGRect){padding, CGRectGetMaxY(_imageNode.frame) + 10.0, postSize}; - - CGFloat buttonHeight = 55.0; - _displayButton.frame = (CGRect){0.0, CGRectGetHeight(bounds) - buttonHeight, CGRectGetWidth(bounds), buttonHeight}; -} - -// this method is pretty gross and just for demonstration :] -- (void)createAndDisplayNodes -{ - [_imageNode.view removeFromSuperview]; - [_postNode.view removeFromSuperview]; - - // ASImageNode gets placeholders by default - _imageNode = [[SlowpokeImageNode alloc] init]; - _imageNode.image = [UIImage imageNamed:@"logo"]; - - _postNode = [[PostNode alloc] init]; - - // change to NO to see text placeholders, change to YES to see the parent placeholder - // this placeholder will cover all subnodes while they are displaying, just a like a stage curtain! - _postNode.placeholderEnabled = NO; - - [self.view addSubnode:_imageNode]; - [self.view addSubnode:_postNode]; -} - - -#pragma mark - -#pragma mark Actions - -- (void)onDisplayButton:(id)sender -{ - [self createAndDisplayNodes]; -} - -@end diff --git a/submodules/AsyncDisplayKit/examples_extra/Placeholders/Sample/logo.png b/submodules/AsyncDisplayKit/examples_extra/Placeholders/Sample/logo.png deleted file mode 100755 index dce1ebc950..0000000000 Binary files a/submodules/AsyncDisplayKit/examples_extra/Placeholders/Sample/logo.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/examples_extra/Placeholders/Sample/main.m b/submodules/AsyncDisplayKit/examples_extra/Placeholders/Sample/main.m deleted file mode 100644 index 511cd1a7ac..0000000000 --- a/submodules/AsyncDisplayKit/examples_extra/Placeholders/Sample/main.m +++ /dev/null @@ -1,18 +0,0 @@ -// -// main.m -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -#import "AppDelegate.h" - -int main(int argc, char * argv[]) { - @autoreleasepool { - return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); - } -} diff --git a/submodules/AsyncDisplayKit/examples_extra/RepoSearcher/Podfile b/submodules/AsyncDisplayKit/examples_extra/RepoSearcher/Podfile deleted file mode 100644 index 21dc49860f..0000000000 --- a/submodules/AsyncDisplayKit/examples_extra/RepoSearcher/Podfile +++ /dev/null @@ -1,9 +0,0 @@ -platform :ios, '9.0' - -target 'RepoSearcher' do - # Comment the next line if you're not using Swift and don't want to use dynamic frameworks - use_frameworks! - - # Pods for RepoSearcher - pod 'Texture/IGListKit', :path => '../..' -end diff --git a/submodules/AsyncDisplayKit/examples_extra/RepoSearcher/RepoSearcher.xcworkspace/contents.xcworkspacedata b/submodules/AsyncDisplayKit/examples_extra/RepoSearcher/RepoSearcher.xcworkspace/contents.xcworkspacedata deleted file mode 100644 index c9f12e24dd..0000000000 --- a/submodules/AsyncDisplayKit/examples_extra/RepoSearcher/RepoSearcher.xcworkspace/contents.xcworkspacedata +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - diff --git a/submodules/AsyncDisplayKit/examples_extra/RepoSearcher/RepoSearcher/AppDelegate.swift b/submodules/AsyncDisplayKit/examples_extra/RepoSearcher/RepoSearcher/AppDelegate.swift deleted file mode 100644 index 75583b7cd9..0000000000 --- a/submodules/AsyncDisplayKit/examples_extra/RepoSearcher/RepoSearcher/AppDelegate.swift +++ /dev/null @@ -1,27 +0,0 @@ -// -// AppDelegate.swift -// Texture -// -// Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -import UIKit - -@UIApplicationMain -class AppDelegate: UIResponder, UIApplicationDelegate { - var window: UIWindow? = { - let window = UIWindow(frame: UIScreen.main.bounds) - window.backgroundColor = .white - return window - }() - - func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool { - // Override point for customization after application launch. - window?.rootViewController = UINavigationController(rootViewController: SearchViewController()) - window?.makeKeyAndVisible() - - return true - } -} - diff --git a/submodules/AsyncDisplayKit/examples_extra/RepoSearcher/RepoSearcher/Assets.xcassets/AppIcon.appiconset/Contents.json b/submodules/AsyncDisplayKit/examples_extra/RepoSearcher/RepoSearcher/Assets.xcassets/AppIcon.appiconset/Contents.json deleted file mode 100644 index 36d2c80d88..0000000000 --- a/submodules/AsyncDisplayKit/examples_extra/RepoSearcher/RepoSearcher/Assets.xcassets/AppIcon.appiconset/Contents.json +++ /dev/null @@ -1,68 +0,0 @@ -{ - "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" - } - ], - "info" : { - "version" : 1, - "author" : "xcode" - } -} \ No newline at end of file diff --git a/submodules/AsyncDisplayKit/examples_extra/RepoSearcher/RepoSearcher/IGListCollectionContext+ASDK.swift b/submodules/AsyncDisplayKit/examples_extra/RepoSearcher/RepoSearcher/IGListCollectionContext+ASDK.swift deleted file mode 100644 index 31a951f349..0000000000 --- a/submodules/AsyncDisplayKit/examples_extra/RepoSearcher/RepoSearcher/IGListCollectionContext+ASDK.swift +++ /dev/null @@ -1,17 +0,0 @@ -// -// IGListCollectionContext+ASDK.swift -// Texture -// -// Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -import Foundation -import IGListKit -import AsyncDisplayKit - -extension ListCollectionContext { - func nodeForItem(at index: Int, sectionController: ListSectionController) -> ASCellNode? { - return (cellForItem(at: index, sectionController: sectionController) as? _ASCollectionViewCell)?.node - } -} diff --git a/submodules/AsyncDisplayKit/examples_extra/RepoSearcher/RepoSearcher/Info.plist b/submodules/AsyncDisplayKit/examples_extra/RepoSearcher/RepoSearcher/Info.plist deleted file mode 100644 index 0f3cc77a42..0000000000 --- a/submodules/AsyncDisplayKit/examples_extra/RepoSearcher/RepoSearcher/Info.plist +++ /dev/null @@ -1,43 +0,0 @@ - - - - - CFBundleDevelopmentRegion - en - CFBundleExecutable - $(EXECUTABLE_NAME) - CFBundleIdentifier - $(PRODUCT_BUNDLE_IDENTIFIER) - CFBundleInfoDictionaryVersion - 6.0 - CFBundleName - $(PRODUCT_NAME) - CFBundlePackageType - APPL - CFBundleShortVersionString - 1.0 - CFBundleVersion - 1 - LSRequiresIPhoneOS - - UILaunchStoryboardName - Launch Screen - UIRequiredDeviceCapabilities - - armv7 - - UISupportedInterfaceOrientations - - UIInterfaceOrientationPortrait - UIInterfaceOrientationLandscapeLeft - UIInterfaceOrientationLandscapeRight - - UISupportedInterfaceOrientations~ipad - - UIInterfaceOrientationPortrait - UIInterfaceOrientationPortraitUpsideDown - UIInterfaceOrientationLandscapeLeft - UIInterfaceOrientationLandscapeRight - - - diff --git a/submodules/AsyncDisplayKit/examples_extra/RepoSearcher/RepoSearcher/LabelSectionController.swift b/submodules/AsyncDisplayKit/examples_extra/RepoSearcher/RepoSearcher/LabelSectionController.swift deleted file mode 100644 index d76dfdd78c..0000000000 --- a/submodules/AsyncDisplayKit/examples_extra/RepoSearcher/RepoSearcher/LabelSectionController.swift +++ /dev/null @@ -1,44 +0,0 @@ -// -// LabelSectionController.swift -// Texture -// -// Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -import Foundation -import AsyncDisplayKit -import IGListKit - -final class LabelSectionController: ListSectionController, ASSectionController { - var object: String? - - func nodeBlockForItem(at index: Int) -> ASCellNodeBlock { - let text = object ?? "" - return { - let node = ASTextCellNode() - node.text = text - return node - } - } - - override func numberOfItems() -> Int { - return 1 - } - - override func didUpdate(to object: Any) { - self.object = String(describing: object) - } - - override func didSelectItem(at index: Int) {} - - //ASDK Replacement - override func sizeForItem(at index: Int) -> CGSize { - return ASIGListSectionControllerMethods.sizeForItem(at: index) - } - - override func cellForItem(at index: Int) -> UICollectionViewCell { - return ASIGListSectionControllerMethods.cellForItem(at: index, sectionController: self) - } -} - diff --git a/submodules/AsyncDisplayKit/examples_extra/RepoSearcher/RepoSearcher/Launch Screen.storyboard b/submodules/AsyncDisplayKit/examples_extra/RepoSearcher/RepoSearcher/Launch Screen.storyboard deleted file mode 100644 index b90f693902..0000000000 --- a/submodules/AsyncDisplayKit/examples_extra/RepoSearcher/RepoSearcher/Launch Screen.storyboard +++ /dev/null @@ -1,48 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/submodules/AsyncDisplayKit/examples_extra/RepoSearcher/RepoSearcher/NSObject+IGListDiffable.swift b/submodules/AsyncDisplayKit/examples_extra/RepoSearcher/RepoSearcher/NSObject+IGListDiffable.swift deleted file mode 100644 index eb95b06c78..0000000000 --- a/submodules/AsyncDisplayKit/examples_extra/RepoSearcher/RepoSearcher/NSObject+IGListDiffable.swift +++ /dev/null @@ -1,18 +0,0 @@ -// -// NSObject+IGListDiffable.swift -// Texture -// -// Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -import IGListKit - -extension NSObject: ListDiffable { - public func diffIdentifier() -> NSObjectProtocol { - return self - } - public func isEqual(toDiffableObject object: ListDiffable?) -> Bool { - return isEqual(object) - } -} diff --git a/submodules/AsyncDisplayKit/examples_extra/RepoSearcher/RepoSearcher/SearchNode.swift b/submodules/AsyncDisplayKit/examples_extra/RepoSearcher/RepoSearcher/SearchNode.swift deleted file mode 100644 index c25322c9cc..0000000000 --- a/submodules/AsyncDisplayKit/examples_extra/RepoSearcher/RepoSearcher/SearchNode.swift +++ /dev/null @@ -1,52 +0,0 @@ -// -// SearchNode.swift -// Texture -// -// Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -import Foundation -import AsyncDisplayKit - -class SearchNode: ASCellNode { - var searchBarNode: SearchBarNode - - init(delegate: UISearchBarDelegate?) { - self.searchBarNode = SearchBarNode(delegate: delegate) - super.init() - automaticallyManagesSubnodes = true - } - - override func layoutSpecThatFits(_ constrainedSize: ASSizeRange) -> ASLayoutSpec { - return ASInsetLayoutSpec(insets: .zero, child: searchBarNode) - } -} - -final class SearchBarNode: ASDisplayNode { - - weak var delegate: UISearchBarDelegate? - - init(delegate: UISearchBarDelegate?) { - self.delegate = delegate - super.init() - setViewBlock { - UISearchBar() - } - - style.preferredSize = CGSize(width: UIScreen.main.bounds.width, height: 44) - } - - var searchBar: UISearchBar { - return view as! UISearchBar - } - - override func didLoad() { - super.didLoad() - searchBar.delegate = delegate - searchBar.searchBarStyle = .minimal - searchBar.tintColor = .black - searchBar.backgroundColor = .white - searchBar.placeholder = "Search" - } -} diff --git a/submodules/AsyncDisplayKit/examples_extra/RepoSearcher/RepoSearcher/SearchSectionController.swift b/submodules/AsyncDisplayKit/examples_extra/RepoSearcher/RepoSearcher/SearchSectionController.swift deleted file mode 100644 index def4b10edd..0000000000 --- a/submodules/AsyncDisplayKit/examples_extra/RepoSearcher/RepoSearcher/SearchSectionController.swift +++ /dev/null @@ -1,71 +0,0 @@ -// -// SearchSectionController.swift -// Texture -// -// Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -import AsyncDisplayKit -import IGListKit - -protocol SearchSectionControllerDelegate: class { - func searchSectionController(_ sectionController: SearchSectionController, didChangeText text: String) -} - -final class SearchSectionController: ListSectionController, ASSectionController { - - weak var delegate: SearchSectionControllerDelegate? - - override init() { - super.init() - scrollDelegate = self - } - - func nodeBlockForItem(at index: Int) -> ASCellNodeBlock { - return { [weak self] in - return SearchNode(delegate: self) - } - } - - override func numberOfItems() -> Int { - return 1 - } - - override func didUpdate(to object: Any) {} - override func didSelectItem(at index: Int) {} - - //ASDK Replacement - override func sizeForItem(at index: Int) -> CGSize { - return ASIGListSectionControllerMethods.sizeForItem(at: index) - } - - override func cellForItem(at index: Int) -> UICollectionViewCell { - return ASIGListSectionControllerMethods.cellForItem(at: index, sectionController: self) - } -} - -extension SearchSectionController: ListScrollDelegate { - func listAdapter(_ listAdapter: ListAdapter, didScroll sectionController: ListSectionController) { - guard let searchNode = collectionContext?.nodeForItem(at: 0, sectionController: self) as? SearchNode else { return } - - let searchBar = searchNode.searchBarNode.searchBar - searchBar.text = "" - searchBar.resignFirstResponder() - } - - func listAdapter(_ listAdapter: ListAdapter, willBeginDragging sectionController: ListSectionController) {} - func listAdapter(_ listAdapter: ListAdapter, didEndDragging sectionController: ListSectionController, willDecelerate decelerate: Bool) {} - -} - -extension SearchSectionController: UISearchBarDelegate { - func searchBar(_ searchBar: UISearchBar, textDidChange searchText: String) { - delegate?.searchSectionController(self, didChangeText: searchText) - } - - func searchBarTextDidEndEditing(_ searchBar: UISearchBar) { - delegate?.searchSectionController(self, didChangeText: "") - } -} - diff --git a/submodules/AsyncDisplayKit/examples_extra/RepoSearcher/RepoSearcher/SearchViewController.swift b/submodules/AsyncDisplayKit/examples_extra/RepoSearcher/RepoSearcher/SearchViewController.swift deleted file mode 100644 index 59556d4b37..0000000000 --- a/submodules/AsyncDisplayKit/examples_extra/RepoSearcher/RepoSearcher/SearchViewController.swift +++ /dev/null @@ -1,65 +0,0 @@ -// -// SearchViewController.swift -// Texture -// -// Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -import UIKit -import AsyncDisplayKit -import IGListKit - -class SearchToken: NSObject {} - -final class SearchViewController: ASViewController { - - lazy var adapter: ListAdapter = { - return ListAdapter(updater: ListAdapterUpdater(), viewController: self, workingRangeSize: 0) - }() - - let words = ["first", "second", "third", "more", "hi", "others"] - - let searchToken = SearchToken() - var filterString = "" - - init() { - let flowLayout = UICollectionViewFlowLayout() - super.init(node: ASCollectionNode(collectionViewLayout: flowLayout)) - adapter.setASDKCollectionNode(node) - adapter.dataSource = self - title = "Search" - } - - required init?(coder aDecoder: NSCoder) { - fatalError("init(coder:) has not been implemented") - } -} - -extension SearchViewController: ListAdapterDataSource { - func listAdapter(_ listAdapter: ListAdapter, sectionControllerFor object: Any) -> ListSectionController { - if object is SearchToken { - let section = SearchSectionController() - section.delegate = self - return section - } - return LabelSectionController() - } - - func emptyView(for listAdapter: ListAdapter) -> UIView? { - // emptyView dosent work in this secenario, there is always one section (searchbar) present in collection - return nil - } - - func objects(for listAdapter: ListAdapter) -> [ListDiffable] { - guard filterString != "" else { return [searchToken] + words.map { $0 as ListDiffable } } - return [searchToken] + words.filter { $0.lowercased().contains(filterString.lowercased()) }.map { $0 as ListDiffable } - } -} - -extension SearchViewController: SearchSectionControllerDelegate { - func searchSectionController(_ sectionController: SearchSectionController, didChangeText text: String) { - filterString = text - adapter.performUpdates(animated: true, completion: nil) - } -} diff --git a/submodules/AsyncDisplayKit/examples_extra/Shop/Podfile b/submodules/AsyncDisplayKit/examples_extra/Shop/Podfile deleted file mode 100644 index b12d45be71..0000000000 --- a/submodules/AsyncDisplayKit/examples_extra/Shop/Podfile +++ /dev/null @@ -1,17 +0,0 @@ -# Uncomment the next line to define a global platform for your project -# platform :ios, '9.0' - -target 'Shop' do - # Comment the next line if you're not using Swift and don't want to use dynamic frameworks - # use_frameworks! - - # Pods for Shop - -pod 'Texture' - - target 'ShopTests' do - inherit! :search_paths - # Pods for testing - end - -end diff --git a/submodules/AsyncDisplayKit/examples_extra/Shop/Screenshots/IMG_0008.jpg b/submodules/AsyncDisplayKit/examples_extra/Shop/Screenshots/IMG_0008.jpg deleted file mode 100644 index 8e0862586d..0000000000 Binary files a/submodules/AsyncDisplayKit/examples_extra/Shop/Screenshots/IMG_0008.jpg and /dev/null differ diff --git a/submodules/AsyncDisplayKit/examples_extra/Shop/Screenshots/IMG_0009.jpg b/submodules/AsyncDisplayKit/examples_extra/Shop/Screenshots/IMG_0009.jpg deleted file mode 100644 index 9e7906cc60..0000000000 Binary files a/submodules/AsyncDisplayKit/examples_extra/Shop/Screenshots/IMG_0009.jpg and /dev/null differ diff --git a/submodules/AsyncDisplayKit/examples_extra/Shop/Screenshots/IMG_0010.jpg b/submodules/AsyncDisplayKit/examples_extra/Shop/Screenshots/IMG_0010.jpg deleted file mode 100644 index 3d1209299f..0000000000 Binary files a/submodules/AsyncDisplayKit/examples_extra/Shop/Screenshots/IMG_0010.jpg and /dev/null differ diff --git a/submodules/AsyncDisplayKit/examples_extra/Shop/Screenshots/IMG_0011.jpg b/submodules/AsyncDisplayKit/examples_extra/Shop/Screenshots/IMG_0011.jpg deleted file mode 100644 index 717deae6b2..0000000000 Binary files a/submodules/AsyncDisplayKit/examples_extra/Shop/Screenshots/IMG_0011.jpg and /dev/null differ diff --git a/submodules/AsyncDisplayKit/examples_extra/Shop/Shop.xcworkspace/contents.xcworkspacedata b/submodules/AsyncDisplayKit/examples_extra/Shop/Shop.xcworkspace/contents.xcworkspacedata deleted file mode 100644 index a8472b4e8a..0000000000 --- a/submodules/AsyncDisplayKit/examples_extra/Shop/Shop.xcworkspace/contents.xcworkspacedata +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - diff --git a/submodules/AsyncDisplayKit/examples_extra/Shop/Shop/AppDelegate.swift b/submodules/AsyncDisplayKit/examples_extra/Shop/Shop/AppDelegate.swift deleted file mode 100644 index ebae7efc3a..0000000000 --- a/submodules/AsyncDisplayKit/examples_extra/Shop/Shop/AppDelegate.swift +++ /dev/null @@ -1,55 +0,0 @@ -// -// AppDelegate.swift -// Texture -// -// Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -import UIKit - -@UIApplicationMain -class AppDelegate: UIResponder, UIApplicationDelegate { - - var window: UIWindow? - - func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool { - // Override point for customization after application launch. - - UINavigationBar.appearance().tintColor = UIColor.white - UINavigationBar.appearance().titleTextAttributes = [NSForegroundColorAttributeName : UIColor.white] - UINavigationBar.appearance().barTintColor = UIColor.primaryBarTintColor() - - self.window = UIWindow(frame: UIScreen.main.bounds) - self.window?.backgroundColor = UIColor.white - self.window?.rootViewController = UINavigationController(rootViewController: ShopViewController()) - self.window?.makeKeyAndVisible() - - return true - } - - func applicationWillResignActive(_ application: UIApplication) { - // 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 invalidate graphics rendering callbacks. Games should use this method to pause the game. - } - - func applicationDidEnterBackground(_ application: UIApplication) { - // 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. - } - - func applicationWillEnterForeground(_ application: UIApplication) { - // Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background. - } - - func applicationDidBecomeActive(_ application: UIApplication) { - // 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. - } - - func applicationWillTerminate(_ application: UIApplication) { - // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. - } - - -} - diff --git a/submodules/AsyncDisplayKit/examples_extra/Shop/Shop/Assets.xcassets/AppIcon.appiconset/Contents.json b/submodules/AsyncDisplayKit/examples_extra/Shop/Shop/Assets.xcassets/AppIcon.appiconset/Contents.json deleted file mode 100644 index b8236c6534..0000000000 --- a/submodules/AsyncDisplayKit/examples_extra/Shop/Shop/Assets.xcassets/AppIcon.appiconset/Contents.json +++ /dev/null @@ -1,48 +0,0 @@ -{ - "images" : [ - { - "idiom" : "iphone", - "size" : "20x20", - "scale" : "2x" - }, - { - "idiom" : "iphone", - "size" : "20x20", - "scale" : "3x" - }, - { - "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" - } -} \ No newline at end of file diff --git a/submodules/AsyncDisplayKit/examples_extra/Shop/Shop/Assets.xcassets/Contents.json b/submodules/AsyncDisplayKit/examples_extra/Shop/Shop/Assets.xcassets/Contents.json deleted file mode 100644 index da4a164c91..0000000000 --- a/submodules/AsyncDisplayKit/examples_extra/Shop/Shop/Assets.xcassets/Contents.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "info" : { - "version" : 1, - "author" : "xcode" - } -} \ No newline at end of file diff --git a/submodules/AsyncDisplayKit/examples_extra/Shop/Shop/Assets.xcassets/Shop/Contents.json b/submodules/AsyncDisplayKit/examples_extra/Shop/Shop/Assets.xcassets/Shop/Contents.json deleted file mode 100644 index da4a164c91..0000000000 --- a/submodules/AsyncDisplayKit/examples_extra/Shop/Shop/Assets.xcassets/Shop/Contents.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "info" : { - "version" : 1, - "author" : "xcode" - } -} \ No newline at end of file diff --git a/submodules/AsyncDisplayKit/examples_extra/Shop/Shop/Assets.xcassets/Shop/filled_star.imageset/Contents.json b/submodules/AsyncDisplayKit/examples_extra/Shop/Shop/Assets.xcassets/Shop/filled_star.imageset/Contents.json deleted file mode 100644 index bf7a318771..0000000000 --- a/submodules/AsyncDisplayKit/examples_extra/Shop/Shop/Assets.xcassets/Shop/filled_star.imageset/Contents.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "images" : [ - { - "idiom" : "universal", - "filename" : "filled_star.png", - "scale" : "1x" - }, - { - "idiom" : "universal", - "filename" : "filled_star-1.png", - "scale" : "2x" - }, - { - "idiom" : "universal", - "filename" : "filled_star-2.png", - "scale" : "3x" - } - ], - "info" : { - "version" : 1, - "author" : "xcode" - } -} \ No newline at end of file diff --git a/submodules/AsyncDisplayKit/examples_extra/Shop/Shop/Assets.xcassets/Shop/filled_star.imageset/filled_star-1.png b/submodules/AsyncDisplayKit/examples_extra/Shop/Shop/Assets.xcassets/Shop/filled_star.imageset/filled_star-1.png deleted file mode 100644 index 21884f8fe8..0000000000 Binary files a/submodules/AsyncDisplayKit/examples_extra/Shop/Shop/Assets.xcassets/Shop/filled_star.imageset/filled_star-1.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/examples_extra/Shop/Shop/Assets.xcassets/Shop/filled_star.imageset/filled_star-2.png b/submodules/AsyncDisplayKit/examples_extra/Shop/Shop/Assets.xcassets/Shop/filled_star.imageset/filled_star-2.png deleted file mode 100644 index 21884f8fe8..0000000000 Binary files a/submodules/AsyncDisplayKit/examples_extra/Shop/Shop/Assets.xcassets/Shop/filled_star.imageset/filled_star-2.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/examples_extra/Shop/Shop/Assets.xcassets/Shop/filled_star.imageset/filled_star.png b/submodules/AsyncDisplayKit/examples_extra/Shop/Shop/Assets.xcassets/Shop/filled_star.imageset/filled_star.png deleted file mode 100644 index 21884f8fe8..0000000000 Binary files a/submodules/AsyncDisplayKit/examples_extra/Shop/Shop/Assets.xcassets/Shop/filled_star.imageset/filled_star.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/examples_extra/Shop/Shop/Assets.xcassets/Shop/placeholder.imageset/Contents.json b/submodules/AsyncDisplayKit/examples_extra/Shop/Shop/Assets.xcassets/Shop/placeholder.imageset/Contents.json deleted file mode 100644 index 70a59709db..0000000000 --- a/submodules/AsyncDisplayKit/examples_extra/Shop/Shop/Assets.xcassets/Shop/placeholder.imageset/Contents.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "images" : [ - { - "idiom" : "universal", - "filename" : "category_placeholder-2.png", - "scale" : "1x" - }, - { - "idiom" : "universal", - "filename" : "category_placeholder-1.png", - "scale" : "2x" - }, - { - "idiom" : "universal", - "filename" : "category_placeholder.png", - "scale" : "3x" - } - ], - "info" : { - "version" : 1, - "author" : "xcode" - } -} \ No newline at end of file diff --git a/submodules/AsyncDisplayKit/examples_extra/Shop/Shop/Assets.xcassets/Shop/placeholder.imageset/category_placeholder-1.png b/submodules/AsyncDisplayKit/examples_extra/Shop/Shop/Assets.xcassets/Shop/placeholder.imageset/category_placeholder-1.png deleted file mode 100644 index 8dec56ca18..0000000000 Binary files a/submodules/AsyncDisplayKit/examples_extra/Shop/Shop/Assets.xcassets/Shop/placeholder.imageset/category_placeholder-1.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/examples_extra/Shop/Shop/Assets.xcassets/Shop/placeholder.imageset/category_placeholder-2.png b/submodules/AsyncDisplayKit/examples_extra/Shop/Shop/Assets.xcassets/Shop/placeholder.imageset/category_placeholder-2.png deleted file mode 100644 index 8dec56ca18..0000000000 Binary files a/submodules/AsyncDisplayKit/examples_extra/Shop/Shop/Assets.xcassets/Shop/placeholder.imageset/category_placeholder-2.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/examples_extra/Shop/Shop/Assets.xcassets/Shop/placeholder.imageset/category_placeholder.png b/submodules/AsyncDisplayKit/examples_extra/Shop/Shop/Assets.xcassets/Shop/placeholder.imageset/category_placeholder.png deleted file mode 100644 index 8dec56ca18..0000000000 Binary files a/submodules/AsyncDisplayKit/examples_extra/Shop/Shop/Assets.xcassets/Shop/placeholder.imageset/category_placeholder.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/examples_extra/Shop/Shop/Assets.xcassets/Shop/unfilled_star.imageset/Contents.json b/submodules/AsyncDisplayKit/examples_extra/Shop/Shop/Assets.xcassets/Shop/unfilled_star.imageset/Contents.json deleted file mode 100644 index 8a56ccde81..0000000000 --- a/submodules/AsyncDisplayKit/examples_extra/Shop/Shop/Assets.xcassets/Shop/unfilled_star.imageset/Contents.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "images" : [ - { - "idiom" : "universal", - "filename" : "unfilled_star.png", - "scale" : "1x" - }, - { - "idiom" : "universal", - "filename" : "unfilled_star-1.png", - "scale" : "2x" - }, - { - "idiom" : "universal", - "filename" : "unfilled_star-2.png", - "scale" : "3x" - } - ], - "info" : { - "version" : 1, - "author" : "xcode" - } -} \ No newline at end of file diff --git a/submodules/AsyncDisplayKit/examples_extra/Shop/Shop/Assets.xcassets/Shop/unfilled_star.imageset/unfilled_star-1.png b/submodules/AsyncDisplayKit/examples_extra/Shop/Shop/Assets.xcassets/Shop/unfilled_star.imageset/unfilled_star-1.png deleted file mode 100644 index a8c225bf04..0000000000 Binary files a/submodules/AsyncDisplayKit/examples_extra/Shop/Shop/Assets.xcassets/Shop/unfilled_star.imageset/unfilled_star-1.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/examples_extra/Shop/Shop/Assets.xcassets/Shop/unfilled_star.imageset/unfilled_star-2.png b/submodules/AsyncDisplayKit/examples_extra/Shop/Shop/Assets.xcassets/Shop/unfilled_star.imageset/unfilled_star-2.png deleted file mode 100644 index a8c225bf04..0000000000 Binary files a/submodules/AsyncDisplayKit/examples_extra/Shop/Shop/Assets.xcassets/Shop/unfilled_star.imageset/unfilled_star-2.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/examples_extra/Shop/Shop/Assets.xcassets/Shop/unfilled_star.imageset/unfilled_star.png b/submodules/AsyncDisplayKit/examples_extra/Shop/Shop/Assets.xcassets/Shop/unfilled_star.imageset/unfilled_star.png deleted file mode 100644 index a8c225bf04..0000000000 Binary files a/submodules/AsyncDisplayKit/examples_extra/Shop/Shop/Assets.xcassets/Shop/unfilled_star.imageset/unfilled_star.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/examples_extra/Shop/Shop/Base.lproj/LaunchScreen.storyboard b/submodules/AsyncDisplayKit/examples_extra/Shop/Shop/Base.lproj/LaunchScreen.storyboard deleted file mode 100644 index fdf3f97d1b..0000000000 --- a/submodules/AsyncDisplayKit/examples_extra/Shop/Shop/Base.lproj/LaunchScreen.storyboard +++ /dev/null @@ -1,27 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/submodules/AsyncDisplayKit/examples_extra/Shop/Shop/Extensions/UIColor.swift b/submodules/AsyncDisplayKit/examples_extra/Shop/Shop/Extensions/UIColor.swift deleted file mode 100644 index 4d6444f131..0000000000 --- a/submodules/AsyncDisplayKit/examples_extra/Shop/Shop/Extensions/UIColor.swift +++ /dev/null @@ -1,29 +0,0 @@ -// -// UIColor.swift -// Texture -// -// Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -import Foundation - -extension UIColor { - - class func primaryBackgroundColor() -> UIColor { - return UIColor.init(red: 237/255, green: 239/255, blue: 242/255, alpha: 1.0) - } - - class func primaryBarTintColor() -> UIColor { - return UIColor.init(red: 57/255, green: 59/255, blue: 63/255, alpha: 1.0) - } - - class func containerBackgroundColor() -> UIColor { - return UIColor.init(red: 255/255, green: 255/255, blue: 255/255, alpha: 1.0) - } - - class func containerBorderColor() -> UIColor { - return UIColor.init(red: 231/255, green: 232/255, blue: 235/255, alpha: 1.0) - } - -} diff --git a/submodules/AsyncDisplayKit/examples_extra/Shop/Shop/Info.plist b/submodules/AsyncDisplayKit/examples_extra/Shop/Shop/Info.plist deleted file mode 100644 index ce18bd2acf..0000000000 --- a/submodules/AsyncDisplayKit/examples_extra/Shop/Shop/Info.plist +++ /dev/null @@ -1,38 +0,0 @@ - - - - - CFBundleDevelopmentRegion - en - CFBundleExecutable - $(EXECUTABLE_NAME) - CFBundleIdentifier - $(PRODUCT_BUNDLE_IDENTIFIER) - CFBundleInfoDictionaryVersion - 6.0 - CFBundleName - $(PRODUCT_NAME) - CFBundlePackageType - APPL - CFBundleShortVersionString - 1.0 - CFBundleVersion - 1 - LSRequiresIPhoneOS - - UILaunchStoryboardName - LaunchScreen - UIRequiredDeviceCapabilities - - armv7 - - UIStatusBarStyle - UIStatusBarStyleLightContent - UISupportedInterfaceOrientations - - UIInterfaceOrientationPortrait - - UIViewControllerBasedStatusBarAppearance - - - diff --git a/submodules/AsyncDisplayKit/examples_extra/Shop/Shop/Models/Category.swift b/submodules/AsyncDisplayKit/examples_extra/Shop/Shop/Models/Category.swift deleted file mode 100644 index d5e4949230..0000000000 --- a/submodules/AsyncDisplayKit/examples_extra/Shop/Shop/Models/Category.swift +++ /dev/null @@ -1,26 +0,0 @@ -// -// Category.swift -// Texture -// -// Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -import Foundation - -struct Category { - - var id: String = UUID().uuidString - var imageURL: String - var numberOfProducts: Int = 0 - var title: String - var products: [Product] - - init(title: String, imageURL: String, products: [Product]) { - self.title = title - self.imageURL = imageURL - self.products = products - self.numberOfProducts = products.count - } - -} diff --git a/submodules/AsyncDisplayKit/examples_extra/Shop/Shop/Models/DummyGenerator.swift b/submodules/AsyncDisplayKit/examples_extra/Shop/Shop/Models/DummyGenerator.swift deleted file mode 100644 index d68e43751f..0000000000 --- a/submodules/AsyncDisplayKit/examples_extra/Shop/Shop/Models/DummyGenerator.swift +++ /dev/null @@ -1,160 +0,0 @@ -// -// DummyGenerator.swift -// Texture -// -// Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -import Foundation - -class DummyGenerator { - - static let sharedGenerator = DummyGenerator() - - // MARK: - Variables - - private let numberOfCategories = 15 - private let imageURLs = ["https://placebear.com/200/200", - "https://placebear.com/200/250", - "https://placebear.com/250/250", - "https://placebear.com/300/200", - "https://placebear.com/300/250", - "https://placebear.com/300/300", - "https://placebear.com/350/200", - "https://placebear.com/350/250", - "https://placebear.com/350/300"] - - // MARK: - Private initializer - - private init() { - - } - - // MARK: - Generate random categories - - func randomCategories() -> [Category] { - var categories: [Category] = [] - for _ in 0.. [Product] { - var products: [Product] = [] - for _ in 0.. String { - return compose(provider: { word }, count: count, middleSeparator: .Space) - } - - public static var sentence: String { - let numberOfWordsInSentence = Int.random(min: 8, max: 16) - let capitalizeFirstLetterDecorator: (String) -> String = { $0.stringWithCapitalizedFirstLetter } - return compose(provider: { word }, count: numberOfWordsInSentence, middleSeparator: .Space, endSeparator: .Dot, decorator: capitalizeFirstLetterDecorator) - } - - public static func sentences(count: Int) -> String { - return compose(provider: { sentence }, count: count, middleSeparator: .Space) - } - - public static var paragraph: String { - let numberOfSentencesInParagraph = Int.random(min: 4, max: 10) - return sentences(count: numberOfSentencesInParagraph) - } - - public static func paragraphs(count: Int) -> String { - return compose(provider: { paragraph }, count: count, middleSeparator: .NewLine) - } - - public static var title: String { - let numberOfWordsInTitle = Int.random(min: 1, max: 2) - let capitalizeStringDecorator: (String) -> String = { $0.capitalized } - return compose(provider: { word }, count: numberOfWordsInTitle, middleSeparator: .Space, decorator: capitalizeStringDecorator) - } - - private enum Separator: String { - case None = "" - case Space = " " - case Dot = "." - case NewLine = "\n" - } - - private static func compose(provider: () -> String, count: Int, middleSeparator: Separator, endSeparator: Separator = .None, decorator: ((String) -> String)? = nil) -> String { - var composedString = "" - - for index in 0.. Element { - let index = Int(arc4random_uniform(UInt32(self.count))) - return self[index] - } -} - -private extension Int { - static func random(min: Int = 0, max: Int) -> Int { - assert(min >= 0) - assert(min < max) - - return Int(arc4random_uniform(UInt32((max - min) + 1))) + min - } -} - -private extension Array { - var randomElement: Element { - return self[Int.random(max: count - 1)] - } -} - -private extension String { - var stringWithCapitalizedFirstLetter: String { - let firstLetterRange = startIndex.. ASLayoutSpec { - return ASInsetLayoutSpec(insets: UIEdgeInsets.zero, child: self.productNode) - } - -} diff --git a/submodules/AsyncDisplayKit/examples_extra/Shop/Shop/Scenes/Product/ProductNode.swift b/submodules/AsyncDisplayKit/examples_extra/Shop/Shop/Scenes/Product/ProductNode.swift deleted file mode 100644 index 8dda39d137..0000000000 --- a/submodules/AsyncDisplayKit/examples_extra/Shop/Shop/Scenes/Product/ProductNode.swift +++ /dev/null @@ -1,118 +0,0 @@ -// -// ProductNode.swift -// Texture -// -// Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -import UIKit - -class ProductNode: ASDisplayNode { - - // MARK: - Variables - - private let imageNode: ASNetworkImageNode - private let titleNode: ASTextNode - private let priceNode: ASTextNode - private let starRatingNode: StarRatingNode - private let reviewsNode: ASTextNode - private let descriptionNode: ASTextNode - - private let product: Product - - // MARK: - Object life cycle - - init(product: Product) { - self.product = product - - imageNode = ASNetworkImageNode() - titleNode = ASTextNode() - starRatingNode = StarRatingNode(rating: product.starRating) - priceNode = ASTextNode() - reviewsNode = ASTextNode() - descriptionNode = ASTextNode() - - super.init() - self.setupNodes() - self.buildNodeHierarchy() - } - - // MARK: - Setup nodes - - private func setupNodes() { - self.setupImageNode() - self.setupTitleNode() - self.setupDescriptionNode() - self.setupPriceNode() - self.setupReviewsNode() - } - - private func setupImageNode() { - self.imageNode.url = URL(string: self.product.imageURL) - self.imageNode.style.preferredSize = CGSize(width: UIScreen.main.bounds.width, height: 300) - } - - private func setupTitleNode() { - self.titleNode.attributedText = NSAttributedString(string: self.product.title, attributes: self.titleTextAttributes()) - self.titleNode.maximumNumberOfLines = 1 - self.titleNode.truncationMode = .byTruncatingTail - } - - private var titleTextAttributes = { - return [NSForegroundColorAttributeName: UIColor.black, NSFontAttributeName: UIFont.boldSystemFont(ofSize: 16)] - } - - private func setupDescriptionNode() { - self.descriptionNode.attributedText = NSAttributedString(string: self.product.descriptionText, attributes: self.descriptionTextAttributes()) - self.descriptionNode.maximumNumberOfLines = 0 - } - - private var descriptionTextAttributes = { - return [NSForegroundColorAttributeName: UIColor.darkGray, NSFontAttributeName: UIFont.systemFont(ofSize: 14)] - } - - private func setupPriceNode() { - self.priceNode.attributedText = NSAttributedString(string: self.product.currency + " \(self.product.price)", attributes: self.priceTextAttributes()) - } - - private var priceTextAttributes = { - return [NSForegroundColorAttributeName: UIColor.red, NSFontAttributeName: UIFont.boldSystemFont(ofSize: 15)] - } - - private func setupReviewsNode() { - self.reviewsNode.attributedText = NSAttributedString(string: "\(self.product.numberOfReviews) reviews", attributes: self.reviewsTextAttributes()) - } - - private var reviewsTextAttributes = { - return [NSForegroundColorAttributeName: UIColor.lightGray, NSFontAttributeName: UIFont.systemFont(ofSize: 14)] - } - - // MARK: - Build node hierarchy - - private func buildNodeHierarchy() { - self.addSubnode(imageNode) - self.addSubnode(titleNode) - self.addSubnode(descriptionNode) - self.addSubnode(starRatingNode) - self.addSubnode(priceNode) - self.addSubnode(reviewsNode) - } - - // MARK: - Layout - - override func layoutSpecThatFits(_ constrainedSize: ASSizeRange) -> ASLayoutSpec { - let spacer = ASLayoutSpec() - spacer.style.flexGrow = 1 - self.titleNode.style.flexShrink = 1 - let titlePriceSpec = ASStackLayoutSpec(direction: .horizontal, spacing: 2.0, justifyContent: .start, alignItems: .center, children: [self.titleNode, spacer, self.priceNode]) - titlePriceSpec.style.alignSelf = .stretch - let starRatingReviewsSpec = ASStackLayoutSpec(direction: .horizontal, spacing: 25.0, justifyContent: .start, alignItems: .center, children: [self.starRatingNode, self.reviewsNode]) - let contentSpec = ASStackLayoutSpec(direction: .vertical, spacing: 8.0, justifyContent: .start, alignItems: .stretch, children: [titlePriceSpec, starRatingReviewsSpec, self.descriptionNode]) - contentSpec.style.flexShrink = 1 - let insetSpec = ASInsetLayoutSpec(insets: UIEdgeInsetsMake(12.0, 12.0, 12.0, 12.0), child: contentSpec) - let finalSpec = ASStackLayoutSpec(direction: .vertical, spacing: 5.0, justifyContent: .start, alignItems: .center, children: [self.imageNode, insetSpec]) - return finalSpec - } - -} diff --git a/submodules/AsyncDisplayKit/examples_extra/Shop/Shop/Scenes/Product/ProductViewController.swift b/submodules/AsyncDisplayKit/examples_extra/Shop/Shop/Scenes/Product/ProductViewController.swift deleted file mode 100644 index 9d36298e1d..0000000000 --- a/submodules/AsyncDisplayKit/examples_extra/Shop/Shop/Scenes/Product/ProductViewController.swift +++ /dev/null @@ -1,62 +0,0 @@ -// -// ProductViewController.swift -// Texture -// -// Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -import UIKit - -class ProductViewController: ASViewController { - - // MARK: - Variables - - let product: Product - - private var tableNode: ASTableNode { - return node - } - - // MARK: - Object life cycle - - init(product: Product) { - self.product = product - super.init(node: ASTableNode()) - tableNode.delegate = self - tableNode.dataSource = self - tableNode.backgroundColor = UIColor.primaryBackgroundColor() - tableNode.view.separatorStyle = .none - } - - required init?(coder aDecoder: NSCoder) { - fatalError("init(coder:) has not been implemented") - } - - // MARK: - View life cycle - - override func viewDidLoad() { - super.viewDidLoad() - self.setupTitle() - } - -} - -extension ProductViewController: ASTableDataSource, ASTableDelegate { - - func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { - return 1 - } - - func tableView(_ tableView: ASTableView, nodeForRowAt indexPath: IndexPath) -> ASCellNode { - let node = ProductCellNode(product: self.product) - return node - } - -} - -extension ProductViewController { - func setupTitle() { - self.title = self.product.title - } -} diff --git a/submodules/AsyncDisplayKit/examples_extra/Shop/Shop/Scenes/Product/StarRatingNode.swift b/submodules/AsyncDisplayKit/examples_extra/Shop/Shop/Scenes/Product/StarRatingNode.swift deleted file mode 100644 index 21c373c858..0000000000 --- a/submodules/AsyncDisplayKit/examples_extra/Shop/Shop/Scenes/Product/StarRatingNode.swift +++ /dev/null @@ -1,59 +0,0 @@ -// -// StarRatingNode.swift -// Texture -// -// Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -import UIKit - -class StarRatingNode: ASDisplayNode { - - // MARK: - Variable - - private lazy var starSize: CGSize = { - return CGSize(width: 15, height: 15) - }() - - private let rating: Int - - private var starImageNodes: [ASDisplayNode] = [] - - // MARK: - Object life cycle - - init(rating: Int) { - self.rating = rating - super.init() - - self.setupStarNodes() - self.buildNodeHierarchy() - } - - // MARK: - Star nodes setup - - private func setupStarNodes() { - for i in 0..<5 { - let imageNode = ASImageNode() - imageNode.image = i <= self.rating ? UIImage(named: "filled_star") : UIImage(named: "unfilled_star") - imageNode.style.preferredSize = self.starSize - self.starImageNodes.append(imageNode) - } - } - - // MARK: - Build node hierarchy - - private func buildNodeHierarchy() { - for node in self.starImageNodes { - self.addSubnode(node) - } - } - - // MARK: - Layout - - override func layoutSpecThatFits(_ constrainedSize: ASSizeRange) -> ASLayoutSpec { - let layoutSpec = ASStackLayoutSpec(direction: .horizontal, spacing: 5, justifyContent: .start, alignItems: .stretch, children: self.starImageNodes) - return layoutSpec - } - -} diff --git a/submodules/AsyncDisplayKit/examples_extra/Shop/Shop/Scenes/Products/ProductCollectionNode.swift b/submodules/AsyncDisplayKit/examples_extra/Shop/Shop/Scenes/Products/ProductCollectionNode.swift deleted file mode 100644 index 5c95586fed..0000000000 --- a/submodules/AsyncDisplayKit/examples_extra/Shop/Shop/Scenes/Products/ProductCollectionNode.swift +++ /dev/null @@ -1,72 +0,0 @@ -// -// ProductCollectionNode.swift -// Texture -// -// Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -import UIKit - -class ProductCollectionNode: ASCellNode { - - // MARK: - Variables - - private let containerNode: ContainerNode - - // MARK: - Object life cycle - - init(product: Product) { - self.containerNode = ContainerNode(node: ProductContentNode(product: product)) - super.init() - self.selectionStyle = .none - self.addSubnode(self.containerNode) - } - - // MARK: - Layout - - override func layoutSpecThatFits(_ constrainedSize: ASSizeRange) -> ASLayoutSpec { - let insets = UIEdgeInsetsMake(2, 2, 2, 2) - return ASInsetLayoutSpec(insets: insets, child: self.containerNode) - } - -} - -class ProductContentNode: ASDisplayNode { - - // MARK: - Variables - - private let imageNode: ASNetworkImageNode - private let titleNode: ASTextNode - private let subtitleNode: ASTextNode - - // MARK: - Object life cycle - - init(product: Product) { - imageNode = ASNetworkImageNode() - imageNode.url = URL(string: product.imageURL) - - titleNode = ASTextNode() - let title = NSAttributedString(string: product.title, attributes: [NSForegroundColorAttributeName: UIColor.white, NSFontAttributeName: UIFont.boldSystemFont(ofSize: 17)]) - titleNode.attributedText = title - - subtitleNode = ASTextNode() - let subtitle = NSAttributedString(string: product.currency + " \(product.price)", attributes: [NSForegroundColorAttributeName: UIColor.white, NSFontAttributeName: UIFont.boldSystemFont(ofSize: 15)]) - subtitleNode.attributedText = subtitle - - super.init() - - self.imageNode.addSubnode(self.titleNode) - self.imageNode.addSubnode(self.subtitleNode) - self.addSubnode(self.imageNode) - } - - // MARK: - Layout - - override func layoutSpecThatFits(_ constrainedSize: ASSizeRange) -> ASLayoutSpec { - let textNodesStack = ASStackLayoutSpec(direction: .vertical, spacing: 5, justifyContent: .end, alignItems: .stretch, children: [self.titleNode, self.subtitleNode]) - let insetStack = ASInsetLayoutSpec(insets: UIEdgeInsetsMake(CGFloat.infinity, 10, 10, 10), child: textNodesStack) - return ASOverlayLayoutSpec(child: self.imageNode, overlay: insetStack) - } - -} diff --git a/submodules/AsyncDisplayKit/examples_extra/Shop/Shop/Scenes/Products/ProductTableNode.swift b/submodules/AsyncDisplayKit/examples_extra/Shop/Shop/Scenes/Products/ProductTableNode.swift deleted file mode 100644 index 816d405dcf..0000000000 --- a/submodules/AsyncDisplayKit/examples_extra/Shop/Shop/Scenes/Products/ProductTableNode.swift +++ /dev/null @@ -1,123 +0,0 @@ -// -// ProductTableNode.swift -// Texture -// -// Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -import UIKit - -class ProductTableNode: ASCellNode { - - // MARK: - Variables - - private lazy var imageSize: CGSize = { - return CGSize(width: 80, height: 80) - }() - - private let product: Product - - private let imageNode: ASNetworkImageNode - private let titleNode: ASTextNode - private let subtitleNode: ASTextNode - private let starRatingNode: StarRatingNode - private let priceNode: ASTextNode - private let separatorNode: ASDisplayNode - - // MARK: - Object life cycle - - init(product: Product) { - self.product = product - - imageNode = ASNetworkImageNode() - titleNode = ASTextNode() - subtitleNode = ASTextNode() - starRatingNode = StarRatingNode(rating: product.starRating) - priceNode = ASTextNode() - separatorNode = ASDisplayNode() - - super.init() - self.setupNodes() - self.buildNodeHierarchy() - } - - // MARK: - Setup nodes - - private func setupNodes() { - self.setupImageNode() - self.setupTitleNode() - self.setupSubtitleNode() - self.setupPriceNode() - self.setupSeparatorNode() - } - - private func setupImageNode() { - self.imageNode.url = URL(string: self.product.imageURL) - self.imageNode.style.preferredSize = self.imageSize - } - - private func setupTitleNode() { - self.titleNode.attributedText = NSAttributedString(string: self.product.title, attributes: self.titleTextAttributes()) - self.titleNode.maximumNumberOfLines = 1 - self.titleNode.truncationMode = .byTruncatingTail - } - - private var titleTextAttributes = { - return [NSForegroundColorAttributeName: UIColor.black, NSFontAttributeName: UIFont.boldSystemFont(ofSize: 16)] - } - - private func setupSubtitleNode() { - self.subtitleNode.attributedText = NSAttributedString(string: self.product.descriptionText, attributes: self.subtitleTextAttributes()) - self.subtitleNode.maximumNumberOfLines = 2 - self.subtitleNode.truncationMode = .byTruncatingTail - } - - private var subtitleTextAttributes = { - return [NSForegroundColorAttributeName: UIColor.darkGray, NSFontAttributeName: UIFont.systemFont(ofSize: 14)] - } - - private func setupPriceNode() { - self.priceNode.attributedText = NSAttributedString(string: self.product.currency + " \(self.product.price)", attributes: self.priceTextAttributes()) - } - - private var priceTextAttributes = { - return [NSForegroundColorAttributeName: UIColor.red, NSFontAttributeName: UIFont.boldSystemFont(ofSize: 15)] - } - - private func setupSeparatorNode() { - self.separatorNode.backgroundColor = UIColor.lightGray - } - - // MARK: - Build node hierarchy - - private func buildNodeHierarchy() { - self.addSubnode(imageNode) - self.addSubnode(titleNode) - self.addSubnode(subtitleNode) - self.addSubnode(starRatingNode) - self.addSubnode(priceNode) - self.addSubnode(separatorNode) - } - - // MARK: - Layout - - override func layout() { - super.layout() - let separatorHeight = 1 / UIScreen.main.scale - self.separatorNode.frame = CGRect(x: 0.0, y: 0.0, width: self.calculatedSize.width, height: separatorHeight) - } - - override func layoutSpecThatFits(_ constrainedSize: ASSizeRange) -> ASLayoutSpec { - let spacer = ASLayoutSpec() - spacer.style.flexGrow = 1 - self.titleNode.style.flexShrink = 1 - let titlePriceSpec = ASStackLayoutSpec(direction: .horizontal, spacing: 2.0, justifyContent: .start, alignItems: .center, children: [self.titleNode, spacer, self.priceNode]) - titlePriceSpec.style.alignSelf = .stretch - let contentSpec = ASStackLayoutSpec(direction: .vertical, spacing: 4.0, justifyContent: .start, alignItems: .stretch, children: [titlePriceSpec, self.subtitleNode, self.starRatingNode]) - contentSpec.style.flexShrink = 1 - let finalSpec = ASStackLayoutSpec(direction: .horizontal, spacing: 10.0, justifyContent: .start, alignItems: .start, children: [self.imageNode, contentSpec]) - return ASInsetLayoutSpec(insets: UIEdgeInsetsMake(10.0, 10.0, 10.0, 10.0), child: finalSpec) - } - -} diff --git a/submodules/AsyncDisplayKit/examples_extra/Shop/Shop/Scenes/Products/ProductsCollectionViewController.swift b/submodules/AsyncDisplayKit/examples_extra/Shop/Shop/Scenes/Products/ProductsCollectionViewController.swift deleted file mode 100644 index caa5278f07..0000000000 --- a/submodules/AsyncDisplayKit/examples_extra/Shop/Shop/Scenes/Products/ProductsCollectionViewController.swift +++ /dev/null @@ -1,69 +0,0 @@ -// -// ProductsCollectionViewController.swift -// Texture -// -// Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -import UIKit - -class ProductsCollectionViewController: ASViewController { - - // MARK: - Variables - - var products: [Product] - - private var collectionNode: ASCollectionNode { - return node - } - - // MARK: - Object life cycle - - init(products: [Product]) { - self.products = products - super.init(node: ASCollectionNode(collectionViewLayout: ProductsLayout())) - collectionNode.delegate = self - collectionNode.dataSource = self - collectionNode.backgroundColor = UIColor.primaryBackgroundColor() - } - - required init?(coder aDecoder: NSCoder) { - fatalError("init(coder:) has not been implemented") - } - - // MARK: - View life cycle - - override func viewDidLoad() { - super.viewDidLoad() - self.setupTitle() - } - -} - -extension ProductsCollectionViewController: ASCollectionDataSource, ASCollectionDelegate { - - func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int { - return self.products.count - } - - func collectionView(_ collectionView: ASCollectionView, nodeForItemAt indexPath: IndexPath) -> ASCellNode { - let product = self.products[indexPath.row] - return ProductCollectionNode(product: product) - } - - func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) { - let product = self.products[indexPath.row] - let viewController = ProductViewController(product: product) - self.navigationController?.pushViewController(viewController, animated: true) - } - -} - -extension ProductsCollectionViewController { - - func setupTitle() { - self.title = "Bears" - } - -} diff --git a/submodules/AsyncDisplayKit/examples_extra/Shop/Shop/Scenes/Products/ProductsLayout.swift b/submodules/AsyncDisplayKit/examples_extra/Shop/Shop/Scenes/Products/ProductsLayout.swift deleted file mode 100644 index 67f4a77837..0000000000 --- a/submodules/AsyncDisplayKit/examples_extra/Shop/Shop/Scenes/Products/ProductsLayout.swift +++ /dev/null @@ -1,55 +0,0 @@ -// -// ProductsLayout.swift -// Texture -// -// Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -import UIKit - -class ProductsLayout: UICollectionViewFlowLayout { - - // MARK: - Variables - - let itemHeight: CGFloat = 220 - let numberOfColumns: CGFloat = 2 - - // MARK: - Object life cycle - - override init() { - super.init() - self.setupLayout() - } - - required init?(coder aDecoder: NSCoder) { - super.init(coder: aDecoder) - self.setupLayout() - } - - // MARK: - Layout - - private func setupLayout() { - self.minimumInteritemSpacing = 0 - self.minimumLineSpacing = 0 - self.scrollDirection = .vertical - } - - func itemWidth() -> CGFloat { - return (collectionView!.frame.width / numberOfColumns) - } - - override var itemSize: CGSize { - set { - self.itemSize = CGSize(width: itemWidth(), height: itemHeight) - } - get { - return CGSize(width: itemWidth(), height: itemHeight) - } - } - - override func targetContentOffset(forProposedContentOffset proposedContentOffset: CGPoint) -> CGPoint { - return self.collectionView!.contentOffset - } - -} diff --git a/submodules/AsyncDisplayKit/examples_extra/Shop/Shop/Scenes/Products/ProductsTableViewController.swift b/submodules/AsyncDisplayKit/examples_extra/Shop/Shop/Scenes/Products/ProductsTableViewController.swift deleted file mode 100644 index bfb851a3f6..0000000000 --- a/submodules/AsyncDisplayKit/examples_extra/Shop/Shop/Scenes/Products/ProductsTableViewController.swift +++ /dev/null @@ -1,78 +0,0 @@ -// -// ProductsTableViewController.swift -// Texture -// -// Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -import UIKit - -class ProductsTableViewController: ASViewController { - - // MARK: - Variables - - var products: [Product] - - private var tableNode: ASTableNode { - return node - } - - // MARK: - Object life cycle - - init(products: [Product]) { - self.products = products - super.init(node: ASTableNode()) - tableNode.delegate = self - tableNode.dataSource = self - tableNode.backgroundColor = UIColor.white - tableNode.view.separatorStyle = .none - } - - required init?(coder aDecoder: NSCoder) { - fatalError("init(coder:) has not been implemented") - } - - // MARK: - View life cycle - - override func viewDidLoad() { - super.viewDidLoad() - self.setupTitle() - } - - override func viewWillAppear(_ animated: Bool) { - super.viewWillAppear(animated) - if let indexPath = self.tableNode.indexPathForSelectedRow { - self.tableNode.view.deselectRow(at: indexPath, animated: true) - } - } - -} - -extension ProductsTableViewController: ASTableDataSource, ASTableDelegate { - - func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { - return self.products.count - } - - func tableView(_ tableView: ASTableView, nodeForRowAt indexPath: IndexPath) -> ASCellNode { - let product = self.products[indexPath.row] - let node = ProductTableNode(product: product) - return node - } - - func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { - let product = self.products[indexPath.row] - let viewController = ProductViewController(product: product) - self.navigationController?.pushViewController(viewController, animated: true) - } - -} - -extension ProductsTableViewController { - - func setupTitle() { - self.title = "Bears" - } - -} diff --git a/submodules/AsyncDisplayKit/examples_extra/Shop/Shop/Scenes/Shop/ShopCellNode.swift b/submodules/AsyncDisplayKit/examples_extra/Shop/Shop/Scenes/Shop/ShopCellNode.swift deleted file mode 100644 index 5e71328296..0000000000 --- a/submodules/AsyncDisplayKit/examples_extra/Shop/Shop/Scenes/Shop/ShopCellNode.swift +++ /dev/null @@ -1,105 +0,0 @@ -// -// ShopCellNode.swift -// Texture -// -// Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -import UIKit - -class ShopCellNode: ASCellNode { - - // MARK: - Variables - - private let containerNode: ContainerNode - private let categoryNode: CategoryNode - - // MARK: - Object life cycle - - init(category: Category) { - categoryNode = CategoryNode(category: category) - containerNode = ContainerNode(node: categoryNode) - super.init() - self.selectionStyle = .none - self.addSubnode(self.containerNode) - } - - // MARK: - Layout - - override func layoutSpecThatFits(_ constrainedSize: ASSizeRange) -> ASLayoutSpec { - return ASInsetLayoutSpec(insets: UIEdgeInsetsMake(5, 10, 5, 10), child: self.containerNode) - } - -} - -class ContainerNode: ASDisplayNode { - - // MARK: - Variables - - private let contentNode: ASDisplayNode - - // MARK: - Object life cycle - - init(node: ASDisplayNode) { - contentNode = node - super.init() - self.backgroundColor = UIColor.containerBackgroundColor() - self.addSubnode(self.contentNode) - } - - // MARK: - Node life cycle - - override func didLoad() { - super.didLoad() - self.layer.cornerRadius = 5.0 - self.layer.borderColor = UIColor.containerBorderColor().cgColor - self.layer.borderWidth = 1.0 - } - - // MARK: - Layout - - override func layoutSpecThatFits(_ constrainedSize: ASSizeRange) -> ASLayoutSpec { - return ASInsetLayoutSpec(insets: UIEdgeInsetsMake(8, 8, 8, 8), child: self.contentNode) - } - -} - -class CategoryNode: ASDisplayNode { - - // MARK: - Variables - - private let imageNode: ASNetworkImageNode - private let titleNode: ASTextNode - private let subtitleNode: ASTextNode - - // MARK: - Object life cycle - - init(category: Category) { - imageNode = ASNetworkImageNode() - imageNode.url = URL(string: category.imageURL) - - titleNode = ASTextNode() - let title = NSAttributedString(string: category.title, attributes: [NSForegroundColorAttributeName: UIColor.white, NSFontAttributeName: UIFont.boldSystemFont(ofSize: 17)]) - titleNode.attributedText = title - - subtitleNode = ASTextNode() - let subtitle = NSAttributedString(string: "\(category.numberOfProducts) products", attributes: [NSForegroundColorAttributeName: UIColor.white, NSFontAttributeName: UIFont.boldSystemFont(ofSize: 15)]) - subtitleNode.attributedText = subtitle - - super.init() - - self.imageNode.addSubnode(self.titleNode) - self.imageNode.addSubnode(self.subtitleNode) - self.addSubnode(self.imageNode) - } - - // MARK: - Layout - - override func layoutSpecThatFits(_ constrainedSize: ASSizeRange) -> ASLayoutSpec { - let textNodesStack = ASStackLayoutSpec(direction: .vertical, spacing: 5, justifyContent: .end, alignItems: .stretch, children: [self.titleNode, self.subtitleNode]) - let insetStack = ASInsetLayoutSpec(insets: UIEdgeInsetsMake(CGFloat.infinity, 10, 10, 10), child: textNodesStack) - return ASOverlayLayoutSpec(child: self.imageNode, overlay: insetStack) - } - -} diff --git a/submodules/AsyncDisplayKit/examples_extra/Shop/Shop/Scenes/Shop/ShopViewController.swift b/submodules/AsyncDisplayKit/examples_extra/Shop/Shop/Scenes/Shop/ShopViewController.swift deleted file mode 100644 index 8feefa3f25..0000000000 --- a/submodules/AsyncDisplayKit/examples_extra/Shop/Shop/Scenes/Shop/ShopViewController.swift +++ /dev/null @@ -1,91 +0,0 @@ -// -// ShopViewController.swift -// Texture -// -// Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -import UIKit - -class ShopViewController: ASViewController { - - // MARK: - Variables - - lazy var categories: [Category] = { - return DummyGenerator.sharedGenerator.randomCategories() - }() - - private var tableNode: ASTableNode { - return node - } - - // MARK: - Object life cycle - - init() { - super.init(node: ASTableNode()) - tableNode.delegate = self - tableNode.dataSource = self - tableNode.backgroundColor = UIColor.primaryBackgroundColor() - tableNode.view.separatorStyle = .none - } - - required init?(coder aDecoder: NSCoder) { - fatalError("init(coder:) has not been implemented") - } - - // MARK: - View life cycle - - override func viewDidLoad() { - super.viewDidLoad() - self.setupTitle() - } - -} - -extension ShopViewController: ASTableDataSource, ASTableDelegate { - - func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { - return self.categories.count - } - - func tableView(_ tableView: ASTableView, nodeForRowAt indexPath: IndexPath) -> ASCellNode { - let category = self.categories[indexPath.row] - let node = ShopCellNode(category: category) - return node - } - - func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { - let products = self.categories[indexPath.row].products - let alertController = UIAlertController(title: nil, message: nil, preferredStyle: .actionSheet) - let tableViewAction = UIAlertAction(title: "ASTableNode", style: .default, handler: { (action) in - let viewController = ProductsTableViewController(products: products) - self.navigationController?.pushViewController(viewController, animated: true) - }) - let collectionViewAction = UIAlertAction(title: "ASCollectionNode", style: .default, handler: { (action) in - let viewController = ProductsCollectionViewController(products: products) - self.navigationController?.pushViewController(viewController, animated: true) - }) - let cancelAction = UIAlertAction(title: "Cancel", style: .cancel, handler: nil) - alertController.addAction(tableViewAction) - alertController.addAction(collectionViewAction) - alertController.addAction(cancelAction) - DispatchQueue.main.async { - self.present(alertController, animated: true, completion: nil) - } - } - - func tableView(_ tableView: ASTableView, constrainedSizeForRowAt indexPath: IndexPath) -> ASSizeRange { - let width = UIScreen.main.bounds.width - return ASSizeRangeMake(CGSize(width: width, height: 175)) - } - -} - -extension ShopViewController { - - func setupTitle() { - self.title = "Bear Shop" - } - -} diff --git a/submodules/AsyncDisplayKit/examples_extra/Shop/Shop/Shop-Bridging-Header.h b/submodules/AsyncDisplayKit/examples_extra/Shop/Shop/Shop-Bridging-Header.h deleted file mode 100644 index 943168eead..0000000000 --- a/submodules/AsyncDisplayKit/examples_extra/Shop/Shop/Shop-Bridging-Header.h +++ /dev/null @@ -1,9 +0,0 @@ -// -// Shop-Bridging-Header.h -// Texture -// -// Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import diff --git a/submodules/AsyncDisplayKit/examples_extra/Shop/ShopTests/Info.plist b/submodules/AsyncDisplayKit/examples_extra/Shop/ShopTests/Info.plist deleted file mode 100644 index 6c6c23c43a..0000000000 --- a/submodules/AsyncDisplayKit/examples_extra/Shop/ShopTests/Info.plist +++ /dev/null @@ -1,22 +0,0 @@ - - - - - CFBundleDevelopmentRegion - en - CFBundleExecutable - $(EXECUTABLE_NAME) - CFBundleIdentifier - $(PRODUCT_BUNDLE_IDENTIFIER) - CFBundleInfoDictionaryVersion - 6.0 - CFBundleName - $(PRODUCT_NAME) - CFBundlePackageType - BNDL - CFBundleShortVersionString - 1.0 - CFBundleVersion - 1 - - diff --git a/submodules/AsyncDisplayKit/examples_extra/Shop/ShopTests/ShopTests.swift b/submodules/AsyncDisplayKit/examples_extra/Shop/ShopTests/ShopTests.swift deleted file mode 100644 index b42098bc4c..0000000000 --- a/submodules/AsyncDisplayKit/examples_extra/Shop/ShopTests/ShopTests.swift +++ /dev/null @@ -1,36 +0,0 @@ -// -// ShopTests.swift -// Texture -// -// Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -import XCTest -@testable import Shop - -class ShopTests: XCTestCase { - - override func setUp() { - super.setUp() - // Put setup code here. This method is called before the invocation of each test method in the class. - } - - override func tearDown() { - // Put teardown code here. This method is called after the invocation of each test method in the class. - super.tearDown() - } - - func testExample() { - // This is an example of a functional test case. - // Use XCTAssert and related functions to verify your tests produce the correct results. - } - - func testPerformanceExample() { - // This is an example of a performance test case. - self.measure { - // Put the code you want to measure the time of here. - } - } - -} diff --git a/submodules/AsyncDisplayKit/examples_extra/SynchronousConcurrency/Default-568h@2x.png b/submodules/AsyncDisplayKit/examples_extra/SynchronousConcurrency/Default-568h@2x.png deleted file mode 100644 index 6ee80b9393..0000000000 Binary files a/submodules/AsyncDisplayKit/examples_extra/SynchronousConcurrency/Default-568h@2x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/examples_extra/SynchronousConcurrency/Default-667h@2x.png b/submodules/AsyncDisplayKit/examples_extra/SynchronousConcurrency/Default-667h@2x.png deleted file mode 100644 index e7b975e21b..0000000000 Binary files a/submodules/AsyncDisplayKit/examples_extra/SynchronousConcurrency/Default-667h@2x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/examples_extra/SynchronousConcurrency/Default-736h@3x.png b/submodules/AsyncDisplayKit/examples_extra/SynchronousConcurrency/Default-736h@3x.png deleted file mode 100644 index c8949cae16..0000000000 Binary files a/submodules/AsyncDisplayKit/examples_extra/SynchronousConcurrency/Default-736h@3x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/examples_extra/SynchronousConcurrency/Podfile b/submodules/AsyncDisplayKit/examples_extra/SynchronousConcurrency/Podfile deleted file mode 100644 index 71a7f2c4b2..0000000000 --- a/submodules/AsyncDisplayKit/examples_extra/SynchronousConcurrency/Podfile +++ /dev/null @@ -1,5 +0,0 @@ -source 'https://github.com/CocoaPods/Specs.git' -platform :ios, '9.0' -target 'Sample' do - pod 'Texture', :path => '../..' -end diff --git a/submodules/AsyncDisplayKit/examples_extra/SynchronousConcurrency/Sample.xcworkspace/contents.xcworkspacedata b/submodules/AsyncDisplayKit/examples_extra/SynchronousConcurrency/Sample.xcworkspace/contents.xcworkspacedata deleted file mode 100644 index 7b5a2f3050..0000000000 --- a/submodules/AsyncDisplayKit/examples_extra/SynchronousConcurrency/Sample.xcworkspace/contents.xcworkspacedata +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - diff --git a/submodules/AsyncDisplayKit/examples_extra/SynchronousConcurrency/Sample/AppDelegate.h b/submodules/AsyncDisplayKit/examples_extra/SynchronousConcurrency/Sample/AppDelegate.h deleted file mode 100644 index c30a27f4dc..0000000000 --- a/submodules/AsyncDisplayKit/examples_extra/SynchronousConcurrency/Sample/AppDelegate.h +++ /dev/null @@ -1,18 +0,0 @@ -// -// AppDelegate.h -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -#define UseAutomaticLayout 1 - -@interface AppDelegate : UIResponder - -@property (strong, nonatomic) UIWindow *window; - -@end diff --git a/submodules/AsyncDisplayKit/examples_extra/SynchronousConcurrency/Sample/AppDelegate.m b/submodules/AsyncDisplayKit/examples_extra/SynchronousConcurrency/Sample/AppDelegate.m deleted file mode 100644 index 662357cb71..0000000000 --- a/submodules/AsyncDisplayKit/examples_extra/SynchronousConcurrency/Sample/AppDelegate.m +++ /dev/null @@ -1,31 +0,0 @@ -// -// AppDelegate.m -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import "AppDelegate.h" - -#import "AsyncTableViewController.h" -#import "AsyncViewController.h" - -@implementation AppDelegate - -- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions -{ - self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; - self.window.backgroundColor = [UIColor whiteColor]; - - UITabBarController *tabBarController = [[UITabBarController alloc] initWithNibName:nil bundle:nil]; - self.window.rootViewController = tabBarController; - - [tabBarController setViewControllers:@[[[AsyncTableViewController alloc] init], [[AsyncViewController alloc] init]]]; - - [self.window makeKeyAndVisible]; - return YES; -} - -@end diff --git a/submodules/AsyncDisplayKit/examples_extra/SynchronousConcurrency/Sample/AsyncTableViewController.h b/submodules/AsyncDisplayKit/examples_extra/SynchronousConcurrency/Sample/AsyncTableViewController.h deleted file mode 100644 index 2b8fe4ed9f..0000000000 --- a/submodules/AsyncDisplayKit/examples_extra/SynchronousConcurrency/Sample/AsyncTableViewController.h +++ /dev/null @@ -1,14 +0,0 @@ -// -// AsyncTableViewController.h -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -@interface AsyncTableViewController : UIViewController - -@end diff --git a/submodules/AsyncDisplayKit/examples_extra/SynchronousConcurrency/Sample/AsyncTableViewController.m b/submodules/AsyncDisplayKit/examples_extra/SynchronousConcurrency/Sample/AsyncTableViewController.m deleted file mode 100644 index 2cacef05ea..0000000000 --- a/submodules/AsyncDisplayKit/examples_extra/SynchronousConcurrency/Sample/AsyncTableViewController.m +++ /dev/null @@ -1,80 +0,0 @@ -// -// AsyncTableViewController.m -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import -#import - -#import "AsyncTableViewController.h" -#import "RandomCoreGraphicsNode.h" - -@interface AsyncTableViewController () -{ - ASTableView *_tableView; -} - -@end - -@implementation AsyncTableViewController - -#pragma mark - UIViewController. - -- (instancetype)init -{ - if (!(self = [super init])) - return nil; - - self.tabBarItem = [[UITabBarItem alloc] initWithTabBarSystemItem:UITabBarSystemItemFeatured tag:0]; - self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemRedo - target:self - action:@selector(reloadEverything)]; - - return self; -} - -- (void)reloadEverything -{ - [_tableView reloadData]; -} - -- (void)viewDidLoad -{ - [super viewDidLoad]; - - _tableView = [[ASTableView alloc] initWithFrame:self.view.bounds style:UITableViewStylePlain]; - _tableView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight; - _tableView.separatorStyle = UITableViewCellSeparatorStyleNone; - _tableView.asyncDataSource = self; - _tableView.asyncDelegate = self; - - ASRangeTuningParameters tuningParameters; - tuningParameters.leadingBufferScreenfuls = 0.5; - tuningParameters.trailingBufferScreenfuls = 1.0; - [_tableView setTuningParameters:tuningParameters forRangeType:ASLayoutRangeTypePreload]; - [_tableView setTuningParameters:tuningParameters forRangeType:ASLayoutRangeTypeDisplay]; - - [self.view addSubview:_tableView]; -} - -#pragma mark - ASTableView. - -- (ASCellNodeBlock)tableView:(ASTableView *)tableView nodeBlockForRowAtIndexPath:(NSIndexPath *)indexPath -{ - return ^{ - RandomCoreGraphicsNode *elementNode = [[RandomCoreGraphicsNode alloc] init]; - elementNode.style.preferredSize = CGSizeMake(320, 100); - return elementNode; - }; -} - -- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section -{ - return 100; -} - -@end diff --git a/submodules/AsyncDisplayKit/examples_extra/SynchronousConcurrency/Sample/AsyncViewController.h b/submodules/AsyncDisplayKit/examples_extra/SynchronousConcurrency/Sample/AsyncViewController.h deleted file mode 100644 index 2c20ade6e9..0000000000 --- a/submodules/AsyncDisplayKit/examples_extra/SynchronousConcurrency/Sample/AsyncViewController.h +++ /dev/null @@ -1,14 +0,0 @@ -// -// AsyncViewController.h -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -@interface AsyncViewController : ASViewController - -@end diff --git a/submodules/AsyncDisplayKit/examples_extra/SynchronousConcurrency/Sample/AsyncViewController.m b/submodules/AsyncDisplayKit/examples_extra/SynchronousConcurrency/Sample/AsyncViewController.m deleted file mode 100644 index de9b71cc89..0000000000 --- a/submodules/AsyncDisplayKit/examples_extra/SynchronousConcurrency/Sample/AsyncViewController.m +++ /dev/null @@ -1,38 +0,0 @@ -// -// AsyncViewController.m -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import "AsyncViewController.h" -#import "RandomCoreGraphicsNode.h" - -@implementation AsyncViewController - -- (instancetype)init -{ - if (!(self = [super initWithNode:[[RandomCoreGraphicsNode alloc] init]])) { - return nil; - } - - self.neverShowPlaceholders = YES; - self.tabBarItem = [[UITabBarItem alloc] initWithTabBarSystemItem:UITabBarSystemItemFavorites tag:0]; - return self; -} - -- (void)viewWillAppear:(BOOL)animated -{ - // FIXME: This is only being called on the first time the UITabBarController shows us. - [super viewWillAppear:animated]; -} - -- (void)viewDidDisappear:(BOOL)animated -{ - [self.node recursivelyClearContents]; - [super viewDidDisappear:animated]; -} - -@end diff --git a/submodules/AsyncDisplayKit/examples_extra/SynchronousConcurrency/Sample/Info.plist b/submodules/AsyncDisplayKit/examples_extra/SynchronousConcurrency/Sample/Info.plist deleted file mode 100644 index 35d842827b..0000000000 --- a/submodules/AsyncDisplayKit/examples_extra/SynchronousConcurrency/Sample/Info.plist +++ /dev/null @@ -1,36 +0,0 @@ - - - - - CFBundleDevelopmentRegion - en - CFBundleExecutable - $(EXECUTABLE_NAME) - CFBundleIdentifier - com.facebook.AsyncDisplayKit.$(PRODUCT_NAME:rfc1034identifier) - CFBundleInfoDictionaryVersion - 6.0 - CFBundleName - $(PRODUCT_NAME) - CFBundlePackageType - APPL - CFBundleShortVersionString - 1.0 - CFBundleSignature - ???? - CFBundleVersion - 1 - LSRequiresIPhoneOS - - UIRequiredDeviceCapabilities - - armv7 - - UISupportedInterfaceOrientations - - UIInterfaceOrientationPortrait - UIInterfaceOrientationLandscapeLeft - UIInterfaceOrientationLandscapeRight - - - diff --git a/submodules/AsyncDisplayKit/examples_extra/SynchronousConcurrency/Sample/RandomCoreGraphicsNode.h b/submodules/AsyncDisplayKit/examples_extra/SynchronousConcurrency/Sample/RandomCoreGraphicsNode.h deleted file mode 100644 index cdd60a3465..0000000000 --- a/submodules/AsyncDisplayKit/examples_extra/SynchronousConcurrency/Sample/RandomCoreGraphicsNode.h +++ /dev/null @@ -1,17 +0,0 @@ -// -// RandomCoreGraphicsNode.h -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -@interface RandomCoreGraphicsNode : ASCellNode -{ - ASTextNode *_textNode; -} - -@end diff --git a/submodules/AsyncDisplayKit/examples_extra/SynchronousConcurrency/Sample/RandomCoreGraphicsNode.m b/submodules/AsyncDisplayKit/examples_extra/SynchronousConcurrency/Sample/RandomCoreGraphicsNode.m deleted file mode 100644 index d80c51caf2..0000000000 --- a/submodules/AsyncDisplayKit/examples_extra/SynchronousConcurrency/Sample/RandomCoreGraphicsNode.m +++ /dev/null @@ -1,96 +0,0 @@ -// -// RandomCoreGraphicsNode.m -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import "RandomCoreGraphicsNode.h" -#import - -@implementation RandomCoreGraphicsNode - -+ (UIColor *)randomColor -{ - 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]; -} - -+ (void)drawRect:(CGRect)bounds withParameters:(id)parameters isCancelled:(asdisplaynode_iscancelled_block_t)isCancelledBlock isRasterizing:(BOOL)isRasterizing -{ - CGFloat locations[3]; - NSMutableArray *colors = [NSMutableArray arrayWithCapacity:3]; - [colors addObject:(id)[[RandomCoreGraphicsNode randomColor] CGColor]]; - locations[0] = 0.0; - [colors addObject:(id)[[RandomCoreGraphicsNode randomColor] CGColor]]; - locations[1] = 1.0; - [colors addObject:(id)[[RandomCoreGraphicsNode randomColor] CGColor]]; - locations[2] = ( arc4random() % 256 / 256.0 ); - - - CGContextRef ctx = UIGraphicsGetCurrentContext(); - CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB(); - CGGradientRef gradient = CGGradientCreateWithColors(colorSpace, (CFArrayRef)colors, locations); - - CGGradientDrawingOptions drawingOptions; - CGContextDrawLinearGradient(ctx, gradient, CGPointZero, CGPointMake(bounds.size.width, bounds.size.height), drawingOptions); - - CGColorSpaceRelease(colorSpace); -} - -- (NSObject *)drawParametersForAsyncLayer:(_ASDisplayLayer *)layer -{ - return [self description]; -} - -- (NSDictionary *)textStyle -{ - UIFont *font = [UIFont fontWithName:@"HelveticaNeue" size:36.0f]; - - NSMutableParagraphStyle *style = [[NSParagraphStyle defaultParagraphStyle] mutableCopy]; - style.paragraphSpacing = 0.5 * font.lineHeight; - style.hyphenationFactor = 1.0; - - return @{ NSFontAttributeName: font, - NSParagraphStyleAttributeName: style }; -} - -- (instancetype)init -{ - if (!(self = [super init])) { - return nil; - } - - _textNode = [[ASTextNode alloc] init]; - _textNode.placeholderEnabled = NO; - _textNode.attributedText = [[NSAttributedString alloc] initWithString:@"Hello, ASDK!" - attributes:[self textStyle]]; - [self addSubnode:_textNode]; - - return self; -} - -- (CGSize)calculateSizeThatFits:(CGSize)constrainedSize -{ - [_textNode layoutThatFits:ASSizeRangeMake(CGSizeZero, constrainedSize)]; - return CGSizeMake(constrainedSize.width, 100); -} - -- (void)layout -{ - [super layout]; - - CGSize boundsSize = self.bounds.size; - CGSize textSize = _textNode.calculatedSize; - CGRect textRect = CGRectMake(roundf((boundsSize.width - textSize.width) / 2.0), - roundf((boundsSize.height - textSize.height) / 2.0), - textSize.width, - textSize.height); - _textNode.frame = textRect; -} - -@end diff --git a/submodules/AsyncDisplayKit/examples_extra/SynchronousConcurrency/Sample/main.m b/submodules/AsyncDisplayKit/examples_extra/SynchronousConcurrency/Sample/main.m deleted file mode 100644 index 511cd1a7ac..0000000000 --- a/submodules/AsyncDisplayKit/examples_extra/SynchronousConcurrency/Sample/main.m +++ /dev/null @@ -1,18 +0,0 @@ -// -// main.m -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -#import "AppDelegate.h" - -int main(int argc, char * argv[]) { - @autoreleasepool { - return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); - } -} diff --git a/submodules/AsyncDisplayKit/examples_extra/SynchronousKittens/Default-568h@2x.png b/submodules/AsyncDisplayKit/examples_extra/SynchronousKittens/Default-568h@2x.png deleted file mode 100644 index 6ee80b9393..0000000000 Binary files a/submodules/AsyncDisplayKit/examples_extra/SynchronousKittens/Default-568h@2x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/examples_extra/SynchronousKittens/Default-667h@2x.png b/submodules/AsyncDisplayKit/examples_extra/SynchronousKittens/Default-667h@2x.png deleted file mode 100644 index e7b975e21b..0000000000 Binary files a/submodules/AsyncDisplayKit/examples_extra/SynchronousKittens/Default-667h@2x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/examples_extra/SynchronousKittens/Default-736h@3x.png b/submodules/AsyncDisplayKit/examples_extra/SynchronousKittens/Default-736h@3x.png deleted file mode 100644 index c8949cae16..0000000000 Binary files a/submodules/AsyncDisplayKit/examples_extra/SynchronousKittens/Default-736h@3x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/examples_extra/SynchronousKittens/Podfile b/submodules/AsyncDisplayKit/examples_extra/SynchronousKittens/Podfile deleted file mode 100644 index 71a7f2c4b2..0000000000 --- a/submodules/AsyncDisplayKit/examples_extra/SynchronousKittens/Podfile +++ /dev/null @@ -1,5 +0,0 @@ -source 'https://github.com/CocoaPods/Specs.git' -platform :ios, '9.0' -target 'Sample' do - pod 'Texture', :path => '../..' -end diff --git a/submodules/AsyncDisplayKit/examples_extra/SynchronousKittens/Sample.xcworkspace/contents.xcworkspacedata b/submodules/AsyncDisplayKit/examples_extra/SynchronousKittens/Sample.xcworkspace/contents.xcworkspacedata deleted file mode 100644 index 7b5a2f3050..0000000000 --- a/submodules/AsyncDisplayKit/examples_extra/SynchronousKittens/Sample.xcworkspace/contents.xcworkspacedata +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - diff --git a/submodules/AsyncDisplayKit/examples_extra/SynchronousKittens/Sample/AppDelegate.h b/submodules/AsyncDisplayKit/examples_extra/SynchronousKittens/Sample/AppDelegate.h deleted file mode 100644 index c30a27f4dc..0000000000 --- a/submodules/AsyncDisplayKit/examples_extra/SynchronousKittens/Sample/AppDelegate.h +++ /dev/null @@ -1,18 +0,0 @@ -// -// AppDelegate.h -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -#define UseAutomaticLayout 1 - -@interface AppDelegate : UIResponder - -@property (strong, nonatomic) UIWindow *window; - -@end diff --git a/submodules/AsyncDisplayKit/examples_extra/SynchronousKittens/Sample/AppDelegate.m b/submodules/AsyncDisplayKit/examples_extra/SynchronousKittens/Sample/AppDelegate.m deleted file mode 100644 index f8437855b0..0000000000 --- a/submodules/AsyncDisplayKit/examples_extra/SynchronousKittens/Sample/AppDelegate.m +++ /dev/null @@ -1,25 +0,0 @@ -// -// AppDelegate.m -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import "AppDelegate.h" - -#import "ViewController.h" - -@implementation AppDelegate - -- (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 diff --git a/submodules/AsyncDisplayKit/examples_extra/SynchronousKittens/Sample/BlurbNode.h b/submodules/AsyncDisplayKit/examples_extra/SynchronousKittens/Sample/BlurbNode.h deleted file mode 100644 index 5451fb39f0..0000000000 --- a/submodules/AsyncDisplayKit/examples_extra/SynchronousKittens/Sample/BlurbNode.h +++ /dev/null @@ -1,17 +0,0 @@ -// -// BlurbNode.h -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -/** - * Simple node that displays a placekitten.com attribution. - */ -@interface BlurbNode : ASCellNode - -@end diff --git a/submodules/AsyncDisplayKit/examples_extra/SynchronousKittens/Sample/BlurbNode.m b/submodules/AsyncDisplayKit/examples_extra/SynchronousKittens/Sample/BlurbNode.m deleted file mode 100644 index 6014711d33..0000000000 --- a/submodules/AsyncDisplayKit/examples_extra/SynchronousKittens/Sample/BlurbNode.m +++ /dev/null @@ -1,120 +0,0 @@ -// -// BlurbNode.m -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import "BlurbNode.h" -#import "AppDelegate.h" - -#import -#import - -#import -#import - -static CGFloat kTextPadding = 10.0f; -static NSString *kLinkAttributeName = @"PlaceKittenNodeLinkAttributeName"; - -@interface BlurbNode () -{ - ASTextNode *_textNode; -} - -@end - - -@implementation BlurbNode - -#pragma mark - -#pragma mark ASCellNode. - -- (instancetype)init -{ - if (!(self = [super init])) - return nil; - - // create a text node - _textNode = [[ASTextNode alloc] init]; - - // configure the node to support tappable links - _textNode.delegate = self; - _textNode.userInteractionEnabled = YES; - _textNode.linkAttributeNames = @[ kLinkAttributeName ]; - - // generate an attributed string using the custom link attribute specified above - NSString *blurb = @"kittens courtesy placekitten.com \U0001F638"; - NSMutableAttributedString *string = [[NSMutableAttributedString alloc] initWithString:blurb]; - [string addAttribute:NSFontAttributeName value:[UIFont fontWithName:@"HelveticaNeue-Light" size:16.0f] range:NSMakeRange(0, blurb.length)]; - [string addAttributes:@{ - kLinkAttributeName: [NSURL URLWithString:@"http://placekitten.com/"], - NSForegroundColorAttributeName: [UIColor grayColor], - NSUnderlineStyleAttributeName: @(NSUnderlineStyleSingle | NSUnderlinePatternDot), - } - range:[blurb rangeOfString:@"placekitten.com"]]; - _textNode.attributedText = string; - - // add it as a subnode, and we're done - [self addSubnode:_textNode]; - - return self; -} - -- (void)didLoad -{ - // enable highlighting now that self.layer has loaded -- see ASHighlightOverlayLayer.h - self.layer.as_allowsHighlightDrawing = YES; - - [super didLoad]; -} - -#if UseAutomaticLayout -- (ASLayoutSpec *)layoutSpecThatFits:(ASSizeRange)constrainedSize -{ - ASCenterLayoutSpec *centerSpec = [[ASCenterLayoutSpec alloc] init]; - centerSpec.centeringOptions = ASCenterLayoutSpecCenteringX; - centerSpec.sizingOptions = ASCenterLayoutSpecSizingOptionMinimumY; - centerSpec.child = _textNode; - - UIEdgeInsets padding =UIEdgeInsetsMake(kTextPadding, kTextPadding, kTextPadding, kTextPadding); - return [ASInsetLayoutSpec insetLayoutSpecWithInsets:padding child:centerSpec]; -} -#else -- (CGSize)calculateSizeThatFits:(CGSize)constrainedSize -{ - // called on a background thread. custom nodes must call -measure: on their subnodes in -calculateSizeThatFits: - CGSize measuredSize = [_textNode measure:CGSizeMake(constrainedSize.width - 2 * kTextPadding, - constrainedSize.height - 2 * kTextPadding)]; - return CGSizeMake(constrainedSize.width, measuredSize.height + 2 * kTextPadding); -} - -- (void)layout -{ - // called on the main thread. we'll use the stashed size from above, instead of blocking on text sizing - CGSize textNodeSize = _textNode.calculatedSize; - _textNode.frame = CGRectMake(roundf((self.calculatedSize.width - textNodeSize.width) / 2.0f), - kTextPadding, - textNodeSize.width, - textNodeSize.height); -} -#endif - -#pragma mark - -#pragma mark ASTextNodeDelegate methods. - -- (BOOL)textNode:(ASTextNode *)richTextNode shouldHighlightLinkAttribute:(NSString *)attribute value:(id)value atPoint:(CGPoint)point -{ - // opt into link highlighting -- tap and hold the link to try it! must enable highlighting on a layer, see -didLoad - return YES; -} - -- (void)textNode:(ASTextNode *)richTextNode tappedLinkAttribute:(NSString *)attribute value:(NSURL *)URL atPoint:(CGPoint)point textRange:(NSRange)textRange -{ - // the node tapped a link, open it - [[UIApplication sharedApplication] openURL:URL]; -} - -@end diff --git a/submodules/AsyncDisplayKit/examples_extra/SynchronousKittens/Sample/Info.plist b/submodules/AsyncDisplayKit/examples_extra/SynchronousKittens/Sample/Info.plist deleted file mode 100644 index 35d842827b..0000000000 --- a/submodules/AsyncDisplayKit/examples_extra/SynchronousKittens/Sample/Info.plist +++ /dev/null @@ -1,36 +0,0 @@ - - - - - CFBundleDevelopmentRegion - en - CFBundleExecutable - $(EXECUTABLE_NAME) - CFBundleIdentifier - com.facebook.AsyncDisplayKit.$(PRODUCT_NAME:rfc1034identifier) - CFBundleInfoDictionaryVersion - 6.0 - CFBundleName - $(PRODUCT_NAME) - CFBundlePackageType - APPL - CFBundleShortVersionString - 1.0 - CFBundleSignature - ???? - CFBundleVersion - 1 - LSRequiresIPhoneOS - - UIRequiredDeviceCapabilities - - armv7 - - UISupportedInterfaceOrientations - - UIInterfaceOrientationPortrait - UIInterfaceOrientationLandscapeLeft - UIInterfaceOrientationLandscapeRight - - - diff --git a/submodules/AsyncDisplayKit/examples_extra/SynchronousKittens/Sample/KittenNode.h b/submodules/AsyncDisplayKit/examples_extra/SynchronousKittens/Sample/KittenNode.h deleted file mode 100644 index 5b0b04203e..0000000000 --- a/submodules/AsyncDisplayKit/examples_extra/SynchronousKittens/Sample/KittenNode.h +++ /dev/null @@ -1,22 +0,0 @@ -// -// KittenNode.h -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -/** - * Social media-style node that displays a kitten picture and a random length - * of lorem ipsum text. Uses a placekitten.com kitten of the specified size. - */ -@interface KittenNode : ASCellNode - -- (instancetype)initWithKittenOfSize:(CGSize)size; - -- (void)toggleImageEnlargement; - -@end diff --git a/submodules/AsyncDisplayKit/examples_extra/SynchronousKittens/Sample/KittenNode.mm b/submodules/AsyncDisplayKit/examples_extra/SynchronousKittens/Sample/KittenNode.mm deleted file mode 100644 index 5fcebf393e..0000000000 --- a/submodules/AsyncDisplayKit/examples_extra/SynchronousKittens/Sample/KittenNode.mm +++ /dev/null @@ -1,197 +0,0 @@ -// -// KittenNode.mm -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import "KittenNode.h" -#import "AppDelegate.h" - -#import - -#import -#import - -static const CGFloat kImageSize = 80.0f; -static const CGFloat kOuterPadding = 16.0f; -static const CGFloat kInnerPadding = 10.0f; - - -@interface KittenNode () -{ - CGSize _kittenSize; - - ASNetworkImageNode *_imageNode; - ASTextNode *_textNode; - ASDisplayNode *_divider; - BOOL _isImageEnlarged; - BOOL _swappedTextAndImage; -} - -@end - - -@implementation KittenNode - -// lorem ipsum text courtesy https://kittyipsum.com/ <3 -+ (NSArray *)placeholders -{ - static NSArray *placeholders = nil; - - static dispatch_once_t once; - dispatch_once(&once, ^{ - placeholders = @[ - @"Kitty ipsum dolor sit amet, purr sleep on your face lay down in your way biting, sniff tincidunt a etiam fluffy fur judging you stuck in a tree kittens.", - @"Lick tincidunt a biting eat the grass, egestas enim ut lick leap puking climb the curtains lick.", - @"Lick quis nunc toss the mousie vel, tortor pellentesque sunbathe orci turpis non tail flick suscipit sleep in the sink.", - @"Orci turpis litter box et stuck in a tree, egestas ac tempus et aliquam elit.", - @"Hairball iaculis dolor dolor neque, nibh adipiscing vehicula egestas dolor aliquam.", - @"Sunbathe fluffy fur tortor faucibus pharetra jump, enim jump on the table I don't like that food catnip toss the mousie scratched.", - @"Quis nunc nam sleep in the sink quis nunc purr faucibus, chase the red dot consectetur bat sagittis.", - @"Lick tail flick jump on the table stretching purr amet, rhoncus scratched jump on the table run.", - @"Suspendisse aliquam vulputate feed me sleep on your keyboard, rip the couch faucibus sleep on your keyboard tristique give me fish dolor.", - @"Rip the couch hiss attack your ankles biting pellentesque puking, enim suspendisse enim mauris a.", - @"Sollicitudin iaculis vestibulum toss the mousie biting attack your ankles, puking nunc jump adipiscing in viverra.", - @"Nam zzz amet neque, bat tincidunt a iaculis sniff hiss bibendum leap nibh.", - @"Chase the red dot enim puking chuf, tristique et egestas sniff sollicitudin pharetra enim ut mauris a.", - @"Sagittis scratched et lick, hairball leap attack adipiscing catnip tail flick iaculis lick.", - @"Neque neque sleep in the sink neque sleep on your face, climb the curtains chuf tail flick sniff tortor non.", - @"Ac etiam kittens claw toss the mousie jump, pellentesque rhoncus litter box give me fish adipiscing mauris a.", - @"Pharetra egestas sunbathe faucibus ac fluffy fur, hiss feed me give me fish accumsan.", - @"Tortor leap tristique accumsan rutrum sleep in the sink, amet sollicitudin adipiscing dolor chase the red dot.", - @"Knock over the lamp pharetra vehicula sleep on your face rhoncus, jump elit cras nec quis quis nunc nam.", - @"Sollicitudin feed me et ac in viverra catnip, nunc eat I don't like that food iaculis give me fish.", - ]; - }); - - return placeholders; -} - -- (instancetype)initWithKittenOfSize:(CGSize)size -{ - if (!(self = [super init])) - return nil; - - _kittenSize = size; - - // kitten image, with a solid background colour serving as placeholder - _imageNode = [[ASNetworkImageNode alloc] init]; - _imageNode.backgroundColor = ASDisplayNodeDefaultPlaceholderColor(); - _imageNode.URL = [NSURL URLWithString:[NSString stringWithFormat:@"https://placekitten.com/%zd/%zd", - (NSInteger)roundl(_kittenSize.width), - (NSInteger)roundl(_kittenSize.height)]]; -// _imageNode.contentMode = UIViewContentModeCenter; - [_imageNode addTarget:self action:@selector(toggleNodesSwap) forControlEvents:ASControlNodeEventTouchUpInside]; - [self addSubnode:_imageNode]; - - // lorem ipsum text, plus some nice styling - _textNode = [[ASTextNode alloc] init]; - _textNode.attributedText = [[NSAttributedString alloc] initWithString:[self kittyIpsum] - attributes:[self textStyle]]; - [self addSubnode:_textNode]; - - // hairline cell separator - _divider = [[ASDisplayNode alloc] init]; - _divider.backgroundColor = [UIColor lightGrayColor]; - [self addSubnode:_divider]; - - return self; -} - -- (NSString *)kittyIpsum -{ - NSArray *placeholders = [KittenNode placeholders]; - u_int32_t ipsumCount = (u_int32_t)[placeholders count]; - u_int32_t location = arc4random_uniform(ipsumCount); - u_int32_t length = arc4random_uniform(ipsumCount - location); - - NSMutableString *string = [placeholders[location] mutableCopy]; - for (u_int32_t i = location + 1; i < location + length; i++) { - [string appendString:(i % 2 == 0) ? @"\n" : @" "]; - [string appendString:placeholders[i]]; - } - - return string; -} - -- (NSDictionary *)textStyle -{ - UIFont *font = [UIFont fontWithName:@"HelveticaNeue" size:12.0f]; - - NSMutableParagraphStyle *style = [[NSParagraphStyle defaultParagraphStyle] mutableCopy]; - style.paragraphSpacing = 0.5 * font.lineHeight; - style.hyphenationFactor = 1.0; - - return @{ NSFontAttributeName: font, - NSParagraphStyleAttributeName: style }; -} - -#if UseAutomaticLayout -- (ASLayoutSpec *)layoutSpecThatFits:(ASSizeRange)constrainedSize -{ - CGSize imageSize = _isImageEnlarged ? CGSizeMake(2.0 * kImageSize, 2.0 * kImageSize) - : CGSizeMake(kImageSize, kImageSize); - _imageNode.size = ASRelativeSizeRangeMakeWithExactCGSize(imageSize); - _textNode.flexShrink = 1.0; - - ASStackLayoutSpec *stackSpec = [[ASStackLayoutSpec alloc] init]; - stackSpec.direction = ASStackLayoutDirectionHorizontal; - stackSpec.spacing = kInnerPadding; - [stackSpec setChildren:!_swappedTextAndImage ? @[_imageNode, _textNode] : @[_textNode, _imageNode]]; - - ASInsetLayoutSpec *insetSpec = [[ASInsetLayoutSpec alloc] init]; - insetSpec.insets = UIEdgeInsetsMake(kOuterPadding, kOuterPadding, kOuterPadding, kOuterPadding); - insetSpec.child = stackSpec; - - return insetSpec; -} - -// With box model, you don't need to override this method, unless you want to add custom logic. -- (void)layout -{ - [super layout]; - - // Manually layout the divider. - CGFloat pixelHeight = 1.0f / [[UIScreen mainScreen] scale]; - _divider.frame = CGRectMake(0.0f, 0.0f, self.calculatedSize.width, pixelHeight); -} -#else -- (CGSize)calculateSizeThatFits:(CGSize)constrainedSize -{ - CGSize imageSize = CGSizeMake(kImageSize, kImageSize); - CGSize textSize = [_textNode measure:CGSizeMake(constrainedSize.width - kImageSize - 2 * kOuterPadding - kInnerPadding, - constrainedSize.height)]; - - // ensure there's room for the text - CGFloat requiredHeight = MAX(textSize.height, imageSize.height); - return CGSizeMake(constrainedSize.width, requiredHeight + 2 * kOuterPadding); -} - -- (void)layout -{ - CGFloat pixelHeight = 1.0f / [[UIScreen mainScreen] scale]; - _divider.frame = CGRectMake(0.0f, 0.0f, self.calculatedSize.width, pixelHeight); - - _imageNode.frame = CGRectMake(kOuterPadding, kOuterPadding, kImageSize, kImageSize); - - CGSize textSize = _textNode.calculatedSize; - _textNode.frame = CGRectMake(kOuterPadding + kImageSize + kInnerPadding, kOuterPadding, textSize.width, textSize.height); -} -#endif - -- (void)toggleImageEnlargement -{ - _isImageEnlarged = !_isImageEnlarged; - [self setNeedsLayout]; -} - -- (void)toggleNodesSwap -{ - _swappedTextAndImage = !_swappedTextAndImage; - [self setNeedsLayout]; -} - -@end diff --git a/submodules/AsyncDisplayKit/examples_extra/SynchronousKittens/Sample/ViewController.h b/submodules/AsyncDisplayKit/examples_extra/SynchronousKittens/Sample/ViewController.h deleted file mode 100644 index c8a0626291..0000000000 --- a/submodules/AsyncDisplayKit/examples_extra/SynchronousKittens/Sample/ViewController.h +++ /dev/null @@ -1,14 +0,0 @@ -// -// ViewController.h -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -@interface ViewController : UIViewController - -@end diff --git a/submodules/AsyncDisplayKit/examples_extra/SynchronousKittens/Sample/ViewController.m b/submodules/AsyncDisplayKit/examples_extra/SynchronousKittens/Sample/ViewController.m deleted file mode 100644 index 1757807a1d..0000000000 --- a/submodules/AsyncDisplayKit/examples_extra/SynchronousKittens/Sample/ViewController.m +++ /dev/null @@ -1,209 +0,0 @@ -// -// ViewController.m -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import "ViewController.h" - -#import -#import - -#import "BlurbNode.h" -#import "KittenNode.h" - - -static const NSInteger kLitterSize = 20; // intial number of kitten cells in ASTableView -static const NSInteger kLitterBatchSize = 10; // number of kitten cells to add to ASTableView -static const NSInteger kMaxLitterSize = 100; // max number of kitten cells allowed in ASTableView - -@interface ViewController () -{ - ASTableView *_tableView; - - // array of boxed CGSizes corresponding to placekitten.com kittens - NSMutableArray *_kittenDataSource; - - BOOL _dataSourceLocked; - NSIndexPath *_blurbNodeIndexPath; -} - -@property (nonatomic, strong) NSMutableArray *kittenDataSource; -@property (atomic, assign) BOOL dataSourceLocked; - -@end - - -@implementation ViewController - -#pragma mark - -#pragma mark UIViewController. - -- (instancetype)init -{ - if (!(self = [super init])) - return nil; - - _tableView = [[ASTableView alloc] initWithFrame:CGRectZero style:UITableViewStylePlain]; - _tableView.separatorStyle = UITableViewCellSeparatorStyleNone; // KittenNode has its own separator - _tableView.asyncDataSource = self; - _tableView.asyncDelegate = self; - - // populate our "data source" with some random kittens - _kittenDataSource = [self createLitterWithSize:kLitterSize]; - - _blurbNodeIndexPath = [NSIndexPath indexPathForItem:0 inSection:0]; - - self.title = @"Kittens"; - self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemEdit - target:self - action:@selector(toggleEditingMode)]; - - return self; -} - -- (NSMutableArray *)createLitterWithSize:(NSInteger)litterSize -{ - NSMutableArray *kittens = [NSMutableArray arrayWithCapacity:litterSize]; - for (NSInteger i = 0; i < litterSize; i++) { - - // placekitten.com will return the same kitten picture if the same pixel height & width are requested, - // so generate kittens with different width & height values. - u_int32_t deltaX = arc4random_uniform(10) - 5; - u_int32_t deltaY = arc4random_uniform(10) - 5; - CGSize size = CGSizeMake(350 + 2 * deltaX, 350 + 4 * deltaY); - - [kittens addObject:[NSValue valueWithCGSize:size]]; - } - return kittens; -} - -- (void)setKittenDataSource:(NSMutableArray *)kittenDataSource { - ASDisplayNodeAssert(!self.dataSourceLocked, @"Could not update data source when it is locked !"); - - _kittenDataSource = kittenDataSource; -} - -- (void)viewDidLoad -{ - [super viewDidLoad]; - - [self.view addSubview:_tableView]; - - [_tableView reloadDataImmediately]; -} - -- (void)viewWillLayoutSubviews -{ - _tableView.frame = self.view.bounds; -} - -- (void)toggleEditingMode -{ - [_tableView setEditing:!_tableView.editing animated:YES]; -} - - -#pragma mark - -#pragma mark ASTableView. - -- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath -{ - [_tableView deselectRowAtIndexPath:indexPath animated:YES]; - [_tableView beginUpdates]; - // Assume only kitten nodes are selectable (see -tableView:shouldHighlightRowAtIndexPath:). - KittenNode *node = (KittenNode *)[_tableView nodeForRowAtIndexPath:indexPath]; - [node toggleImageEnlargement]; - [_tableView endUpdates]; -} - -- (ASCellNode *)tableView:(ASTableView *)tableView nodeForRowAtIndexPath:(NSIndexPath *)indexPath -{ - // special-case the first row - if ([_blurbNodeIndexPath compare:indexPath] == NSOrderedSame) { - BlurbNode *node = [[BlurbNode alloc] init]; - return node; - } - - NSValue *size = _kittenDataSource[indexPath.row - 1]; - KittenNode *node = [[KittenNode alloc] initWithKittenOfSize:size.CGSizeValue]; - return node; -} - -- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section -{ - // blurb node + kLitterSize kitties - return 1 + _kittenDataSource.count; -} - -- (BOOL)tableView:(UITableView *)tableView shouldHighlightRowAtIndexPath:(NSIndexPath *)indexPath -{ - // Enable selection for kitten nodes - return [_blurbNodeIndexPath compare:indexPath] != NSOrderedSame; -} - -- (void)tableViewLockDataSource:(ASTableView *)tableView -{ - self.dataSourceLocked = YES; -} - -- (void)tableViewUnlockDataSource:(ASTableView *)tableView -{ - self.dataSourceLocked = NO; -} - -- (BOOL)shouldBatchFetchForTableView:(UITableView *)tableView -{ - return _kittenDataSource.count < kMaxLitterSize; -} - -- (void)tableView:(UITableView *)tableView willBeginBatchFetchWithContext:(ASBatchContext *)context -{ - NSLog(@"adding kitties"); - - dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{ - sleep(1); - dispatch_async(dispatch_get_main_queue(), ^{ - - // populate a new array of random-sized kittens - NSArray *moarKittens = [self createLitterWithSize:kLitterBatchSize]; - - NSMutableArray *indexPaths = [[NSMutableArray alloc] init]; - - // find number of kittens in the data source and create their indexPaths - NSInteger existingRows = _kittenDataSource.count + 1; - - for (NSInteger i = 0; i < moarKittens.count; i++) { - [indexPaths addObject:[NSIndexPath indexPathForRow:existingRows + i inSection:0]]; - } - - // add new kittens to the data source & notify table of new indexpaths - [_kittenDataSource addObjectsFromArray:moarKittens]; - [tableView insertRowsAtIndexPaths:indexPaths withRowAnimation:UITableViewRowAnimationFade]; - - [context completeBatchFetching:YES]; - - NSLog(@"kittens added"); - }); - }); -} - -- (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath -{ - // Enable editing for Kitten nodes - return [_blurbNodeIndexPath compare:indexPath] != NSOrderedSame; -} - -- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath -{ - if (editingStyle == UITableViewCellEditingStyleDelete) { - // Assume only kitten nodes are editable (see -tableView:canEditRowAtIndexPath:). - [_kittenDataSource removeObjectAtIndex:indexPath.row - 1]; - [_tableView deleteRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationAutomatic]; - } -} - -@end diff --git a/submodules/AsyncDisplayKit/examples_extra/SynchronousKittens/Sample/main.m b/submodules/AsyncDisplayKit/examples_extra/SynchronousKittens/Sample/main.m deleted file mode 100644 index 511cd1a7ac..0000000000 --- a/submodules/AsyncDisplayKit/examples_extra/SynchronousKittens/Sample/main.m +++ /dev/null @@ -1,18 +0,0 @@ -// -// main.m -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -#import "AppDelegate.h" - -int main(int argc, char * argv[]) { - @autoreleasepool { - return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); - } -} diff --git a/submodules/AsyncDisplayKit/examples_extra/TextStressTest/Default-568h@2x.png b/submodules/AsyncDisplayKit/examples_extra/TextStressTest/Default-568h@2x.png deleted file mode 100644 index 6ee80b9393..0000000000 Binary files a/submodules/AsyncDisplayKit/examples_extra/TextStressTest/Default-568h@2x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/examples_extra/TextStressTest/Default-667h@2x.png b/submodules/AsyncDisplayKit/examples_extra/TextStressTest/Default-667h@2x.png deleted file mode 100644 index e7b975e21b..0000000000 Binary files a/submodules/AsyncDisplayKit/examples_extra/TextStressTest/Default-667h@2x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/examples_extra/TextStressTest/Default-736h@3x.png b/submodules/AsyncDisplayKit/examples_extra/TextStressTest/Default-736h@3x.png deleted file mode 100644 index c8949cae16..0000000000 Binary files a/submodules/AsyncDisplayKit/examples_extra/TextStressTest/Default-736h@3x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/examples_extra/TextStressTest/Podfile b/submodules/AsyncDisplayKit/examples_extra/TextStressTest/Podfile deleted file mode 100644 index 73e26195cd..0000000000 --- a/submodules/AsyncDisplayKit/examples_extra/TextStressTest/Podfile +++ /dev/null @@ -1,6 +0,0 @@ -source 'https://github.com/CocoaPods/Specs.git' -platform :ios, '9.0' -target 'Sample' do - pod 'Texture/Yoga', :path => '../..' -end - diff --git a/submodules/AsyncDisplayKit/examples_extra/TextStressTest/Sample.xcworkspace/contents.xcworkspacedata b/submodules/AsyncDisplayKit/examples_extra/TextStressTest/Sample.xcworkspace/contents.xcworkspacedata deleted file mode 100644 index 7b5a2f3050..0000000000 --- a/submodules/AsyncDisplayKit/examples_extra/TextStressTest/Sample.xcworkspace/contents.xcworkspacedata +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - diff --git a/submodules/AsyncDisplayKit/examples_extra/TextStressTest/Sample/AppDelegate.h b/submodules/AsyncDisplayKit/examples_extra/TextStressTest/Sample/AppDelegate.h deleted file mode 100644 index e4a477eb23..0000000000 --- a/submodules/AsyncDisplayKit/examples_extra/TextStressTest/Sample/AppDelegate.h +++ /dev/null @@ -1,15 +0,0 @@ -// -// AppDelegate.h -// Texture -// -// Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -@interface AppDelegate : UIResponder - -@property (strong, nonatomic) UIWindow *window; - -@end diff --git a/submodules/AsyncDisplayKit/examples_extra/TextStressTest/Sample/AppDelegate.m b/submodules/AsyncDisplayKit/examples_extra/TextStressTest/Sample/AppDelegate.m deleted file mode 100644 index c54a53505e..0000000000 --- a/submodules/AsyncDisplayKit/examples_extra/TextStressTest/Sample/AppDelegate.m +++ /dev/null @@ -1,37 +0,0 @@ -// -// AppDelegate.m -// Texture -// -// Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import "AppDelegate.h" - -#import "TabBarController.h" -#import "CollectionViewController.h" -#import "ViewController.h" - - -@implementation AppDelegate - -- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions -{ - self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; - self.window.backgroundColor = [UIColor whiteColor]; - - ViewController *viewController = [[ViewController alloc] init]; - viewController.tabBarItem.title = @"TextStress"; - - CollectionViewController *cvc = [[CollectionViewController alloc] init]; - cvc.tabBarItem.title = @"Flexbox"; - - TabBarController *tabBarController = [[TabBarController alloc] init]; - tabBarController.viewControllers = @[cvc, viewController]; - - self.window.rootViewController = tabBarController; - [self.window makeKeyAndVisible]; - return YES; -} - -@end diff --git a/submodules/AsyncDisplayKit/examples_extra/TextStressTest/Sample/CollectionViewController.h b/submodules/AsyncDisplayKit/examples_extra/TextStressTest/Sample/CollectionViewController.h deleted file mode 100644 index d9329bdb07..0000000000 --- a/submodules/AsyncDisplayKit/examples_extra/TextStressTest/Sample/CollectionViewController.h +++ /dev/null @@ -1,13 +0,0 @@ -// -// CollectionViewController.h -// Texture -// -// Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import -#import - -@interface CollectionViewController : ASViewController -@end diff --git a/submodules/AsyncDisplayKit/examples_extra/TextStressTest/Sample/CollectionViewController.m b/submodules/AsyncDisplayKit/examples_extra/TextStressTest/Sample/CollectionViewController.m deleted file mode 100644 index 0464c376fa..0000000000 --- a/submodules/AsyncDisplayKit/examples_extra/TextStressTest/Sample/CollectionViewController.m +++ /dev/null @@ -1,63 +0,0 @@ -// -// CollectionViewController.m -// Texture -// -// Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import "CollectionViewController.h" -#import "TextCellNode.h" - -@interface CollectionViewController() -{ - ASCollectionNode *_collectionNode; - NSArray *_labels; - TextCellNode *_cellNode; -} - -@end - -@implementation CollectionViewController - -- (instancetype)init -{ - UICollectionViewFlowLayout *flowLayout = [[UICollectionViewFlowLayout alloc] init]; - _collectionNode = [[ASCollectionNode alloc] initWithCollectionViewLayout:flowLayout]; - CGRect rect = [[UIApplication sharedApplication] statusBarFrame]; - _collectionNode.contentInset = UIEdgeInsetsMake(rect.size.height, 0, 0, 0); - self = [super initWithNode:_collectionNode]; - if (self) { - _collectionNode.delegate = self; - _collectionNode.dataSource = self; - } - return self; -} - -- (void)viewDidLoad -{ - [super viewDidLoad]; - _collectionNode.backgroundColor = [UIColor whiteColor]; - _labels = @[@"Fight of the Living Dead: Experiment Fight of the Living Dead: Experiment", @"S1 • E1"]; -} - -- (NSInteger)collectionNode:(ASCollectionNode *)collectionNode numberOfItemsInSection:(NSInteger)section -{ - return 1; -} - -- (ASCellNodeBlock)collectionNode:(ASCollectionNode *)collectionNode nodeBlockForItemAtIndexPath:(NSIndexPath *)indexPath -{ - return ^{ - _cellNode = [[TextCellNode alloc] initWithText1:_labels[0] text2:_labels[1]]; - return _cellNode; - }; -} - -- (ASSizeRange)collectionNode:(ASCollectionNode *)collectionNode constrainedSizeForItemAtIndexPath:(NSIndexPath *)indexPath -{ - CGFloat width = collectionNode.view.bounds.size.width; - return ASSizeRangeMake(CGSizeMake(width, 0.0f), CGSizeMake(width, CGFLOAT_MAX)); -} - -@end diff --git a/submodules/AsyncDisplayKit/examples_extra/TextStressTest/Sample/Info.plist b/submodules/AsyncDisplayKit/examples_extra/TextStressTest/Sample/Info.plist deleted file mode 100644 index fb4115c84c..0000000000 --- a/submodules/AsyncDisplayKit/examples_extra/TextStressTest/Sample/Info.plist +++ /dev/null @@ -1,36 +0,0 @@ - - - - - CFBundleDevelopmentRegion - en - CFBundleExecutable - $(EXECUTABLE_NAME) - CFBundleIdentifier - $(PRODUCT_BUNDLE_IDENTIFIER) - CFBundleInfoDictionaryVersion - 6.0 - CFBundleName - $(PRODUCT_NAME) - CFBundlePackageType - APPL - CFBundleShortVersionString - 1.0 - CFBundleSignature - ???? - CFBundleVersion - 1 - LSRequiresIPhoneOS - - UIRequiredDeviceCapabilities - - armv7 - - UISupportedInterfaceOrientations - - UIInterfaceOrientationPortrait - UIInterfaceOrientationLandscapeLeft - UIInterfaceOrientationLandscapeRight - - - diff --git a/submodules/AsyncDisplayKit/examples_extra/TextStressTest/Sample/TabBarController.h b/submodules/AsyncDisplayKit/examples_extra/TextStressTest/Sample/TabBarController.h deleted file mode 100644 index a8d7f80512..0000000000 --- a/submodules/AsyncDisplayKit/examples_extra/TextStressTest/Sample/TabBarController.h +++ /dev/null @@ -1,12 +0,0 @@ -// -// TabBarController.h -// Texture -// -// Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -@interface TabBarController : ASTabBarController -@end diff --git a/submodules/AsyncDisplayKit/examples_extra/TextStressTest/Sample/TabBarController.m b/submodules/AsyncDisplayKit/examples_extra/TextStressTest/Sample/TabBarController.m deleted file mode 100644 index d056f1f679..0000000000 --- a/submodules/AsyncDisplayKit/examples_extra/TextStressTest/Sample/TabBarController.m +++ /dev/null @@ -1,15 +0,0 @@ -// -// TabBarController.m -// Texture -// -// Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import "TabBarController.h" - -@interface TabBarController () -@end - -@implementation TabBarController -@end diff --git a/submodules/AsyncDisplayKit/examples_extra/TextStressTest/Sample/TextCellNode.h b/submodules/AsyncDisplayKit/examples_extra/TextStressTest/Sample/TextCellNode.h deleted file mode 100644 index 2ae855e5fb..0000000000 --- a/submodules/AsyncDisplayKit/examples_extra/TextStressTest/Sample/TextCellNode.h +++ /dev/null @@ -1,13 +0,0 @@ -// -// TextCellNode.h -// Texture -// -// Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -@interface TextCellNode : ASCellNode -- (instancetype)initWithText1:(NSString *)text1 text2:(NSString *)text2; -@end diff --git a/submodules/AsyncDisplayKit/examples_extra/TextStressTest/Sample/TextCellNode.m b/submodules/AsyncDisplayKit/examples_extra/TextStressTest/Sample/TextCellNode.m deleted file mode 100644 index 4b777b5677..0000000000 --- a/submodules/AsyncDisplayKit/examples_extra/TextStressTest/Sample/TextCellNode.m +++ /dev/null @@ -1,96 +0,0 @@ -// -// TextCellNode.m -// Texture -// -// Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import "TextCellNode.h" -#import -#import - -#ifndef USE_ASTEXTNODE_2 -#define USE_ASTEXTNODE_2 1 -#endif - -@interface TextCellNode() -{ -#if USE_ASTEXTNODE_2 - ASTextNode2 *_label1; - ASTextNode2 *_label2; -#else - ASTextNode *_label1; - ASTextNode *_label2; -#endif -} -@end - -@implementation TextCellNode - -- (instancetype)initWithText1:(NSString *)text1 text2:(NSString *)text2 -{ - self = [super init]; - if (self) { - self.automaticallyManagesSubnodes = YES; - self.clipsToBounds = YES; -#if USE_ASTEXTNODE_2 - _label1 = [[ASTextNode2 alloc] init]; - _label2 = [[ASTextNode2 alloc] init]; -#else - _label1 = [[ASTextNode alloc] init]; - _label2 = [[ASTextNode alloc] init]; -#endif - - _label1.attributedText = [[NSAttributedString alloc] initWithString:text1]; - _label2.attributedText = [[NSAttributedString alloc] initWithString:text2]; - - _label1.maximumNumberOfLines = 1; - _label1.truncationMode = NSLineBreakByTruncatingTail; - _label2.maximumNumberOfLines = 1; - _label2.truncationMode = NSLineBreakByTruncatingTail; - - [self simpleSetupYogaLayout]; - } - return self; -} - -/** - This is to text a row with two labels, the first should be truncated with "...". - Layout is like: [l1Container[_label1], label2]. - This shows a bug of ASTextNode2. - */ -- (void)simpleSetupYogaLayout -{ - [self.style yogaNodeCreateIfNeeded]; - [_label1.style yogaNodeCreateIfNeeded]; - [_label2.style yogaNodeCreateIfNeeded]; - - _label1.style.flexGrow = 0; - _label1.style.flexShrink = 1; - _label1.backgroundColor = [UIColor lightGrayColor]; - - _label2.style.flexGrow = 0; - _label2.style.flexShrink = 0; - _label2.backgroundColor = [UIColor greenColor]; - - ASDisplayNode *l1Container = [ASDisplayNode yogaVerticalStack]; - - // TODO(fix ASTextNode2): next two line will show the bug of TextNode2 - // which works for ASTextNode though - // see discussion here: https://github.com/TextureGroup/Texture/pull/553 - l1Container.style.alignItems = ASStackLayoutAlignItemsCenter; - _label1.style.alignSelf = ASStackLayoutAlignSelfStart; - - l1Container.style.flexGrow = 0; - l1Container.style.flexShrink = 1; - - l1Container.yogaChildren = @[_label1]; - - self.style.justifyContent = ASStackLayoutJustifyContentSpaceBetween; - self.style.alignItems = ASStackLayoutAlignItemsStart; - self.style.flexDirection = ASStackLayoutDirectionHorizontal; - self.yogaChildren = @[l1Container, _label2]; -} - -@end diff --git a/submodules/AsyncDisplayKit/examples_extra/TextStressTest/Sample/ViewController.h b/submodules/AsyncDisplayKit/examples_extra/TextStressTest/Sample/ViewController.h deleted file mode 100644 index 8c2d4162b9..0000000000 --- a/submodules/AsyncDisplayKit/examples_extra/TextStressTest/Sample/ViewController.h +++ /dev/null @@ -1,13 +0,0 @@ -// -// ViewController.h -// Texture -// -// Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -@interface ViewController : UIViewController - -@end diff --git a/submodules/AsyncDisplayKit/examples_extra/TextStressTest/Sample/ViewController.m b/submodules/AsyncDisplayKit/examples_extra/TextStressTest/Sample/ViewController.m deleted file mode 100644 index f14bba18b3..0000000000 --- a/submodules/AsyncDisplayKit/examples_extra/TextStressTest/Sample/ViewController.m +++ /dev/null @@ -1,162 +0,0 @@ -// -// ViewController.m -// Texture -// -// Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import "ViewController.h" -#import - -#define NUMBER_ELEMENTS 2 - -@interface ViewController () -{ - NSMutableArray *_textNodes; - NSMutableArray *_textLabels; - UIScrollView *_scrollView; -} - -@end - - -@implementation ViewController - -- (void)viewDidLoad -{ - [super viewDidLoad]; - - _textNodes = [NSMutableArray array]; - _textLabels = [NSMutableArray array]; - - _scrollView = [[UIScrollView alloc] init]; - [self.view addSubview:_scrollView]; - - for (int i = 0; i < NUMBER_ELEMENTS; i++) { - - ASTextNode *node = [self createNodeForIndex:i]; - [_textNodes addObject:node]; - [_scrollView addSubnode:node]; - - UILabel *label = [self createLabelForIndex:i]; - [_textLabels addObject:label]; - [_scrollView addSubview:label]; - } -} - -- (void)viewWillLayoutSubviews -{ - [super viewWillLayoutSubviews]; - - CGFloat maxWidth = 0; - CGFloat maxHeight = 0; - - CGRect frame = CGRectMake(50, 50, 0, 0); - - for (int i = 0; i < NUMBER_ELEMENTS; i++) { - frame.size = [self sizeForIndex:i]; - [[_textNodes objectAtIndex:i] setFrame:frame]; - - frame.origin.x += frame.size.width + 50; - - [[_textLabels objectAtIndex:i] setFrame:frame]; - - if (frame.size.width > maxWidth) { - maxWidth = frame.size.width; - } - if ((frame.size.height + frame.origin.y) > maxHeight) { - maxHeight = frame.size.height + frame.origin.y; - } - - frame.origin.x -= frame.size.width + 50; - frame.origin.y += frame.size.height + 20; - } - - _scrollView.frame = self.view.bounds; - _scrollView.contentSize = CGSizeMake(maxWidth, maxHeight); -} - -- (ASTextNode *)createNodeForIndex:(NSUInteger)index -{ - ASTextNode *node = [[ASTextNode alloc] init]; - node.attributedText = [self textForIndex:index]; - node.backgroundColor = [UIColor orangeColor]; - - NSMutableAttributedString *string = [node.attributedText mutableCopy]; - - switch (index) { - case 0: // top justification (ASDK) vs. center justification (UILabel) - node.maximumNumberOfLines = 3; - return node; - - case 1: // default truncation attributed string color shouldn't match attributed text color (ASDK) vs. match (UIKit) - node.maximumNumberOfLines = 3; - [string addAttribute:NSForegroundColorAttributeName - value:[UIColor redColor] - range:NSMakeRange(0, [string length])]; - node.attributedText = string; - return node; - - default: - return nil; - } -} - -- (UILabel *)createLabelForIndex:(NSUInteger)index -{ - UILabel *label = [[UILabel alloc] init]; - label.attributedText = [self textForIndex:index]; - label.backgroundColor = [UIColor greenColor]; - - NSMutableAttributedString *string = [label.attributedText mutableCopy]; - - switch (index) { - case 0: - label.numberOfLines = 3; - return label; - - case 1: - label.numberOfLines = 3; - [string addAttribute:NSForegroundColorAttributeName - value:[UIColor redColor] - range:NSMakeRange(0, [string length])]; - label.attributedText = string; - return label; - - default: - return nil; - } -} - -- (NSAttributedString *)textForIndex:(NSUInteger)index -{ - NSDictionary *attrs = @{ NSFontAttributeName: [UIFont fontWithName:@"HelveticaNeue" size:12.0f] }; - - switch (index) { - case 0: - return [[NSAttributedString alloc] initWithString:@"1\n2\n3\n4\n5" attributes:attrs]; - - case 1: - return [[NSAttributedString alloc] initWithString:@"1\n2\n3\n4\n5" attributes:attrs]; - - default: - return nil; - } -} - -- (CGSize)sizeForIndex:(NSUInteger)index -{ - switch (index) { - case 0: - return CGSizeMake(40, 100); - - case 1: - return CGSizeMake(40, 100); - - default: - return CGSizeZero; - } -} - -@end diff --git a/submodules/AsyncDisplayKit/examples_extra/TextStressTest/Sample/main.m b/submodules/AsyncDisplayKit/examples_extra/TextStressTest/Sample/main.m deleted file mode 100644 index 1745cc192d..0000000000 --- a/submodules/AsyncDisplayKit/examples_extra/TextStressTest/Sample/main.m +++ /dev/null @@ -1,17 +0,0 @@ -// -// main.m -// Texture -// -// Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -#import "AppDelegate.h" - -int main(int argc, char * argv[]) { - @autoreleasepool { - return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); - } -} diff --git a/submodules/AsyncDisplayKit/examples_extra/VideoTableView/Default-568h@2x.png b/submodules/AsyncDisplayKit/examples_extra/VideoTableView/Default-568h@2x.png deleted file mode 100644 index 6ee80b9393..0000000000 Binary files a/submodules/AsyncDisplayKit/examples_extra/VideoTableView/Default-568h@2x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/examples_extra/VideoTableView/Default-667h@2x.png b/submodules/AsyncDisplayKit/examples_extra/VideoTableView/Default-667h@2x.png deleted file mode 100644 index e7b975e21b..0000000000 Binary files a/submodules/AsyncDisplayKit/examples_extra/VideoTableView/Default-667h@2x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/examples_extra/VideoTableView/Default-736h@3x.png b/submodules/AsyncDisplayKit/examples_extra/VideoTableView/Default-736h@3x.png deleted file mode 100644 index c8949cae16..0000000000 Binary files a/submodules/AsyncDisplayKit/examples_extra/VideoTableView/Default-736h@3x.png and /dev/null differ diff --git a/submodules/AsyncDisplayKit/examples_extra/VideoTableView/Podfile b/submodules/AsyncDisplayKit/examples_extra/VideoTableView/Podfile deleted file mode 100644 index 71a7f2c4b2..0000000000 --- a/submodules/AsyncDisplayKit/examples_extra/VideoTableView/Podfile +++ /dev/null @@ -1,5 +0,0 @@ -source 'https://github.com/CocoaPods/Specs.git' -platform :ios, '9.0' -target 'Sample' do - pod 'Texture', :path => '../..' -end diff --git a/submodules/AsyncDisplayKit/examples_extra/VideoTableView/Sample.xcworkspace/contents.xcworkspacedata b/submodules/AsyncDisplayKit/examples_extra/VideoTableView/Sample.xcworkspace/contents.xcworkspacedata deleted file mode 100644 index 7b5a2f3050..0000000000 --- a/submodules/AsyncDisplayKit/examples_extra/VideoTableView/Sample.xcworkspace/contents.xcworkspacedata +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - diff --git a/submodules/AsyncDisplayKit/examples_extra/VideoTableView/Sample/AppDelegate.h b/submodules/AsyncDisplayKit/examples_extra/VideoTableView/Sample/AppDelegate.h deleted file mode 100644 index c30a27f4dc..0000000000 --- a/submodules/AsyncDisplayKit/examples_extra/VideoTableView/Sample/AppDelegate.h +++ /dev/null @@ -1,18 +0,0 @@ -// -// AppDelegate.h -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -#define UseAutomaticLayout 1 - -@interface AppDelegate : UIResponder - -@property (strong, nonatomic) UIWindow *window; - -@end diff --git a/submodules/AsyncDisplayKit/examples_extra/VideoTableView/Sample/AppDelegate.m b/submodules/AsyncDisplayKit/examples_extra/VideoTableView/Sample/AppDelegate.m deleted file mode 100644 index f8437855b0..0000000000 --- a/submodules/AsyncDisplayKit/examples_extra/VideoTableView/Sample/AppDelegate.m +++ /dev/null @@ -1,25 +0,0 @@ -// -// AppDelegate.m -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import "AppDelegate.h" - -#import "ViewController.h" - -@implementation AppDelegate - -- (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 diff --git a/submodules/AsyncDisplayKit/examples_extra/VideoTableView/Sample/BlurbNode.h b/submodules/AsyncDisplayKit/examples_extra/VideoTableView/Sample/BlurbNode.h deleted file mode 100644 index 5451fb39f0..0000000000 --- a/submodules/AsyncDisplayKit/examples_extra/VideoTableView/Sample/BlurbNode.h +++ /dev/null @@ -1,17 +0,0 @@ -// -// BlurbNode.h -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -/** - * Simple node that displays a placekitten.com attribution. - */ -@interface BlurbNode : ASCellNode - -@end diff --git a/submodules/AsyncDisplayKit/examples_extra/VideoTableView/Sample/BlurbNode.m b/submodules/AsyncDisplayKit/examples_extra/VideoTableView/Sample/BlurbNode.m deleted file mode 100644 index ba39439157..0000000000 --- a/submodules/AsyncDisplayKit/examples_extra/VideoTableView/Sample/BlurbNode.m +++ /dev/null @@ -1,113 +0,0 @@ -// -// BlurbNode.m -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import "BlurbNode.h" -#import "AppDelegate.h" - -#import -#import - -#import -#import - -static CGFloat kTextPadding = 10.0f; -static NSString *kLinkAttributeName = @"PlaceKittenNodeLinkAttributeName"; - -@interface BlurbNode () -{ - ASTextNode *_textNode; -} - -@end - - -@implementation BlurbNode - -#pragma mark - -#pragma mark ASCellNode. - -- (instancetype)init -{ - if (!(self = [super init])) - return nil; - - // create a text node - _textNode = [[ASTextNode alloc] init]; - - // configure the node to support tappable links - _textNode.delegate = self; - _textNode.userInteractionEnabled = YES; - _textNode.linkAttributeNames = @[ kLinkAttributeName ]; - - // generate an attributed string using the custom link attribute specified above - NSString *blurb = @"Nic Cage courtesy of himself."; - NSMutableAttributedString *string = [[NSMutableAttributedString alloc] initWithString:blurb]; - _textNode.attributedText = string; - - // add it as a subnode, and we're done - [self addSubnode:_textNode]; - - return self; -} - -- (void)didLoad -{ - // enable highlighting now that self.layer has loaded -- see ASHighlightOverlayLayer.h - self.layer.as_allowsHighlightDrawing = YES; - - [super didLoad]; -} - -#if UseAutomaticLayout -- (ASLayoutSpec *)layoutSpecThatFits:(ASSizeRange)constrainedSize -{ - ASCenterLayoutSpec *centerSpec = [[ASCenterLayoutSpec alloc] init]; - centerSpec.centeringOptions = ASCenterLayoutSpecCenteringX; - centerSpec.sizingOptions = ASCenterLayoutSpecSizingOptionMinimumY; - centerSpec.child = _textNode; - - UIEdgeInsets padding =UIEdgeInsetsMake(kTextPadding, kTextPadding, kTextPadding, kTextPadding); - return [ASInsetLayoutSpec insetLayoutSpecWithInsets:padding child:centerSpec]; -} -#else -- (CGSize)calculateSizeThatFits:(CGSize)constrainedSize -{ - // called on a background thread. custom nodes must call -measure: on their subnodes in -calculateSizeThatFits: - CGSize measuredSize = [_textNode measure:CGSizeMake(constrainedSize.width - 2 * kTextPadding, - constrainedSize.height - 2 * kTextPadding)]; - return CGSizeMake(constrainedSize.width, measuredSize.height + 2 * kTextPadding); -} - -- (void)layout -{ - // called on the main thread. we'll use the stashed size from above, instead of blocking on text sizing - CGSize textNodeSize = _textNode.calculatedSize; - _textNode.frame = CGRectMake(roundf((self.calculatedSize.width - textNodeSize.width) / 2.0f), - kTextPadding, - textNodeSize.width, - textNodeSize.height); -} -#endif - -#pragma mark - -#pragma mark ASTextNodeDelegate methods. - -- (BOOL)textNode:(ASTextNode *)richTextNode shouldHighlightLinkAttribute:(NSString *)attribute value:(id)value atPoint:(CGPoint)point -{ - // opt into link highlighting -- tap and hold the link to try it! must enable highlighting on a layer, see -didLoad - return YES; -} - -- (void)textNode:(ASTextNode *)richTextNode tappedLinkAttribute:(NSString *)attribute value:(NSURL *)URL atPoint:(CGPoint)point textRange:(NSRange)textRange -{ - // the node tapped a link, open it - [[UIApplication sharedApplication] openURL:URL]; -} - -@end diff --git a/submodules/AsyncDisplayKit/examples_extra/VideoTableView/Sample/Info.plist b/submodules/AsyncDisplayKit/examples_extra/VideoTableView/Sample/Info.plist deleted file mode 100644 index 35d842827b..0000000000 --- a/submodules/AsyncDisplayKit/examples_extra/VideoTableView/Sample/Info.plist +++ /dev/null @@ -1,36 +0,0 @@ - - - - - CFBundleDevelopmentRegion - en - CFBundleExecutable - $(EXECUTABLE_NAME) - CFBundleIdentifier - com.facebook.AsyncDisplayKit.$(PRODUCT_NAME:rfc1034identifier) - CFBundleInfoDictionaryVersion - 6.0 - CFBundleName - $(PRODUCT_NAME) - CFBundlePackageType - APPL - CFBundleShortVersionString - 1.0 - CFBundleSignature - ???? - CFBundleVersion - 1 - LSRequiresIPhoneOS - - UIRequiredDeviceCapabilities - - armv7 - - UISupportedInterfaceOrientations - - UIInterfaceOrientationPortrait - UIInterfaceOrientationLandscapeLeft - UIInterfaceOrientationLandscapeRight - - - diff --git a/submodules/AsyncDisplayKit/examples_extra/VideoTableView/Sample/NicCageNode.h b/submodules/AsyncDisplayKit/examples_extra/VideoTableView/Sample/NicCageNode.h deleted file mode 100644 index b2937f6a44..0000000000 --- a/submodules/AsyncDisplayKit/examples_extra/VideoTableView/Sample/NicCageNode.h +++ /dev/null @@ -1,22 +0,0 @@ -// -// NicCageNode.h -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -/** - * Social media-style node that displays a kitten picture and a random length - * of lorem ipsum text. Uses a placekitten.com kitten of the specified size. - */ -@interface NicCageNode : ASCellNode - -- (instancetype)initWithKittenOfSize:(CGSize)size; - -- (void)toggleImageEnlargement; - -@end diff --git a/submodules/AsyncDisplayKit/examples_extra/VideoTableView/Sample/NicCageNode.mm b/submodules/AsyncDisplayKit/examples_extra/VideoTableView/Sample/NicCageNode.mm deleted file mode 100644 index 5e960ee013..0000000000 --- a/submodules/AsyncDisplayKit/examples_extra/VideoTableView/Sample/NicCageNode.mm +++ /dev/null @@ -1,260 +0,0 @@ -// -// NicCageNode.mm -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import "NicCageNode.h" -#import "AppDelegate.h" - -#import - -#import -#import -#import -#import - -static const CGFloat kImageSize = 80.0f; -static const CGFloat kOuterPadding = 16.0f; -static const CGFloat kInnerPadding = 10.0f; - -#define kVideoURL @"https://www.w3schools.com/html/mov_bbb.mp4" -#define kVideoStreamURL @"http://devimages.apple.com/iphone/samples/bipbop/bipbopall.m3u8" - -@interface NicCageNode () -{ - CGSize _kittenSize; - -// ASNetworkImageNode *_imageNode; - ASVideoNode *_videoNode; - ASTextNode *_textNode; - ASDisplayNode *_divider; - BOOL _isImageEnlarged; - BOOL _swappedTextAndImage; -} - -@end - - -@implementation NicCageNode - -// lorem ipsum text courtesy https://kittyipsum.com/ <3 -+ (NSArray *)placeholders -{ - static NSArray *placeholders = nil; - - static dispatch_once_t once; - dispatch_once(&once, ^{ - placeholders = @[ - @"Kitty ipsum dolor sit amet, purr sleep on your face lay down in your way biting, sniff tincidunt a etiam fluffy fur judging you stuck in a tree kittens.", - @"Lick tincidunt a biting eat the grass, egestas enim ut lick leap puking climb the curtains lick.", - @"Lick quis nunc toss the mousie vel, tortor pellentesque sunbathe orci turpis non tail flick suscipit sleep in the sink.", - @"Orci turpis litter box et stuck in a tree, egestas ac tempus et aliquam elit.", - @"Hairball iaculis dolor dolor neque, nibh adipiscing vehicula egestas dolor aliquam.", - @"Sunbathe fluffy fur tortor faucibus pharetra jump, enim jump on the table I don't like that food catnip toss the mousie scratched.", - @"Quis nunc nam sleep in the sink quis nunc purr faucibus, chase the red dot consectetur bat sagittis.", - @"Lick tail flick jump on the table stretching purr amet, rhoncus scratched jump on the table run.", - @"Suspendisse aliquam vulputate feed me sleep on your keyboard, rip the couch faucibus sleep on your keyboard tristique give me fish dolor.", - @"Rip the couch hiss attack your ankles biting pellentesque puking, enim suspendisse enim mauris a.", - @"Sollicitudin iaculis vestibulum toss the mousie biting attack your ankles, puking nunc jump adipiscing in viverra.", - @"Nam zzz amet neque, bat tincidunt a iaculis sniff hiss bibendum leap nibh.", - @"Chase the red dot enim puking chuf, tristique et egestas sniff sollicitudin pharetra enim ut mauris a.", - @"Sagittis scratched et lick, hairball leap attack adipiscing catnip tail flick iaculis lick.", - @"Neque neque sleep in the sink neque sleep on your face, climb the curtains chuf tail flick sniff tortor non.", - @"Ac etiam kittens claw toss the mousie jump, pellentesque rhoncus litter box give me fish adipiscing mauris a.", - @"Pharetra egestas sunbathe faucibus ac fluffy fur, hiss feed me give me fish accumsan.", - @"Tortor leap tristique accumsan rutrum sleep in the sink, amet sollicitudin adipiscing dolor chase the red dot.", - @"Knock over the lamp pharetra vehicula sleep on your face rhoncus, jump elit cras nec quis quis nunc nam.", - @"Sollicitudin feed me et ac in viverra catnip, nunc eat I don't like that food iaculis give me fish.", - ]; - }); - - return placeholders; -} - -- (instancetype)initWithKittenOfSize:(CGSize)size -{ - if (!(self = [super init])) - return nil; - - _kittenSize = size; - - u_int32_t videoInitMethod = arc4random_uniform(3); - u_int32_t autoPlay = arc4random_uniform(2); - NSArray* methodArray = @[@"AVAsset", @"File URL", @"HLS URL"]; - NSArray* autoPlayArray = @[@"paused", @"auto play"]; - - switch (videoInitMethod) { - case 0: - // Construct an AVAsset from a URL - _videoNode = [[ASVideoNode alloc] init]; - _videoNode.asset = [AVAsset assetWithURL:[NSURL URLWithString:kVideoURL]]; - break; - - case 1: - // Construct the video node directly from the .mp4 URL - _videoNode = [[ASVideoNode alloc] init]; - _videoNode.asset = [AVAsset assetWithURL:[NSURL URLWithString:kVideoURL]]; - break; - - case 2: - // Construct the video node from an HTTP Live Streaming URL - // URL from https://developer.apple.com/library/ios/documentation/AudioVideo/Conceptual/AVFoundationPG/Articles/02_Playback.html - _videoNode = [[ASVideoNode alloc] init]; - _videoNode.asset = [AVAsset assetWithURL:[NSURL URLWithString:kVideoStreamURL]]; - break; - } - - if (autoPlay == 1) - _videoNode.shouldAutoplay = YES; - - _videoNode.shouldAutorepeat = YES; - _videoNode.backgroundColor = ASDisplayNodeDefaultPlaceholderColor(); - - [self addSubnode:_videoNode]; - - _textNode = [[ASTextNode alloc] init]; - _textNode.attributedText = [[NSAttributedString alloc] initWithString:[NSString stringWithFormat:@"%@ %@ %@", methodArray[videoInitMethod], autoPlayArray[autoPlay], [self kittyIpsum]] - attributes:[self textStyle]]; - [self addSubnode:_textNode]; - - // hairline cell separator - _divider = [[ASDisplayNode alloc] init]; - _divider.backgroundColor = [UIColor lightGrayColor]; - [self addSubnode:_divider]; - - return self; -} - -- (NSString *)kittyIpsum -{ - NSArray *placeholders = [NicCageNode placeholders]; - u_int32_t ipsumCount = (u_int32_t)[placeholders count]; - u_int32_t location = arc4random_uniform(ipsumCount); - u_int32_t length = arc4random_uniform(ipsumCount - location); - - NSMutableString *string = [placeholders[location] mutableCopy]; - for (u_int32_t i = location + 1; i < location + length; i++) { - [string appendString:(i % 2 == 0) ? @"\n" : @" "]; - [string appendString:placeholders[i]]; - } - - return string; -} - -- (NSDictionary *)textStyle -{ - UIFont *font = [UIFont fontWithName:@"HelveticaNeue" size:12.0f]; - - NSMutableParagraphStyle *style = [[NSParagraphStyle defaultParagraphStyle] mutableCopy]; - style.paragraphSpacing = 0.5 * font.lineHeight; - style.hyphenationFactor = 1.0; - - return @{ NSFontAttributeName: font, - NSParagraphStyleAttributeName: style }; -} - -#if UseAutomaticLayout -- (ASLayoutSpec *)layoutSpecThatFits:(ASSizeRange)constrainedSize -{ - CGSize videoNodeSize = _isImageEnlarged ? CGSizeMake(2.0 * kImageSize, 2.0 * kImageSize) - : CGSizeMake(kImageSize, kImageSize); - - [_videoNode.style setPreferredSize:videoNodeSize]; - - _textNode.style.flexShrink = 1.0; - - ASStackLayoutSpec *stackSpec = [[ASStackLayoutSpec alloc] init]; - stackSpec.direction = ASStackLayoutDirectionHorizontal; - stackSpec.spacing = kInnerPadding; - [stackSpec setChildren:!_swappedTextAndImage ? @[_videoNode, _textNode] : @[_textNode, _videoNode]]; - - ASInsetLayoutSpec *insetSpec = [[ASInsetLayoutSpec alloc] init]; - insetSpec.insets = UIEdgeInsetsMake(kOuterPadding, kOuterPadding, kOuterPadding, kOuterPadding); - insetSpec.child = stackSpec; - - return insetSpec; -} - -// With box model, you don't need to override this method, unless you want to add custom logic. -- (void)layout -{ - [super layout]; - - // Manually layout the divider. - CGFloat pixelHeight = 1.0f / [[UIScreen mainScreen] scale]; - _divider.frame = CGRectMake(0.0f, 0.0f, self.calculatedSize.width, pixelHeight); -} -#else -- (CGSize)calculateSizeThatFits:(CGSize)constrainedSize -{ - CGSize imageSize = CGSizeMake(kImageSize, kImageSize); - CGSize textSize = [_textNode measure:CGSizeMake(constrainedSize.width - kImageSize - 2 * kOuterPadding - kInnerPadding, - constrainedSize.height)]; - - // ensure there's room for the text - CGFloat requiredHeight = MAX(textSize.height, imageSize.height); - return CGSizeMake(constrainedSize.width, requiredHeight + 2 * kOuterPadding); -} - -- (void)layout -{ - CGFloat pixelHeight = 1.0f / [[UIScreen mainScreen] scale]; - _divider.frame = CGRectMake(0.0f, 0.0f, self.calculatedSize.width, pixelHeight); - - _imageNode.frame = CGRectMake(kOuterPadding, kOuterPadding, kImageSize, kImageSize); - - CGSize textSize = _textNode.calculatedSize; - _textNode.frame = CGRectMake(kOuterPadding + kImageSize + kInnerPadding, kOuterPadding, textSize.width, textSize.height); -} -#endif - -- (void)toggleImageEnlargement -{ - _isImageEnlarged = !_isImageEnlarged; - [self setNeedsLayout]; -} - -- (void)toggleNodesSwap -{ - _swappedTextAndImage = !_swappedTextAndImage; - - [UIView animateWithDuration:0.15 animations:^{ - self.alpha = 0; - } completion:^(BOOL finished) { - [self setNeedsLayout]; - [self.view layoutIfNeeded]; - - [UIView animateWithDuration:0.15 animations:^{ - self.alpha = 1; - }]; - }]; -} - -- (void)updateBackgroundColor -{ - if (self.highlighted) { - self.backgroundColor = [UIColor lightGrayColor]; - } else if (self.selected) { - self.backgroundColor = [UIColor blueColor]; - } else { - self.backgroundColor = [UIColor whiteColor]; - } -} - -- (void)setSelected:(BOOL)selected -{ - [super setSelected:selected]; - [self updateBackgroundColor]; -} - -- (void)setHighlighted:(BOOL)highlighted -{ - [super setHighlighted:highlighted]; - [self updateBackgroundColor]; -} - -@end diff --git a/submodules/AsyncDisplayKit/examples_extra/VideoTableView/Sample/ViewController.h b/submodules/AsyncDisplayKit/examples_extra/VideoTableView/Sample/ViewController.h deleted file mode 100644 index c8a0626291..0000000000 --- a/submodules/AsyncDisplayKit/examples_extra/VideoTableView/Sample/ViewController.h +++ /dev/null @@ -1,14 +0,0 @@ -// -// ViewController.h -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -@interface ViewController : UIViewController - -@end diff --git a/submodules/AsyncDisplayKit/examples_extra/VideoTableView/Sample/ViewController.m b/submodules/AsyncDisplayKit/examples_extra/VideoTableView/Sample/ViewController.m deleted file mode 100644 index 5e1553c571..0000000000 --- a/submodules/AsyncDisplayKit/examples_extra/VideoTableView/Sample/ViewController.m +++ /dev/null @@ -1,197 +0,0 @@ -// -// ViewController.m -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import "ViewController.h" - -#import -#import - -#import "BlurbNode.h" -#import "NicCageNode.h" -#import - -static const NSInteger kCageSize = 20; // intial number of Cage cells in ASTableView -static const NSInteger kCageBatchSize = 10; // number of Cage cells to add to ASTableView -static const NSInteger kMaxCageSize = 100; // max number of Cage cells allowed in ASTableView - -@interface ViewController () -{ - ASTableView *_tableView; - - // array of boxed CGSizes corresponding to placekitten.com kittens - NSMutableArray *_kittenDataSource; - - BOOL _dataSourceLocked; - NSIndexPath *_blurbNodeIndexPath; -} - -@property (nonatomic, strong) NSMutableArray *kittenDataSource; -@property (atomic, assign) BOOL dataSourceLocked; - -@end - -@implementation ViewController - -#pragma mark - -#pragma mark UIViewController. - -- (instancetype)init -{ - if (!(self = [super init])) - return nil; - - _tableView = [[ASTableView alloc] initWithFrame:CGRectZero style:UITableViewStylePlain]; - _tableView.separatorStyle = UITableViewCellSeparatorStyleNone; // KittenNode has its own separator - _tableView.asyncDataSource = self; - _tableView.asyncDelegate = self; - - // populate our "data source" with some random kittens - _kittenDataSource = [self createLitterWithSize:kCageSize]; - - _blurbNodeIndexPath = [NSIndexPath indexPathForItem:0 inSection:0]; - - self.title = @"Nic Cage"; - self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemEdit - target:self - action:@selector(toggleEditingMode)]; - - return self; -} - -- (NSMutableArray *)createLitterWithSize:(NSInteger)litterSize -{ - NSMutableArray *cages = [NSMutableArray arrayWithCapacity:litterSize]; - for (NSInteger i = 0; i < litterSize; i++) { - - u_int32_t deltaX = arc4random_uniform(10) - 5; - u_int32_t deltaY = arc4random_uniform(10) - 5; - CGSize size = CGSizeMake(350 + 2 * deltaX, 350 + 4 * deltaY); - - [cages addObject:[NSValue valueWithCGSize:size]]; - } - return cages; -} - -- (void)setKittenDataSource:(NSMutableArray *)kittenDataSource { - ASDisplayNodeAssert(!self.dataSourceLocked, @"Could not update data source when it is locked !"); - - _kittenDataSource = kittenDataSource; -} - -- (void)viewDidLoad -{ - [super viewDidLoad]; - - [self.view addSubview:_tableView]; -} - -- (void)viewWillLayoutSubviews -{ - _tableView.frame = self.view.bounds; -} - -- (void)toggleEditingMode -{ - [_tableView setEditing:!_tableView.editing animated:YES]; -} - -#pragma mark - -#pragma mark ASTableView. - -- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath -{ - [_tableView deselectRowAtIndexPath:indexPath animated:YES]; - // Assume only kitten nodes are selectable (see -tableView:shouldHighlightRowAtIndexPath:). - NicCageNode *node = (NicCageNode *)[_tableView nodeForRowAtIndexPath:indexPath]; - [node toggleImageEnlargement]; -} - -- (ASCellNode *)tableView:(ASTableView *)tableView nodeForRowAtIndexPath:(NSIndexPath *)indexPath -{ - // special-case the first row - if ([_blurbNodeIndexPath compare:indexPath] == NSOrderedSame) { - BlurbNode *node = [[BlurbNode alloc] init]; - return node; - } - - NSValue *size = _kittenDataSource[indexPath.row - 1]; - NicCageNode *node = [[NicCageNode alloc] initWithKittenOfSize:size.CGSizeValue]; - return node; -} - -- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section -{ - // blurb node + kLitterSize kitties - return 1 + _kittenDataSource.count; -} - -- (BOOL)tableView:(UITableView *)tableView shouldHighlightRowAtIndexPath:(NSIndexPath *)indexPath -{ - // Enable selection for kitten nodes - return [_blurbNodeIndexPath compare:indexPath] != NSOrderedSame; -} - -- (void)tableViewLockDataSource:(ASTableView *)tableView -{ - self.dataSourceLocked = YES; -} - -- (void)tableViewUnlockDataSource:(ASTableView *)tableView -{ - self.dataSourceLocked = NO; -} - -- (BOOL)shouldBatchFetchForTableView:(UITableView *)tableView -{ - return _kittenDataSource.count < kMaxCageSize; -} - -- (void)tableView:(UITableView *)tableView willBeginBatchFetchWithContext:(ASBatchContext *)context -{ - dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{ - sleep(1); - dispatch_async(dispatch_get_main_queue(), ^{ - - // populate a new array of random-sized kittens - NSArray *moarKittens = [self createLitterWithSize:kCageBatchSize]; - - NSMutableArray *indexPaths = [[NSMutableArray alloc] init]; - - // find number of kittens in the data source and create their indexPaths - NSInteger existingRows = _kittenDataSource.count + 1; - - for (NSInteger i = 0; i < moarKittens.count; i++) { - [indexPaths addObject:[NSIndexPath indexPathForRow:existingRows + i inSection:0]]; - } - - // add new kittens to the data source & notify table of new indexpaths - [_kittenDataSource addObjectsFromArray:moarKittens]; - [tableView insertRowsAtIndexPaths:indexPaths withRowAnimation:UITableViewRowAnimationFade]; - - [context completeBatchFetching:YES]; - }); - }); -} - -- (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath -{ - // Enable editing for Kitten nodes - return [_blurbNodeIndexPath compare:indexPath] != NSOrderedSame; -} - -- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath -{ - if (editingStyle == UITableViewCellEditingStyleDelete) { - // Assume only kitten nodes are editable (see -tableView:canEditRowAtIndexPath:). - [_kittenDataSource removeObjectAtIndex:indexPath.row - 1]; - [_tableView deleteRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationAutomatic]; - } -} - -@end diff --git a/submodules/AsyncDisplayKit/examples_extra/VideoTableView/Sample/main.m b/submodules/AsyncDisplayKit/examples_extra/VideoTableView/Sample/main.m deleted file mode 100644 index 511cd1a7ac..0000000000 --- a/submodules/AsyncDisplayKit/examples_extra/VideoTableView/Sample/main.m +++ /dev/null @@ -1,18 +0,0 @@ -// -// main.m -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -#import "AppDelegate.h" - -int main(int argc, char * argv[]) { - @autoreleasepool { - return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); - } -} diff --git a/tools/buck/buck-2be0e8fa79117daa854e79dd7d9ce32048d506a8.patch b/tools/buck/buck-2be0e8fa79117daa854e79dd7d9ce32048d506a8.patch new file mode 100644 index 0000000000..fe6ee40c41 --- /dev/null +++ b/tools/buck/buck-2be0e8fa79117daa854e79dd7d9ce32048d506a8.patch @@ -0,0 +1,157 @@ +diff --git a/.gitignore b/.gitignore +index 78ce658b9a..30c0369ab7 100644 +--- a/.gitignore ++++ b/.gitignore +@@ -3,6 +3,7 @@ + + # IntelliJ build + /intellij-out/ ++/.idea/ + + # Buck + /buck-out +diff --git a/.idea/modules.xml b/.idea/modules.xml +deleted file mode 100644 +index 7ff823b554..0000000000 +--- a/.idea/modules.xml ++++ /dev/null +@@ -1,16 +0,0 @@ +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +\ No newline at end of file +diff --git a/src/com/facebook/buck/apple/AppleBundle.java b/src/com/facebook/buck/apple/AppleBundle.java +index d895ab9a79..ad42beb302 100644 +--- a/src/com/facebook/buck/apple/AppleBundle.java ++++ b/src/com/facebook/buck/apple/AppleBundle.java +@@ -992,7 +992,11 @@ public class AppleBundle extends AbstractBuildRuleWithDeclaredAndExtraDeps + keys.put("DTPlatformName", new NSString(platform.getName())); + keys.put("DTPlatformVersion", new NSString(sdkVersion)); + keys.put("DTSDKName", new NSString(sdkName + sdkVersion)); +- keys.put("MinimumOSVersion", new NSString(minOSVersion)); ++ if (infoPlistSubstitutions.containsKey("MinimumOSVersion")) { ++ keys.put("MinimumOSVersion", new NSString(infoPlistSubstitutions.get("MinimumOSVersion"))); ++ } else { ++ keys.put("MinimumOSVersion", new NSString(minOSVersion)); ++ } + if (platformBuildVersion.isPresent()) { + keys.put("DTPlatformBuild", new NSString(platformBuildVersion.get())); + keys.put("DTSDKBuild", new NSString(platformBuildVersion.get())); +@@ -1185,9 +1189,10 @@ public class AppleBundle extends AbstractBuildRuleWithDeclaredAndExtraDeps + + // .framework bundles will be code-signed when they're copied into the containing bundle. + private boolean needCodeSign() { +- return binary.isPresent() ++ return false; ++ /*return binary.isPresent() + && ApplePlatform.needsCodeSign(platform.getName()) +- && !extension.equals(FRAMEWORK_EXTENSION); ++ && !extension.equals(FRAMEWORK_EXTENSION);*/ + } + + @Override +diff --git a/src/com/facebook/buck/apple/MultiarchFileInfos.java b/src/com/facebook/buck/apple/MultiarchFileInfos.java +index c078b2e134..030f9fc289 100644 +--- a/src/com/facebook/buck/apple/MultiarchFileInfos.java ++++ b/src/com/facebook/buck/apple/MultiarchFileInfos.java +@@ -177,7 +177,12 @@ public class MultiarchFileInfos { + cxxBuckConfig.shouldCacheLinks(), + BuildTargetPaths.getGenPath( + projectFilesystem, buildTarget, multiarchOutputPathFormat)); +- graphBuilder.addToIndex(multiarchFile); ++ Optional existingRule2 = graphBuilder.getRuleOptional(multiarchFile.getBuildTarget()); ++ if (existingRule2.isPresent()) { ++ return existingRule2.get(); ++ } else { ++ graphBuilder.addToIndex(multiarchFile); ++ } + return multiarchFile; + } else { + return new NoopBuildRule(buildTarget, projectFilesystem); +diff --git a/src/com/facebook/buck/features/apple/project/ProjectGenerator.java b/src/com/facebook/buck/features/apple/project/ProjectGenerator.java +index 8db968b982..b10f793d8e 100644 +--- a/src/com/facebook/buck/features/apple/project/ProjectGenerator.java ++++ b/src/com/facebook/buck/features/apple/project/ProjectGenerator.java +@@ -825,6 +825,7 @@ public class ProjectGenerator { + Optional.of(xcodeDescriptions.getXCodeDescriptions())); + if (bundleRequiresRemovalOfAllTransitiveFrameworks(targetNode)) { + copiedRules = rulesWithoutFrameworkBundles(copiedRules); ++ copiedRules = rulesWithoutDylibs(copiedRules); + } else if (bundleRequiresAllTransitiveFrameworks(binaryNode, bundleLoaderNode)) { + copiedRules = + ImmutableSet.>builder() +@@ -954,6 +955,22 @@ public class ProjectGenerator { + .toImmutableList(); + } + ++ private ImmutableList> rulesWithoutDylibs( ++ Iterable> copiedRules) { ++ return RichStream.from(copiedRules) ++ .filter( ++ input -> ++ TargetNodes.castArg(input, AppleLibraryDescriptionArg.class) ++ .map(argTargetNode -> { ++ if (argTargetNode.getBuildTarget().getFlavors().contains(CxxDescriptionEnhancer.SHARED_FLAVOR)) { ++ return false; ++ } ++ return true; ++ }) ++ .orElse(true)) ++ .toImmutableList(); ++ } ++ + private ImmutableList> rulesWithoutBundleLoader( + Iterable> copiedRules, TargetNode bundleLoader) { + return RichStream.from(copiedRules).filter(x -> !bundleLoader.equals(x)).toImmutableList(); +@@ -2316,8 +2333,9 @@ public class ProjectGenerator { + .transform( + bundleExtension -> { + switch (bundleExtension) { +- case APP: + case APPEX: ++ return false; ++ case APP: + case PLUGIN: + case BUNDLE: + case XCTEST: +@@ -2515,7 +2533,7 @@ public class ProjectGenerator { + + librarySearchPaths.add("$DT_TOOLCHAIN_DIR/usr/lib/swift/$PLATFORM_NAME"); + if (options.shouldLinkSystemSwift()) { +- librarySearchPaths.add("$DT_TOOLCHAIN_DIR/usr/lib/swift-5.0/$PLATFORM_NAME"); ++ //librarySearchPaths.add("$DT_TOOLCHAIN_DIR/usr/lib/swift-5.0/$PLATFORM_NAME"); + } + } + +@@ -3444,7 +3462,7 @@ public class ProjectGenerator { + + PBXFileReference fileReference = getLibraryFileReference(targetNode); + PBXBuildFile buildFile = new PBXBuildFile(fileReference); +- if (fileReference.getExplicitFileType().equals(Optional.of("wrapper.framework"))) { ++ if (fileReference.getExplicitFileType().equals(Optional.of("wrapper.framework")) || fileReference.getExplicitFileType().equals(Optional.of("compiled.mach-o.dylib"))) { + UnflavoredBuildTargetView buildTarget = + targetNode.getBuildTarget().getUnflavoredBuildTarget(); + if (frameworkTargets.contains(buildTarget)) { +@@ -4696,6 +4714,9 @@ public class ProjectGenerator { + + private static boolean bundleRequiresRemovalOfAllTransitiveFrameworks( + TargetNode targetNode) { ++ if (targetNode.getConstructorArg().getXcodeProductType().equals(Optional.of("com.apple.product-type.app-extension"))) { ++ return true; ++ } + return isFrameworkBundle(targetNode.getConstructorArg()); + } + diff --git a/tools/buck/prepare_buck_source.sh b/tools/buck/prepare_buck_source.sh new file mode 100644 index 0000000000..ebf91824a2 --- /dev/null +++ b/tools/buck/prepare_buck_source.sh @@ -0,0 +1,48 @@ +#!/bin/bash + +set -x +set -e + +target_directory="$1" + +if [ -z "$target_directory" ]; then + echo "Usage: sh prepare_buck_source.sh path/to/target/directory" + exit 1 +fi + +mkdir -p "$target_directory" + +patch_file="$(ls *.patch | head -1)" +patch_path="$(pwd)/$patch_file" + +if [ -z "$patch_file" ]; then + echo "There should be a patch-COMMIT_SHA.patch in the current directory" + exit 1 +fi + +commit_sha="$(echo "$patch_file" | sed -e 's/buck-//g' | sed -e 's/\.patch//g')" + +echo "Fetching commit $commit_sha" + +dir="$(pwd)" +cd "$target_directory" + +if [ ! -d "buck" ]; then + git clone "https://github.com/facebook/buck.git" +fi + +cd "buck" + +git reset --hard +git reset --hard "$commit_sha" + +git apply --check "$patch_path" +git apply "$patch_path" + +ant + +./bin/buck build --show-output buck + +#result_path="$(pwd)/buck-out/gen/programs/buck.pex" + +cd "$dir"