Permalink
Browse files

Rename the block typedefs to have a prefix

  • Loading branch information...
1 parent a40bf61 commit 8ba4839ab04217a9ca9172b4333a281b91952b92 @danielctull danielctull committed Nov 9, 2011
Showing with 13 additions and 12 deletions.
  1. +9 −8 NSTimer+JCSBlocks.h
  2. +4 −4 NSTimer+JCSBlocks.m
View
17 NSTimer+JCSBlocks.h
@@ -26,8 +26,8 @@
you how they are used.
*/
-typedef void (^timerCallback_t)();
-typedef void (^interruptableTimerCallback_t)(BOOL *stop);
+typedef void (^JCSTimerCallback)();
+typedef void (^JCSInterruptableTimerCallback)(BOOL *stop);
@interface NSTimer (JCSBlocks)
@@ -37,12 +37,13 @@ typedef void (^interruptableTimerCallback_t)(BOOL *stop);
@param seconds NSInterval. The number of seconds between the the firing of the timer.
@param repeats BOOL. Whether the timer should be repeating or not.
@param block A block which has a void return and takes no paramaters. This is run whenever the timer fires.
- The type is timerCallback_t which is defined as:
- typedef void (^timerCallback_t)();
+ The type is JCSTimerCallback which is defined as:
+
+ typedef void (^JCSTimerCallback)();
*/
-+ (NSTimer *)jcs_scheduledTimerWithTimeInterval:(NSTimeInterval)seconds repeats:(BOOL)repeats blockHandler:(timerCallback_t)block;
++ (NSTimer *)jcs_scheduledTimerWithTimeInterval:(NSTimeInterval)seconds repeats:(BOOL)repeats blockHandler:(JCSTimerCallback)block;
/** Create a repeating timer which can be stopped from within the passed block
@@ -54,11 +55,11 @@ typedef void (^interruptableTimerCallback_t)(BOOL *stop);
Setting this parameter to `NO` from within the block will prevent any more events to be fired by the timer.
Additionally, the timer will be invalidated and set to nil when it is stopped this way.
- The type is interruptableTimerCallback_t which is defined as
+ The type is JCSInterruptableTimerCallback which is defined as
- typedef void (^interruptableTimerCallback_t)(BOOL *stop);
+ typedef void (^JCSInterruptableTimerCallback)(BOOL *stop);
*/
-+ (NSTimer *)jcs_scheduledInterruptableTimerWithTimeInterval:(NSTimeInterval)seconds blockHandler:(interruptableTimerCallback_t)block;
++ (NSTimer *)jcs_scheduledInterruptableTimerWithTimeInterval:(NSTimeInterval)seconds blockHandler:(JCSInterruptableTimerCallback)block;
@end
View
8 NSTimer+JCSBlocks.m
@@ -18,15 +18,15 @@ - (void)jcs_handleBlockWithInterruptableTimer:(NSTimer *)timer;
@implementation NSTimer (JCSBlocks)
-+ (NSTimer *)jcs_scheduledTimerWithTimeInterval:(NSTimeInterval)seconds repeats:(BOOL)repeats blockHandler:(timerCallback_t)block {
++ (NSTimer *)jcs_scheduledTimerWithTimeInterval:(NSTimeInterval)seconds repeats:(BOOL)repeats blockHandler:(JCSTimerCallback)block {
JCSTimerBlockHandler *blockHandler = [[JCSTimerBlockHandler alloc] init];
blockHandler.block = [block copy];
return [self scheduledTimerWithTimeInterval:seconds target:blockHandler selector:@selector(jcs_handleBlockWithTimer:) userInfo:nil repeats:repeats];
}
-+ (NSTimer *)jcs_scheduledInterruptableTimerWithTimeInterval:(NSTimeInterval)seconds blockHandler:(interruptableTimerCallback_t)block{
++ (NSTimer *)jcs_scheduledInterruptableTimerWithTimeInterval:(NSTimeInterval)seconds blockHandler:(JCSInterruptableTimerCallback)block{
JCSTimerBlockHandler *blockHandler = [[JCSTimerBlockHandler alloc] init];
blockHandler.block = [block copy];
@@ -42,14 +42,14 @@ @implementation JCSTimerBlockHandler
- (void)jcs_handleBlockWithTimer:(NSTimer *)timer {
- timerCallback_t callbackBlock = self.block;
+ JCSTimerCallback callbackBlock = self.block;
callbackBlock();
}
- (void)jcs_handleBlockWithInterruptableTimer:(NSTimer *)timer {
- interruptableTimerCallback_t callbackBlock = self.block;
+ JCSInterruptableTimerCallback callbackBlock = self.block;
BOOL stop;
callbackBlock(&stop);

0 comments on commit 8ba4839

Please sign in to comment.