Created
January 17, 2011 14:31
-
-
Save mikeabdullah/782896 to your computer and use it in GitHub Desktop.
Simple value transfer like `NSIsNotNil`, but for NSNotFound
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// KSIsNotNSNotFound.h | |
// Sandvox | |
// | |
// Created by Mike on 16/01/2011. | |
// Copyright 2011 Karelia Software. All rights reserved. | |
// | |
#import <Cocoa/Cocoa.h> | |
@interface KSIsNotNSNotFound : NSValueTransformer | |
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// KSIsNotNSNotFound.m | |
// Sandvox | |
// | |
// Created by Mike on 16/01/2011. | |
// Copyright 2011 Karelia Software. All rights reserved. | |
// | |
#import "KSIsNotNSNotFound.h" | |
@implementation KSIsNotNSNotFound | |
+ (Class)transformedValueClass; { return [NSNumber class]; } | |
+ (BOOL)allowsReverseTransformation; { return NO; } | |
- (id)transformedValue:(id)value; | |
{ | |
BOOL result = [value unsignedIntegerValue] != NSNotFound; | |
return NSBOOL(result); | |
} | |
@end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment