Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Don't bother with a typedef for the block

  • Loading branch information...
commit e68f62147752e7ad79947cefc8623d1ad7dc3c3c 1 parent 629a757
Daniel Tull authored
Showing with 4 additions and 14 deletions.
  1. +2 −12 NSObject+DCTKVOExtras.h
  2. +2 −2 NSObject+DCTKVOExtras.m
14 NSObject+DCTKVOExtras.h
View
@@ -36,8 +36,6 @@
#import "DCTFoundation.h"
-typedef void (^DCTKeyValueChange) ();
-
/** Helper methods to handle key-value coding calls.
*/
@interface NSObject (DCTKVOExtras)
@@ -46,25 +44,17 @@ typedef void (^DCTKeyValueChange) ();
/** Convenience method that calls willChangeValueForKey: and didChangeValueForKey: for the given key
either side of the change block.
- DCTKeyValueChange is a block defined as:
-
- `typedef void (^DCTKeyValueChange) ();`
-
@param key The key that is changed in the change block.
@param change The change block that performs the change.
*/
-- (void)dct_changeValueForKey:(NSString *)key withChange:(DCTKeyValueChange)change;
+- (void)dct_changeValueForKey:(NSString *)key withChange:(void (^)())change;
/** Convenience method that calls willChangeValueForKey: and didChangeValueForKey: for each key
in the array of keys either side of the change block.
- DCTKeyValueChange is a block defined as:
-
- `typedef void (^DCTKeyValueChange) ();`
-
@param keys An array of keys that are changed in the change block.
@param change The change block that performs the change.
*/
-- (void)dct_changeValueForKeys:(NSArray *)keys withChange:(DCTKeyValueChange)change;
+- (void)dct_changeValueForKeys:(NSArray *)keys withChange:(void (^)())change;
@end
4 NSObject+DCTKVOExtras.m
View
@@ -39,13 +39,13 @@ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
@implementation NSObject (DCTKVOExtras)
-- (void)dct_changeValueForKey:(NSString *)key withChange:(DCTKeyValueChange)change {
+- (void)dct_changeValueForKey:(NSString *)key withChange:(void (^)())change {
[self willChangeValueForKey:key];
change();
[self didChangeValueForKey:key];
}
-- (void)dct_changeValueForKeys:(NSArray *)keys withChange:(DCTKeyValueChange)change {
+- (void)dct_changeValueForKeys:(NSArray *)keys withChange:(void (^)())change {
for (NSString *key in keys) [self willChangeValueForKey:key];
change();
for (NSString *key in [keys reverseObjectEnumerator]) [self didChangeValueForKey:key];
Please sign in to comment.
Something went wrong with that request. Please try again.