Views to display contact information.
The Spezi Contact Swift Package provides views and infrastructure to display contact information in an application.
A ContactsList rendered in the Spezi Template Application. |
You need to add the Spezi Contact Swift package to your app in Xcode or Swift package.
The Contact module enables displaying contact information in an application.
Information can be encoded in Contact and ContactOption to configure the contact views.
The ContactView and ContactsList can display the contact information in a card-like layout and list.
The following example shows how Contacts can be created to encode an individual's contact information and displayed in a ContactsList within a SwiftUI View.
import SpeziContact
import SwiftUI
struct ContactsExample: View {
let contact = Contact(
name: PersonNameComponents(givenName: "Leland", familyName: "Stanford"),
image: Image(systemName: "figure.wave.circle"),
title: "Founder",
description: """
Leland Stanford is the founder of Stanford University.
""",
organization: "Stanford University",
address: {
let address = CNMutablePostalAddress()
address.country = "USA"
address.state = "CA"
address.postalCode = "94305"
address.city = "Stanford"
address.street = "450 Serra Mall"
return address
}(),
contactOptions: [
.call("+1 (650) 123-4567"),
.text("+1 (650) 123-4567"),
.email(addresses: ["[email protected]"], subject: "Hi!")
]
)
var body: some View {
ContactsList(contacts: [contact])
}
}For more information, please refer to the API documentation.
The Spezi Template Application provides a great starting point and example using the SpeziContact module.
Contributions to this project are welcome. Please make sure to read the contribution guidelines and the contributor covenant code of conduct first.
This project is licensed under the MIT License. See Licenses for more information.