-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathContactsUI+Convenience.h
72 lines (43 loc) · 1.96 KB
/
ContactsUI+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
//
// ContactsUI+Convenience.h
// vCard
//
// Created by Alexander Ivanov on 07.04.2018.
// Copyright © 2018 Alexander Ivanov. All rights reserved.
//
#import <ContactsUI/ContactsUI.h>
#import "NSArray+Convenience.h"
#import "NSObject+Convenience.h"
@interface CNContactStore (Convenience)
+ (instancetype)defaultStore;
+ (CNAuthorizationStatus)authorizationStatus;
- (void)requestAccess:(void (^)(BOOL granted))completionHandler;
- (BOOL)enumerateContactsWithKeysToFetch:(NSArray <id<CNKeyDescriptor>>*)keysToFetch usingBlock:(BOOL (^)(CNContact *contact))block;
@end
@interface CNContact (Convenience)
@property (strong, nonatomic, readonly) NSString *fullName;
@property (strong, nonatomic, readonly) NSString *phoneticFullName;
@property (strong, nonatomic, readonly) UIImage *image;
@property (strong, nonatomic, readonly) UIImage *thumbnailImage;
- (CNSocialProfile *)socialProfileWithService:(NSString *)service;
- (CNInstantMessageAddress *)instantMessageAddressWithService:(NSString *)service;
@end
@interface CNContactVCardSerialization (Convenience)
+ (NSArray<CNContact *> *)contactsWithData:(NSData *)data;
+ (NSData *)dataWithContacts:(NSArray<CNContact *> *)contacts;
@end
@interface CNSocialProfile (Convenience)
+ (instancetype)facebookProfileWithUsername:(NSString *)username;
+ (instancetype)flickrProfileWithUsername:(NSString *)username;
+ (instancetype)linkedInProfileWithUsername:(NSString *)username;
+ (instancetype)twitterProfileWithUsername:(NSString *)username;
@property (strong, nonatomic, readonly) NSURL *url;
@end
@interface NSArray<ObjectType> (CNLabeledValue)
- (NSArray<ObjectType> *)allLabeled:(NSString *)label;
- (ObjectType)firstLabeled:(NSString *)label;
@end
@interface UIViewController (ContactsUI)
- (CNContactPickerViewController *)presentContactPickerWithCompletion:(void (^)(CNContact *contact))completion;
- (CNContactViewController *)presentUnknownContact:(CNContact *)contact store:(CNContactStore *)contactStore;
@end