CKMountable Protocol Reference

Conforms to NSObject
Declared in CKMountable.h

– layoutThatFits:parentSize: required method

Call this on children components to compute their layouts.

- (CKComponentLayout)layoutThatFits:(CKSizeRange)constrainedSize parentSize:(CGSize)parentSize

Parameters

constrainedSize

Specifies a minimum and maximum size. The receiver must choose a size that is in this range.

parentSize

The parent component’s size. If the parent component does not have a final size in a given dimension, then it should be passed as kCKComponentParentDimensionUndefined (for example, if the parent’s width depends on the child’s size).

Return Value

A struct defining the layout of the receiver and its children.

Declared In

CKMountable.h

– viewContext required method

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

CKMountable.h

  mountedView required method

If the component owns its own view and is mounted, returns it.

@property (nonatomic, readonly) UIView *mountedView

Declared In

CKMountable.h

  mountInfo required method

If the component is mounted, returns it.

@property (nonatomic, readonly) CKMountInfo mountInfo

Declared In

CKMountable.h

– mountInContext:size:children:supercomponent: required method

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:(id<CKMountable>)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

systraceListener

The current systrace listener - will be nil if systrace is not enabled.

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

CKMountable.h

– unmount required method

Unmounts the component: - Clears the references to supercomponent and superview. - If the component has a mountedView: - Clears the view’s reference back to this component using CKSetMountedComponentForView(). - Clears mountedView.

- (void)unmount

Declared In

CKMountable.h

– childrenDidMount required method

Called when the component and all its children have been mounted.

- (void)childrenDidMount

Parameters

systraceListener

The current systrace listener - will be nil if systrace is not enabled.

Declared In

CKMountable.h

  uniqueIdentifier required method

Unique identifier of the component - can be nil

@property (nonatomic, strong, readonly) id<NSObject> uniqueIdentifier

Declared In

CKMountable.h

– shouldCacheLayout required method

Indicates if layout should be cached during computation of component tree. This is for backward compatibility because we don’t want to expose the concept of component controller.

- (BOOL)shouldCacheLayout

Declared In

CKMountable.h

– debugName required method

Name used in debug message

- (NSString *)debugName

Declared In

CKMountable.h