Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/abdullahselek/ContactsWrapper

Contacts wrapper for iOS 9 or upper with Objective-C
https://github.com/abdullahselek/ContactsWrapper

carthage cocoapods contacts contacts-wrapper xcode

Last synced: about 1 month ago
JSON representation

Contacts wrapper for iOS 9 or upper with Objective-C

Awesome Lists containing this project

README

        

[![Build Status](https://travis-ci.org/abdullahselek/ContactsWrapper.svg?branch=master)](https://travis-ci.org/abdullahselek/ContactsWrapper)
![CocoaPods Compatible](https://img.shields.io/cocoapods/v/ContactsWrapper.svg)
[![Carthage Compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](https://github.com/Carthage/Carthage)
[![Coverage Status](https://coveralls.io/repos/github/abdullahselek/ContactsWrapper/badge.svg?branch=master)](https://coveralls.io/github/abdullahselek/ContactsWrapper?branch=master)
![Platform](https://img.shields.io/cocoapods/p/ContactsWrapper.svg?style=flat)
![License](https://img.shields.io/dub/l/vibe-d.svg)

# ContactsWrapper
Contacts wrapper for iOS 9 or upper with Objective-C. For the information translated to Russian, take a look at this [link](http://gargo.of.by/contactswrapper/).

## Requirements
iOS 9.0+

## CocoaPods

CocoaPods is a dependency manager for Cocoa projects. You can install it with the following command:
```
$ gem install cocoapods
```
To integrate ContactsWrapper into your Xcode project using CocoaPods, specify it in your Podfile:
```
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '9.0'
use_frameworks!

target '' do
pod 'ContactsWrapper', '1.0.2'
end
```
Then, run the following command:
```
$ pod install
```
## Carthage

Carthage is a decentralized dependency manager that builds your dependencies and provides you with binary frameworks.

You can install Carthage with Homebrew using the following command:

```
brew update
brew install carthage
```

To integrate ContactsWrapper into your Xcode project using Carthage, specify it in your Cartfile:

```
github "abdullahselek/ContactsWrapper" ~> 1.0.2
```

Run carthage update to build the framework and drag the built ContactsWrapper.framework into your Xcode project.

### For iOS 10
```
add "Privacy - Contacts Usage Description" to your application .plist file
```
## Available methods

- Get all contacts if available with CNContactFamilyNameKey, CNContactGivenNameKey, CNContactPhoneNumbersKey, CNContactImageDataKey descriptors
```
- (void)getContactsWithContainerId:(nullable NSString *)containerId completionBlock:(void (^)(NSArray * _Nullable contacts, NSError * _Nullable error))completionBlock;
```

- Get all contacts with given key descriptors
```
- (void)getContactsWithKeys:(NSArray> *)keys
containerId:(nullable NSString *)containerId
completionBlock:(void (^)(NSArray * _Nullable contacts, NSError * _Nullable error))completionBlock
```

- Saves given contact
```
- (void)saveContact:(CNMutableContact *)contact
containerId:(nullable NSString *)containerId
completionBlock:(void (^)(bool isSuccess, NSError * _Nullable error))completionBlock
```

- Get contacts with given name
```
- (void)getContactsWithGivenName:(NSString *)givenName
completionBlock:(void (^)(NSArray * _Nullable contacts, NSError * _Nullable error))completionBlock
```

- Get contacts with given and family name
```
- (void)getContactsWithGivenName:(NSString *)givenName
familyName:(NSString *)familyName
completionBlock:(void (^)(NSArray * _Nullable contacts, NSError * _Nullable error))completionBlock
```

- Updates given contact
```
- (void)updateContact:(CNMutableContact *)contact
completionBlock:(void (^)(bool isSuccess, NSError * _Nullable error))completionBlock
```

- Get contacts with given email address
```
- (void)getContactsWithEmailAddress:(NSString *)emailAddress
completionBlock:(void (^)(NSArray * _Nullable contacts, NSError * _Nullable error))completionBlock
```
- Delete given contact
```
- (void)deleteContact:(CNMutableContact *)contact
completionBlock:(void (^)(bool isSuccess, NSError * _Nullable error))completionBlock
```

- Add given group to contacts list
```
- (void)addGroup:(CNMutableGroup *)group
containerId:(nullable NSString *)containerId
completionBlock:(void (^)(bool isSuccess, NSError * _Nullable error))completionBlock
```

- Add given member to given group
```
- (void)addGroupMember:(CNContact *)contact
group:(CNGroup *)group
completionBlock:(void (^)(bool isSuccess, NSError * _Nullable error))completionBlock
```

- Add given contacts to given group
```
- (void)addGroupMembers:(NSArray *)contacts
group:(CNGroup *)group
completionBlock:(void (^)(BOOL isSuccess, NSError * _Nullable error))completionBlock
```

- Fething groups
```
- (void)getGroupsWithContainerId:(nullable NSString *)containerId completionBlock:(void (^)(NSArray * _Nullable groups, NSError * _Nullable error))completionBlock
```

- Delete group
```
- (void)deleteGroup:(CNMutableGroup *)group
completionBlock:(void (^)(bool isSuccess, NSError * _Nullable error))completionBlock;
```

- Update group
```
- (void)updateGroup:(CNMutableGroup *)group
completionBlock:(void (^)(bool isSuccess, NSError * _Nullable error))completionBlock;
```

- Fetching containers
```
- (void)getContainers:(void (^)(NSArray * _Nullable containers, NSError * _Nullable error))completionBlock
```

## License

The MIT License (MIT)

Copyright (c) 2016 Abdullah Selek

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.