From 4149c6b0f59547734984780dfc4dceaac5f53bbc Mon Sep 17 00:00:00 2001 From: Levi McCallum Date: Wed, 8 Jun 2016 15:29:47 -0700 Subject: [PATCH] Move ASLayout frame to a computed property --- AsyncDisplayKit/Layout/ASLayout.h | 12 ++++++------ AsyncDisplayKit/Layout/ASLayout.mm | 2 ++ 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/AsyncDisplayKit/Layout/ASLayout.h b/AsyncDisplayKit/Layout/ASLayout.h index 7733a6a207..0d0bcfa281 100644 --- a/AsyncDisplayKit/Layout/ASLayout.h +++ b/AsyncDisplayKit/Layout/ASLayout.h @@ -68,6 +68,12 @@ extern BOOL CGPointIsNull(CGPoint point); */ @property (nonatomic, readonly, getter=isFlattened) BOOL flattened; +/** + * @abstract Returns a valid frame for the current layout computed with the size and position. + * @discussion Clamps the layout's origin or position to 0 if any of the calculated values are infinite. + */ +@property (nonatomic, readonly) CGRect frame; + /** * Initializer. * @@ -142,12 +148,6 @@ extern BOOL CGPointIsNull(CGPoint point); */ - (ASLayout *)flattenedLayoutUsingPredicateBlock:(BOOL (^)(ASLayout *evaluatedLayout))predicateBlock; -/** - * @abstract Returns a valid frame for the current layout computed with the size and position. - * @discussion Clamps the layout's origin or position to 0 if any of the calculated values are infinite. - */ -- (CGRect)frame; - @end NS_ASSUME_NONNULL_END diff --git a/AsyncDisplayKit/Layout/ASLayout.mm b/AsyncDisplayKit/Layout/ASLayout.mm index d715e45a48..e5f0cd1778 100644 --- a/AsyncDisplayKit/Layout/ASLayout.mm +++ b/AsyncDisplayKit/Layout/ASLayout.mm @@ -24,6 +24,8 @@ extern BOOL CGPointIsNull(CGPoint point) @implementation ASLayout +@dynamic frame; + + (instancetype)layoutWithLayoutableObject:(id)layoutableObject constrainedSizeRange:(ASSizeRange)sizeRange size:(CGSize)size