Skip to content

Commit

Permalink
resolve ambiguity in DTMemoryStorage categories
Browse files Browse the repository at this point in the history
  • Loading branch information
DenTelezhkin committed Aug 28, 2014
1 parent 7a75ca5 commit 741cce1
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 31 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@
@warning Moving item at index, that is not valid, won't do anything, except logging into console about failure
*/
-(void)moveItemAtIndexPath:(NSIndexPath *)sourceIndexPath
toIndexPath:(NSIndexPath *)destinationIndexPath;
-(void)moveCollectionItemAtIndexPath:(NSIndexPath *)sourceIndexPath
toIndexPath:(NSIndexPath *)destinationIndexPath;

///---------------------------------------
/// @name Managing sections
Expand All @@ -55,6 +55,6 @@
@param toSection The index in the collection view that is the destination of the move for the section. The existing section at that location slides up or down to an adjoining index position to make room for it.
*/
-(void)moveSection:(NSInteger)fromSection toSection:(NSInteger)toSection;
-(void)moveCollectionViewSection:(NSInteger)fromSection toSection:(NSInteger)toSection;

@end
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ -(void)performAnimatedUpdate:(void(^)(UICollectionView *))animationBlock;

@implementation DTMemoryStorage(DTCollectionViewManagerAdditions)

-(void)moveItemAtIndexPath:(NSIndexPath *)sourceIndexPath
toIndexPath:(NSIndexPath *)destinationIndexPath;
-(void)moveCollectionItemAtIndexPath:(NSIndexPath *)sourceIndexPath
toIndexPath:(NSIndexPath *)destinationIndexPath;
{
[self startUpdate];

Expand Down Expand Up @@ -101,7 +101,7 @@ -(void)moveItemAtIndexPath:(NSIndexPath *)sourceIndexPath
self.currentUpdate = nil;
}

