https://github.com/swiftui-plus/connections
A set of SwiftUI dynamic property wrappers that provide a more familiar API for accessing the Contacts framework. (iOS, watchOS, macOS)
https://github.com/swiftui-plus/connections
app connections contacts ios macos swift swiftui watchos
Last synced: 6 months ago
JSON representation
A set of SwiftUI dynamic property wrappers that provide a more familiar API for accessing the Contacts framework. (iOS, watchOS, macOS)
- Host: GitHub
- URL: https://github.com/swiftui-plus/connections
- Owner: SwiftUI-Plus
- License: mit
- Created: 2021-09-01T16:24:43.000Z (about 4 years ago)
- Default Branch: master
- Last Pushed: 2023-07-24T05:13:09.000Z (about 2 years ago)
- Last Synced: 2025-03-27T04:12:37.135Z (6 months ago)
- Topics: app, connections, contacts, ios, macos, swift, swiftui, watchos
- Language: Swift
- Homepage: https://benkau.com/packages.json
- Size: 37.1 KB
- Stars: 20
- Watchers: 1
- Forks: 6
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README


# Connections
> Also available as a part of my [SwiftUI+ Collection](https://benkau.com/packages.json) – 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:
```swift
@FetchContainerList private var containers
```There are of course additional initializers that allow you to filter the result:
```swift
@FetchContainerList(
forContact: contact.identifier
) private var containers
```### Groups
Fetch a list of groups:
```swift
@FetchGroupList private var groups
```Similar to containers, you can also filter the results:
```swift
@FetchGroupList(
inContainer: container.identifier
) private var groups
```### Contacts
```swift
@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`