Skip to content

Instantly share code, notes, and snippets.

@rhysforyou
Created December 13, 2011 04:00
Show Gist options
  • Select an option

  • Save rhysforyou/1470502 to your computer and use it in GitHub Desktop.

Select an option

Save rhysforyou/1470502 to your computer and use it in GitHub Desktop.
#import <Foundation/Foundation.h>
#import <CoreData/CoreData.h>
@interface Task : NSManagedObject
@property (nonatomic, retain) NSString * title;
@property (nonatomic, retain) NSNumber * duration;
- (NSString *)durationString;
- (NSString *)minutesString;
@end
#import "Task.h"
@implementation Task
@dynamic title;
@dynamic duration;
- (NSString *)durationString
{
if ((int)self.duration == 1) {
return @"1 Pomodoro";
} else {
return [NSString stringWithFormat:@"%@ Pomodoros", self.duration];
}
}
- (NSString *)minutesString
{
return [NSString stringWithFormat:@"%@ minutes", [NSNumber numberWithInt:(int)self.duration*25]];
}
@end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment