By itself, both cell view and layout section does not do anything by itself. The datasource is powerful object which manages cell views, layout sections and data which then will updates the collection view.
Basically, for a collection view to works properly, you need to
- Create cell views
- Create layout sections
- Use datasource to setup the data, cell views and layouts.
Figure below shows datasource inspector.
1. Section count attribute
Here, you can set how many sections are required for the collection view.
2. Selected section segment attributes
- (Order): Popup to select which section to modify.
- Layout: Choose layout section of selected section. The layout will define the views arrangement on the collection view.
- Section name: Section name which is displayed at the top of (2)
- Cell count: Total number of cell for selected section.
- Cell view: Choose cell view to be displayed for cell in selected section.
- Header Top Leading: Choose which header view to be displayed for the header. This attribute is dynamic and shown based on how type and if headers/footers available for selected layout section.
3. (Header Top Leading) segment attributes
- (Header Top Leading): Popup to select which header to modify.
- All attributes inside this segment are derived attributes which are based on the selected header view.
4. (Cell 2) segment attributes
- (Cell 2): Popup to select which cell index to modify
- All attributes inside this segment are derived attributes which are based on the selected cell view. Each cell index may have different data.