-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathNSDictionary+Convenience.h
43 lines (30 loc) · 1.38 KB
/
NSDictionary+Convenience.h
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
//
// NSDictionary+Convenience.h
// Sleep Diary
//
// Created by Alexander Ivanov on 19.11.16.
// Copyright © 2016 Alexander Ivanov. All rights reserved.
//
#import <Foundation/Foundation.h>
@interface NSDictionary<KeyType, ObjectType> (Convenience)
- (ObjectType)objectForNullableKey:(KeyType)aKey;
- (instancetype)dictionaryWithObjectsForKeys:(NSArray<KeyType> *)keys;
- (instancetype)dictionaryWithObject:(ObjectType)object forKey:(KeyType)key;
- (instancetype)dictionaryWithObjects:(NSArray<ObjectType> *)objects forKeys:(NSArray<KeyType> *)keys;
- (instancetype)dictionaryWithEntriesFromDictionary:(NSDictionary *)otherDictionary;
- (NSDictionary *)mapKeys:(id (^)(KeyType key))keyBlock values:(id (^)(ObjectType val))valBlock;
- (NSDictionary *)mapKeys:(id (^)(KeyType key))block;
- (NSDictionary *)mapValues:(id (^)(ObjectType val))block;
- (NSArray *)array:(NSArray *(^)(KeyType key, ObjectType val))block;
- (NSArray *)array;
- (BOOL)boolForKey:(NSString *)key;
- (double)doubleForKey:(NSString *)key;
- (NSInteger)integerForKey:(NSString *)key;
- (NSUInteger)unsignedIntegerForKey:(NSString *)key;
@end
@interface NSMutableDictionary (Convenience)
- (void)setBool:(BOOL)value forKey:(NSString *)key;
- (void)setDouble:(double)value forKey:(NSString *)key;
- (void)setInteger:(NSInteger)value forKey:(NSString *)key;
- (void)setUnsignedInteger:(NSUInteger)value forKey:(NSString *)key;
@end