All Projects → satishbabariya → Swiftycontacts

satishbabariya / Swiftycontacts

Licence: mit
A Swift library for Contacts framework.

Programming Languages

swift
15916 projects
swift4
162 projects

Projects that are alternatives of or similar to Swiftycontacts

Core
🚀 The Node.js Framework highly focused on developer ergonomics, stability and confidence
Stars: ✭ 11,697 (+6740.35%)
Mutual labels:  hacktoberfest, framework
Cyclejs
A functional and reactive JavaScript framework for predictable code
Stars: ✭ 9,996 (+5745.61%)
Mutual labels:  hacktoberfest, framework
Scrapy
Scrapy, a fast high-level web crawling & scraping framework for Python.
Stars: ✭ 42,343 (+24661.99%)
Mutual labels:  hacktoberfest, framework
Milligram
A minimalist CSS framework.
Stars: ✭ 9,568 (+5495.32%)
Mutual labels:  hacktoberfest, framework
Custom Pod Autoscaler
Custom Pod Autoscaler base, allows creation of Custom Pod Autoscalers
Stars: ✭ 148 (-13.45%)
Mutual labels:  hacktoberfest, framework
Libmtev
Mount Everest Application Framework
Stars: ✭ 104 (-39.18%)
Mutual labels:  hacktoberfest, framework
Elgg
A social networking engine in PHP/MySQL
Stars: ✭ 1,510 (+783.04%)
Mutual labels:  hacktoberfest, framework
Loadingshimmer
An easy way to add a shimmering effect to any view with just one line of code. It is useful as an unobtrusive loading indicator.
Stars: ✭ 1,180 (+590.06%)
Mutual labels:  hacktoberfest, framework
Fiber
⚡️ Express inspired web framework written in Go
Stars: ✭ 17,334 (+10036.84%)
Mutual labels:  hacktoberfest, framework
Ocpp
Python implementation of the Open Charge Point Protocol (OCPP).
Stars: ✭ 127 (-25.73%)
Mutual labels:  hacktoberfest, framework
Cloudcmd
✨☁️📁✨ Cloud Commander file manager for the web with console and editor.
Stars: ✭ 1,332 (+678.95%)
Mutual labels:  hacktoberfest, framework
Framework
This repository contains the core code of Laravel Zero
Stars: ✭ 167 (-2.34%)
Mutual labels:  hacktoberfest, framework
Coteafs Appium
📱 Wrapper Appium Framework in Java which supports Automation of Mobile and Tablet apps.
Stars: ✭ 93 (-45.61%)
Mutual labels:  hacktoberfest, framework
Truffle
A tool for developing smart contracts. Crafted with the finest cacaos.
Stars: ✭ 11,909 (+6864.33%)
Mutual labels:  hacktoberfest, framework
Pastepwn
Python framework to scrape Pastebin pastes and analyze them
Stars: ✭ 87 (-49.12%)
Mutual labels:  hacktoberfest, framework
Meteor
Meteor, the JavaScript App Platform
Stars: ✭ 42,739 (+24893.57%)
Mutual labels:  hacktoberfest, framework
Falcon
The no-nonsense REST API and microservices framework for Python developers, with a focus on reliability, correctness, and performance at scale.
Stars: ✭ 8,654 (+4960.82%)
Mutual labels:  hacktoberfest, framework
Edxposedmanager
Companion Android application for EdXposed
Stars: ✭ 1,172 (+585.38%)
Mutual labels:  hacktoberfest, framework
Cphalcon
High performance, full-stack PHP framework delivered as a C extension.
Stars: ✭ 10,534 (+6060.23%)
Mutual labels:  hacktoberfest, framework
Playframework
Play Framework
Stars: ✭ 12,041 (+6941.52%)
Mutual labels:  hacktoberfest, framework

SwiftyContacts

Language: Swift 4 Version License Platform Swift Package Manager Carthage compatible CocoaPods compatible RxSwift: Supported Read the Docs

