-
Notifications
You must be signed in to change notification settings - Fork 83
/
Copy pathStopwatch.h
44 lines (35 loc) · 814 Bytes
/
Stopwatch.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
//
// Timer.h
// Thyme
//
// Created by João on 3/16/13.
//
//
#import <Foundation/Foundation.h>
// Delegate
@protocol StopwatchDelegate <NSObject>
- (void) didStart:(id)stopwatch;
- (void) didPause:(id)stopwatch;
- (void) didStop:(id)stopwatch withValue:(NSTimeInterval)value;
- (void) didChange:(id)stopwatch;
@end
// Timer
@interface Stopwatch : NSObject {
id<StopwatchDelegate> delegate;
@private
NSTimer* timer;
NSDate* reference;
NSTimeInterval accum;
}
@property (nonatomic, assign) id<StopwatchDelegate> delegate;
- (id) initWithDelegate:(id<StopwatchDelegate>)delegate;
- (NSString*) description;
- (NSTimeInterval) value;
- (BOOL) isActive;
- (BOOL) isPaused;
- (BOOL) isStopped;
- (void) start;
- (void) pause;
- (void) reset:(NSTimeInterval) value;
- (void) stop;
@end