diff --git a/AsyncDisplayKit/Layout/ASBackgroundLayoutSpec.mm b/AsyncDisplayKit/Layout/ASBackgroundLayoutSpec.mm index 77f41112f2..ea18aca990 100644 --- a/AsyncDisplayKit/Layout/ASBackgroundLayoutSpec.mm +++ b/AsyncDisplayKit/Layout/ASBackgroundLayoutSpec.mm @@ -68,9 +68,4 @@ static NSString * const kBackgroundChildKey = @"kBackgroundChildKey"; return [super childForIdentifier:kBackgroundChildKey]; } -- (void)setChildren:(NSArray *)children -{ - ASDisplayNodeAssert(NO, @"not supported by this layout spec"); -} - @end diff --git a/AsyncDisplayKit/Layout/ASInsetLayoutSpec.mm b/AsyncDisplayKit/Layout/ASInsetLayoutSpec.mm index befb7edc3b..5c03393be7 100644 --- a/AsyncDisplayKit/Layout/ASInsetLayoutSpec.mm +++ b/AsyncDisplayKit/Layout/ASInsetLayoutSpec.mm @@ -115,9 +115,4 @@ static CGFloat centerInset(CGFloat outer, CGFloat inner) return [ASLayout layoutWithLayoutableObject:self size:computedSize sublayouts:@[sublayout]]; } -- (void)setChildren:(NSArray *)children -{ - ASDisplayNodeAssert(NO, @"not supported by this layout spec"); -} - @end diff --git a/AsyncDisplayKit/Layout/ASLayoutSpec.mm b/AsyncDisplayKit/Layout/ASLayoutSpec.mm index 2de93d49b2..b656a95782 100644 --- a/AsyncDisplayKit/Layout/ASLayoutSpec.mm +++ b/AsyncDisplayKit/Layout/ASLayoutSpec.mm @@ -26,7 +26,6 @@ ASEnvironmentState _environmentState; ASDN::RecursiveMutex _propertyLock; - id _child; NSArray *_children; NSMutableDictionary *_childrenWithIdentifier; } @@ -118,7 +117,7 @@ ASDisplayNodeAssert(self.isMutable, @"Cannot set properties when layout spec is not mutable"); id finalLayoutable = [self layoutableToAddFromLayoutable:child]; - _child = finalLayoutable; + _children = @[finalLayoutable]; [self propagateUpLayoutable:finalLayoutable]; } @@ -128,6 +127,7 @@ id finalLayoutable = [self layoutableToAddFromLayoutable:child]; self.childrenWithIdentifier[identifier] = finalLayoutable; + self.children = [self.children arrayByAddingObject:finalLayoutable]; // TODO: Should we propagate up the layoutable at it could happen that multiple children will propagated up their // layout options and one child will overwrite values from another child @@ -156,7 +156,7 @@ - (id)child { - return _child; + return [_children firstObject]; } - (NSArray *)children diff --git a/AsyncDisplayKit/Layout/ASOverlayLayoutSpec.mm b/AsyncDisplayKit/Layout/ASOverlayLayoutSpec.mm index f8cef20a18..892872179e 100644 --- a/AsyncDisplayKit/Layout/ASOverlayLayoutSpec.mm +++ b/AsyncDisplayKit/Layout/ASOverlayLayoutSpec.mm @@ -61,11 +61,6 @@ static NSString * const kOverlayChildKey = @"kOverlayChildKey"; return [ASLayout layoutWithLayoutableObject:self size:contentsLayout.size sublayouts:sublayouts]; } -- (void)setChildren:(NSArray *)children -{ - ASDisplayNodeAssert(NO, @"not supported by this layout spec"); -} - @end @implementation ASOverlayLayoutSpec (Debugging) diff --git a/AsyncDisplayKit/Layout/ASRatioLayoutSpec.mm b/AsyncDisplayKit/Layout/ASRatioLayoutSpec.mm index 17d18a763d..4e9c66ed98 100644 --- a/AsyncDisplayKit/Layout/ASRatioLayoutSpec.mm +++ b/AsyncDisplayKit/Layout/ASRatioLayoutSpec.mm @@ -75,11 +75,6 @@ return [ASLayout layoutWithLayoutableObject:self size:sublayout.size sublayouts:@[sublayout]]; } -- (void)setChildren:(NSArray *)children -{ - ASDisplayNodeAssert(NO, @"not supported by this layout spec"); -} - @end @implementation ASRatioLayoutSpec (Debugging) diff --git a/AsyncDisplayKit/Layout/ASRelativeLayoutSpec.mm b/AsyncDisplayKit/Layout/ASRelativeLayoutSpec.mm index e1c2d6c0d3..4206171b5e 100644 --- a/AsyncDisplayKit/Layout/ASRelativeLayoutSpec.mm +++ b/AsyncDisplayKit/Layout/ASRelativeLayoutSpec.mm @@ -92,11 +92,6 @@ return [ASLayout layoutWithLayoutableObject:self size:size sublayouts:@[sublayout]]; } -- (void)setChildren:(NSArray *)children -{ - ASDisplayNodeAssert(NO, @"not supported by this layout spec"); -} - - (CGFloat)proportionOfAxisForAxisPosition:(ASRelativeLayoutSpecPosition)position { if ((position & ASRelativeLayoutSpecPositionCenter) != 0) { diff --git a/AsyncDisplayKit/Layout/ASStackLayoutSpec.mm b/AsyncDisplayKit/Layout/ASStackLayoutSpec.mm index 26b6d449c7..cb99f38288 100644 --- a/AsyncDisplayKit/Layout/ASStackLayoutSpec.mm +++ b/AsyncDisplayKit/Layout/ASStackLayoutSpec.mm @@ -121,17 +121,6 @@ _baselineRelativeArrangement = baselineRelativeArrangement; } -- (void)setChild:(id)child forIdentifier:(NSString *)identifier -{ - ASDisplayNodeAssert(NO, @"ASStackLayoutSpec only supports setChildren"); -} - -- (id)childForIdentifier:(NSString *)identifier -{ - ASDisplayNodeAssert(NO, @"ASStackLayoutSpec only supports children"); - return nil; -} - - (ASLayout *)measureWithSizeRange:(ASSizeRange)constrainedSize { if (self.children.count == 0) { diff --git a/AsyncDisplayKit/Layout/ASStaticLayoutSpec.mm b/AsyncDisplayKit/Layout/ASStaticLayoutSpec.mm index a727376a57..68db47ff14 100644 --- a/AsyncDisplayKit/Layout/ASStaticLayoutSpec.mm +++ b/AsyncDisplayKit/Layout/ASStaticLayoutSpec.mm @@ -72,17 +72,6 @@ sublayouts:sublayouts]; } -- (void)setChild:(id)child forIdentifier:(NSString *)identifier -{ - ASDisplayNodeAssert(NO, @"ASStaticLayoutSpec only supports setChildren"); -} - -- (id)childForIdentifier:(NSString *)identifier -{ - ASDisplayNodeAssert(NO, @"ASStaticLayoutSpec only supports children"); - return nil; -} - @end @implementation ASStaticLayoutSpec (ASEnvironment)