This document is deprecated new document is on the way

A Swift library for Contacts framework.

Requirements

  • iOS 9.0+ / Mac OS X 10.12+ / watchOS 3.0+
  • Xcode 9.0+

Installation

CocoaPods

CocoaPods is a dependency manager for Cocoa projects. You can install it with the following command:

$ gem install cocoapods

To integrate SwiftyContacts into your Xcode project using CocoaPods, specify it in your Podfile:

source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '8.0'
use_frameworks!

pod 'SwiftyContacts'

#or

pod 'SwiftyContacts/RxSwift'

For swift 3.x use

// Swift 3.x
pod 'SwiftyContacts' , '~> 2.0.7'

Then, run the following command:

$ pod install

Carthage

Carthage is a decentralized dependency manager that automates the process of adding frameworks to your Cocoa application.

You can install Carthage with Homebrew using the following command:

$ brew update
$ brew install carthage

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

github "SwiftyContacts/SwiftyContacts" ~> 3.0.8

Swift Package Manager

To use SwiftyContacts as a Swift Package Manager package just add the following in your Package.swift file.

import PackageDescription

let package = Package(
    name: "HelloSwiftyContacts",
    dependencies: [
        .Package(url: "https://github.com/satishbabariya/SwiftyContacts", "3.0.8")
    ]
)

Manually

If you prefer not to use either of the aforementioned dependency managers, you can integrate SwiftyContacts into your project manually.

Embeded Binaries

  • Download the latest release from https://github.com/satishbabariya/SwiftyContacts/releases
  • Next, select your application project in the Project Navigator (blue project icon) to navigate to the target configuration window and select the application target under the "Targets" heading in the sidebar.
  • In the tab bar at the top of that window, open the "General" panel.
  • Click on the + button under the "Embedded Binaries" section.
  • Add the downloaded SwiftyContacts.framework.
  • And that's it!

Get started

Import SwiftyContacts into your porject

    import SwiftyContacts

For requesting an access for getting contacts. The user will only be prompted the first time access is requested.

    requestAccess { (responce) in
        if responce {
            print("Contacts Acess Granted")
        } else {
            print("Contacts Acess Denied")
        }
    }

Determine Status of Acess Permission

    authorizationStatus { (status) in
        switch status {
            case .authorized:
                print("authorized")
                break
            case .denied:
                print("denied")
                break
            default:
                break
        }
    }

Fetch Contacts -- Result will be Array of CNContacts

    fetchContacts { (result) in
        switch result {
            case .success(let contacts):
                // Do your thing here with [CNContacts] array
                break
            case .failure(let error):
                break
        }
    }

Fetch Contacts by Order -- Sorted by CNContactSortOrder -- Result will be Array of CNContacts

    fetchContacts(ContactsSortorder: .givenName) { (result) in
        switch result{
            case .success(let contacts):
                // Do your thing here with [CNContacts] array
                break
            case .failure(let error):
                print(error)
                break
        }
    })

Fetch Contacts on Background Thread

    fetchContactsOnBackgroundThread(completionHandler: { (result) in
        switch result{
            case .success(let contacts):
                // Do your thing here with [CNContacts] array	 
                break
            case .failure(let error):
                print(error)
                break
        }
    })

Search Contact

    searchContact(SearchString: "john") { (result) in
        switch result{
            case .success(let contacts):
                // Contacts Array includes Search Result Contacts
                break
            case .failure(let error):
                print(error)
                break
        }
    }

Get CNContact From Identifire

    getContactFromID(Identifire: "XXXXXXXXX", completionHandler: { (result) in  
        switch result{
            case .success(let contact):
                // CNContact
                break
            case .failure(let error):
                print(error)
                break
        }
    })

Add Contact

    let contact : CNMutableContact = CNMutableContact()
    contact.givenName = "Satish"
    // OR Use contact.mutableCopy() For Any CNContact

    addContact(Contact: contact) { (result) in
        switch result{
            case .success(let bool):
                if bool{
                    print("Contact Sucessfully Added")
                }
                break
            case .failure(let error):
                print(error.localizedDescription)
                break
        }
    }

