CKComponent Class Reference

Inherits from NSObject
Declared in CKComponent.h

Overview

A component is an immutable object that specifies how to configure a view, loosely inspired by React.

+ newWithView:size:

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

+ (instancetype)newWithView:(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.

@example A component that renders a red square: [CKComponent newWithView:{[UIView class], {{@selector(setBackgroundColor:), [UIColor redColor]}}} size:{100, 100}]

Declared In

CKComponent.h

– viewContext

While the component is mounted, returns information about the component’s manifestation in the view hierarchy.

- (CKComponentViewContext)viewContext

Discussion

If this component creates a view, this method returns the view it created (or recycled) and a frame with origin 0,0 and size equal to the view’s bounds, since the component’s size is the view’s size.

If this component does not create a view, returns the view this component is mounted within and the logical frame of the component’s content. In this case, you should not make any assumptions about what class the view is.

Declared In

CKComponent.h

– nextResponder

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

- (id)nextResponder

Declared In

CKComponent.h