Also available as a part of my SwiftUI+ Collection – just add it to Xcode 13+
A set of SwiftUI dynamic property wrappers that provide a more familiar API for accessing the Contacts framework.
A full demo is included in this repo.
- Familiar API, matches CoreData's new FetchRequest APIs
- Animation support
- View's automatically update to reflect remote changes
Fetch a list of containers:
@FetchContainerList private var containers
There are of course additional initializers that allow you to filter the result:
@FetchContainerList(
forContact: contact.identifier
) private var containers
Fetch a list of groups:
@FetchGroupList private var groups
Similar to containers, you can also filter the results:
@FetchGroupList(
inContainer: container.identifier
) private var groups
@FetchContactList(
keysToFetch: [
.type,
.givenName, .familyName,
.organizationName,
.phoneNumbers
],
sortOrder: .givenName
) private var contacts
All property wrappers provide standard SwiftUI animation properties. If you don't include this value, the value defaults to
.default
The code is packaged as a framework. You can install manually (by copying the files in the Sources
directory) or using Swift Package Manager (preferred)
To install using Swift Package Manager, add this to the dependencies
section of your Package.swift
file:
.package(url: "https://github.com/SwiftUI-Plus/Connections.git", .upToNextMinor(from: "1.0.0"))
If you want easy access to this and more packages, add the following collection to your Xcode 13+ configuration:
https://benkau.com/packages.json