The adaptorSections property represents an internal list of the flattened content-tree. Each section has an adaptor that corresponds to one content item. Each adaptor acts as a collection view 'section' datasource, while the larger list of all adaptors combine to act as the full collection view datasource.

To help illustrate, in the following section is the layout process from data to view. This example shows the raw assembler response, with everything accept the @types removed and the internal objects simplified for clarity:

{
"contents": [
{
"SecondaryContent": [
{
"@type": "Breadcrumbs", [2 Breadcrumbs in here]
},
{
"contents": [
{
"navigation": [
{
"@type": "RefinementMenu", [4 Refinements in here]
},
{ … },
{ … },
{
"@type": "PriceSlider", [1 Price Slider]
},
{ … }
],
"@type": "GuidedNavigation"
}
],
"@type": "ContentSlot-Secondary"
}
],
"@type": "MobilePage",
}
],
"@type": "PageSlot"
}

That response is parsed into objects by reading the @type property and constructing a corresponding class. In the example, the parsed object maintains the same structure. It is passed into the adaptor manager which loops over the parsed object and constructs adaptor sections. Each adaptor section has only one content item adaptor.

When the Secondary Content is flattened into adaptor sections (the first row), each adaptor manages the layout of its contents (in the columns), as shown in the following illustration:

This illustration is described in the preceding text.

When the adaptor manager has finished constructing the object, it informs the view controller that it is ready to be displayed to the user. Commerce Reference Store uses an Apple class called a UICollectionView to render the data. The collection view has a simple interface that expects content to be fed into it in sections and rows. The adaptor manager has prepared the data into logical sections each with corresponding rows of data. You can think of the adaptor manager as the section manager that manages all sections, and the individual adaptors as row managers that only manage rows within one section.

When it comes time to display, it looks something like the following illustration, where the adaptors that do not have rendered subcontent actually have no visible height, since they will not display.

This illustration is described in the preceding text.
Interface
//Implements <UICollectionViewDelegate, UICollectionViewFlowDelegate>
//Calls adaptorForContentItem:controller:

- (void)constructAdaptorForContentItem:(EMContentItem *)pContentItem withController:(EMAssemblerViewController *)pController;

//Calls adaptorForContentItem:controller: for each contentItem in the list.

- (void)constructAdaptorForContentItemList:(EMContentItemList *)pContentItemList withController:(EMAssemblerViewController *)pController;

//extension point for overriding the factory construction of contentItemAdaptors.

- (EMContentItemAdaptor *)adaptorForContentItem:(EMContentItem *)pContentItem controller:(EMAssemblerViewController *)pController;

//which adaptorsection is a particular contentItem in? useful for constructing //indexPaths for collection view.

- (NSInteger)indexOfContentItem:(EMContentItem *)pContentItem;

//Adaptor attributes are a general purpose place to stick adaptor properties
//An instance of fooAdaptor may put an offset in this map before reload is called
//after reload the new instance of fooAdaptor  may reference it from the //persistent map location.

@property (nonatomic, strong) NSDictionary *adaptorAttributes;

Copyright © 1997, 2013 Oracle and/or its affiliates. All rights reserved. Legal Notices