5 // Created by Hori,Masaki on 2015/03/01.
6 // Copyright (c) 2015年 Hori,Masaki. All rights reserved.
9 #import "HMSokuTransformer.h"
11 typedef NS_ENUM(NSInteger, SokuType) {
16 @implementation HMSokuTransformer
19 static dispatch_once_t onceToken;
20 dispatch_once(&onceToken, ^{
21 [NSValueTransformer setValueTransformer:[self new] forName:@"HMSokuTransformer"];
24 + (Class)transformedValueClass
26 return [NSString class];
28 + (BOOL)allowsReverseTransformation
33 - (id)transformedValue:(id)value
35 if(![value isKindOfClass:[NSNumber class]]) return nil;
37 NSString *result = nil;
38 SokuType soku = [value integerValue];
41 result = NSLocalizedString(@"Slow", @"Speed, slow");
44 result = NSLocalizedString(@"Fast", @"Speed, fast");