Merge pull request #918 from levi/master

Inline supplementary kind iteration in data controller
This commit is contained in:
appleguy 2015-12-07 12:58:25 -08:00
commit c9a0a3d46f

View File

@ -40,8 +40,7 @@
- (void)prepareForReloadData
{
NSArray *kinds = [self supplementaryKinds];
for (NSString *kind in kinds) {
for (NSString *kind in [self supplementaryKinds]) {
LOG(@"Populating elements of kind: %@", kind);
NSMutableArray *indexPaths = [NSMutableArray array];
NSMutableArray *nodes = [NSMutableArray array];
@ -83,8 +82,7 @@
- (void)prepareForInsertSections:(NSIndexSet *)sections
{
NSArray *kinds = [self supplementaryKinds];
for (NSString *kind in kinds) {
for (NSString *kind in [self supplementaryKinds]) {
LOG(@"Populating elements of kind: %@, for sections: %@", kind, sections);
NSMutableArray *nodes = [NSMutableArray array];
NSMutableArray *indexPaths = [NSMutableArray array];
@ -116,8 +114,7 @@
- (void)willDeleteSections:(NSIndexSet *)sections
{
NSArray *kinds = [self supplementaryKinds];
for (NSString *kind in kinds) {
for (NSString *kind in [self supplementaryKinds]) {
NSArray *indexPaths = ASIndexPathsForMultidimensionalArrayAtIndexSet([self editingNodesOfKind:kind], sections);
[self deleteNodesOfKind:kind atIndexPaths:indexPaths completion:nil];
@ -127,8 +124,7 @@
- (void)prepareForReloadSections:(NSIndexSet *)sections
{
NSArray *kinds = [self supplementaryKinds];
for (NSString *kind in kinds) {
for (NSString *kind in [self supplementaryKinds]) {
NSMutableArray *nodes = [NSMutableArray array];
NSMutableArray *indexPaths = [NSMutableArray array];
[self _populateSupplementaryNodesOfKind:kind withSections:sections mutableNodes:nodes mutableIndexPaths:indexPaths];
@ -154,8 +150,7 @@
- (void)willMoveSection:(NSInteger)section toSection:(NSInteger)newSection
{
NSArray *kinds = [self supplementaryKinds];
for (NSString *kind in kinds) {
for (NSString *kind in [self supplementaryKinds]) {
NSArray *indexPaths = ASIndexPathsForMultidimensionalArrayAtIndexSet([self editingNodesOfKind:kind], [NSIndexSet indexSetWithIndex:section]);
NSArray *nodes = ASFindElementsInMultidimensionalArrayAtIndexPaths([self editingNodesOfKind:kind], indexPaths);
[self deleteNodesOfKind:kind atIndexPaths:indexPaths completion:nil];