Overview
Mountable Components are used to render views or drawables and are a replacement for the old Java Specs API-based Mount Specs.
Mountable Components should only be created when you need to integrate your own views/drawables with Litho. Here, Mount refers to the operation performed by all components in a layout tree to extract their rendered state (a 'View' or a 'Drawable') to be displayed.
The Mountable Components section contains the following pages:
- Creating a Mountable Component - details how to create a Component responsible for rendering a View or Drawable. Also, compares Mountable Components with KComponents.
- Lifecycle of a SimpleMountable - covers the purpose and creation of a SimpleMountable in addition to how to create and mount its content.
- Measuring - shows different strategies to measure the content the Mountable Component will render.
- Controllers Pattern - illustrates the use of controllers by implementing a simple TimePicker that shows an arbitrary time.
- Content Pooling - details a strategy that can be used to populate the content pools to optimise first mount performance.
Information and step-by-step explanations of how to migrate to Mountable Components from already existing components can be found in the following documents:
- Migrating from MountSpecs - details the process of migrating from MountSpec API.
- Cheatsheet - set of links for the migration of individual aspects of existing code from the Java Spec API to Kotlin API.