Add support for multiple children to ASWrapperLayoutSpec (#2469)

This commit is contained in:
Michael Schneider
2016-10-24 09:59:44 -07:00
committed by GitHub
parent 97e23776e4
commit 4e580b96dc
2 changed files with 44 additions and 7 deletions

View File

@@ -63,19 +63,31 @@ NS_ASSUME_NONNULL_BEGIN
@end
/**
* An ASLayoutSpec subclass that can wrap a ASLayoutElement and calculates the layout of the child.
* An ASLayoutSpec subclass that can wrap one or more ASLayoutElement and calculates the layout based on the
* sizes of the children. If multiple children are provided the size of the biggest child will be used to for
* size of this layout spec.
*/
@interface ASWrapperLayoutSpec : ASLayoutSpec
/*
* Returns an ASWrapperLayoutSpec object with the given layoutElement as child
* Returns an ASWrapperLayoutSpec object with the given layoutElement as child.
*/
+ (instancetype)wrapperWithLayoutElement:(id<ASLayoutElement>)layoutElement AS_WARN_UNUSED_RESULT;
/*
* Returns an ASWrapperLayoutSpec object initialized with the given layoutElement as child
* Returns an ASWrapperLayoutSpec object with the given layoutElements as children.
*/
- (instancetype)initWithLayoutElement:(id<ASLayoutElement>)layoutElement NS_DESIGNATED_INITIALIZER;
+ (instancetype)wrapperWithLayoutElements:(NSArray<id<ASLayoutElement>> *)layoutElements AS_WARN_UNUSED_RESULT;
/*
* Returns an ASWrapperLayoutSpec object initialized with the given layoutElement as child.
*/
- (instancetype)initWithLayoutElement:(id<ASLayoutElement>)layoutElement AS_WARN_UNUSED_RESULT;
/*
* Returns an ASWrapperLayoutSpec object initialized with the given layoutElements as children.
*/
- (instancetype)initWithLayoutElements:(NSArray<id<ASLayoutElement>> *)layoutElements AS_WARN_UNUSED_RESULT;
/*
* Init not available for ASWrapperLayoutSpec