[Cleanup] Remove deprecated APIs (#529)

* Remove preferredFrameSize

* Remove -measure:

* Remove -measureWithSizeRange:

* Remove ASLayoutable

* Remove .name

* Remove deprecated style forwardings

That includes following properties that are declared on ASDisplayNode and ASLayoutSpec: spacingBefore, spacingAfter, flexGrow, flexShrink, flexBasis, alignSelf, ascender, descender, sizeRange and layoutPosition.

* Remove usesImplicitHierarchyManagement

* Remove deprecated range update callbacks:
-visibilityDidChange:
-visibleStateDidChange:
-displayStateDidChange:
-loadStateDidChange:

* Remove -clearFetchedData

* Remove -cancelLayoutTransitionsInProgress

* Remve ASDisplayNode+Deprecated.h

* Remove ASLayoutRangeTypeRender and ASLayoutRangeTypeFetchData

* Remove -[ASTableView clearContents]

* Remove reloadDataImmediately

* Remove ASStaticLayoutSpec

* Remove ASDimensionDeprecated

* Remove optional -pagerNode:constrainedSizeForNodeAtIndex: delegate method in ASPagerDelegate

* Remove suppressesInvalidCollectionUpdateExceptions

* Remove -[ASCollectionViewLayoutInspector initWithCollectionView]

* Remove ASVideoPlayerNode.loadAssetWhenNodeBecomesVisible

* Update CHANGELOG

* Update license of ASLayoutSpecTests.m

* Update examples/PagerNode

* Remove ASEnvironmentTraitCollection

* Remove -ASViewController.nodeConstrainedSize

* More on removing ASLayoutable
This commit is contained in:
Huy Nguyen
2017-09-07 19:25:42 +01:00
committed by GitHub
parent 19a9d29aa8
commit 4ba6f451f6
48 changed files with 42 additions and 1015 deletions

View File

@@ -106,7 +106,6 @@
636EA1A41C7FF4EC00EE152F /* NSArray+Diffing.m in Sources */ = {isa = PBXBuildFile; fileRef = DBC452DA1C5BF64600B16017 /* NSArray+Diffing.m */; };
636EA1A51C7FF4EF00EE152F /* ASDefaultPlayButton.m in Sources */ = {isa = PBXBuildFile; fileRef = AEB7B0191C5962EA00662EF4 /* ASDefaultPlayButton.m */; };
680346941CE4052A0009FEB4 /* ASNavigationController.h in Headers */ = {isa = PBXBuildFile; fileRef = 68FC85DC1CE29AB700EDD713 /* ASNavigationController.h */; settings = {ATTRIBUTES = (Public, ); }; };
683489281D70DE3400327501 /* ASDisplayNode+Deprecated.h in Headers */ = {isa = PBXBuildFile; fileRef = 683489271D70DE3400327501 /* ASDisplayNode+Deprecated.h */; settings = {ATTRIBUTES = (Public, ); }; };
68355B341CB579B9001D4E68 /* ASImageNode+AnimatedImage.mm in Sources */ = {isa = PBXBuildFile; fileRef = 68355B2E1CB5799E001D4E68 /* ASImageNode+AnimatedImage.mm */; };
68355B3E1CB57A60001D4E68 /* ASPINRemoteImageDownloader.m in Sources */ = {isa = PBXBuildFile; fileRef = 68355B361CB57A5A001D4E68 /* ASPINRemoteImageDownloader.m */; };
68355B401CB57A69001D4E68 /* ASImageContainerProtocolCategories.m in Sources */ = {isa = PBXBuildFile; fileRef = 68355B381CB57A5A001D4E68 /* ASImageContainerProtocolCategories.m */; };
@@ -129,8 +128,6 @@
6907C25A1DC4ECFE00374C66 /* ASObjectDescriptionHelpers.m in Sources */ = {isa = PBXBuildFile; fileRef = 6907C2571DC4ECFE00374C66 /* ASObjectDescriptionHelpers.m */; };
690C35621E055C5D00069B91 /* ASDimensionInternal.mm in Sources */ = {isa = PBXBuildFile; fileRef = 690C35601E055C5D00069B91 /* ASDimensionInternal.mm */; };
690C35641E055C7B00069B91 /* ASDimensionInternal.h in Headers */ = {isa = PBXBuildFile; fileRef = 690C35631E055C7B00069B91 /* ASDimensionInternal.h */; settings = {ATTRIBUTES = (Public, ); }; };
690C35671E0567C600069B91 /* ASDimensionDeprecated.mm in Sources */ = {isa = PBXBuildFile; fileRef = 690C35651E0567C600069B91 /* ASDimensionDeprecated.mm */; };
690C356B1E05680300069B91 /* ASDimensionDeprecated.h in Headers */ = {isa = PBXBuildFile; fileRef = 690C356A1E05680300069B91 /* ASDimensionDeprecated.h */; settings = {ATTRIBUTES = (Public, ); }; };
690ED58E1E36BCA6000627C0 /* ASLayoutElementStylePrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = 690ED58D1E36BCA6000627C0 /* ASLayoutElementStylePrivate.h */; settings = {ATTRIBUTES = (Private, ); }; };
690ED5961E36D118000627C0 /* ASControlNode+tvOS.h in Headers */ = {isa = PBXBuildFile; fileRef = 690ED5921E36D118000627C0 /* ASControlNode+tvOS.h */; settings = {ATTRIBUTES = (Private, ); }; };
690ED5981E36D118000627C0 /* ASControlNode+tvOS.m in Sources */ = {isa = PBXBuildFile; fileRef = 690ED5931E36D118000627C0 /* ASControlNode+tvOS.m */; };
@@ -627,7 +624,6 @@
4640521B1A3F83C40061C0BA /* ASTableLayoutController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ASTableLayoutController.h; sourceTree = "<group>"; };
4640521C1A3F83C40061C0BA /* ASTableLayoutController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ASTableLayoutController.m; sourceTree = "<group>"; };
4640521D1A3F83C40061C0BA /* ASLayoutController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ASLayoutController.h; sourceTree = "<group>"; };
683489271D70DE3400327501 /* ASDisplayNode+Deprecated.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "ASDisplayNode+Deprecated.h"; sourceTree = "<group>"; };
68355B2E1CB5799E001D4E68 /* ASImageNode+AnimatedImage.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = "ASImageNode+AnimatedImage.mm"; sourceTree = "<group>"; };
68355B361CB57A5A001D4E68 /* ASPINRemoteImageDownloader.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ASPINRemoteImageDownloader.m; sourceTree = "<group>"; };
68355B371CB57A5A001D4E68 /* ASImageContainerProtocolCategories.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ASImageContainerProtocolCategories.h; sourceTree = "<group>"; };
@@ -652,8 +648,6 @@
6907C2571DC4ECFE00374C66 /* ASObjectDescriptionHelpers.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ASObjectDescriptionHelpers.m; sourceTree = "<group>"; };
690C35601E055C5D00069B91 /* ASDimensionInternal.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = ASDimensionInternal.mm; sourceTree = "<group>"; };
690C35631E055C7B00069B91 /* ASDimensionInternal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ASDimensionInternal.h; sourceTree = "<group>"; };
690C35651E0567C600069B91 /* ASDimensionDeprecated.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = ASDimensionDeprecated.mm; sourceTree = "<group>"; };
690C356A1E05680300069B91 /* ASDimensionDeprecated.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ASDimensionDeprecated.h; sourceTree = "<group>"; };
690ED58D1E36BCA6000627C0 /* ASLayoutElementStylePrivate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ASLayoutElementStylePrivate.h; sourceTree = "<group>"; };
690ED5921E36D118000627C0 /* ASControlNode+tvOS.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "ASControlNode+tvOS.h"; sourceTree = "<group>"; };
690ED5931E36D118000627C0 /* ASControlNode+tvOS.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "ASControlNode+tvOS.m"; sourceTree = "<group>"; };
@@ -1081,7 +1075,6 @@
058D09D9195D050800B7D73C /* ASDisplayNode.mm */,
68B027791C1A79CC0041016B /* ASDisplayNode+Beta.h */,
90FC784E1E4BFE1B00383C5A /* ASDisplayNode+Yoga.mm */,
683489271D70DE3400327501 /* ASDisplayNode+Deprecated.h */,
058D09DA195D050800B7D73C /* ASDisplayNode+Subclasses.h */,
CC034A071E60BEB400626263 /* ASDisplayNode+Convenience.h */,
CC034A081E60BEB400626263 /* ASDisplayNode+Convenience.m */,
@@ -1524,8 +1517,6 @@
ACF6ED041B17843500DA7C62 /* ASCenterLayoutSpec.mm */,
ACF6ED071B17843500DA7C62 /* ASDimension.h */,
ACF6ED081B17843500DA7C62 /* ASDimension.mm */,
690C356A1E05680300069B91 /* ASDimensionDeprecated.h */,
690C35651E0567C600069B91 /* ASDimensionDeprecated.mm */,
690C35631E055C7B00069B91 /* ASDimensionInternal.h */,
690C35601E055C5D00069B91 /* ASDimensionInternal.mm */,
ACF6ED091B17843500DA7C62 /* ASInsetLayoutSpec.h */,
@@ -1731,8 +1722,6 @@
696F01EC1DD2AF450049FBD5 /* ASEventLog.h in Headers */,
690C35641E055C7B00069B91 /* ASDimensionInternal.h in Headers */,
3917EBD41E9C2FC400D04A01 /* _ASCollectionReusableView.h in Headers */,
690C356B1E05680300069B91 /* ASDimensionDeprecated.h in Headers */,
683489281D70DE3400327501 /* ASDisplayNode+Deprecated.h in Headers */,
698371DB1E4379CD00437585 /* ASNodeController+Beta.h in Headers */,
6907C2581DC4ECFE00374C66 /* ASObjectDescriptionHelpers.h in Headers */,
69E0E8A71D356C9400627613 /* ASEqualityHelpers.h in Headers */,
@@ -2204,7 +2193,6 @@
CCCCCCE41EC3EF060087FE10 /* NSParagraphStyle+ASText.m in Sources */,
8BBBAB8D1CEBAF1E00107FC6 /* ASDefaultPlaybackButton.m in Sources */,
B30BF6541C59D889004FCD53 /* ASLayoutManager.m in Sources */,
690C35671E0567C600069B91 /* ASDimensionDeprecated.mm in Sources */,
92DD2FE71BF4D0850074C9DD /* ASMapNode.mm in Sources */,
CCA282B91E9EA8E40037E8B7 /* AsyncDisplayKit+Tips.m in Sources */,
636EA1A51C7FF4EF00EE152F /* ASDefaultPlayButton.m in Sources */,

