{"id":13617931,"url":"https://github.com/SwiftyContacts/SwiftyContacts","last_synced_at":"2025-04-14T06:36:12.069Z","repository":{"id":41496602,"uuid":"102214834","full_name":"SwiftyContacts/SwiftyContacts","owner":"SwiftyContacts","description":"A Swift library for Contacts framework.","archived":false,"fork":false,"pushed_at":"2022-10-08T19:56:14.000Z","size":44759,"stargazers_count":261,"open_issues_count":3,"forks_count":45,"subscribers_count":9,"default_branch":"master","last_synced_at":"2025-04-13T10:30:23.822Z","etag":null,"topics":["async-await","contact-management","contacts","contacts-manager","contacts-wrapper","framework","hacktoberfest","ios","macos","swift","watchos"],"latest_commit_sha":null,"homepage":"","language":"Swift","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/SwiftyContacts.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-09-02T18:09:59.000Z","updated_at":"2025-04-06T10:30:55.000Z","dependencies_parsed_at":"2022-08-10T02:35:04.127Z","dependency_job_id":null,"html_url":"https://github.com/SwiftyContacts/SwiftyContacts","commit_stats":null,"previous_names":[],"tags_count":24,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SwiftyContacts%2FSwiftyContacts","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SwiftyContacts%2FSwiftyContacts/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SwiftyContacts%2FSwiftyContacts/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SwiftyContacts%2FSwiftyContacts/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/SwiftyContacts","download_url":"https://codeload.github.com/SwiftyContacts/SwiftyContacts/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248836246,"owners_count":21169368,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["async-await","contact-management","contacts","contacts-manager","contacts-wrapper","framework","hacktoberfest","ios","macos","swift","watchos"],"created_at":"2024-08-01T20:01:50.851Z","updated_at":"2025-04-14T06:36:12.004Z","avatar_url":"https://github.com/SwiftyContacts.png","language":"Swift","readme":"# SwiftyContacts\n\n[![Language: Swift 5](https://img.shields.io/badge/language-Swift%205-f48041.svg?style=flat-square)](https://developer.apple.com/swift)\n[![Version](https://img.shields.io/cocoapods/v/SwiftyContacts.svg?style=flat-square)](http://cocoapods.org/pods/SwiftyContacts)\n[![License](https://img.shields.io/cocoapods/l/SwiftyContacts.svg?style=flat-square)](http://cocoapods.org/pods/SwiftyContacts)\n[![Platform](https://img.shields.io/badge/platforms-iOS%209.0+%20%7C%20macOS%2010.12+%20%7C%20watchOS%203.0+-333333.svg?style=flat-square)](http://cocoapods.org/pods/SwiftyContacts)\n[![Swift Package Manager](https://img.shields.io/badge/Swift%20Package%20Manager-compatible-brightgreen.svg?style=flat-square)](https://github.com/apple/swift-package-manager)\n[![Carthage compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat-square)](https://github.com/Carthage/Carthage)\n[![CocoaPods compatible](https://img.shields.io/cocoapods/v/SwiftyContacts.svg?style=flat-square)](https://cocoapods.org/pods/SwiftyContacts)\n[![RxSwift: Supported](https://img.shields.io/badge/RxSwift-Supported-f48041.svg?style=flat-square)](https://github.com/ReactiveX/RxSwift)\n[![Read the Docs](https://img.shields.io/readthedocs/pip.svg?style=flat-square)](https://swiftycontacts.firebaseapp.com/)\n\n\n\nA Swift library for Contacts framework.\n\n- [SwiftyContacts](#swiftycontacts)\n  - [Requirements](#requirements)\n  - [Installation](#installation)\n    - [CocoaPods](#cocoapods)\n    - [Swift Package Manager](#swift-package-manager)\n  - [Get started](#get-started)\n    - [async-await](#async-await)\n      - [Requests access to the user's contacts](#requests-access-to-the-users-contacts)\n      - [Request the current authorization status](#request-the-current-authorization-status)\n      - [Fetch all contacts from device](#fetch-all-contacts-from-device)\n      - [Fetch contacts matching a name.](#fetch-contacts-matching-a-name)\n      - [Fetch contacts matching an email address.](#fetch-contacts-matching-an-email-address)\n      - [Fetch contacts matching a phone number.](#fetch-contacts-matching-a-phone-number)\n      - [To fetch contacts matching contact identifiers.](#to-fetch-contacts-matching-contact-identifiers)\n      - [To fetch contacts matching group identifier](#to-fetch-contacts-matching-group-identifier)\n      - [find the contacts in the specified container.](#find-the-contacts-in-the-specified-container)\n      - [Fetch a contact with a given identifier.](#fetch-a-contact-with-a-given-identifier)\n      - [Add contact to the contact store.](#add-contact-to-the-contact-store)\n      - [Update contact to the contact store.](#update-contact-to-the-contact-store)\n      - [Delete contact to the contact store.](#delete-contact-to-the-contact-store)\n      - [Adds a group to the contact store.](#adds-a-group-to-the-contact-store)\n      - [Fetches all groups in the contact store.](#fetches-all-groups-in-the-contact-store)\n      - [Updates an existing group in the contact store.](#updates-an-existing-group-in-the-contact-store)\n      - [Deletes a group from the contact store.](#deletes-a-group-from-the-contact-store)\n      - [Find the contacts that are members in the specified group.](#find-the-contacts-that-are-members-in-the-specified-group)\n      - [Add a new member to a group.](#add-a-new-member-to-a-group)\n      - [Removes a contact as a member of a group.](#removes-a-contact-as-a-member-of-a-group)\n    - [closures](#closures)\n      - [Requests access to the user's contacts](#requests-access-to-the-users-contacts-1)\n      - [Fetch all contacts from device](#fetch-all-contacts-from-device-1)\n      - [Fetch contacts matching a name.](#fetch-contacts-matching-a-name-1)\n      - [Fetch contacts matching an email address.](#fetch-contacts-matching-an-email-address-1)\n      - [Fetch contacts matching a phone number.](#fetch-contacts-matching-a-phone-number-1)\n      - [Fetch contacts matching contact identifiers.](#fetch-contacts-matching-contact-identifiers)\n      - [Fetch contacts matching group identifier](#fetch-contacts-matching-group-identifier)\n      - [Find the contacts in the specified container.](#find-the-contacts-in-the-specified-container-1)\n      - [Fetch a contact with a given identifier.](#fetch-a-contact-with-a-given-identifier-1)\n      - [Adds the specified contact to the contact store.](#adds-the-specified-contact-to-the-contact-store)\n      - [Updates an existing contact in the contact store.](#updates-an-existing-contact-in-the-contact-store)\n      - [Deletes a contact from the contact store.](#deletes-a-contact-from-the-contact-store)\n      - [Fetches all groups matching the specified predicate.](#fetches-all-groups-matching-the-specified-predicate)\n      - [Adds a group to the contact store.](#adds-a-group-to-the-contact-store-1)\n      - [Updates an existing group in the contact store.](#updates-an-existing-group-in-the-contact-store-1)\n      - [Deletes a group from the contact store.](#deletes-a-group-from-the-contact-store-1)\n      - [Find the contacts that are members in the specified group.](#find-the-contacts-that-are-members-in-the-specified-group-1)\n      - [Add a new member to a group.](#add-a-new-member-to-a-group-1)\n      - [Removes a contact as a member of a group.](#removes-a-contact-as-a-member-of-a-group-1)\n  - [Author](#author)\n  - [License](#license)\n\n## Requirements\n\n- iOS 11.0+ / Mac OS X 10.13+ /  watchOS 4.0+\n- Xcode 13.0+\n\n## Installation\n\n### CocoaPods\n\n[CocoaPods](http://cocoapods.org) is a dependency manager for Cocoa projects. You can install it with the following command:\n\n```bash\n$ gem install cocoapods\n```\n\nTo integrate SwiftyContacts into your Xcode project using CocoaPods, specify it in your `Podfile`:\n\n```ruby\npod 'SwiftyContacts'\n```\n\nThen, run the following command:\n\n```bash\n$ pod install\n```\n\n### Swift Package Manager\n\nThe [Swift Package Manager](https://swift.org/package-manager/) is a tool for automating the distribution of Swift code and is integrated into the `swift` compiler. It is in early development, but SwiftyContacts does support its use on supported platforms.\n\nOnce you have your Swift package set up, adding SwiftyContacts as a dependency is as easy as adding it to the `dependencies` value of your `Package.swift`.\n\n```swift\ndependencies: [\n    .package(url: \"https://github.com/SwiftyContacts/SwiftyContacts.git\", .upToNextMajor(from: \"4.0.0\"))\n]\n```\n\n\n## Get started\n\n\n### async-await\n\n#### Requests access to the user's contacts\n```swift\nlet access = try await requestAccess()\n```\n\n#### Request the current authorization status\n```swift\nlet status = authorizationStatus()\nprint(status == CNAuthorizationStatus.authorized)\n```\n\n#### Fetch all contacts from device\n```swift\nlet contacts = try await fetchContacts()\n```\n\n#### Fetch contacts matching a name.\n```swift\nlet contacts = try await fetchContacts(matchingName: \"Satish Babariya\")\n```\n\n\n#### Fetch contacts matching an email address.\n```swift\nlet contacts = try await fetchContacts(matchingEmailAddress: \"satish.babariya@gmail.com\")\n```\n\n#### Fetch contacts matching a phone number.\n```swift\nlet contacts = try await fetchContacts(matching: CNPhoneNumber(stringValue: \"+919426678969\"))\n```\n\n#### To fetch contacts matching contact identifiers.\n```swift\nlet contacts = try await fetchContacts(withIdentifiers: [\"id1\", \"id2\" ... ])\n```\n\n#### To fetch contacts matching group identifier\n```swift\nlet contacts = try await fetchContacts(withGroupIdentifier: \"\")\n```\n\n#### find the contacts in the specified container.\n```swift\nlet contacts = try await fetchContacts(withContainerIdentifier: \"\")\n```\n\n#### Fetch a contact with a given identifier.\n```swift\nlet contact = try await fetchContact(withIdentifier: \"\")\n```\n\n#### Add contact to the contact store.\n```swift\nlet contact = CNMutableContact()\ncontact.givenName = \"Satish\"\ntry addContact(contact)\n```\n\n#### Update contact to the contact store.\n```swift\nguard let contact = contact.mutableCopy() as? CNMutableContact else {\n    return\n}\ncontact.givenName = \"Satish\"\ntry updateContact(contact)\n```\n\n#### Delete contact to the contact store.\n```swift\nguard let contact = contact.mutableCopy() as? CNMutableContact else {\n    return\n}\ntry deleteContact(contact)\n```\n\n#### Adds a group to the contact store.\n```swift\ntry addGroup(\"My Group\")\n```\n\n#### Fetches all groups in the contact store.\n```swift\nlet groups = try await fetchGroups()\n```\n\n#### Updates an existing group in the contact store.\n```swift\nguard let group = group.mutableCopy() as? CNMutableGroup else {\n    return\n}\ntry updateGroup(group)\n```\n\n#### Deletes a group from the contact store.\n```swift\ntry deleteGroup(group)\n```\n\n#### Find the contacts that are members in the specified group.\n```swift\nlet contacts = try fetchContacts(in: \"My Group\")\n```\n\n#### Add a new member to a group.\n```swift\ntry addContact(contact, to: group)\n```\n\n#### Removes a contact as a member of a group.\n```swift\ntry deleteContact(contact, from: group)\n```\n\n### closures\n\n#### Requests access to the user's contacts\n```swift\nrequestAccess { result in\n    switch result {\n    case let .success(bool):\n        print(bool)\n    case let .failure(error):\n        print(error.localizedDescription)\n    }\n}\n```\n\n#### Fetch all contacts from device\n```swift\nfetchContacts { result in\n    switch result {\n    case let .success(contacts):\n        print(contacts)\n    case let .failure(error):\n        print(error.localizedDescription)\n    }\n}\n```\n\n#### Fetch contacts matching a name.\n```swift\nfetchContacts(matchingName: \"Satish\") { result in\n    switch result {\n    case let .success(contacts):\n        print(contacts)\n    case let .failure(error):\n        print(error.localizedDescription)\n    }\n}\n```\n\n#### Fetch contacts matching an email address.\n```swift\nfetchContacts(matchingEmailAddress: \"satish.babariya@gmail.com\") { result in\n    switch result {\n    case let .success(contacts):\n        print(contacts)\n    case let .failure(error):\n        print(error.localizedDescription)\n    }\n}\n```\n\n#### Fetch contacts matching a phone number.\n```swift\nfetchContacts(matching: CNPhoneNumber(stringValue: \"+919426678969\")) { result in\n    switch result {\n    case let .success(contacts):\n        print(contacts)\n    case let .failure(error):\n        print(error.localizedDescription)\n    }\n}\n```\n\n#### Fetch contacts matching contact identifiers.\n```swift\nfetchContacts(withIdentifiers: []) { result in\n    switch result {\n    case let .success(contacts):\n        print(contacts)\n    case let .failure(error):\n        print(error.localizedDescription)\n    }\n}\n```\n\n#### Fetch contacts matching group identifier\n```swift\nfetchContacts(withGroupIdentifier: \"\") { result in\n    switch result {\n    case let .success(contacts):\n        print(contacts)\n    case let .failure(error):\n        print(error.localizedDescription)\n    }\n}\n```\n\n#### Find the contacts in the specified container.\n```swift\nfetchContacts(withContainerIdentifier: \"\") { result in\n    switch result {\n    case let .success(contacts):\n        print(contacts)\n    case let .failure(error):\n        print(error.localizedDescription)\n    }\n}\n```\n\n#### Fetch a contact with a given identifier.\n```swift\nfetchContact(withIdentifier: \"\") { result in\n    switch result {\n    case let .success(contact):\n        print(contact)\n    case let .failure(error):\n        print(error.localizedDescription)\n    }\n}\n```\n\n#### Adds the specified contact to the contact store.\n```swift\nlet contact = CNMutableContact()\ncontact.givenName = \"Satish\"\naddContact(contact) { result in\n    switch result {\n    case let .success(contact):\n        print(contact)\n    case let .failure(error):\n        print(error.localizedDescription)\n    }\n}\n```\n\n#### Updates an existing contact in the contact store.\n```swift\nguard let contact = contact.mutableCopy() as? CNMutableContact else {\n    return\n}\ncontact.givenName = \"Satish\"\nupdateContact(contact) { result in\n    switch result {\n    case let .success(contact):\n        print(contact)\n    case let .failure(error):\n        print(error.localizedDescription)\n    }\n}\n```\n\n#### Deletes a contact from the contact store.\n```swift\nguard let contact = contact.mutableCopy() as? CNMutableContact else {\n    return\n}\ndeleteContact(contact) { result in\n    switch result {\n    case let .success(contact):\n        print(contact)\n    case let .failure(error):\n        print(error.localizedDescription)\n    }\n}\n```\n\n#### Fetches all groups matching the specified predicate.\n```swift\nfetchGroups() { result in\n    switch result {\n    case let .success(groups):\n        print(groups)\n    case let .failure(error):\n        print(error.localizedDescription)\n    }\n}\n```\n\n#### Adds a group to the contact store.\n```swift\naddGroup(\"My Group\") { result in\n    switch result {\n    case let .success(group):\n        print(group)\n    case let .failure(error):\n        print(error.localizedDescription)\n    }\n}\n```\n\n#### Updates an existing group in the contact store.\n```swift\nguard let group = group.mutableCopy() as? CNMutableGroup else {\n    return\n}\nupdateGroup(group) { result in\n    switch result {\n    case let .success(group):\n        print(group)\n    case let .failure(error):\n        print(error.localizedDescription)\n    }\n}\n```\n\n#### Deletes a group from the contact store.\n```swift\nguard let group = group.mutableCopy() as? CNMutableGroup else {\n    return\n}\ndeleteGroup(group) { result in\n    switch result {\n    case let .success(group):\n        print(group)\n    case let .failure(error):\n        print(error.localizedDescription)\n    }\n}\n```\n\n#### Find the contacts that are members in the specified group.\n```swift\nfetchContacts(in: \"My Group\") { result in\n    switch result {\n    case let .success(contacts):\n        print(contacts)\n    case let .failure(error):\n        print(error.localizedDescription)\n    }\n}\n```\n\n#### Add a new member to a group.\n```swift\naddContact(contact, to: group) { result in\n    switch result {\n    case let .success(contact):\n        print(contact)\n    case let .failure(error):\n        print(error.localizedDescription)\n    }\n}\n```\n\n#### Removes a contact as a member of a group.\n```swift\nremoveContact(contact, from: group) { result in\n    switch result {\n    case let .success(contact):\n        print(contact)\n    case let .failure(error):\n        print(error.localizedDescription)\n    }\n}\n```\n\n\n## Author\n\nSatish Babariya, satish.babariya@gmail.com\n\n## License\n\nSwiftyContacts is available under the MIT license. See the LICENSE file for more info.\n","funding_links":[],"categories":["Swift"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FSwiftyContacts%2FSwiftyContacts","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FSwiftyContacts%2FSwiftyContacts","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FSwiftyContacts%2FSwiftyContacts/lists"}