diff --git a/.gitignore b/.gitignore index 1631c5d..f49ea8f 100644 --- a/.gitignore +++ b/.gitignore @@ -17,5 +17,4 @@ profile DerivedData .idea/ -Podfile.lock Pods/ \ No newline at end of file diff --git a/DTCollectionViewManager.podspec b/DTCollectionViewManager.podspec index 4a507ba..88a4cb3 100644 --- a/DTCollectionViewManager.podspec +++ b/DTCollectionViewManager.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = 'DTCollectionViewManager' - s.version = '2.4.0' + s.version = '2.5.0' s.license = 'MIT' s.summary = 'The most simple and robust way to manage UICollectionView.' s.homepage = 'https://github.com/DenHeadless/DTCollectionViewManager' @@ -12,5 +12,5 @@ Pod::Spec.new do |s| s.ios.deployment_target = '6.0' s.ios.frameworks = 'UIKit', 'Foundation' s.platform = :ios,'6.0' - s.dependency 'DTModelStorage' , '0.6.0' + s.dependency 'DTModelStorage' , '0.8.0' end \ No newline at end of file diff --git a/DTCollectionViewManager/Convenience/DTCollectionReusableView.m b/DTCollectionViewManager/Convenience/DTCollectionReusableView.m index 0ab7bd8..8a3a14d 100644 --- a/DTCollectionViewManager/Convenience/DTCollectionReusableView.m +++ b/DTCollectionViewManager/Convenience/DTCollectionReusableView.m @@ -43,4 +43,9 @@ - (id)model return nil; } ++(NSString *)reuseIdentifier +{ + return NSStringFromClass(self); +} + @end diff --git a/DTCollectionViewManager/Convenience/DTCollectionViewCell.m b/DTCollectionViewManager/Convenience/DTCollectionViewCell.m index 536bc3c..a805377 100644 --- a/DTCollectionViewManager/Convenience/DTCollectionViewCell.m +++ b/DTCollectionViewManager/Convenience/DTCollectionViewCell.m @@ -43,4 +43,9 @@ -(id)model return nil; } ++(NSString *)reuseIdentifier +{ + return NSStringFromClass(self); +} + @end diff --git a/DTCollectionViewManager/DTCollectionViewFactory.m b/DTCollectionViewManager/DTCollectionViewFactory.m index d5b3bbe..83994b5 100644 --- a/DTCollectionViewManager/DTCollectionViewFactory.m +++ b/DTCollectionViewManager/DTCollectionViewFactory.m @@ -74,7 +74,7 @@ - (void)registerCellClass:(Class)cellClass forModelClass:(Class)modelClass { [[self.delegate collectionView] registerNib:[UINib nibWithNibName:cellClassString bundle:nil] - forCellWithReuseIdentifier:cellClassString]; + forCellWithReuseIdentifier:[self reuseIdentifierFromClass:cellClass]]; } self.cellMappings[[self classStringForClass:modelClass]] = NSStringFromClass(cellClass); } @@ -90,7 +90,7 @@ - (void)registerSupplementaryClass:(Class)supplementaryClass [[self.delegate collectionView] registerNib:[UINib nibWithNibName:supplementaryClassString bundle:nil] forSupplementaryViewOfKind:kind - withReuseIdentifier:supplementaryClassString]; + withReuseIdentifier:[self reuseIdentifierFromClass:supplementaryClass]]; } [self setSupplementaryClass:supplementaryClass forKind:kind @@ -100,7 +100,8 @@ - (void)registerSupplementaryClass:(Class)supplementaryClass - (UICollectionViewCell *)cellForItem:(id)modelItem atIndexPath:(NSIndexPath *)indexPath { - NSString * reuseIdentifier = self.cellMappings[[self classStringForClass:[modelItem class]]]; + NSString * classString = self.cellMappings[[self classStringForClass:[modelItem class]]]; + NSString * reuseIdentifier = [self reuseIdentifierFromClass:NSClassFromString(classString)]; if (!reuseIdentifier) { return nil; @@ -117,7 +118,8 @@ - (void)registerSupplementaryClass:(Class)supplementaryClass forItem:(id)modelItem atIndexPath:(NSIndexPath *)indexPath { - NSString * reuseIdentifier = [self supplementaryClassForKind:kind modelClass:[modelItem class]]; + NSString * classString = [self supplementaryClassForKind:kind modelClass:[modelItem class]]; + NSString * reuseIdentifier = [self reuseIdentifierFromClass:NSClassFromString(classString)]; if (!reuseIdentifier) { return nil; @@ -131,6 +133,17 @@ - (void)registerSupplementaryClass:(Class)supplementaryClass } } +-(NSString *)reuseIdentifierFromClass:(Class)klass +{ + NSString * reuseIdentifier = NSStringFromClass(klass); + + if ([klass respondsToSelector:@selector(reuseIdentifier)]) + { + reuseIdentifier = [klass reuseIdentifier]; + } + return reuseIdentifier; +} + - (NSString *)classStringForClass:(Class)class { NSString * classString = NSStringFromClass(class); diff --git a/Example/CedarUnitTests/CedarUnitTests-Prefix.pch b/Example/CedarUnitTests/CedarUnitTests-Prefix.pch index abfaaf9..c935459 100644 --- a/Example/CedarUnitTests/CedarUnitTests-Prefix.pch +++ b/Example/CedarUnitTests/CedarUnitTests-Prefix.pch @@ -11,8 +11,7 @@ #ifdef __OBJC__ #import #import - #import - #import + #import #import "DTCollectionViewManager.h" #import #endif diff --git a/Example/Podfile b/Example/Podfile index 95023ce..2d0ae78 100644 --- a/Example/Podfile +++ b/Example/Podfile @@ -2,7 +2,7 @@ xcodeproj 'DTCollectionViewManagerExample.xcodeproj' inhibit_all_warnings! platform :ios, 6.0 -pod 'DTModelStorage', '0.6.0' +pod 'DTModelStorage', '0.8.0' pod 'PlaceKit', '~> 1.0.0' target :Tests do diff --git a/Example/Podfile.lock b/Example/Podfile.lock new file mode 100644 index 0000000..9e54ab9 --- /dev/null +++ b/Example/Podfile.lock @@ -0,0 +1,35 @@ +PODS: + - AutoDescribe (1.0.0) + - Cedar (0.9.7) + - DTModelStorage (0.8.0): + - DTModelStorage/All + - DTModelStorage/All (0.8.0): + - DTModelStorage/CoreDataStorage + - DTModelStorage/MemoryStorage + - DTModelStorage/ModelTransfer + - DTModelStorage/Core (0.8.0) + - DTModelStorage/CoreDataStorage (0.8.0): + - DTModelStorage/Core + - DTModelStorage/MemoryStorage (0.8.0): + - DTModelStorage/Core + - DTModelStorage/ModelTransfer (0.8.0) + - OCMock (2.2.4) + - PlaceKit (1.0.0): + - PlaceKit/Core + - PlaceKit/Core (1.0.0) + +DEPENDENCIES: + - AutoDescribe + - Cedar + - DTModelStorage (= 0.8.0) + - OCMock (~> 2.2.1) + - PlaceKit (~> 1.0.0) + +SPEC CHECKSUMS: + AutoDescribe: ef4ac47c8593c58ab852506368f61d3820a24ad5 + Cedar: d704a464f628b39ce763d49f42b5510a9e0b03b9 + DTModelStorage: 84b63252b63132c14238283d5de67aebe464694c + OCMock: 6db79185520e24f9f299548f2b8b07e41d881bd5 + PlaceKit: bf5a00a4abada01dd8dc8f822987571a99263449 + +COCOAPODS: 0.33.1