From 7490c2d8b20aa1ff10b0f5c3ad154bde1f2a1319 Mon Sep 17 00:00:00 2001 From: Huy Nguyen Date: Thu, 7 Sep 2017 19:25:42 +0100 Subject: [PATCH] [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 --- AsyncDisplayKit.xcodeproj/project.pbxproj | 12 -- CHANGELOG.md | 1 + Source/ASCollectionNode.h | 10 -- Source/ASCollectionNode.mm | 7 - Source/ASCollectionView.h | 8 - Source/ASDisplayNode+Beta.h | 13 -- Source/ASDisplayNode+Deprecated.h | 142 ------------------ Source/ASDisplayNode+Layout.mm | 13 +- Source/ASDisplayNode+Subclasses.h | 8 +- Source/ASDisplayNode.h | 2 +- Source/ASDisplayNode.mm | 134 +---------------- Source/ASPagerNode.h | 12 -- Source/ASPagerNode.m | 18 --- Source/ASTableView.h | 14 -- Source/ASTableView.mm | 7 - Source/ASVideoPlayerNode.h | 8 - Source/ASVideoPlayerNode.mm | 22 --- Source/ASViewController.h | 13 -- Source/ASViewController.mm | 6 - Source/AsyncDisplayKit.h | 2 - .../Details/ASCollectionViewLayoutInspector.h | 3 - .../Details/ASCollectionViewLayoutInspector.m | 7 - Source/Details/ASLayoutRangeType.h | 3 - Source/Details/ASTraitCollection.h | 21 --- Source/Layout/ASAbsoluteLayoutElement.h | 6 - Source/Layout/ASAbsoluteLayoutSpec.h | 9 -- Source/Layout/ASAbsoluteLayoutSpec.mm | 15 -- Source/Layout/ASDimensionDeprecated.h | 102 ------------- Source/Layout/ASDimensionDeprecated.mm | 102 ------------- Source/Layout/ASLayout.h | 17 --- Source/Layout/ASLayout.mm | 24 --- Source/Layout/ASLayoutElement.h | 16 -- Source/Layout/ASLayoutElement.mm | 18 --- Source/Layout/ASLayoutElementPrivate.h | 136 ----------------- Source/Layout/ASLayoutSpec.h | 6 - Source/Layout/ASLayoutSpec.mm | 20 --- Source/Private/ASDisplayNodeInternal.h | 2 - Source/Private/ASTableView+Undeprecated.h | 8 - .../Layout/ASStackUnpositionedLayout.mm | 2 +- .../Private/_ASCollectionGalleryLayoutItem.mm | 1 - Source/Private/_ASHierarchyChangeSet.mm | 14 +- Tests/ASCollectionViewTests.mm | 2 +- Tests/ASDisplayNodeLayoutTests.mm | 2 +- Tests/ASDisplayNodeTests.mm | 22 --- Tests/ASLayoutSpecTests.m | 15 +- Tests/ASTableViewTests.mm | 3 +- Tests/ASTableViewThrashTests.m | 3 +- examples/PagerNode/Sample/PageNode.m | 26 ++-- 48 files changed, 42 insertions(+), 1015 deletions(-) delete mode 100644 Source/ASDisplayNode+Deprecated.h delete mode 100644 Source/Layout/ASDimensionDeprecated.h delete mode 100644 Source/Layout/ASDimensionDeprecated.mm diff --git a/AsyncDisplayKit.xcodeproj/project.pbxproj b/AsyncDisplayKit.xcodeproj/project.pbxproj index c02b9fd52..41389f721 100644 --- a/AsyncDisplayKit.xcodeproj/project.pbxproj +++ b/AsyncDisplayKit.xcodeproj/project.pbxproj @@ -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 = ""; }; 4640521C1A3F83C40061C0BA /* ASTableLayoutController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ASTableLayoutController.m; sourceTree = ""; }; 4640521D1A3F83C40061C0BA /* ASLayoutController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ASLayoutController.h; sourceTree = ""; }; - 683489271D70DE3400327501 /* ASDisplayNode+Deprecated.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "ASDisplayNode+Deprecated.h"; sourceTree = ""; }; 68355B2E1CB5799E001D4E68 /* ASImageNode+AnimatedImage.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = "ASImageNode+AnimatedImage.mm"; sourceTree = ""; }; 68355B361CB57A5A001D4E68 /* ASPINRemoteImageDownloader.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ASPINRemoteImageDownloader.m; sourceTree = ""; }; 68355B371CB57A5A001D4E68 /* ASImageContainerProtocolCategories.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ASImageContainerProtocolCategories.h; sourceTree = ""; }; @@ -652,8 +648,6 @@ 6907C2571DC4ECFE00374C66 /* ASObjectDescriptionHelpers.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ASObjectDescriptionHelpers.m; sourceTree = ""; }; 690C35601E055C5D00069B91 /* ASDimensionInternal.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = ASDimensionInternal.mm; sourceTree = ""; }; 690C35631E055C7B00069B91 /* ASDimensionInternal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ASDimensionInternal.h; sourceTree = ""; }; - 690C35651E0567C600069B91 /* ASDimensionDeprecated.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = ASDimensionDeprecated.mm; sourceTree = ""; }; - 690C356A1E05680300069B91 /* ASDimensionDeprecated.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ASDimensionDeprecated.h; sourceTree = ""; }; 690ED58D1E36BCA6000627C0 /* ASLayoutElementStylePrivate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ASLayoutElementStylePrivate.h; sourceTree = ""; }; 690ED5921E36D118000627C0 /* ASControlNode+tvOS.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "ASControlNode+tvOS.h"; sourceTree = ""; }; 690ED5931E36D118000627C0 /* ASControlNode+tvOS.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "ASControlNode+tvOS.m"; sourceTree = ""; }; @@ -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 */, diff --git a/CHANGELOG.md b/CHANGELOG.md index 7deeff472..d3d6a3d33 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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) diff --git a/Source/ASCollectionNode.h b/Source/ASCollectionNode.h index 352867e9f..68e5d752f 100644 --- a/Source/ASCollectionNode.h +++ b/Source/ASCollectionNode.h @@ -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 diff --git a/Source/ASCollectionNode.mm b/Source/ASCollectionNode.mm index 5bb12befd..e5cde4c8e 100644 --- a/Source/ASCollectionNode.mm +++ b/Source/ASCollectionNode.mm @@ -753,13 +753,6 @@ - (void)reloadData [self reloadDataWithCompletion:nil]; } -- (void)reloadDataImmediately -{ - ASDisplayNodeAssertMainThread(); - [self reloadData]; - [self waitUntilAllUpdatesAreProcessed]; -} - - (void)relayoutItems { ASDisplayNodeAssertMainThread(); diff --git a/Source/ASCollectionView.h b/Source/ASCollectionView.h index 2a1eb1856..2c1f87984 100644 --- a/Source/ASCollectionView.h +++ b/Source/ASCollectionView.h @@ -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. * diff --git a/Source/ASDisplayNode+Beta.h b/Source/ASDisplayNode+Beta.h index 8e413a5a3..e8b08a9a5 100644 --- a/Source/ASDisplayNode+Beta.h +++ b/Source/ASDisplayNode+Beta.h @@ -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 diff --git a/Source/ASDisplayNode+Deprecated.h b/Source/ASDisplayNode+Deprecated.h deleted file mode 100644 index 696169fa2..000000000 --- a/Source/ASDisplayNode+Deprecated.h +++ /dev/null @@ -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 - -@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 diff --git a/Source/ASDisplayNode+Layout.mm b/Source/ASDisplayNode+Layout.mm index 5674997d0..6727cd23b 100644 --- a/Source/ASDisplayNode+Layout.mm +++ b/Source/ASDisplayNode+Layout.mm @@ -57,15 +57,6 @@ - (ASLayoutElementType)layoutElementType #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 @@ - (ASTraitCollection *)asyncTraitCollection return [ASTraitCollection traitCollectionWithASPrimitiveTraitCollection:self.primitiveTraitCollection]; } -ASPrimitiveTraitCollectionDeprecatedImplementation - #pragma mark - ASLayoutElementAsciiArtProtocol - (NSString *)asciiArtString @@ -938,7 +927,7 @@ - (void)_pendingLayoutTransitionDidComplete // 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]) { diff --git a/Source/ASDisplayNode+Subclasses.h b/Source/ASDisplayNode+Subclasses.h index b506124d4..9cc98aab3 100644 --- a/Source/ASDisplayNode+Subclasses.h +++ b/Source/ASDisplayNode+Subclasses.h @@ -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; diff --git a/Source/ASDisplayNode.h b/Source/ASDisplayNode.h index 24347d09b..c221e3c6e 100644 --- a/Source/ASDisplayNode.h +++ b/Source/ASDisplayNode.h @@ -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:. * diff --git a/Source/ASDisplayNode.mm b/Source/ASDisplayNode.mm index e1ce6f8bd..f91b33849 100644 --- a/Source/ASDisplayNode.mm +++ b/Source/ASDisplayNode.mm @@ -20,7 +20,6 @@ #import #import #import -#import #import #import #import @@ -77,19 +76,8 @@ @implementation ASDisplayNode @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 @@ + (void)initialize 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 @@ - (void)__layout 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 @@ - (void)didEnterPreloadState 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 @@ - (void)didExitPreloadState 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 @@ - (void)addSubnode:(ASDisplayNode *)subnode } @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 diff --git a/Source/ASPagerNode.h b/Source/ASPagerNode.h index 51e57898c..2b489659a 100644 --- a/Source/ASPagerNode.h +++ b/Source/ASPagerNode.h @@ -61,18 +61,6 @@ NS_ASSUME_NONNULL_BEGIN @end @protocol ASPagerDelegate - -@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 /** diff --git a/Source/ASPagerNode.m b/Source/ASPagerNode.m index 86062f664..1ef893d9d 100644 --- a/Source/ASPagerNode.m +++ b/Source/ASPagerNode.m @@ -39,9 +39,6 @@ @interface ASPagerNode () _pagerDelegate; - struct { - unsigned constrainedSizeForNode:1; - } _pagerDelegateFlags; ASPagerNodeProxy *_proxyDelegate; } @@ -181,13 +178,6 @@ - (NSInteger)collectionNode:(ASCollectionNode *)collectionNode numberOfItemsInSe - (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 @@ - (void)setDelegate:(id)delegate { 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 )_proxyDelegate; } } diff --git a/Source/ASTableView.h b/Source/ASTableView.h index 0a3d07ec4..04e1dbd12 100644 --- a/Source/ASTableView.h +++ b/Source/ASTableView.h @@ -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 diff --git a/Source/ASTableView.mm b/Source/ASTableView.mm index 8f41cffac..4606726f2 100644 --- a/Source/ASTableView.mm +++ b/Source/ASTableView.mm @@ -544,13 +544,6 @@ - (void)reloadData [self reloadDataWithCompletion:nil]; } -- (void)reloadDataImmediately -{ - ASDisplayNodeAssertMainThread(); - [self reloadData]; - [_dataController waitUntilAllUpdatesAreProcessed]; -} - - (void)scrollToRowAtIndexPath:(NSIndexPath *)indexPath atScrollPosition:(UITableViewScrollPosition)scrollPosition animated:(BOOL)animated { if ([self validateIndexPath:indexPath]) { diff --git a/Source/ASVideoPlayerNode.h b/Source/ASVideoPlayerNode.h index e68b15c5f..f878c152f 100644 --- a/Source/ASVideoPlayerNode.h +++ b/Source/ASVideoPlayerNode.h @@ -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; diff --git a/Source/ASVideoPlayerNode.mm b/Source/ASVideoPlayerNode.mm index ca05c0589..e6f766b41 100644 --- a/Source/ASVideoPlayerNode.mm +++ b/Source/ASVideoPlayerNode.mm @@ -154,28 +154,6 @@ - (void)_initControlsAndVideoNode [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 diff --git a/Source/ASViewController.h b/Source/ASViewController.h index c2e71a274..bdd343b30 100644 --- a/Source/ASViewController.h +++ b/Source/ASViewController.h @@ -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 diff --git a/Source/ASViewController.mm b/Source/ASViewController.mm index d4dab1a62..2826fae9d 100644 --- a/Source/ASViewController.mm +++ b/Source/ASViewController.mm @@ -146,12 +146,9 @@ - (void)viewWillLayoutSubviews [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 @@ - (void)propagateNewTraitCollection:(ASPrimitiveTraitCollection)traitCollection 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 } } diff --git a/Source/AsyncDisplayKit.h b/Source/AsyncDisplayKit.h index 73a5288bc..b1903945e 100644 --- a/Source/AsyncDisplayKit.h +++ b/Source/AsyncDisplayKit.h @@ -75,7 +75,6 @@ #import #import #import -#import #import #import #import @@ -125,7 +124,6 @@ #import #import -#import #import #import diff --git a/Source/Details/ASCollectionViewLayoutInspector.h b/Source/Details/ASCollectionViewLayoutInspector.h index 3f6302fea..ba2aadf28 100644 --- a/Source/Details/ASCollectionViewLayoutInspector.h +++ b/Source/Details/ASCollectionViewLayoutInspector.h @@ -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 - -- (instancetype)initWithCollectionView:(ASCollectionView *)collectionView ASDISPLAYNODE_DEPRECATED_MSG("Use -init instead."); - @end NS_ASSUME_NONNULL_END diff --git a/Source/Details/ASCollectionViewLayoutInspector.m b/Source/Details/ASCollectionViewLayoutInspector.m index 26100cec6..9b8a302d9 100644 --- a/Source/Details/ASCollectionViewLayoutInspector.m +++ b/Source/Details/ASCollectionViewLayoutInspector.m @@ -47,13 +47,6 @@ @implementation ASCollectionViewLayoutInspector { } _delegateFlags; } -#pragma mark Lifecycle - -- (instancetype)initWithCollectionView:(ASCollectionView *)collectionView -{ - return [self init]; -} - #pragma mark ASCollectionViewLayoutInspecting - (void)didChangeCollectionViewDelegate:(id)delegate diff --git a/Source/Details/ASLayoutRangeType.h b/Source/Details/ASLayoutRangeType.h index 45e163544..2f2be5206 100644 --- a/Source/Details/ASLayoutRangeType.h +++ b/Source/Details/ASLayoutRangeType.h @@ -74,6 +74,3 @@ typedef NS_ENUM(NSInteger, ASLayoutRangeType) { }; static NSInteger const ASLayoutRangeTypeCount = 2; - -#define ASLayoutRangeTypeRender ASLayoutRangeTypeDisplay -#define ASLayoutRangeTypeFetchData ASLayoutRangeTypePreload diff --git a/Source/Details/ASTraitCollection.h b/Source/Details/ASTraitCollection.h index 760919c0d..fdff5c0b1 100644 --- a/Source/Details/ASTraitCollection.h +++ b/Source/Details/ASTraitCollection.h @@ -66,10 +66,6 @@ extern NSString *NSStringFromASPrimitiveTraitCollection(ASPrimitiveTraitCollecti */ extern void ASTraitCollectionPropagateDown(id 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\ {\ diff --git a/Source/Layout/ASAbsoluteLayoutElement.h b/Source/Layout/ASAbsoluteLayoutElement.h index 39ce04f1b..384830f5e 100644 --- a/Source/Layout/ASAbsoluteLayoutElement.h +++ b/Source/Layout/ASAbsoluteLayoutElement.h @@ -16,7 +16,6 @@ // #import -#import 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 diff --git a/Source/Layout/ASAbsoluteLayoutSpec.h b/Source/Layout/ASAbsoluteLayoutSpec.h index 7d218dce0..0c250ec68 100644 --- a/Source/Layout/ASAbsoluteLayoutSpec.h +++ b/Source/Layout/ASAbsoluteLayoutSpec.h @@ -50,13 +50,4 @@ NS_ASSUME_NONNULL_BEGIN @end - -#pragma mark - Deprecated - -@interface ASStaticLayoutSpec : ASAbsoluteLayoutSpec - -+ (instancetype)staticLayoutSpecWithChildren:(NSArray> *)children AS_WARN_UNUSED_RESULT ASDISPLAYNODE_DEPRECATED; - -@end - NS_ASSUME_NONNULL_END diff --git a/Source/Layout/ASAbsoluteLayoutSpec.mm b/Source/Layout/ASAbsoluteLayoutSpec.mm index c8d136a58..96ab7a705 100644 --- a/Source/Layout/ASAbsoluteLayoutSpec.mm +++ b/Source/Layout/ASAbsoluteLayoutSpec.mm @@ -107,18 +107,3 @@ - (ASLayout *)calculateLayoutThatFits:(ASSizeRange)constrainedSize @end -#pragma mark - ASStaticLayoutSpec - -@implementation ASStaticLayoutSpec : ASAbsoluteLayoutSpec - -+ (instancetype)staticLayoutSpecWithChildren:(NSArray> *)children -{ - return [self absoluteLayoutSpecWithSizing:ASAbsoluteLayoutSpecSizingSizeToFit children:children]; -} - -- (instancetype)initWithChildren:(NSArray *)children -{ - return [super initWithSizing:ASAbsoluteLayoutSpecSizingSizeToFit children:children]; -} - -@end diff --git a/Source/Layout/ASDimensionDeprecated.h b/Source/Layout/ASDimensionDeprecated.h deleted file mode 100644 index 94483edc2..000000000 --- a/Source/Layout/ASDimensionDeprecated.h +++ /dev/null @@ -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 -#import - -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 diff --git a/Source/Layout/ASDimensionDeprecated.mm b/Source/Layout/ASDimensionDeprecated.mm deleted file mode 100644 index bca453d08..000000000 --- a/Source/Layout/ASDimensionDeprecated.mm +++ /dev/null @@ -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 - -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)); -} diff --git a/Source/Layout/ASLayout.h b/Source/Layout/ASLayout.h index a0aff5b7b..fa1371985 100644 --- a/Source/Layout/ASLayout.h +++ b/Source/Layout/ASLayout.h @@ -147,23 +147,6 @@ ASDISPLAYNODE_EXTERN_C_END @end -#pragma mark - Deprecated - -@interface ASLayout (Deprecated) - -- (id )layoutableObject ASDISPLAYNODE_DEPRECATED; - -+ (instancetype)layoutWithLayoutableObject:(id)layoutElement - constrainedSizeRange:(ASSizeRange)constrainedSizeRange - size:(CGSize)size ASDISPLAYNODE_DEPRECATED; - -+ (instancetype)layoutWithLayoutableObject:(id)layoutElement - constrainedSizeRange:(ASSizeRange)constrainedSizeRange - size:(CGSize)size - sublayouts:(nullable NSArray *)sublayouts AS_WARN_UNUSED_RESULT ASDISPLAYNODE_DEPRECATED; - -@end - #pragma mark - Debugging @interface ASLayout (Debugging) diff --git a/Source/Layout/ASLayout.mm b/Source/Layout/ASLayout.mm index 22904b8b6..031120100 100644 --- a/Source/Layout/ASLayout.mm +++ b/Source/Layout/ASLayout.mm @@ -353,30 +353,6 @@ - (NSString *)_recursiveDescriptionForLayout:(ASLayout *)layout level:(NSUIntege @end -@implementation ASLayout (Deprecation) - -- (id )layoutableObject -{ - return self.layoutElement; -} - -+ (instancetype)layoutWithLayoutableObject:(id)layoutElement - constrainedSizeRange:(ASSizeRange)constrainedSizeRange - size:(CGSize)size -{ - return [self layoutWithLayoutElement:layoutElement size:size]; -} - -+ (instancetype)layoutWithLayoutableObject:(id)layoutElement - constrainedSizeRange:(ASSizeRange)constrainedSizeRange - size:(CGSize)size - sublayouts:(nullable NSArray *)sublayouts -{ - return [self layoutWithLayoutElement:layoutElement size:size sublayouts:sublayouts]; -} - -@end - ASLayout *ASCalculateLayout(id layoutElement, const ASSizeRange sizeRange, const CGSize parentSize) { ASDisplayNodeCAssertNotNil(layoutElement, @"Not valid layoutElement passed in."); diff --git a/Source/Layout/ASLayoutElement.h b/Source/Layout/ASLayoutElement.h index 2ebd55a46..ca56c6722 100644 --- a/Source/Layout/ASLayoutElement.h +++ b/Source/Layout/ASLayoutElement.h @@ -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 diff --git a/Source/Layout/ASLayoutElement.mm b/Source/Layout/ASLayoutElement.mm index 8d647c09a..9fc52b3bf 100644 --- a/Source/Layout/ASLayoutElement.mm +++ b/Source/Layout/ASLayoutElement.mm @@ -804,22 +804,4 @@ - (void)setAspectRatio:(CGFloat)aspectRatio { #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 diff --git a/Source/Layout/ASLayoutElementPrivate.h b/Source/Layout/ASLayoutElementPrivate.h index 68c46de61..9bc3101b0 100644 --- a/Source/Layout/ASLayoutElementPrivate.h +++ b/Source/Layout/ASLayoutElementPrivate.h @@ -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")\ diff --git a/Source/Layout/ASLayoutSpec.h b/Source/Layout/ASLayoutSpec.h index e4d9d42db..ac02bacd0 100644 --- a/Source/Layout/ASLayoutSpec.h +++ b/Source/Layout/ASLayoutSpec.h @@ -104,10 +104,4 @@ NS_ASSUME_NONNULL_BEGIN @end -@interface ASLayoutSpec (Deprecated) - -ASLayoutElementStyleForwardingDeclaration - -@end - NS_ASSUME_NONNULL_END diff --git a/Source/Layout/ASLayoutSpec.mm b/Source/Layout/ASLayoutSpec.mm index 6600f5086..76901d1ac 100644 --- a/Source/Layout/ASLayoutSpec.mm +++ b/Source/Layout/ASLayoutSpec.mm @@ -35,17 +35,6 @@ @implementation ASLayoutSpec @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 @@ - (ASTraitCollection *)asyncTraitCollection } ASPrimitiveTraitCollectionDefaults -ASPrimitiveTraitCollectionDeprecatedImplementation #pragma mark - ASLayoutElementStyleExtensibility @@ -353,11 +341,3 @@ + (NSString *)asciiArtStringForChildren:(NSArray *)children parentName:(NSString } @end - -#pragma mark - ASLayoutSpec (Deprecated) - -@implementation ASLayoutSpec (Deprecated) - -ASLayoutElementStyleForwarding - -@end diff --git a/Source/Private/ASDisplayNodeInternal.h b/Source/Private/ASDisplayNodeInternal.h index 36683954d..0d1982a29 100644 --- a/Source/Private/ASDisplayNodeInternal.h +++ b/Source/Private/ASDisplayNodeInternal.h @@ -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) diff --git a/Source/Private/ASTableView+Undeprecated.h b/Source/Private/ASTableView+Undeprecated.h index 70098940f..bef11339d 100644 --- a/Source/Private/ASTableView+Undeprecated.h +++ b/Source/Private/ASTableView+Undeprecated.h @@ -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. * diff --git a/Source/Private/Layout/ASStackUnpositionedLayout.mm b/Source/Private/Layout/ASStackUnpositionedLayout.mm index 54a17bb08..1dff93348 100644 --- a/Source/Private/Layout/ASStackUnpositionedLayout.mm +++ b/Source/Private/Layout/ASStackUnpositionedLayout.mm @@ -71,7 +71,7 @@ static CGFloat resolveCrossDimensionMinForStretchChild(const ASStackLayoutSpecSt 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}]; } diff --git a/Source/Private/_ASCollectionGalleryLayoutItem.mm b/Source/Private/_ASCollectionGalleryLayoutItem.mm index 688ef44d4..32479d1ce 100644 --- a/Source/Private/_ASCollectionGalleryLayoutItem.mm +++ b/Source/Private/_ASCollectionGalleryLayoutItem.mm @@ -38,7 +38,6 @@ - (instancetype)initWithItemSize:(CGSize)itemSize collectionElement:(ASCollectio ASLayoutElementStyleExtensibilityForwarding ASPrimitiveTraitCollectionDefaults -ASPrimitiveTraitCollectionDeprecatedImplementation - (ASTraitCollection *)asyncTraitCollection { diff --git a/Source/Private/_ASHierarchyChangeSet.mm b/Source/Private/_ASHierarchyChangeSet.mm index e2e70c707..77ad5d959 100644 --- a/Source/Private/_ASHierarchyChangeSet.mm +++ b/Source/Private/_ASHierarchyChangeSet.mm @@ -25,19 +25,11 @@ #import #import -// 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 diff --git a/Tests/ASCollectionViewTests.mm b/Tests/ASCollectionViewTests.mm index f3567b437..b223e246f 100644 --- a/Tests/ASCollectionViewTests.mm +++ b/Tests/ASCollectionViewTests.mm @@ -620,7 +620,7 @@ - (void)testThatDisappearingSupplementariesWithLayerBackedNodesDontFailAssert [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]; diff --git a/Tests/ASDisplayNodeLayoutTests.mm b/Tests/ASDisplayNodeLayoutTests.mm index a998e9828..00512e801 100644 --- a/Tests/ASDisplayNodeLayoutTests.mm +++ b/Tests/ASDisplayNodeLayoutTests.mm @@ -44,7 +44,7 @@ - (void)testMeasureOnLayoutIfNotHappenedBefore 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]; diff --git a/Tests/ASDisplayNodeTests.mm b/Tests/ASDisplayNodeTests.mm index 99882df06..f1fb33d1b 100644 --- a/Tests/ASDisplayNodeTests.mm +++ b/Tests/ASDisplayNodeTests.mm @@ -24,7 +24,6 @@ #import #import #import -#import #import #import "ASDisplayNodeTestsHelper.h" #import @@ -2128,27 +2127,6 @@ - (void)testThatOnDidLoadWorks 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]; diff --git a/Tests/ASLayoutSpecTests.m b/Tests/ASLayoutSpecTests.m index 630092464..5cfc3a66c 100644 --- a/Tests/ASLayoutSpecTests.m +++ b/Tests/ASLayoutSpecTests.m @@ -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 @@ -39,7 +48,7 @@ @implementation ASLayoutElementStyle (ASDKExtendedLayoutElement) @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 diff --git a/Tests/ASTableViewTests.mm b/Tests/ASTableViewTests.mm index 2bf793641..f26d96b11 100644 --- a/Tests/ASTableViewTests.mm +++ b/Tests/ASTableViewTests.mm @@ -253,7 +253,8 @@ - (void)testConstrainedSizeForRowAtIndexPath tableView.asyncDelegate = delegate; tableView.asyncDataSource = dataSource; - [tableView reloadDataImmediately]; + [tableView reloadData]; + [tableView waitUntilAllUpdatesAreCommitted]; [tableView setNeedsLayout]; [tableView layoutIfNeeded]; diff --git a/Tests/ASTableViewThrashTests.m b/Tests/ASTableViewThrashTests.m index e547fe39c..fe2e2efd1 100644 --- a/Tests/ASTableViewThrashTests.m +++ b/Tests/ASTableViewThrashTests.m @@ -226,7 +226,8 @@ - (instancetype)initWithData:(NSArray *)data { #else _tableView.asyncDelegate = self; _tableView.asyncDataSource = self; - [_tableView reloadDataImmediately]; + [_tableView reloadData]; + [_tableView waitUntilAllUpdatesAreCommitted]; #endif [_tableView layoutIfNeeded]; } diff --git a/examples/PagerNode/Sample/PageNode.m b/examples/PagerNode/Sample/PageNode.m index bda108a1b..0efd83121 100644 --- a/examples/PagerNode/Sample/PageNode.m +++ b/examples/PagerNode/Sample/PageNode.m @@ -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. +// +// 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 // -// 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. +// http://www.apache.org/licenses/LICENSE-2.0 // #import "PageNode.h" @@ -26,10 +24,10 @@ - (CGSize)calculateSizeThatFits:(CGSize)constrainedSize return constrainedSize; } -- (void)fetchData +- (void)didEnterPreloadState { - [super fetchData]; - NSLog(@"Fetching data for node: %@", self); + [super didEnterPreloadState]; + NSLog(@"didEnterPreloadState for node: %@", self); } @end