-
Notifications
You must be signed in to change notification settings - Fork 1
/
CloudKit+Convenience.h
86 lines (54 loc) · 2.52 KB
/
CloudKit+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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
//
// CloudKit+Convenience.h
// Ringtonic
//
// Created by Alexander Ivanov on 19.11.16.
// Copyright © 2016 Alexander Ivanov. All rights reserved.
//
#import <CloudKit/CloudKit.h>
#import "NSDictionary+Convenience.h"
#import "NSObject+Convenience.h"
#import "NSString+Convenience.h"
#define CKDefaultOwnerRecordName @"__defaultOwner__"
@interface CKContainer (Convenience)
- (void)fetchUserRecordID:(void (^)(CKRecordID *recordID))completionHandler;
//- (CKModifyBadgeOperation *)modifyBadge:(NSUInteger)badgeValue completionHandler:(void (^)(BOOL success))completionHandler;
- (CKFetchRecordsOperation *)fetchCurrentUserRecord:(void(^)(CKRecord *record))completionHandler;
@end
@interface CKNotification (Convenience)
- (NSString *)alertLocalization;
@property (assign, nonatomic, readonly) BOOL hasAlert;
@end
#define CKNotificationInfoSoundNameDefault @"default"
@interface CKNotificationInfo (Convenience)
- (BOOL)hasAlert;
@end
@interface CKRecord (Comnvenience)
- (NSDictionary *)allKeyValuePairs;
@end
@interface CKReference (Convenience)
- (instancetype)initWithRecord:(CKRecord *)record;
- (instancetype)initWithRecordID:(CKRecordID *)recordID;
@end
#define KEY_RECORD_ID @"recordID"
#define KEY_CREATOR_USER_RECORD_ID @"creatorUserRecordID"
#define KEY_LAST_MODIFIED_USER_RECORD_ID @"lastModifiedUserRecordID"
#define KEY_CREATION_DATE @"creationDate"
#define KEY_MODIFICATION_DATE @"modificationDate"
@interface NSPredicate (Convenience)
+ (NSPredicate *)truePredicate;
+ (NSPredicate *)falsePredicate;
+ (NSPredicate *)predicateWithKeys:(NSDictionary<NSString *, __kindof id <CKRecordValue>> *)keys;
+ (NSPredicate *)predicateWithKey:(NSString *)key value:(__kindof id <CKRecordValue>)value;
+ (NSPredicate *)predicateWithKey:(NSString *)key values:(NSArray<__kindof id <CKRecordValue>> *)values;
+ (NSPredicate *)predicateWithRecordID:(CKRecordID *)recordID;
+ (NSPredicate *)predicateWithCreatorUserRecordID:(CKRecordID *)recordID;
+ (NSPredicate *)predicateWithCreatorUserRecordIDs:(NSArray<CKRecordID *> *)recordIDs;
+ (NSPredicate *)predicateWithKey:(NSString *)key greaterThan:(__kindof id <CKRecordValue>)value;
+ (NSPredicate *)predicateWithKey:(NSString *)key lessThan:(__kindof id <CKRecordValue>)value;
+ (NSPredicate *)predicateWithCreationDateGreaterThan:(NSDate *)date;
+ (NSPredicate *)predicateWithCreationDateLessThan:(NSDate *)date;
+ (NSPredicate *)predicateWithModificationDateGreaterThan:(NSDate *)date;
+ (NSPredicate *)predicateWithModificationDateLessThan:(NSDate *)date;
- (NSPredicate *)notPredicate;
@end