-(void)moveSection:(NSInteger)fromSection toSection:(NSInteger)toSection
-(void)moveCollectionViewSection:(NSInteger)fromSection toSection:(NSInteger)toSection
{
[self startUpdate];
DTSectionModel * validSectionFrom = [self getValidSection:fromSection];
Expand Down
48 changes: 24 additions & 24 deletions Example/CedarUnitTests/Specs/Datasource.mm
Original file line number Diff line number Diff line change
Expand Up @@ -290,19 +290,19 @@

it(@"should move item to another row", ^{
[collection.memoryStorage addItems:@[model1,model2,model3]];
[collection.memoryStorage moveItemAtIndexPath:[NSIndexPath indexPathForItem:0
inSection:0]
toIndexPath:[NSIndexPath indexPathForItem:2
inSection:0]];

[collection.memoryStorage moveCollectionItemAtIndexPath:[NSIndexPath indexPathForItem:0
inSection:0]
toIndexPath:[NSIndexPath indexPathForItem:2
inSection:0]];
[collection verifySection:@[model2,model3,model1] withSectionNumber:0];
});

it(@"should move item to another empty section", ^{
[collection.memoryStorage addItems:@[model1,model2,model3]];
[collection.memoryStorage moveItemAtIndexPath:[NSIndexPath indexPathForItem:2 inSection:0]
toIndexPath:[NSIndexPath indexPathForItem:0 inSection:1]];

[collection.memoryStorage moveCollectionItemAtIndexPath:[NSIndexPath indexPathForItem:2 inSection:0]
toIndexPath:[NSIndexPath indexPathForItem:0 inSection:1]];

[collection verifySection:@[model1,model2] withSectionNumber:0];
[collection verifySection:@[model3] withSectionNumber:1];
Expand All @@ -311,9 +311,9 @@
it(@"should move item to another section", ^{
[collection.memoryStorage addItems:@[model1,model2,model3]];
[collection.memoryStorage addItems:@[model4] toSection:1];
[collection.memoryStorage moveItemAtIndexPath:[NSIndexPath indexPathForItem:2 inSection:0]
toIndexPath:[NSIndexPath indexPathForItem:0 inSection:1]];

[collection.memoryStorage moveCollectionItemAtIndexPath:[NSIndexPath indexPathForItem:2 inSection:0]
toIndexPath:[NSIndexPath indexPathForItem:0 inSection:1]];

[collection verifySection:@[model1,model2] withSectionNumber:0];
[collection verifySection:@[model3,model4] withSectionNumber:1];
Expand All @@ -323,8 +323,8 @@
[collection.memoryStorage addItems:@[model1,model2]];

^{
[collection.memoryStorage moveItemAtIndexPath:[NSIndexPath indexPathForItem:1 inSection:0]
toIndexPath:[NSIndexPath indexPathForItem:4 inSection:3]];
[collection.memoryStorage moveCollectionItemAtIndexPath:[NSIndexPath indexPathForItem:1 inSection:0]
toIndexPath:[NSIndexPath indexPathForItem:4 inSection:3]];
} should_not raise_exception;
});

Expand Down Expand Up @@ -371,8 +371,8 @@

it(@"should move section to empty section", ^{
[collection.memoryStorage addItems:@[model1,model2]];
[collection.memoryStorage moveSection:0 toSection:1];

[collection.memoryStorage moveCollectionViewSection:0 toSection:1];

[collection verifySection:@[model1,model2] withSectionNumber:1];
[collection verifySection:@[] withSectionNumber:0];
Expand All @@ -381,8 +381,8 @@
it(@"should switch sections", ^{
[collection.memoryStorage addItems:@[model1,model2]];
[collection.memoryStorage addItems:@[model3,model4] toSection:1];
[collection.memoryStorage moveSection:0 toSection:1];

[collection.memoryStorage moveCollectionViewSection:0 toSection:1];

[collection verifySection:@[model3,model4] withSectionNumber:0];
[collection verifySection:@[model1,model2] withSectionNumber:1];
Expand Down Expand Up @@ -421,8 +421,8 @@
[collection.memoryStorage addItems:section0];
[collection.memoryStorage addItems:section1 toSection:1];
[collection.memoryStorage addItems:section2 toSection:2];
[collection.memoryStorage moveSection:0 toSection:2];

[collection.memoryStorage moveCollectionViewSection:0 toSection:2];

expect([collection.memoryStorage supplementaryModelOfKind:header forSectionIndex:0]).to(equal(@2));
expect([collection.memoryStorage supplementaryModelOfKind:header forSectionIndex:1]).to(equal(@3));
Expand All @@ -437,8 +437,8 @@
[collection.memoryStorage addItems:section0];
[collection.memoryStorage addItems:section1 toSection:1];
[collection.memoryStorage addItems:section2 toSection:2];
[collection.memoryStorage moveSection:0 toSection:2];

[collection.memoryStorage moveCollectionViewSection:0 toSection:2];

expect([collection.memoryStorage supplementaryModelOfKind:footer forSectionIndex:0]).to(equal(@2));
expect([collection.memoryStorage supplementaryModelOfKind:footer forSectionIndex:1]).to(equal(@3));
Expand All @@ -453,8 +453,8 @@
[collection.memoryStorage addItems:section0];
[collection.memoryStorage addItems:section1 toSection:1];
[collection.memoryStorage addItems:section2 toSection:2];
[collection.memoryStorage moveSection:0 toSection:2];

[collection.memoryStorage moveCollectionViewSection:0 toSection:2];

expect([collection.memoryStorage supplementaryModelOfKind:customKind forSectionIndex:0]).to(equal(@2));
expect([collection.memoryStorage supplementaryModelOfKind:customKind forSectionIndex:1]).to(equal(@3));
Expand All @@ -469,7 +469,7 @@
[collection.memoryStorage addItems:section1];
[collection.memoryStorage addItems:section2];
^{
[collection.memoryStorage moveSection:0 toSection:1];
[collection.memoryStorage moveCollectionViewSection:0 toSection:1];
} should_not raise_exception();
});
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ - (void)moveSections:(id)sender
{
if ([self.memoryStorage.sections count])
{
[self.memoryStorage moveSection:[self.memoryStorage.sections count]-1 toSection:0];
[self.memoryStorage moveCollectionViewSection:[self.memoryStorage.sections count] - 1 toSection:0];
}
}

Expand Down

0 comments on commit 741cce1

Please sign in to comment.