Adlai Holler 56ee00986f [Architecture] Add plans for new Section Info Objects (#2067)
* [section-infos-api] Add ASSectionInfo.h

* Create Processes.md

* Update ASSectionInfo.h

* Update ASSectionInfo.h

* Add more changes/info

* More stuff

* More updates

* Make it a protocol

* Update things

* Oops

* Update Misc.m

* Update Overview.md

* Update ASCollectionSection.h

* Update ASCollectionSection.h
2016-08-16 10:19:58 -07:00

32 lines
1.3 KiB
Objective-C

// Added to ASCollectionDataSource:
/**
* Data sources can override this method to return custom info associated with a
* section of the collection view.
*
* These section info objects can be read by a UICollectionViewLayout subclass
* and used to configure the layout for that section. @see ASSectionUserInfo
*/
@optional
- (nullable id<ASSectionUserInfo>)collectionView:(ASCollectionView *)collectionView infoForSectionAtIndex:(NSInteger)sectionIndex;
// ----
// Added to ASCollectionView:
// Reads from data controller's _completedSections. Asserts that section index is in bounds.
- (nullable id<ASSectionUserInfo>)infoForSectionAtIndex:(NSInteger)sectionIndex;
// ----
// In ASDataController.mm:
// Replace _editingNodes and _completedNodes with:
NSMutableArray<ASCollectionSection *> *_editingSections;
NSMutableArray<ASCollectionSection *> *_completedSections;
// Modify _reloadDataWithAnimationOptions and insertSections:withAnimationOptions:.
// In those methods we use _populateFromDataSourceWithSectionIndexSet to get the node blocks.
// Now we will also need to create the ASCollectionSections and ask for UserInfos, just before we get the node blocks.
// In essence, wherever we use an NSMutableArray of nodes to represent a section, we now
// will use an ASCollectionSection instead.