View File

@@ -15,6 +15,7 @@
- Change the API for disabling logging from a compiler flag to a runtime C function ASDisableLogging(). [Adlai Holler](https://github.com/Adlai-Holler) [#528](https://github.com/TextureGroup/Texture/pull/528)
- Table and collection views to consider content inset when calculating (default) element size range [Huy Nguyen](https://github.com/nguyenhuy) [#525](https://github.com/TextureGroup/Texture/pull/525)
- [ASEditableTextNode] added -editableTextNodeShouldBeginEditing to ASEditableTextNodeDelegate to mirror the corresponding method from UITextViewDelegate. [Yan S.](https://github.com/yans) [#535](https://github.com/TextureGroup/Texture/pull/535)
- [Breaking] Remove APIs that have been deprecated since 2.0 and/or for at least 6 months [Huy Nguyen](https://github.com/nguyenhuy) [#529](https://github.com/TextureGroup/Texture/pull/529)
##2.4
- Fix an issue where inserting/deleting sections could lead to inconsistent supplementary element behavior. [Adlai Holler](https://github.com/Adlai-Holler)

View File

@@ -524,16 +524,6 @@ NS_ASSUME_NONNULL_BEGIN
@interface ASCollectionNode (Deprecated)
/**
* Reload everything from scratch, destroying the working range and all cached nodes.
*
* @warning This method is substantially more expensive than UICollectionView's version.
*
* @deprecated This method is deprecated in 2.0. Use @c reloadDataWithCompletion: and
* then @c waitUntilAllUpdatesAreProcessed instead.
*/
- (void)reloadDataImmediately ASDISPLAYNODE_DEPRECATED_MSG("Use -reloadData / -reloadDataWithCompletion: followed by -waitUntilAllUpdatesAreProcessed instead.");
- (void)waitUntilAllUpdatesAreCommitted ASDISPLAYNODE_DEPRECATED_MSG("This method has been renamed to -waitUntilAllUpdatesAreProcessed.");
@end

View File

@@ -753,13 +753,6 @@
[self reloadDataWithCompletion:nil];
}
- (void)reloadDataImmediately
{
ASDisplayNodeAssertMainThread();
[self reloadData];
[self waitUntilAllUpdatesAreProcessed];
}
- (void)relayoutItems
{
ASDisplayNodeAssertMainThread();

View File

@@ -280,14 +280,6 @@ NS_ASSUME_NONNULL_BEGIN
*/
- (void)reloadData AS_UNAVAILABLE("Use ASCollectionNode method instead.");
/**
* Reload everything from scratch entirely on the main thread, destroying the working range and all cached nodes.
*
* @warning This method is substantially more expensive than UICollectionView's version and will block the main thread
* while all the cells load.
*/
- (void)reloadDataImmediately AS_UNAVAILABLE("Use ASCollectionNode method instead.");
/**
* Triggers a relayout of all nodes.
*

View File

@@ -61,19 +61,6 @@ typedef struct {
@interface ASDisplayNode (Beta)
/**
* 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.
*
* 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.
*/
+ (BOOL)suppressesInvalidCollectionUpdateExceptions AS_WARN_UNUSED_RESULT ASDISPLAYNODE_DEPRECATED_MSG("Collection update exceptions are thrown if assertions are enabled.");
+ (void)setSuppressesInvalidCollectionUpdateExceptions:(BOOL)suppresses ASDISPLAYNODE_DEPRECATED_MSG("Collection update exceptions are thrown if assertions are enabled.");
/**
* @abstract Recursively ensures node and all subnodes are displayed.
* @see Full documentation in ASDisplayNode+FrameworkPrivate.h

View File

@@ -1,142 +0,0 @@
//
// ASDisplayNode+Deprecated.h
// Texture
//
// Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
// This source code is licensed under the BSD-style license found in the
// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional
// grant of patent rights can be found in the PATENTS file in the same directory.
//
// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present,
// Pinterest, Inc. 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
//
#pragma once
#import <AsyncDisplayKit/ASDisplayNode.h>
@interface ASDisplayNode (Deprecated)
/**
* @abstract 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 *name ASDISPLAYNODE_DEPRECATED_MSG("Use .debugName instead.");
/**
* @abstract Provides a default intrinsic content size for calculateSizeThatFits:. This is useful when laying out
* a node that either has 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.
*
* @return Try to create a CGSize for preferredFrameSize of this node from the width and height property of this node. It will return CGSizeZero if width and height dimensions are not of type ASDimensionUnitPoints.
*
* @deprecated Deprecated in version 2.0: Just calls through to set the height and width property of the node. Convert to use sizing properties instead: height, minHeight, maxHeight, width, minWidth, maxWidth.
*/
@property (nonatomic, assign, readwrite) CGSize preferredFrameSize ASDISPLAYNODE_DEPRECATED_MSG("Use .style.preferredSize instead OR set individual values with .style.height and .style.width.");
/**
* @abstract Asks the node to measure and return the size that best fits its subnodes.
*
* @param constrainedSize The maximum size the receiver should fit in.
*
* @return 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.
*
* @see measureWithSizeRange:
* @see [ASDisplayNode(Subclassing) calculateLayoutThatFits:]
*
* @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 ASDISPLAYNODE_DEPRECATED_MSG("Use layoutThatFits: with a constrained size of (CGSizeZero, constrainedSize) and call size on the returned ASLayout.");
ASLayoutElementStyleForwardingDeclaration
/**
* @abstract Called whenever the visiblity of the node changed.
*
* @discussion Subclasses may use this to monitor when they become visible.
*
* @deprecated @see didEnterVisibleState @see didExitVisibleState
*/
- (void)visibilityDidChange:(BOOL)isVisible ASDISPLAYNODE_REQUIRES_SUPER ASDISPLAYNODE_DEPRECATED_MSG("Use -didEnterVisibleState / -didExitVisibleState instead.");
/**
* @abstract Called whenever the visiblity of the node changed.
*
* @discussion Subclasses may use this to monitor when they become visible.
*
* @deprecated @see didEnterVisibleState @see didExitVisibleState
*/
- (void)visibleStateDidChange:(BOOL)isVisible ASDISPLAYNODE_REQUIRES_SUPER ASDISPLAYNODE_DEPRECATED_MSG("Use -didEnterVisibleState / -didExitVisibleState instead.");
/**
* @abstract Called whenever the the node has entered or exited the display state.
*
* @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.
*
* @deprecated @see didEnterDisplayState @see didExitDisplayState
*/
- (void)displayStateDidChange:(BOOL)inDisplayState ASDISPLAYNODE_REQUIRES_SUPER ASDISPLAYNODE_DEPRECATED_MSG("Use -didEnterDisplayState / -didExitDisplayState instead.");
/**
* @abstract Called whenever the the node has entered or left the load state.
*
* @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.
*
* @deprecated @see didEnterPreloadState @see didExitPreloadState
*/
- (void)loadStateDidChange:(BOOL)inLoadState ASDISPLAYNODE_REQUIRES_SUPER ASDISPLAYNODE_DEPRECATED_MSG("Use -didEnterPreloadState / -didExitPreloadState instead.");
/**
* @abstract Cancels all performing layout transitions. Can be called on any thread.
*
* @deprecated Deprecated in version 2.0: Use cancelLayoutTransition
*/
- (void)cancelLayoutTransitionsInProgress ASDISPLAYNODE_DEPRECATED_MSG("Use -cancelLayoutTransition instead.");
/**
* @abstract 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.
*
* @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.
*
* @deprecated Deprecated in version 2.0: Use automaticallyManagesSubnodes
*/
@property (nonatomic, assign) BOOL usesImplicitHierarchyManagement ASDISPLAYNODE_DEPRECATED_MSG("Set .automaticallyManagesSubnodes instead.");
/**
* @abstract Indicates that the node should fetch any external data, such as images.
*
* @discussion Subclasses may override this method to be notified when they should begin to preload. 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.
*/
- (void)fetchData ASDISPLAYNODE_REQUIRES_SUPER ASDISPLAYNODE_DEPRECATED_MSG("Use -didEnterPreloadState instead.");
/**
* Provides an opportunity to clear any fetched data (e.g. remote / network or database-queried) on the current node.
*
* @discussion This will not clear data recursively for all subnodes. Either call -recursivelyClearPreloadedData or
* selectively clear fetched data.
*/
- (void)clearFetchedData ASDISPLAYNODE_REQUIRES_SUPER ASDISPLAYNODE_DEPRECATED_MSG("Use -didExitPreloadState instead.");
@end

View File

@@ -57,15 +57,6 @@
#pragma mark Measurement Pass
- (ASLayout *)layoutThatFits:(ASSizeRange)constrainedSize
{
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
// For now we just call the deprecated measureWithSizeRange: method to not break old API
return [self measureWithSizeRange:constrainedSize];
#pragma clang diagnostic pop
}
- (ASLayout *)measureWithSizeRange:(ASSizeRange)constrainedSize
{
return [self layoutThatFits:constrainedSize parentSize:constrainedSize.max];
}
@@ -127,8 +118,6 @@ ASLayoutElementStyleExtensibilityForwarding
return [ASTraitCollection traitCollectionWithASPrimitiveTraitCollection:self.primitiveTraitCollection];
}
ASPrimitiveTraitCollectionDeprecatedImplementation
#pragma mark - ASLayoutElementAsciiArtProtocol
- (NSString *)asciiArtString
@@ -938,7 +927,7 @@ ASPrimitiveTraitCollectionDeprecatedImplementation
// Grab lock after calling out to subclass
ASDN::MutexLocker l(__instanceLock__);
// We generate placeholders at measureWithSizeRange: time so that a node is guaranteed to have a placeholder ready to go.
// We generate placeholders at -layoutThatFits: time so that a node is guaranteed to have a placeholder ready to go.
// This is also because measurement is usually asynchronous, but placeholders need to be set up synchronously.
// First measurement is guaranteed to be before the node is onscreen, so we can create the image async. but still have it appear sync.
if (_placeholderEnabled && !_placeholderImage && [self _locked_displaysAsynchronously]) {

View File

@@ -116,12 +116,12 @@ NS_ASSUME_NONNULL_BEGIN
* @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:.
* Note: .calculatedLayout will only be set for nodes that have had -layoutThatFits: called on them.
* For manual layout, make sure you call -layoutThatFits: 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,
* the ASLayoutSpec implementation will automatically call -layoutThatFits: on all of the subnodes,
* and the ASDisplayNode base class implementation of -layout will automatically make use of .calculatedLayout on the subnodes.
*
* @return Layout that wraps calculated size returned by -calculateSizeThatFits: (in manual layout mode),
@@ -183,7 +183,7 @@ NS_ASSUME_NONNULL_BEGIN
* 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.
* @note This method should not be called directly outside of ASDisplayNode; use -layoutThatFits: or -calculatedLayout instead.
*/
- (ASLayout *)calculateLayoutThatFits:(ASSizeRange)constrainedSize;

View File

@@ -785,7 +785,7 @@ extern NSInteger const ASDefaultDrawingPriority;
* @abstract Return the calculated size.
*
* @discussion Ideal for use by subclasses in -layout, having already prompted their subnodes to calculate their size by
* calling -measure: on them in -calculateLayoutThatFits.
* calling -layoutThatFits: on them in -calculateLayoutThatFits.
*
* @return Size already calculated by -calculateLayoutThatFits:.
*

View File

@@ -20,7 +20,6 @@
#import <AsyncDisplayKit/ASDisplayNode+Ancestry.h>
#import <AsyncDisplayKit/ASDisplayNode+FrameworkSubclasses.h>
#import <AsyncDisplayKit/ASDisplayNode+Beta.h>
#import <AsyncDisplayKit/ASDisplayNode+Deprecated.h>
#import <AsyncDisplayKit/AsyncDisplayKit+Debug.h>
#import <AsyncDisplayKit/ASLayoutSpec+Subclasses.h>
#import <AsyncDisplayKit/ASCellNode+Internal.h>
@@ -77,19 +76,8 @@ NSInteger const ASDefaultDrawingPriority = ASDefaultTransactionPriority;
@synthesize threadSafeBounds = _threadSafeBounds;
static BOOL suppressesInvalidCollectionUpdateExceptions = NO;
static std::atomic_bool storesUnflattenedLayouts = ATOMIC_VAR_INIT(NO);
+ (BOOL)suppressesInvalidCollectionUpdateExceptions
{
return suppressesInvalidCollectionUpdateExceptions;
}
+ (void)setSuppressesInvalidCollectionUpdateExceptions:(BOOL)suppresses
{
suppressesInvalidCollectionUpdateExceptions = suppresses;
}
BOOL ASDisplayNodeSubclassOverridesSelector(Class subclass, SEL selector)
{
return ASSubclassOverridesSelector([ASDisplayNode class], subclass, selector);
@@ -182,12 +170,6 @@ static ASDisplayNodeMethodOverrides GetASDisplayNodeMethodOverrides(Class c)
if (ASDisplayNodeSubclassOverridesSelector(c, @selector(calculateSizeThatFits:))) {
overrides |= ASDisplayNodeMethodOverrideCalcSizeThatFits;
}
if (ASDisplayNodeSubclassOverridesSelector(c, @selector(fetchData))) {
overrides |= ASDisplayNodeMethodOverrideFetchData;
}
if (ASDisplayNodeSubclassOverridesSelector(c, @selector(clearFetchedData))) {
overrides |= ASDisplayNodeMethodOverrideClearFetchedData;
}
return overrides;
}
@@ -202,8 +184,6 @@ static ASDisplayNodeMethodOverrides GetASDisplayNodeMethodOverrides(Class c)
ASDisplayNodeAssert(!ASDisplayNodeSubclassOverridesSelector(self, @selector(calculatedSize)), @"Subclass %@ must not override calculatedSize method.", classString);
ASDisplayNodeAssert(!ASDisplayNodeSubclassOverridesSelector(self, @selector(calculatedLayout)), @"Subclass %@ must not override calculatedLayout method.", classString);
ASDisplayNodeAssert(!ASDisplayNodeSubclassOverridesSelector(self, @selector(measure:)), @"Subclass %@ must not override measure: method", classString);
ASDisplayNodeAssert(!ASDisplayNodeSubclassOverridesSelector(self, @selector(measureWithSizeRange:)), @"Subclass %@ must not override measureWithSizeRange: method. Instead override calculateLayoutThatFits:", classString);
ASDisplayNodeAssert(!ASDisplayNodeSubclassOverridesSelector(self, @selector(layoutThatFits:)), @"Subclass %@ must not override layoutThatFits: method. Instead override calculateLayoutThatFits:.", classString);
ASDisplayNodeAssert(!ASDisplayNodeSubclassOverridesSelector(self, @selector(layoutThatFits:parentSize:)), @"Subclass %@ must not override layoutThatFits:parentSize method. Instead override calculateLayoutThatFits:.", classString);
ASDisplayNodeAssert(!ASDisplayNodeSubclassOverridesSelector(self, @selector(recursivelyClearContents)), @"Subclass %@ must not override recursivelyClearContents method.", classString);
@@ -906,7 +886,7 @@ static ASDisplayNodeMethodOverrides GetASDisplayNodeMethodOverrides(Class c)
if (CGRectEqualToRect(bounds, CGRectZero)) {
// Performing layout on a zero-bounds view often results in frame calculations
// with negative sizes after applying margins, which will cause
// measureWithSizeRange: on subnodes to assert.
// layoutThatFits: on subnodes to assert.
as_log_debug(OS_LOG_DISABLED, "Warning: No size given for node before node was trying to layout itself: %@. Please provide a frame for the node.", self);
return;
}
@@ -2935,13 +2915,6 @@ ASDISPLAYNODE_INLINE BOOL subtreeIsRasterized(ASDisplayNode *node) {
ASDisplayNodeAssertMainThread();
ASDisplayNodeAssertLockUnownedByCurrentThread(__instanceLock__);
[_interfaceStateDelegate didEnterPreloadState];
if (_methodOverrides & ASDisplayNodeMethodOverrideFetchData) {
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
[self fetchData];
#pragma clang diagnostic pop
}
}
- (void)didExitPreloadState
@@ -2949,13 +2922,6 @@ ASDISPLAYNODE_INLINE BOOL subtreeIsRasterized(ASDisplayNode *node) {
ASDisplayNodeAssertMainThread();
ASDisplayNodeAssertLockUnownedByCurrentThread(__instanceLock__);
[_interfaceStateDelegate didExitPreloadState];
if (_methodOverrides & ASDisplayNodeMethodOverrideClearFetchedData) {
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
[self clearFetchedData];
#pragma clang diagnostic pop
}
}
- (void)clearContents
@@ -3504,101 +3470,3 @@ static const char *ASDisplayNodeAssociatedNodeKey = "ASAssociatedNode";
}
@end
#pragma mark - ASDisplayNode (Deprecated)
@implementation ASDisplayNode (Deprecated)
- (NSString *)name
{
return self.debugName;
}
- (void)setName:(NSString *)name
{
self.debugName = name;
}
- (void)setPreferredFrameSize:(CGSize)preferredFrameSize
{
// Deprecated preferredFrameSize just calls through to set width and height
self.style.preferredSize = preferredFrameSize;
[self setNeedsLayout];
}
- (CGSize)preferredFrameSize
{
ASLayoutSize size = self.style.preferredLayoutSize;
BOOL isPoints = (size.width.unit == ASDimensionUnitPoints && size.height.unit == ASDimensionUnitPoints);
return isPoints ? CGSizeMake(size.width.value, size.height.value) : CGSizeZero;
}
- (BOOL)usesImplicitHierarchyManagement
{
return self.automaticallyManagesSubnodes;
}
- (void)setUsesImplicitHierarchyManagement:(BOOL)enabled
{
self.automaticallyManagesSubnodes = enabled;
}
- (CGSize)measure:(CGSize)constrainedSize
{
return [self layoutThatFits:ASSizeRangeMake(CGSizeZero, constrainedSize)].size;
}
ASLayoutElementStyleForwarding
- (void)visibilityDidChange:(BOOL)isVisible
{
if (isVisible) {
[self didEnterVisibleState];
} else {
[self didExitVisibleState];
}
}
- (void)visibleStateDidChange:(BOOL)isVisible
{
if (isVisible) {
[self didEnterVisibleState];
} else {
[self didExitVisibleState];
}
}
- (void)displayStateDidChange:(BOOL)inDisplayState
{
if (inDisplayState) {
[self didEnterVisibleState];
} else {
[self didExitVisibleState];
}
}
- (void)loadStateDidChange:(BOOL)inLoadState
{
if (inLoadState) {
[self didEnterPreloadState];
} else {
[self didExitPreloadState];
}
}
- (void)fetchData
{
// subclass override
}
- (void)clearFetchedData
{
// subclass override
}
- (void)cancelLayoutTransitionsInProgress
{
[self cancelLayoutTransition];
}
@end

View File

@@ -61,18 +61,6 @@ NS_ASSUME_NONNULL_BEGIN
@end
@protocol ASPagerDelegate <ASCollectionDelegate>
@optional
/**
* Provides the constrained size range for measuring the node at the index.
*
* @param pagerNode The sender.
* @param index The index of the node.
* @return A constrained size range for layout the node at this index.
*/
- (ASSizeRange)pagerNode:(ASPagerNode *)pagerNode constrainedSizeForNodeAtIndex:(NSInteger)index ASDISPLAYNODE_DEPRECATED_MSG("Pages in a pager node should be the exact size of the collection node (default behavior).");
@end
/**

View File

@@ -39,9 +39,6 @@
} _pagerDataSourceFlags;
__weak id <ASPagerDelegate> _pagerDelegate;
struct {
unsigned constrainedSizeForNode:1;
} _pagerDelegateFlags;
ASPagerNodeProxy *_proxyDelegate;
}
@@ -181,13 +178,6 @@
- (ASSizeRange)collectionNode:(ASCollectionNode *)collectionNode constrainedSizeForItemAtIndexPath:(NSIndexPath *)indexPath
{
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
if (_pagerDelegateFlags.constrainedSizeForNode) {
return [_pagerDelegate pagerNode:self constrainedSizeForNodeAtIndex:indexPath.item];
}
#pragma clang diagnostic pop
return ASSizeRangeMake([self pageSize]);
}
@@ -220,15 +210,7 @@
{
if (delegate != _pagerDelegate) {
_pagerDelegate = delegate;
if (delegate == nil) {
memset(&_pagerDelegateFlags, 0, sizeof(_pagerDelegateFlags));
} else {
_pagerDelegateFlags.constrainedSizeForNode = [_pagerDelegate respondsToSelector:@selector(pagerNode:constrainedSizeForNodeAtIndex:)];
}
_proxyDelegate = delegate ? [[ASPagerNodeProxy alloc] initWithTarget:delegate interceptor:self] : nil;
super.delegate = (id <ASCollectionDelegate>)_proxyDelegate;
}
}

View File

@@ -184,14 +184,6 @@ NS_ASSUME_NONNULL_BEGIN
*/
- (void)reloadData ASDISPLAYNODE_DEPRECATED_MSG("Use ASTableNode method instead.");
/**
* Reload everything from scratch entirely on the main thread, destroying the working range and all cached nodes.
*
* @warning This method is substantially more expensive than UITableView's version and will block the main thread while
* all the cells load.
*/
- (void)reloadDataImmediately ASDISPLAYNODE_DEPRECATED_MSG("Use ASTableNode's reloadDataWithCompletion: followed by ASTableNode's -waitUntilAllUpdatesAreCommitted instead.");
/**
* Triggers a relayout of all nodes.
*
@@ -241,12 +233,6 @@ NS_ASSUME_NONNULL_BEGIN
- (void)moveRowAtIndexPath:(NSIndexPath *)indexPath toIndexPath:(NSIndexPath *)newIndexPath ASDISPLAYNODE_DEPRECATED_MSG("Use ASTableNode method instead.");
/// Deprecated in 2.0. You should not call this method.
- (void)clearContents ASDISPLAYNODE_DEPRECATED_MSG("You should not call this method directly. Intead, rely on the Interstate State callback methods.");
/// Deprecated in 2.0. You should not call this method.
- (void)clearFetchedData ASDISPLAYNODE_DEPRECATED_MSG("You should not call this method directly. Intead, rely on the Interstate State callback methods.");
- (void)setContentOffset:(CGPoint)contentOffset animated:(BOOL)animated ASDISPLAYNODE_DEPRECATED_MSG("Use ASTableNode method instead.");
@end

View File

@@ -544,13 +544,6 @@ static NSString * const kCellReuseIdentifier = @"_ASTableViewCell";
[self reloadDataWithCompletion:nil];
}
- (void)reloadDataImmediately
{
ASDisplayNodeAssertMainThread();
[self reloadData];
[_dataController waitUntilAllUpdatesAreProcessed];
}
- (void)scrollToRowAtIndexPath:(NSIndexPath *)indexPath atScrollPosition:(UITableViewScrollPosition)scrollPosition animated:(BOOL)animated
{
if ([self validateIndexPath:indexPath]) {

View File

@@ -44,8 +44,6 @@ NS_ASSUME_NONNULL_BEGIN
@property (nonatomic, assign) BOOL controlsDisabled;
@property (nonatomic, assign, readonly) BOOL loadAssetWhenNodeBecomesVisible ASDISPLAYNODE_DEPRECATED_MSG("Asset is always loaded when this node enters preload state. This flag does nothing.");
#pragma mark - ASVideoNode property proxy
/**
* When shouldAutoplay is set to true, a video node will play when it has both loaded and entered the "visible" interfaceState.
@@ -79,12 +77,6 @@ NS_ASSUME_NONNULL_BEGIN
- (instancetype)initWithAsset:(AVAsset *)asset;
- (instancetype)initWithAsset:(AVAsset *)asset videoComposition:(AVVideoComposition *)videoComposition audioMix:(AVAudioMix *)audioMix;
#pragma mark Lifecycle Deprecated
- (instancetype)initWithUrl:(NSURL *)url ASDISPLAYNODE_DEPRECATED_MSG("Asset is always loaded when this node enters preload state, therefore loadAssetWhenNodeBecomesVisible is deprecated and not used anymore.");
- (instancetype)initWithUrl:(NSURL *)url loadAssetWhenNodeBecomesVisible:(BOOL)loadAssetWhenNodeBecomesVisible ASDISPLAYNODE_DEPRECATED_MSG("Asset is always loaded when this node enters preload state, therefore loadAssetWhenNodeBecomesVisible is deprecated and not used anymore.");
- (instancetype)initWithAsset:(AVAsset *)asset loadAssetWhenNodeBecomesVisible:(BOOL)loadAssetWhenNodeBecomesVisible ASDISPLAYNODE_DEPRECATED_MSG("Asset is always loaded when this node enters preload state, therefore loadAssetWhenNodeBecomesVisible is deprecated and not used anymore.");
- (instancetype)initWithAsset:(AVAsset *)asset videoComposition:(AVVideoComposition *)videoComposition audioMix:(AVAudioMix *)audioMix loadAssetWhenNodeBecomesVisible:(BOOL)loadAssetWhenNodeBecomesVisible ASDISPLAYNODE_DEPRECATED_MSG("Asset is always loaded when this node enters preload state, therefore loadAssetWhenNodeBecomesVisible is deprecated and not used anymore.");
#pragma mark - Public API
- (void)seekToTime:(CGFloat)percentComplete;
- (void)play;

View File

@@ -154,28 +154,6 @@ static void *ASVideoPlayerNodeContext = &ASVideoPlayerNodeContext;
[self addSubnode:_videoNode];
}
#pragma mark Deprecated
- (instancetype)initWithUrl:(NSURL *)url
{
return [self initWithURL:url];
}
- (instancetype)initWithUrl:(NSURL *)url loadAssetWhenNodeBecomesVisible:(BOOL)loadAssetWhenNodeBecomesVisible
{
return [self initWithURL:url];
}
- (instancetype)initWithAsset:(AVAsset *)asset loadAssetWhenNodeBecomesVisible:(BOOL)loadAssetWhenNodeBecomesVisible
{
return [self initWithAsset:asset];
}
- (instancetype)initWithAsset:(AVAsset *)asset videoComposition:(AVVideoComposition *)videoComposition audioMix:(AVAudioMix *)audioMix loadAssetWhenNodeBecomesVisible:(BOOL)loadAssetWhenNodeBecomesVisible
{
return [self initWithAsset:asset videoComposition:videoComposition audioMix:audioMix];
}
#pragma mark - Setter / Getter
- (void)setAssetURL:(NSURL *)assetURL

View File

@@ -92,17 +92,4 @@ NS_ASSUME_NONNULL_BEGIN
@end
@interface ASViewController (Deprecated)
/**
* The constrained size used to measure the backing node.
*
* @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.
*/
- (ASSizeRange)nodeConstrainedSize AS_WARN_UNUSED_RESULT ASDISPLAYNODE_DEPRECATED_MSG("Set the size directly to the view's frame");
@end
NS_ASSUME_NONNULL_END

View File

@@ -146,12 +146,9 @@
[self propagateNewTraitCollection:traitCollection];
}];
} else {
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
// Call layoutThatFits: to let the node prepare for a layout that will happen shortly in the layout pass of the view.
// If the node's constrained size didn't change between the last layout pass it's a no-op
[_node layoutThatFits:[self nodeConstrainedSize]];
#pragma clang diagnostic pop
}
}
@@ -296,13 +293,10 @@ ASVisibilityDepthImplementation;
ASTraitCollectionPropagateDown(child, traitCollection);
}
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
// Once we've propagated all the traits, layout this node.
// Remeasure the node with the latest constrained size old constrained size may be incorrect.
as_activity_scope_verbose(as_activity_create("Layout ASViewController node with new traits", AS_ACTIVITY_CURRENT, OS_ACTIVITY_FLAG_DEFAULT));
[_node layoutThatFits:[self nodeConstrainedSize]];
#pragma clang diagnostic pop
}
}

