CKComponentController Class Reference

Conforms to *
:
CKComponent
ComponentType
__covariant
Declared in CKComponentController.h

– didInit

The controller was initialised. Called on the main thread.

- (void)didInit

Declared In

CKComponentController.h

– willMount

The controller’s component is not mounted, but is about to be.

- (void)willMount

Declared In

CKComponentController.h

– didMount

The controller’s component was not previously mounted, but now it is (including all of its children).

- (void)didMount

Declared In

CKComponentController.h

– willRemount

The controller’s component is mounted and is about to be mounted again. This can happen in two scenarios: 1. The component is updating. In that case, the controller has already received a call to -willUpdateComponent, and the component property already reflects the updated component that will be mounted. 2. The root component is being attached to a different root view.

- (void)willRemount

Declared In

CKComponentController.h

– didRemount

The controller’s component was mounted after a call to willRemount.

- (void)didRemount

Declared In

CKComponentController.h

– willUnmount

The controller’s component is mounted, but is about to be unmounted.

- (void)willUnmount

Declared In

CKComponentController.h

– didUnmount

The controller’s component was previously mounted, but now it no longer is.

- (void)didUnmount

Declared In

CKComponentController.h

– willUpdateComponent

If the controller’s component is changing, invoked immediately before the updated component is mounted.

- (void)willUpdateComponent

Declared In

CKComponentController.h

– didUpdateComponent

If the controller’s component has changed, invoked immediately after the updated component is mounted.

- (void)didUpdateComponent

Declared In

CKComponentController.h

– componentDidAcquireView

Invoked immediately after the component has acquired a view.

- (void)componentDidAcquireView

Declared In

CKComponentController.h

– componentWillRelinquishView

Invoked immediately before the component relinquishes its view to be reused by other components.

- (void)componentWillRelinquishView

Declared In

CKComponentController.h

– componentTreeWillAppear

As suggested in name, this lifecycle method will only be called when the entire component tree will appear on screen. That means if a component tree has already appeared on screen and it’s still visible, a component that is added to this component tree hierarchy will not have this lifecycle method called. NOTE: - In the context of UICollectionView, this corresponds to willDisplayCell:forItemAtIndexPath:. - In the context of CKComponentHostingView, this corresponds to hostingViewWillAppear.

- (void)componentTreeWillAppear

Declared In

CKComponentController.h

– componentTreeDidDisappear

As suggested in name, this lifecycle method will only be called when the entire component tree did disappear. That means if a component is removed from its component tree hierarchy, this lifecycle method will not be called. NOTE: - In the context of UICollectionView, this corresponds to didEndDisplayingCell:forItemAtIndexPath:. - In the context of CKComponentHostingView, this corresponds to hostingViewDidDisappear.

- (void)componentTreeDidDisappear

Declared In

CKComponentController.h

– invalidateController

Called on the main thread prior to controller deallocation *

- (void)invalidateController

Declared In

CKComponentController.h

– didPrepareLayout:forComponent:

Called on the main thread when a new component has been created and its layout has been calculated. This layout will be used during the next mount (unless another state update will be triggered).

- (void)didPrepareLayout:(const CKLayout &)layout forComponent:(CKComponent *)component

Declared In

CKComponentController.h

  component

The current version of the component.

@property (nonatomic, weak, readonly) ComponentType component

Declared In

CKComponentController.h

  view

The view created by the component, if currently mounted.

@property (nonatomic, strong, readonly) UIView *view

Declared In

CKComponentController.h

– nextResponder

While the controller’s component is mounted, returns its next responder. This is the first of: - The supercomponent of the controller’s component; - The view the controller’s component is mounted within, if it is the root component.

- (id)nextResponder

Declared In

CKComponentController.h

– canPerformAction:withSender:

When an action is triggered, a component controller may use this method to either capture or ignore the given action. The default implementation simply uses respondsToSelector: to determine if the controller can perform the given action.

- (BOOL)canPerformAction:(SEL)action withSender:(id)sender

Discussion

In practice, this is useful only for integrations with UIMenuController whose API walks the UIResponder chain to determine which menu items to display. You should not override this method for standard component actions.

Declared In

CKComponentController.h

– initWithComponent:

Initializes a controller with the first generation of component. You should not directly initialize a controller, they are initialized for you by the infrastructure.

- (instancetype)initWithComponent:(ComponentType)component

Declared In

CKComponentController.h