Read, create, update, and pick contacts using CNContactStore, CNSaveRequest, and CNContactPickerViewController. Covers SwiftUI integration, permissions, fetch/mutation patterns, and vCard serialization.
Ships in all-ios-skills. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Use CNContactStore, CNSaveRequest, and ContactsUI to fetch, mutate, or let
the user select contacts. Prefer the system picker when full address-book access
is unnecessary.
| Need | API |
|---|---|
| User chooses one or more contacts without broad permission | CNContactPickerViewController |
| App reads or writes its authorized contact set | CNContactStore |
| User expands an iOS 18+ limited set | ContactAccessButton or contactAccessPicker |
| Import/export or sharing | CNContactVCardSerialization |
Read Contacts extended patterns for a complete observable manager, SwiftUI lists, single/multi-select picker wrappers, email-only selection, optimized search, vCard import/export, groups, and change notification handling.
NSContactsUsageDescription before direct Contacts API access; missing it
causes termination.CNContact.note
requires the Apple-approved com.apple.developer.contacts.notes entitlement.Treat authorization states explicitly:
| Status | Behavior |
|---|---|
.notDetermined | Request only from a user-understood action |
.authorized | Full access |
.limited | Usable, but only for granted or app-created contacts |
.denied | Explain the feature and route to Settings when appropriate |
.restricted | Disable the operation; do not repeatedly prompt |
Only fetch keys the caller will access. Reading an unfetched property raises
CNContactPropertyNotFetchedException.
@preconcurrency import Contacts
let keys: [CNKeyDescriptor] = [
CNContactFormatter.descriptorForRequiredKeys(for: .fullName),
CNContactPhoneNumbersKey as CNKeyDescriptor
]
let request = CNContactFetchRequest(keysToFetch: keys)
try store.enumerateContacts(with: request) { contact, stop in
consume(contact)
}
Use unifiedContacts(matching:keysToFetch:) for predicate queries,
unifiedContact(withIdentifier:keysToFetch:) for known identifiers, and
enumeration for the authorized address book. Avoid full-resolution image data
unless the UI truly requires it. For large caches, fetch identifiers first and
hydrate details in bounded batches.
CNMutableContact and CNSaveRequest.add.mutableCopy(), then adding the operation to a fresh save request.store.execute(request) returning without throwing is the success boundary.
Advance app state or clear drafts only afterward.execute uses it.let mutable = CNMutableContact()
mutable.givenName = "Taylor"
let request = CNSaveRequest()
request.add(mutable, toContainerWithIdentifier: nil)
try store.execute(request)
Enumeration is I/O-heavy; keep it off the main actor. With strict concurrency,
use @preconcurrency import Contacts only at the framework boundary or map
CNContact values into app-owned Sendable models before crossing actors.
Observe .CNContactStoreDidChange, invalidate cached CNContact objects, and
refetch the authorized set. Reuse one store instead of constructing stores per
row or query.
.limited as denial or assuming it exposes the full address book.keysToFetch.CNContact directly.execute succeeds..limited, has product behavior.CNSaveRequest values and mutable contacts.CNContactStore is reused.What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
/all-ios-skills:contacts-frameworkfrom all-ios-skills
npx claudepluginhub thienqo/ios-skills --plugin all-ios-skills95 skills in this plugin
/accessorysetupkitDiscover and configure Bluetooth and Wi-Fi accessories using AccessorySetupKit. Use when presenting a privacy-preserving accessory picker, defining discovery descriptors for BLE or Wi-Fi devices, handling accessory session events, migrating from CoreBluetooth permission-based scanning, or setting up accessories without requiring broad Bluetooth permissions./activitykitBuild or review Live Activities and Dynamic Island experiences with ActivityKit, including lifecycle, layouts, push updates, and scheduled delivery. Use for time-sensitive Lock Screen or Dynamic Island state; route ordinary widgets to widgetkit./adattributionkitMeasure ad effectiveness with privacy-preserving attribution using AdAttributionKit. Use when registering ad impressions, handling attribution postbacks, updating conversion values, implementing re-engagement attribution, configuring publisher or advertiser apps, or replacing SKAdNetwork with AdAttributionKit for ad measurement.Other plugins' skills for the same job