blob: 250c1a896b95e109f67800db00c2f6e8eadbe98c (
plain)
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
|
//
// NSDictionary+SafeRemove.m
// SmartDeviceLink-iOS
//
// Created by Joel Fischer on 7/21/16.
// Copyright © 2016 smartdevicelink. All rights reserved.
//
#import "NSMutableDictionary+SafeRemove.h"
@implementation NSMutableDictionary (SafeRemove)
- (BOOL)safeRemoveObjectForKey:(id)aKey {
if ([self objectForKey:aKey] != nil) {
[self removeObjectForKey:aKey];
return YES;
}
return NO;
}
@end
@implementation NSMapTable (SafeRemove)
- (BOOL)safeRemoveObjectForKey:(id)aKey {
if ([self objectForKey:aKey] != nil) {
[self removeObjectForKey:aKey];
return YES;
}
return NO;
}
@end
|