admin
2022-09-04 fa05f89529e05078b29606e4beda3de5cfdce485
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
//
//  NSMutableDictionary+Utilities.h
//  BUAdSDK
//
//  Created by 李盛 on 2018/2/28.
//  Copyright © 2018年 bytedance. All rights reserved.
//
 
#import <Foundation/Foundation.h>
 
NS_ASSUME_NONNULL_BEGIN
 
@interface NSDictionary (BU_Helper)
 
#pragma mark - Safe Value Type From Key
- (nullable NSString *)bu_stringForKey:(NSString *)key defaultValue:(nullable NSString *)defalutValue;
- (BOOL)bu_boolForKey:(NSString *)key defaultValue:(BOOL)defalutValue;
- (NSInteger)bu_integerForKey:(NSString *)key defaultValue:(NSInteger)defalutValue;
- (long)bu_longForKey:(NSString *)key defaultValue:(long)defalutValue;
- (long long)bu_longLongForKey:(NSString *)key defaultValue:(long long)defalutValue;
- (NSTimeInterval)bu_timeIntervalForKey:(NSString *)key defaultValue:(NSTimeInterval)defalutValue;
- (float)bu_floatForKey:(NSString *)key defaultValue:(float)defalutValue;
- (nullable NSArray *)bu_arrayForKey:(NSString *)key defaultValue:(nullable NSArray *)defalutValue;
- (nullable NSDictionary *)bu_dictionaryForKey:(NSString *)key defaultValue:(nullable NSDictionary *)defalutValue;
 
@end
 
@interface NSDictionary(BU_JSONValue)
 
- (nullable NSString *)bu_JSONRepresentation:(NSError **)error;
+ (nullable NSDictionary *)bu_dictionaryWithJSONData:(nullable NSData *)inData error:(NSError **)outError;
+ (nullable NSDictionary *)bu_dictionaryWithJSONString:(NSString *)inJSON error:(NSError **)outError;
 
 
 
 
- (void)bu_forEachWithBlock:(void(^)(id key, id value))block;
 
 
 
 
 
@end
 
@interface NSDictionary(BU_Formate)
 
- (void)bu_parserWithKey:(NSString *)key stringValue:(NSString *_Nullable*_Nullable)stringValue dictValue:(NSDictionary *_Nullable*_Nullable)dictValue aryValue:(NSArray *_Nullable*_Nullable)aryValue;
 
@end
 
@interface NSMutableDictionary (BU_Helper)
 
#pragma mark - Safe Set Object For Key
- (void)bu_setObject:(nullable id)object forKey:(nullable id<NSCopying>)key;
 
@end
 
NS_ASSUME_NONNULL_END