From 4cf69c4576cb94bf38f690c2e33740ba556717d2 Mon Sep 17 00:00:00 2001 From: Nikolay Kasyanov Date: Sun, 18 Oct 2015 19:33:23 +0200 Subject: [PATCH] Use generics to improve Swift interop --- CollectionChanges/VMBCollectionSectionChange.h | 4 ++-- CollectionChanges/VMBCollectionSectionChange.m | 10 +++++----- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/CollectionChanges/VMBCollectionSectionChange.h b/CollectionChanges/VMBCollectionSectionChange.h index 7a9f8c9..2ef1a71 100644 --- a/CollectionChanges/VMBCollectionSectionChange.h +++ b/CollectionChanges/VMBCollectionSectionChange.h @@ -28,12 +28,12 @@ typedef BOOL (^VMBCollectionItemComparator)(id left, id right); + (instancetype)removeChange; /// changes is NSArray -+ (instancetype)incrementalChange:(NSArray *)changes; ++ (instancetype)incrementalChange:(NSArray *)changes; - (void)ifReloadChange:(dispatch_block_t)reloadHandler insert:(dispatch_block_t)insertHandler remove:(dispatch_block_t)removeHandler - incremental:(void (^)(NSArray /* */ *changes))incrementalHandler; + incremental:(void (^)(NSArray *changes))incrementalHandler; @end diff --git a/CollectionChanges/VMBCollectionSectionChange.m b/CollectionChanges/VMBCollectionSectionChange.m index 8985245..e8d87f5 100644 --- a/CollectionChanges/VMBCollectionSectionChange.m +++ b/CollectionChanges/VMBCollectionSectionChange.m @@ -17,7 +17,7 @@ @implementation YACollectionSectionChangeReload - (void)ifReloadChange:(dispatch_block_t)reloadHandler insert:(dispatch_block_t)insertHandler remove:(dispatch_block_t)removeHandler - incremental:(void (^)(NSArray *))incrementalHandler { + incremental:(void (^)(NSArray *))incrementalHandler { reloadHandler(); } @@ -33,7 +33,7 @@ @implementation YACollectionSectionChangeInsert - (void)ifReloadChange:(dispatch_block_t)reloadHandler insert:(dispatch_block_t)insertHandler remove:(dispatch_block_t)removeHandler - incremental:(void (^)(NSArray *))incrementalHandler { + incremental:(void (^)(NSArray *))incrementalHandler { insertHandler(); } @@ -49,7 +49,7 @@ @implementation YACollectionSectionChangeRemove - (void)ifReloadChange:(dispatch_block_t)reloadHandler insert:(dispatch_block_t)insertHandler remove:(dispatch_block_t)removeHandler - incremental:(void (^)(NSArray *))incrementalHandler { + incremental:(void (^)(NSArray *))incrementalHandler { removeHandler(); } @@ -67,7 +67,7 @@ @implementation YACollectionSectionChangeIncremental - (void)ifReloadChange:(dispatch_block_t)reloadHandler insert:(dispatch_block_t)insertHandler remove:(dispatch_block_t)removeHandler - incremental:(void (^)(NSArray *))incrementalHandler { + incremental:(void (^)(NSArray *))incrementalHandler { incrementalHandler(self.changes); } @@ -181,7 +181,7 @@ + (instancetype)incrementalChange:(NSArray *)changes { - (void)ifReloadChange:(dispatch_block_t)reloadHandler insert:(dispatch_block_t)insertHandler remove:(dispatch_block_t)removeHandler - incremental:(void (^)(NSArray *))incrementalHandler { + incremental:(void (^)(NSArray *))incrementalHandler { @throw [NSException exceptionWithName:NSInternalInconsistencyException reason:@"This class is not meant to be subclassed" userInfo:nil];