Skip to content

A set of SwiftUI dynamic property wrappers that provide a more familiar API for accessing the Contacts framework. (iOS, watchOS, macOS)

License

Notifications You must be signed in to change notification settings

SwiftUI-Plus/Connections

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ios watch mac

Connections

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.

Features

  • Familiar API, matches CoreData's new FetchRequest APIs
  • Animation support
  • View's automatically update to reflect remote changes

Example

Containers

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

Groups

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

Contacts

@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

Installation

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"))

Other Packages

If you want easy access to this and more packages, add the following collection to your Xcode 13+ configuration:

https://benkau.com/packages.json

About

A set of SwiftUI dynamic property wrappers that provide a more familiar API for accessing the Contacts framework. (iOS, watchOS, macOS)

Topics

Resources

License

Code of conduct

Stars

Watchers

Forks

Languages