Community-maintained Agent Skills for complete Swift and Apple-platform app delivery.
72
90%
Does it follow best practices?
Run evals on this skill
Adds up to 20 points to the overall score
View guide
Medium
Suggest reviewing before use
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..tessl-plugin
skills
accessorysetupkit
references
activitykit
adattributionkit
references
alarmkit
references
app-clips
app-intents
app-store-optimization
app-store-review
apple-on-device-ai
appmigrationkit
audioaccessorykit
references
authentication
references
avfoundation-audio
references
avkit
background-processing
references
browserenginekit
callkit
references
carplay
cloudkit
contacts-framework
references
core-bluetooth
references
core-data
core-haptics
references
core-motion
references
core-nfc
references
coreml
references
cryptokit
cryptotokenkit
debugging-instruments
device-integrity
references
energykit
references
eventkit
family-controls
references
financekit
focus-engine
gamekit
git-branching-workflow
references
healthkit
references
homekit
references
ios-accessibility
ios-app-workflow
references
ios-ettrace-performance
ios-localization
ios-memgraph-analysis
ios-networking
ios-simulator
references
metrickit
references
musickit
references
natural-language
paperkit
references
passkit
references
pdfkit
pencilkit
references
permissionkit
references
photokit
push-notifications
quicklook
references
realitykit
references
relevancekit
references
scenekit
sensorkit
shazamkit
references
speech-recognition
references
spritekit
storekit
swift-api-design-guidelines
swift-architecture
references
swift-charts
swift-codable
references
swift-code-review
swift-concurrency
swift-formatstyle
references
swift-language
swift-security
references
swift-testing
swiftdata
swiftlint
swiftui-animation
swiftui-gestures
references
swiftui-layout-components
swiftui-liquid-glass
references
swiftui-patterns
swiftui-performance
swiftui-responsive-layout
swiftui-uikit-interop
swiftui-webkit
tabletopkit
tipkit
vision-framework
weatherkit
references