Add Contact in Container

    addContactInContainer(Contact: CNMutableContact, Container_Identifier: String) { (result) in
        //Same As Add Contact
    }

Update Contact

    updateContact(Contact: contact) { (result) in
        switch result{
        case .success(let bool):
            if bool{
                print("Contact Sucessfully Updated")
            }
            break
        case .failure(let error):
            print(error.localizedDescription)
            break
        }
    }

Delete Contact

    // Use contact.mutableCopy() To convert CNContact to CNMutableContact
    deleteContact(Contact: contact) { (result) in
        switch result{
            case .success(let bool):
                if bool{
                    print("Contact Sucessfully Deleted")
                }
                break
            case .failure(let error):
                print(error.localizedDescription)
                break
        }
    }

Fetch List Of Groups

    fetchGroups { (result) in
        switch result{
            case .success(let groups):
                // List Of Groups in groups array
                break
            case .failure(let error):
                print(error.localizedDescription)
            break
        }
    }

Create Group

    createGroup(Group_Name: "Satish") { (result) in
        switch result{
            case .success(let bool):
                if bool{
                    print("Group Sucessfully Created")
                }
                break
            case .failure(let error):
                print(error.localizedDescription)
                break
        }
    }

Create Group in Container

    createGroup(Group_Name: "Satish" , ContainerIdentifire: "ID") { (result) in
        switch result{
            case .success(let bool):
                if bool{
                    print("Group Sucessfully Created")
                }
                break
            case .failure(let error):
                print(error.localizedDescription)
                break
        }
    }

Update Group

    updateGroup(Group: group, New_Group_Name: "New Name") { (result) in
        switch result{
            case .success(response: let bool):
                if bool{
                    print("Group Sucessfully Updated")
                }
                break
            case .failure(let error):
                print(error.localizedDescription)
                break
        }
    }

Remove Group

    removeGroup(Group: group) { (result) in
        switch result{
            case .success(response: let bool):
                if bool{
                    print("Group Sucessfully Removed")
                }
                break
            case .failure(let error):
                print(error.localizedDescription)
                break
        }
    }

Fetch Contacts In Group

    fetchContactsInGorup(Group: group) { (result) in
        switch result{
            case .success(let contacts):
                // Do your thing here with [CNContacts] array	 
                break
            case .failure(let error):
                print(error)
                break
        }
    }

// OR Use

    fetchContactsInGorup2(Group: group) { (result) in
        switch result{
            case .success(let contacts):
                // Do your thing here with [CNContacts] array	 
                break
            case .failure(let error):
                print(error)
                break
        }
    }

Add Contact To Group

    addContactToGroup(Group: group, Contact: contact) { (result) in
        switch result{
            case .success(let bool):
                if bool{
                    print("Contact Sucessfully Added To Group")         
                }
                break
            case .failure(let error):
                print(error.localizedDescription)
                break
        }
    }

Remove Contact From Group

    removeContactFromGroup(Group: group, Contact: contact) { (result) in
        switch result{
            case .success(let bool):
                if bool{
                    print("Contact Sucessfully Added To Group")
                }
                break
            case .failure(let error):
                print(error.localizedDescription)
                break
        }
    }

Convert [CNContacts] TO CSV

    contactsToVCardConverter(contacts: ContactsArray) { (result) in
        switch result {
            case .success(let data):
                // Use file extension will be .vcf
                break
            case .failure(let error):
                print(error.localizedDescription)
                break

        }
    }

Convert CSV TO [CNContact]

    VCardToContactConverter(data: data) { (result) in
        switch result{
            case .success(let contacts):
                // Use Contacts array as you like   
                break
            case .failure(let error):
                print(error.localizedDescription)
                break
        }
    }

Author

Satish Babariya, [email protected]

License

SwiftyContacts is available under the MIT license. See the LICENSE file for more info.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].