View File

@@ -75,7 +75,6 @@
#import <AsyncDisplayKit/ASLayout.h>
#import <AsyncDisplayKit/ASDimension.h>
#import <AsyncDisplayKit/ASDimensionInternal.h>
#import <AsyncDisplayKit/ASDimensionDeprecated.h>
#import <AsyncDisplayKit/ASLayoutElement.h>
#import <AsyncDisplayKit/ASLayoutSpec.h>
#import <AsyncDisplayKit/ASBackgroundLayoutSpec.h>
@@ -125,7 +124,6 @@
#import <AsyncDisplayKit/AsyncDisplayKit+Debug.h>
#import <AsyncDisplayKit/AsyncDisplayKit+Tips.h>
#import <AsyncDisplayKit/ASDisplayNode+Deprecated.h>
#import <AsyncDisplayKit/IGListAdapter+AsyncDisplayKit.h>
#import <AsyncDisplayKit/AsyncDisplayKit+IGListKitMethods.h>

View File

@@ -86,9 +86,6 @@ extern ASSizeRange NodeConstrainedSizeForScrollDirection(ASCollectionView *colle
* @warning This class is not meant to be subclassed and will be restricted in the future.
*/
@interface ASCollectionViewLayoutInspector : NSObject <ASCollectionViewLayoutInspecting>
- (instancetype)initWithCollectionView:(ASCollectionView *)collectionView ASDISPLAYNODE_DEPRECATED_MSG("Use -init instead.");
@end
NS_ASSUME_NONNULL_END

View File

@@ -47,13 +47,6 @@ ASSizeRange NodeConstrainedSizeForScrollDirection(ASCollectionView *collectionVi
} _delegateFlags;
}
#pragma mark Lifecycle
- (instancetype)initWithCollectionView:(ASCollectionView *)collectionView
{
return [self init];
}
#pragma mark ASCollectionViewLayoutInspecting
- (void)didChangeCollectionViewDelegate:(id<ASCollectionDelegate>)delegate

