CKCompositeComponent Class Reference

Inherits from CKComponent : NSObject
Declared in CKCompositeComponent.h

Overview

CKCompositeComponent allows you to hide your implementation details and avoid subclassing layout components like CKFlexboxComponent. In almost all cases, you should subclass CKCompositeComponent instead of subclassing any other class directly.

For example, suppose you create a component that should lay out some children in a vertical stack. Incorrect: subclass CKFlexboxComponent and call self newWithChildren:. Correct: subclass CKCompositeComponent and call super newWithComponent:[CKFlexboxComponent newWithChildren...

This hides your layout implementation details from the outside world.

Warning: Overriding -layoutThatFits:parentSize: or -computeLayoutThatFits: is not allowed for any subclass.

+ newWithComponent:

Calls the initializer with {} for view.

+ (instancetype _Nullable)newWithComponent:(NS_RELEASES_ARGUMENT CKComponent *_Nullable)component

Declared In

CKCompositeComponent.h

+ newWithView:component:

Passed to CKComponent’s initializer. This should be used sparingly for CKCompositeComponent. Prefer delegating view configuration completely to the child component to hide implementation details.

+ (instancetype _Nullable)newWithView:(const CKComponentViewConfiguration &)view component:(NS_RELEASES_ARGUMENT CKComponent *_Nullable)component

Parameters

view

Passed to CKComponent’s initializer. This should be used sparingly for CKCompositeComponent. Prefer delegating view configuration completely to the child component to hide implementation details.

component

The component the composite component uses for layout and sizing.

Declared In

CKCompositeComponent.h

  child

Access the child component. For internal use only.

@property (nonatomic, strong, readonly, nullable) CKComponent *child

Declared In

CKCompositeComponent.h