ASContextTransitioning.h 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. //
  2. // ASContextTransitioning.h
  3. // AsyncDisplayKit
  4. //
  5. // Created by Levi McCallum on 2/4/16.
  6. //
  7. // Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
  8. // This source code is licensed under the BSD-style license found in the
  9. // LICENSE file in the root directory of this source tree. An additional grant
  10. // of patent rights can be found in the PATENTS file in the same directory.
  11. //
  12. #import <AsyncDisplayKit/ASDimension.h>
  13. @class ASDisplayNode;
  14. @class ASLayout;
  15. NS_ASSUME_NONNULL_BEGIN
  16. extern NSString * const ASTransitionContextFromLayoutKey;
  17. extern NSString * const ASTransitionContextToLayoutKey;
  18. @protocol ASContextTransitioning <NSObject>
  19. /**
  20. @abstract Defines if the given transition is animated
  21. */
  22. - (BOOL)isAnimated;
  23. /**
  24. * @abstract Retrieve either the "from" or "to" layout
  25. */
  26. - (nullable ASLayout *)layoutForKey:(NSString *)key;
  27. /**
  28. * @abstract Retrieve either the "from" or "to" constrainedSize
  29. */
  30. - (ASSizeRange)constrainedSizeForKey:(NSString *)key;
  31. /**
  32. * @abstract Retrieve the subnodes from either the "from" or "to" layout
  33. */
  34. - (NSArray<ASDisplayNode *> *)subnodesForKey:(NSString *)key;
  35. /**
  36. * @abstract Subnodes that have been inserted in the layout transition
  37. */
  38. - (NSArray<ASDisplayNode *> *)insertedSubnodes;
  39. /**
  40. * @abstract Subnodes that will be removed in the layout transition
  41. */
  42. - (NSArray<ASDisplayNode *> *)removedSubnodes;
  43. /**
  44. @abstract The frame for the given node before the transition began.
  45. @discussion Returns CGRectNull if the node was not in the hierarchy before the transition.
  46. */
  47. - (CGRect)initialFrameForNode:(ASDisplayNode *)node;
  48. /**
  49. @abstract The frame for the given node when the transition completes.
  50. @discussion Returns CGRectNull if the node is no longer in the hierarchy after the transition.
  51. */
  52. - (CGRect)finalFrameForNode:(ASDisplayNode *)node;
  53. /**
  54. @abstract Invoke this method when the transition is completed in `animateLayoutTransition:`
  55. @discussion Passing NO to `didComplete` will set the original layout as the new layout.
  56. */
  57. - (void)completeTransition:(BOOL)didComplete;
  58. @end
  59. NS_ASSUME_NONNULL_END