View File

@@ -74,6 +74,3 @@ typedef NS_ENUM(NSInteger, ASLayoutRangeType) {
};
static NSInteger const ASLayoutRangeTypeCount = 2;
#define ASLayoutRangeTypeRender ASLayoutRangeTypeDisplay
#define ASLayoutRangeTypeFetchData ASLayoutRangeTypePreload

View File

@@ -66,10 +66,6 @@ extern NSString *NSStringFromASPrimitiveTraitCollection(ASPrimitiveTraitCollecti
*/
extern void ASTraitCollectionPropagateDown(id<ASLayoutElement> element, ASPrimitiveTraitCollection traitCollection);
/// For backward compatibility reasons we redefine the old layout element trait collection struct name
#define ASEnvironmentTraitCollection ASPrimitiveTraitCollection
#define ASEnvironmentTraitCollectionMakeDefault ASPrimitiveTraitCollectionMakeDefault
ASDISPLAYNODE_EXTERN_C_END
/**
@@ -92,13 +88,6 @@ ASDISPLAYNODE_EXTERN_C_END
*/
- (ASTraitCollection *)asyncTraitCollection;
/**
* Deprecated and should be replaced by the methods from above
*/
- (ASEnvironmentTraitCollection)environmentTraitCollection;
- (void)setEnvironmentTraitCollection:(ASEnvironmentTraitCollection)traitCollection;
@end
#define ASPrimitiveTraitCollectionDefaults \
@@ -111,16 +100,6 @@ ASDISPLAYNODE_EXTERN_C_END
_primitiveTraitCollection = traitCollection;\
}\
#define ASPrimitiveTraitCollectionDeprecatedImplementation \
- (ASEnvironmentTraitCollection)environmentTraitCollection\
{\
return self.primitiveTraitCollection;\
}\
- (void)setEnvironmentTraitCollection:(ASEnvironmentTraitCollection)traitCollection\
{\
[self setPrimitiveTraitCollection:traitCollection];\
}\
#define ASLayoutElementCollectionTableSetTraitCollection(lock) \
- (void)setPrimitiveTraitCollection:(ASPrimitiveTraitCollection)traitCollection\
{\

View File

@@ -16,7 +16,6 @@
//
#import <AsyncDisplayKit/ASBaseDefines.h>
#import <AsyncDisplayKit/ASDimensionDeprecated.h>
NS_ASSUME_NONNULL_BEGIN
@@ -30,11 +29,6 @@ NS_ASSUME_NONNULL_BEGIN
*/
@property (nonatomic, assign) CGPoint layoutPosition;
#pragma mark Deprecated
@property (nonatomic, assign) ASRelativeSizeRange sizeRange ASDISPLAYNODE_DEPRECATED;
@end
NS_ASSUME_NONNULL_END

View File

@@ -50,13 +50,4 @@ NS_ASSUME_NONNULL_BEGIN
@end
#pragma mark - Deprecated
@interface ASStaticLayoutSpec : ASAbsoluteLayoutSpec
+ (instancetype)staticLayoutSpecWithChildren:(NSArray<id<ASLayoutElement>> *)children AS_WARN_UNUSED_RESULT ASDISPLAYNODE_DEPRECATED;
@end
NS_ASSUME_NONNULL_END

View File

@@ -107,18 +107,3 @@
@end
#pragma mark - ASStaticLayoutSpec
@implementation ASStaticLayoutSpec : ASAbsoluteLayoutSpec
+ (instancetype)staticLayoutSpecWithChildren:(NSArray<id<ASLayoutElement>> *)children
{
return [self absoluteLayoutSpecWithSizing:ASAbsoluteLayoutSpecSizingSizeToFit children:children];
}
- (instancetype)initWithChildren:(NSArray *)children
{
return [super initWithSizing:ASAbsoluteLayoutSpecSizingSizeToFit children:children];
}
@end

View File

@@ -1,102 +0,0 @@
//
// ASDimensionDeprecated.h
// Texture
//
// Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
// This source code is licensed under the BSD-style license found in the
// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional
// grant of patent rights can be found in the PATENTS file in the same directory.
//
// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present,
// Pinterest, Inc. 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
//
#pragma once
#import <AsyncDisplayKit/ASBaseDefines.h>
#import <AsyncDisplayKit/ASDimension.h>
ASDISPLAYNODE_EXTERN_C_BEGIN
NS_ASSUME_NONNULL_BEGIN
/**
* 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.
*/
typedef NS_ENUM(NSInteger, ASRelativeDimensionType) {
/** This indicates "I have no opinion" and may be resolved in whatever way makes most sense given the circumstances. */
ASRelativeDimensionTypeAuto,
/** Just a number. It will always resolve to exactly this amount. This is the default type. */
ASRelativeDimensionTypePoints,
/** Multiplied to a provided parent amount to resolve a final amount. */
ASRelativeDimensionTypeFraction,
};
#define ASRelativeDimension ASDimension
#define ASRelativeSize ASLayoutSize
#define ASRelativeDimensionMakeWithPoints ASDimensionMakeWithPoints
#define ASRelativeDimensionMakeWithFraction ASDimensionMakeWithFraction
/**
* Function is deprecated. Use ASSizeRangeMake instead.
*/
extern AS_WARN_UNUSED_RESULT ASSizeRange ASSizeRangeMakeExactSize(CGSize size) ASDISPLAYNODE_DEPRECATED_MSG("Use ASSizeRangeMake instead.");
/**
Expresses an inclusive range of relative sizes. Used to provide additional constraint to layout.
Used by ASStaticLayoutSpec.
*/
typedef struct {
ASLayoutSize min;
ASLayoutSize max;
} ASRelativeSizeRange;
extern ASRelativeSizeRange const ASRelativeSizeRangeUnconstrained;
#pragma mark - ASRelativeDimension
extern ASDimension ASRelativeDimensionMake(ASRelativeDimensionType type, CGFloat value) ASDISPLAYNODE_DEPRECATED;
#pragma mark - ASRelativeSize
extern ASLayoutSize ASRelativeSizeMake(ASRelativeDimension width, ASRelativeDimension height) ASDISPLAYNODE_DEPRECATED;
/** Convenience constructor to provide size in points. */
extern ASLayoutSize ASRelativeSizeMakeWithCGSize(CGSize size) ASDISPLAYNODE_DEPRECATED;
/** Convenience constructor to provide size as a fraction. */
extern ASLayoutSize ASRelativeSizeMakeWithFraction(CGFloat fraction) ASDISPLAYNODE_DEPRECATED;
extern BOOL ASRelativeSizeEqualToRelativeSize(ASLayoutSize lhs, ASLayoutSize rhs) ASDISPLAYNODE_DEPRECATED;
extern NSString *NSStringFromASRelativeSize(ASLayoutSize size) ASDISPLAYNODE_DEPRECATED;
#pragma mark - ASRelativeSizeRange
extern ASRelativeSizeRange ASRelativeSizeRangeMake(ASLayoutSize min, ASLayoutSize max) ASDISPLAYNODE_DEPRECATED;
#pragma mark Convenience constructors to provide an exact size (min == max).
extern ASRelativeSizeRange ASRelativeSizeRangeMakeWithExactRelativeSize(ASLayoutSize exact) ASDISPLAYNODE_DEPRECATED;
extern ASRelativeSizeRange ASRelativeSizeRangeMakeWithExactCGSize(CGSize exact) ASDISPLAYNODE_DEPRECATED;
extern ASRelativeSizeRange ASRelativeSizeRangeMakeWithExactFraction(CGFloat fraction) ASDISPLAYNODE_DEPRECATED;
extern ASRelativeSizeRange ASRelativeSizeRangeMakeWithExactRelativeDimensions(ASRelativeDimension exactWidth, ASRelativeDimension exactHeight) ASDISPLAYNODE_DEPRECATED;
extern BOOL ASRelativeSizeRangeEqualToRelativeSizeRange(ASRelativeSizeRange lhs, ASRelativeSizeRange rhs) ASDISPLAYNODE_DEPRECATED;
/** Provided a parent size, compute final dimensions for this RelativeSizeRange to arrive at a SizeRange. */
extern ASSizeRange ASRelativeSizeRangeResolve(ASRelativeSizeRange relativeSizeRange, CGSize parentSize) ASDISPLAYNODE_DEPRECATED;
NS_ASSUME_NONNULL_END
ASDISPLAYNODE_EXTERN_C_END

View File

@@ -1,102 +0,0 @@
//
// ASDimensionDeprecated.mm
// Texture
//
// Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
// This source code is licensed under the BSD-style license found in the
// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional
// grant of patent rights can be found in the PATENTS file in the same directory.
//
// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present,
// Pinterest, Inc. 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 <AsyncDisplayKit/ASDimensionDeprecated.h>
ASDimension ASRelativeDimensionMake(ASRelativeDimensionType type, CGFloat value)
{
if (type == ASRelativeDimensionTypePoints) {
return ASDimensionMakeWithPoints(value);
} else if (type == ASRelativeDimensionTypeFraction) {
return ASDimensionMakeWithFraction(value);
}
ASDisplayNodeCAssert(NO, @"ASRelativeDimensionMake does not support the given ASRelativeDimensionType");
return ASDimensionMakeWithPoints(0);
}
ASSizeRange ASSizeRangeMakeExactSize(CGSize size)
{
return ASSizeRangeMake(size);
}
ASRelativeSizeRange const ASRelativeSizeRangeUnconstrained = {};
#pragma mark - ASRelativeSize
ASLayoutSize ASRelativeSizeMake(ASRelativeDimension width, ASRelativeDimension height)
{
return ASLayoutSizeMake(width, height);
}
ASLayoutSize ASRelativeSizeMakeWithCGSize(CGSize size)
{
return ASRelativeSizeMake(ASRelativeDimensionMakeWithPoints(size.width),
ASRelativeDimensionMakeWithPoints(size.height));
}
ASLayoutSize ASRelativeSizeMakeWithFraction(CGFloat fraction)
{
return ASRelativeSizeMake(ASRelativeDimensionMakeWithFraction(fraction),
ASRelativeDimensionMakeWithFraction(fraction));
}
BOOL ASRelativeSizeEqualToRelativeSize(ASLayoutSize lhs, ASLayoutSize rhs)
{
return ASDimensionEqualToDimension(lhs.width, rhs.width)
&& ASDimensionEqualToDimension(lhs.height, rhs.height);
}
#pragma mark - ASRelativeSizeRange
ASRelativeSizeRange ASRelativeSizeRangeMake(ASLayoutSize min, ASLayoutSize max)
{
ASRelativeSizeRange sizeRange; sizeRange.min = min; sizeRange.max = max; return sizeRange;
}
ASRelativeSizeRange ASRelativeSizeRangeMakeWithExactRelativeSize(ASLayoutSize exact)
{
return ASRelativeSizeRangeMake(exact, exact);
}
ASRelativeSizeRange ASRelativeSizeRangeMakeWithExactCGSize(CGSize exact)
{
return ASRelativeSizeRangeMakeWithExactRelativeSize(ASRelativeSizeMakeWithCGSize(exact));
}
ASRelativeSizeRange ASRelativeSizeRangeMakeWithExactFraction(CGFloat fraction)
{
return ASRelativeSizeRangeMakeWithExactRelativeSize(ASRelativeSizeMakeWithFraction(fraction));
}
ASRelativeSizeRange ASRelativeSizeRangeMakeWithExactRelativeDimensions(ASRelativeDimension exactWidth, ASRelativeDimension exactHeight)
{
return ASRelativeSizeRangeMakeWithExactRelativeSize(ASRelativeSizeMake(exactWidth, exactHeight));
}
BOOL ASRelativeSizeRangeEqualToRelativeSizeRange(ASRelativeSizeRange lhs, ASRelativeSizeRange rhs)
{
return ASRelativeSizeEqualToRelativeSize(lhs.min, rhs.min) && ASRelativeSizeEqualToRelativeSize(lhs.max, rhs.max);
}
ASSizeRange ASRelativeSizeRangeResolve(ASRelativeSizeRange relativeSizeRange,
CGSize parentSize)
{
return ASSizeRangeMake(ASLayoutSizeResolveSize(relativeSizeRange.min, parentSize, parentSize),
ASLayoutSizeResolveSize(relativeSizeRange.max, parentSize, parentSize));
}

View File

@@ -147,23 +147,6 @@ ASDISPLAYNODE_EXTERN_C_END
@end
#pragma mark - Deprecated
@interface ASLayout (Deprecated)
- (id <ASLayoutElement>)layoutableObject ASDISPLAYNODE_DEPRECATED;
+ (instancetype)layoutWithLayoutableObject:(id<ASLayoutElement>)layoutElement
constrainedSizeRange:(ASSizeRange)constrainedSizeRange
size:(CGSize)size ASDISPLAYNODE_DEPRECATED;
+ (instancetype)layoutWithLayoutableObject:(id<ASLayoutElement>)layoutElement
constrainedSizeRange:(ASSizeRange)constrainedSizeRange
size:(CGSize)size
sublayouts:(nullable NSArray<ASLayout *> *)sublayouts AS_WARN_UNUSED_RESULT ASDISPLAYNODE_DEPRECATED;
@end
#pragma mark - Debugging
@interface ASLayout (Debugging)

View File

@@ -353,30 +353,6 @@ static std::atomic_bool static_retainsSublayoutLayoutElements = ATOMIC_VAR_INIT(
@end
@implementation ASLayout (Deprecation)
- (id <ASLayoutElement>)layoutableObject
{
return self.layoutElement;
}
+ (instancetype)layoutWithLayoutableObject:(id<ASLayoutElement>)layoutElement
constrainedSizeRange:(ASSizeRange)constrainedSizeRange
size:(CGSize)size
{
return [self layoutWithLayoutElement:layoutElement size:size];
}
+ (instancetype)layoutWithLayoutableObject:(id<ASLayoutElement>)layoutElement
constrainedSizeRange:(ASSizeRange)constrainedSizeRange
size:(CGSize)size
sublayouts:(nullable NSArray<ASLayout *> *)sublayouts
{
return [self layoutWithLayoutElement:layoutElement size:size sublayouts:sublayouts];
}
@end
ASLayout *ASCalculateLayout(id<ASLayoutElement> layoutElement, const ASSizeRange sizeRange, const CGSize parentSize)
{
ASDisplayNodeCAssertNotNil(layoutElement, @"Not valid layoutElement passed in.");

View File

@@ -147,22 +147,6 @@ typedef NS_ENUM(NSUInteger, ASLayoutElementType) {
- (BOOL)implementsLayoutMethod;
#pragma mark - Deprecated
#define ASLayoutable ASLayoutElement
/**
* @abstract Calculate a layout based on given size range.
*
* @param constrainedSize The minimum and maximum sizes the receiver should fit in.
*
* @return An ASLayout instance defining the layout of the receiver and its children.
*
* @deprecated Deprecated in version 2.0: Use layoutThatFits: or layoutThatFits:parentSize: if used in
* ASLayoutSpec subclasses
*/
- (nonnull ASLayout *)measureWithSizeRange:(ASSizeRange)constrainedSize ASDISPLAYNODE_DEPRECATED_MSG("Use layoutThatFits: instead.");
@end
#pragma mark - ASLayoutElementStyle

View File

@@ -804,22 +804,4 @@ do {\
#endif /* YOGA */
#pragma mark Deprecated
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
- (ASRelativeSizeRange)sizeRange
{
return ASRelativeSizeRangeMake(self.minLayoutSize, self.maxLayoutSize);
}
- (void)setSizeRange:(ASRelativeSizeRange)sizeRange
{
self.minLayoutSize = sizeRange.min;
self.maxLayoutSize = sizeRange.max;
}
#pragma clang diagnostic pop
@end

View File

@@ -51,11 +51,6 @@ NS_ASSUME_NONNULL_END
return [self layoutThatFits:constrainedSize parentSize:constrainedSize.max];\
}\
\
- (ASLayout *)measureWithSizeRange:(ASSizeRange)constrainedSize\
{\
return [self layoutThatFits:constrainedSize parentSize:constrainedSize.max];\
}\
\
- (ASLayout *)layoutThatFits:(ASSizeRange)constrainedSize parentSize:(CGSize)parentSize\
{\
return [self calculateLayoutThatFits:constrainedSize restrictedToSize:self.style.size relativeToParentSize:parentSize];\
@@ -117,134 +112,3 @@ typedef struct ASLayoutElementStyleExtensions {
return [self.style layoutOptionExtensionEdgeInsetsAtIndex:idx];\
}\
#pragma mark ASLayoutElementStyleForwardingDeclaration (Deprecated)
#define ASLayoutElementStyleForwardingDeclaration \
@property (nonatomic, readwrite) CGFloat spacingBefore ASDISPLAYNODE_DEPRECATED_MSG("Use style.spacingBefore"); \
@property (nonatomic, readwrite) CGFloat spacingAfter ASDISPLAYNODE_DEPRECATED_MSG("Use style.spacingAfter"); \
@property (nonatomic, readwrite) CGFloat flexGrow ASDISPLAYNODE_DEPRECATED_MSG("Use style.flexGrow"); \
@property (nonatomic, readwrite) CGFloat flexShrink ASDISPLAYNODE_DEPRECATED_MSG("Use style.flexShrink"); \
@property (nonatomic, readwrite) ASDimension flexBasis ASDISPLAYNODE_DEPRECATED_MSG("Use style.flexBasis"); \
@property (nonatomic, readwrite) ASStackLayoutAlignSelf alignSelf ASDISPLAYNODE_DEPRECATED_MSG("Use style.alignSelf"); \
@property (nonatomic, readwrite) CGFloat ascender ASDISPLAYNODE_DEPRECATED_MSG("Use style.ascender"); \
@property (nonatomic, readwrite) CGFloat descender ASDISPLAYNODE_DEPRECATED_MSG("Use style.descender"); \
@property (nonatomic, assign) ASRelativeSizeRange sizeRange ASDISPLAYNODE_DEPRECATED_MSG("Don't use sizeRange anymore instead set style.width or style.height"); \
@property (nonatomic, assign) CGPoint layoutPosition ASDISPLAYNODE_DEPRECATED_MSG("Use style.layoutPosition"); \
#pragma mark - ASLayoutElementStyleForwarding (Deprecated)
// For the time beeing we are forwading all style related properties on ASDisplayNode and ASLayoutSpec. This define
// help us to not have duplicate code while moving from 1.x to 2.0s
#define ASLayoutElementStyleForwarding \
\
@dynamic spacingBefore, spacingAfter, flexGrow, flexShrink, flexBasis, alignSelf, ascender, descender, sizeRange, layoutPosition;\
\
_Pragma("mark - ASStackLayoutElement")\
\
- (void)setSpacingBefore:(CGFloat)spacingBefore\
{\
self.style.spacingBefore = spacingBefore;\
}\
\
- (CGFloat)spacingBefore\
{\
return self.style.spacingBefore;\
}\
\
- (void)setSpacingAfter:(CGFloat)spacingAfter\
{\
self.style.spacingAfter = spacingAfter;\
}\
\
- (CGFloat)spacingAfter\
{\
return self.style.spacingAfter;\
}\
\
- (void)setFlexGrow:(CGFloat)flexGrow\
{\
self.style.flexGrow = flexGrow;\
}\
\
- (CGFloat)flexGrow\
{\
return self.style.flexGrow;\
}\
\
- (void)setFlexShrink:(CGFloat)flexShrink\
{\
self.style.flexShrink = flexShrink;\
}\
\
- (CGFloat)flexShrink\
{\
return self.style.flexShrink;\
}\
\
- (void)setFlexBasis:(ASDimension)flexBasis\
{\
self.style.flexBasis = flexBasis;\
}\
\
- (ASDimension)flexBasis\
{\
return self.style.flexBasis;\
}\
\
- (void)setAlignSelf:(ASStackLayoutAlignSelf)alignSelf\
{\
self.style.alignSelf = alignSelf;\
}\
\
- (ASStackLayoutAlignSelf)alignSelf\
{\
return self.style.alignSelf;\
}\
\
- (void)setAscender:(CGFloat)ascender\
{\
self.style.ascender = ascender;\
}\
\
- (CGFloat)ascender\
{\
return self.style.ascender;\
}\
\
- (void)setDescender:(CGFloat)descender\
{\
self.style.descender = descender;\
}\
\
- (CGFloat)descender\
{\
return self.style.descender;\
}\
\
_Pragma("mark - ASAbsoluteLayoutElement")\
\
- (void)setLayoutPosition:(CGPoint)layoutPosition\
{\
self.style.layoutPosition = layoutPosition;\
}\
\
- (CGPoint)layoutPosition\
{\
return self.style.layoutPosition;\
}\
\
_Pragma("clang diagnostic push")\
_Pragma("clang diagnostic ignored \"-Wdeprecated-declarations\"")\
\
- (void)setSizeRange:(ASRelativeSizeRange)sizeRange\
{\
self.style.sizeRange = sizeRange;\
}\
\
- (ASRelativeSizeRange)sizeRange\
{\
return self.style.sizeRange;\
}\
\
_Pragma("clang diagnostic pop")\

View File

@@ -104,10 +104,4 @@ NS_ASSUME_NONNULL_BEGIN
@end
@interface ASLayoutSpec (Deprecated)
ASLayoutElementStyleForwardingDeclaration
@end
NS_ASSUME_NONNULL_END

View File

@@ -35,17 +35,6 @@
@dynamic layoutElementType;
@synthesize debugName = _debugName;
#pragma mark - Class
+ (void)initialize
{
[super initialize];
if (self != [ASLayoutSpec class]) {
ASDisplayNodeAssert(!ASSubclassOverridesSelector([ASLayoutSpec class], self, @selector(measureWithSizeRange:)), @"Subclass %@ must not override measureWithSizeRange: method. Instead override calculateLayoutThatFits:", NSStringFromClass(self));
}
}
#pragma mark - Lifecycle
- (instancetype)init
@@ -167,7 +156,6 @@ ASLayoutElementLayoutCalculationDefaults
}
ASPrimitiveTraitCollectionDefaults
ASPrimitiveTraitCollectionDeprecatedImplementation
#pragma mark - ASLayoutElementStyleExtensibility
@@ -353,11 +341,3 @@ ASLayoutElementStyleExtensibilityForwarding
}
@end
#pragma mark - ASLayoutSpec (Deprecated)
@implementation ASLayoutSpec (Deprecated)
ASLayoutElementStyleForwarding
@end

View File

@@ -52,8 +52,6 @@ typedef NS_OPTIONS(NSUInteger, ASDisplayNodeMethodOverrides)
ASDisplayNodeMethodOverrideLayoutSpecThatFits = 1 << 4,
ASDisplayNodeMethodOverrideCalcLayoutThatFits = 1 << 5,
ASDisplayNodeMethodOverrideCalcSizeThatFits = 1 << 6,
ASDisplayNodeMethodOverrideFetchData = 1 << 7,
ASDisplayNodeMethodOverrideClearFetchedData = 1 << 8
};
typedef NS_OPTIONS(uint_least32_t, ASDisplayNodeAtomicFlags)

View File

@@ -154,14 +154,6 @@ NS_ASSUME_NONNULL_BEGIN
*/
- (void)reloadData;
/**
* Reload everything from scratch entirely on the main thread, destroying the working range and all cached nodes.
*
* @warning This method is substantially more expensive than UITableView's version and will block the main thread while
* all the cells load.
*/
- (void)reloadDataImmediately;
/**
* Triggers a relayout of all nodes.
*

View File

@@ -71,7 +71,7 @@ static ASLayout *crossChildLayout(const ASStackLayoutSpecChild &child,
crossMax);
const ASSizeRange childSizeRange = directionSizeRange(style.direction, stackMin, stackMax, childCrossMin, childCrossMax);
ASLayout *layout = [child.element layoutThatFits:childSizeRange parentSize:parentSize];
ASDisplayNodeCAssertNotNil(layout, @"ASLayout returned from measureWithSizeRange: must not be nil: %@", child.element);
ASDisplayNodeCAssertNotNil(layout, @"ASLayout returned from -layoutThatFits:parentSize: must not be nil: %@", child.element);
return layout ? : [ASLayout layoutWithLayoutElement:child.element size:{0, 0}];
}

View File

@@ -38,7 +38,6 @@
ASLayoutElementStyleExtensibilityForwarding
ASPrimitiveTraitCollectionDefaults
ASPrimitiveTraitCollectionDeprecatedImplementation
- (ASTraitCollection *)asyncTraitCollection
{

View File

@@ -25,19 +25,11 @@
#import <AsyncDisplayKit/ASDataController.h>
#import <AsyncDisplayKit/ASBaseDefines.h>
// If assertions are enabled and they haven't forced us to suppress the exception,
// then throw, otherwise log.
// If assertions are enabled, throw. Otherwise log.
#if ASDISPLAYNODE_ASSERTIONS_ENABLED
#define ASFailUpdateValidation(...)\
_Pragma("clang diagnostic push")\
_Pragma("clang diagnostic ignored \"-Wdeprecated-declarations\"")\
if ([ASDisplayNode suppressesInvalidCollectionUpdateExceptions]) {\
NSLog(__VA_ARGS__);\
} else {\
NSLog(__VA_ARGS__);\
[NSException raise:ASCollectionInvalidUpdateException format:__VA_ARGS__];\
}\
_Pragma("clang diagnostic pop")
NSLog(__VA_ARGS__);\
[NSException raise:ASCollectionInvalidUpdateException format:__VA_ARGS__];
#else
#define ASFailUpdateValidation(...) NSLog(__VA_ARGS__);
#endif

View File

@@ -620,7 +620,7 @@
[window makeKeyAndVisible];
for (NSInteger i = 0; i < 2; i++) {
// NOTE: waitUntilAllUpdatesAreProcessed or reloadDataImmediately is not sufficient here!!
// NOTE: reloadData and waitUntilAllUpdatesAreProcessed are not sufficient here!!
XCTestExpectation *done = [self expectationWithDescription:[NSString stringWithFormat:@"Reload #%td complete", i]];
[cn reloadDataWithCompletion:^{
[done fulfill];

View File

@@ -44,7 +44,7 @@
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 measure: call before so the automatic measurement
// 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];

View File

@@ -24,7 +24,6 @@
#import <AsyncDisplayKit/_ASDisplayView.h>
#import <AsyncDisplayKit/ASDisplayNode+Subclasses.h>
#import <AsyncDisplayKit/ASDisplayNode+FrameworkPrivate.h>
#import <AsyncDisplayKit/ASDisplayNode+Deprecated.h>
#import <AsyncDisplayKit/ASDisplayNodeInternal.h>
#import "ASDisplayNodeTestsHelper.h"
#import <AsyncDisplayKit/UIView+ASConvenience.h>
@@ -2128,27 +2127,6 @@ static bool stringContainsPointer(NSString *description, id p) {
XCTAssertEqualObjects(calls, expected);
}
- (void)testPreferredFrameSizeDeprecated
{
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
ASDisplayNode *node = [ASDisplayNode new];
// Default auto preferred frame size will be CGSizeZero
XCTAssert(CGSizeEqualToSize(node.preferredFrameSize, CGSizeZero));
// Set a specific preferredFrameSize
node.preferredFrameSize = CGSizeMake(100, 100);
ASXCTAssertEqualSizes(node.preferredFrameSize, CGSizeMake(100, 100));
// CGSizeZero should be returned if width or height is not of unit type points
node.style.width = ASDimensionMakeWithFraction(0.5);
ASXCTAssertEqualSizes(node.preferredFrameSize, CGSizeZero);
#pragma clang diagnostic pop
}
- (void)testSettingPropertiesViaStyllableProtocol
{
ASDisplayNode *node = [[ASDisplayNode alloc] init];

View File

@@ -2,8 +2,17 @@
// ASLayoutSpecTests.m
// Texture
//
// Created by Michael Schneider on 1/27/17.
// Copyright © 2017 Facebook. All rights reserved.
// Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
// This source code is licensed under the BSD-style license found in the
// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional
// grant of patent rights can be found in the PATENTS file in the same directory.
//
// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present,
// Pinterest, Inc. 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 <XCTest/XCTest.h>
@@ -39,7 +48,7 @@ ASDK_STYLE_PROP_OBJ(NSString *, extendedName, setExtendedName);
@end
/*
* As the ASLayoutableStyle conforms to the ASDKExtendedLayoutable protocol now, ASDKExtendedLayoutable properties
* As the ASLayoutElementStyle conforms to the ASDKExtendedLayoutElement protocol now, ASDKExtendedLayoutElement properties
* can be accessed in ASDKExtendedLayoutSpec
*/
@interface ASDKExtendedLayoutSpec : ASLayoutSpec

View File

@@ -253,7 +253,8 @@
tableView.asyncDelegate = delegate;
tableView.asyncDataSource = dataSource;
[tableView reloadDataImmediately];
[tableView reloadData];
[tableView waitUntilAllUpdatesAreCommitted];
[tableView setNeedsLayout];
[tableView layoutIfNeeded];

View File

@@ -226,7 +226,8 @@ static atomic_uint ASThrashTestSectionNextID = 1;
#else
_tableView.asyncDelegate = self;
_tableView.asyncDataSource = self;
[_tableView reloadDataImmediately];
[_tableView reloadData];
[_tableView waitUntilAllUpdatesAreCommitted];
#endif
[_tableView layoutIfNeeded];
}

View File

@@ -1,20 +1,18 @@
//
// PageNode.m
// Sample
//
// Created by McCallum, Levi on 12/7/15.
// Texture
//
// Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
// This source code is licensed under the BSD-style license found in the
// LICENSE file in the root directory of this source tree. An additional grant
// of patent rights can be found in the PATENTS file in the same directory.
// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional
// grant of patent rights can be found in the PATENTS file in the same directory.
//
// 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.
// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present,
// Pinterest, Inc. 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 "PageNode.h"
@@ -26,10 +24,10 @@
return constrainedSize;
}
- (void)fetchData
- (void)didEnterPreloadState
{
[super fetchData];
NSLog(@"Fetching data for node: %@", self);
[super didEnterPreloadState];
NSLog(@"didEnterPreloadState for node: %@", self);
}
@end