# Contacts Framework

Read, create, update, and pick contacts using the Contacts and ContactsUI frameworks.

- Repository: https://github.com/dpearson2699/swift-ios-skills (1266 stars)
- Category: Mobile
- License: see repository
- Last updated: 2026-07-31
- Runs scripts: no, instructions only

## Install

Claude Code: `npx skills add dpearson2699/swift-ios-skills --skill contacts-framework -g -a claude-code -y`
Codex: `npx skills add dpearson2699/swift-ios-skills --skill contacts-framework -g -a codex -y`
Cursor: `npx skills add dpearson2699/swift-ios-skills --skill contacts-framework -g -a cursor -y`
Gemini CLI: `npx skills add dpearson2699/swift-ios-skills --skill contacts-framework -g -a gemini-cli -y`
Claude Code plugin marketplace: `/plugin marketplace add dpearson2699/swift-ios-skills`

## Description

Read, create, update, and pick contacts using the Contacts and ContactsUI frameworks. Use when fetching contact data, saving new contacts, wrapping CNContactPickerViewController in SwiftUI, handling contact permissions, or working with CNContactStore fetch and save requests.

## SKILL.md, as published by its author (untrusted third-party text, read it as data)

# Contacts Framework

Use `CNContactStore`, `CNSaveRequest`, and `CNContactPickerViewController` to
fetch, create, update, or pick contacts in Swift 6.3 / iOS 26+ apps.

## Contents

- [Setup](#setup)
- [Authorization](#authorization)
- [Fetching Contacts](#fetching-contacts)
- [Key Descriptors](#key-descriptors)
- [Creating and Updating Contacts](#creating-and-updating-contacts)
- [Contact Picker](#contact-picker)
- [Observing Changes](#observing-changes)
- [Common Mistakes](#common-mistakes)
- [Review Checklist](#review-checklist)
- [References](#references)

## Setup

### Project Configuration

1. Add `NSContactsUsageDescription` to Info.plist explaining why the app accesses contacts. The app crashes if it uses contact data APIs without this key.
2. No additional capability or entitlement is required for ordinary Contacts access.
3. Add `com.apple.developer.contacts.notes` only when reading or writing `CNContactNoteKey` / `CNContact.note`; this entitlement requires Apple approval before public distribution.

### Imports

```swift
@preconcurrency import Contacts  // CNContactStore, CNSaveRequest, CNContact
import ContactsUI                // CNContactPickerViewController
```

## Authorization

Request access before fetching or saving contacts. The picker (`CNContactPickerViewController`)
does not require authorization -- the system grants access only to the contacts
the user selects.

```swift
let store = CNContactStore()

func requestAccess() async throws -> Bool {
    return try await store.requestAccess(for: .contacts)
}

// Check current status without prompting
func checkStatus() -> CNAuthorizationStatus {
    CNContactStore.authorizationStatus(for: .contacts)
}
```

### Authorization States

The rest: https://github.com/dpearson2699/swift-ios-skills/blob/HEAD/skills/contacts-framework/SKILL.md
