1234567891011121314151617181920212223242526272829303132333435363738 |
- #import "Bool.h"
-
- @interface Bool()
-
- @property (nonatomic, retain) NSNumber* value;
-
- @end
-
- @implementation Bool
-
- - (instancetype)initWithBOOL:(BOOL)boolValue {
- self = [super initWithValue:@(boolValue)];
- return self;
- }
-
- - (BOOL)get {
- return [self.value boolValue];
- }
-
- - (NSNumber *)getValue {
- return self.value;
- }
-
- - (BOOL)getWithDefaultValue:(BOOL)defaultValue {
- if (self.value) {
- return [self.value boolValue];
- } else {
- return defaultValue;
- }
- }
-
- - (bool)isFalse {
- return self.value != nil && ![self.value boolValue];
- }
-
-
- @end
|