CKComponent() Category Reference

Conforms to CKTreeNodeComponentProtocol
Declared in CKComponentInternal.h

– mountInContext:size:children:supercomponent:

Mounts the component in the given context: - Stores references to the supercomponent and superview for -nextResponder and -viewConfiguration. - Creates or updates a controller for this component, if one should exist. - If this component has a view, creates or recycles a view by fetching one from the given MountContext, and: - Unmounts the view’s previous component (if any). - Applies attributes to the view. - Stores a reference to the view in _mountedView (for -viewContext, transient view state, and -unmount). - Stores a reference back to this component using CKSetMountedComponentForView. (This sets up a retain cycle which must be torn down in -unmount.)

- (CK : : Component : : MountResult)mountInContext:(const CK : : Component : : MountContext &)context size:(const CGSize)size children:(std : : shared_ptr<conststd::vector<CKComponentLayoutChild> >)children supercomponent:(CKComponent *)supercomponent

Parameters

context

The component’s content should be positioned within the given view at the given position.

size

The size for this component

children

The positioned children for this component. Normally this parameter is ignored.

supercomponent

This component’s parent component

Return Value

An updated mount context. In most cases, this is just be the passed-in context. If a view was created, this is used to specify that subcomponents should be mounted inside the view.

Discussion

Override this if your component wants to perform a custom mounting action, but this should be very rare!

Declared In

CKComponentInternal.h

+ newRenderComponentWithView:size:

For internal use only; don’t use this initializer.

+ (instancetype)newRenderComponentWithView:(const CKComponentViewConfiguration &)view size:(const CKComponentSize &)size

Parameters

view

A struct describing the view for this component. Pass {} to specify that no view should be created.

size

A size constraint that should apply to this component. Pass {} to specify no size constraint.

This initializer will not try to acquire the scope handle from the thread local store.

Declared In

CKComponentInternal.h

– setViewConfiguration:

For internal use only; don’t use this directly.

- (void)setViewConfiguration:(const CKComponentViewConfiguration &)viewConfiguration

Declared In

CKComponentInternal.h

– viewConfiguration

A CKComponentViewConfiguration specifies the class of a view and the attributes that should be applied to it.

- (const CKComponentViewConfiguration &)viewConfiguration

Declared In

CKComponentInternal.h

  rootComponentMountedView

Used to get the root component in the responder chain; don’t touch this.

@property (nonatomic, weak) UIView *rootComponentMountedView

Declared In

CKComponentInternal.h

  size

The size that was passed into the component; don’t touch this.

@property (nonatomic, assign, readonly) CKComponentSize size

Declared In

CKComponentInternal.h

  scopeEnumeratorProvider

Used to get the scope root enumerator; during component creation only

@property (nonatomic, strong, readonly) id<CKComponentScopeEnumeratorProvider> scopeEnumeratorProvider

Declared In

CKComponentInternal.h

  scopeHandle

For internal use only; don’t touch this.

@property (nonatomic, strong, readonly) CKComponentScopeHandle *scopeHandle

Declared In

CKComponentInternal.h

– backtraceStackDescription

For internal debug use only; don’t touch this.

- (NSString *)backtraceStackDescription

Declared In

CKComponentInternal.h

+ shouldUpdateComponentInController

Update component in controller right after new generation is created. NOTE: This should only be used by ComponentKit infra.

+ (BOOL)shouldUpdateComponentInController

Declared In

CKComponentInternal.h