Move ASLayout frame to a computed property

This commit is contained in:
Levi McCallum
2016-06-08 15:29:47 -07:00
parent f1f45c61a8
commit 4149c6b0f5
2 changed files with 8 additions and 6 deletions

View File

@@ -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

View File

@@ -24,6 +24,8 @@ extern BOOL CGPointIsNull(CGPoint point)
@implementation ASLayout
@dynamic frame;
+ (instancetype)layoutWithLayoutableObject:(id<ASLayoutable>)layoutableObject
constrainedSizeRange:(ASSizeRange)sizeRange
size:(CGSize)size