Swiftpack.co - StanfordSpezi/SpeziContact as Swift Package

Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
See all packages published by StanfordSpezi.
StanfordSpezi/SpeziContact 1.0.0
Spezi module to display contact information
⭐️ 3
🕓 7 weeks ago
iOS
.package(url: "https://github.com/StanfordSpezi/SpeziContact.git", from: "1.0.0")

Spezi Contact

Build and Test codecov DOI

Views to display contact information.

Overview

The Spezi Contact Swift Package provides views and infrastructure to display contact information in an application.

Screenshot showing a ContactsList rendered within the Spezi Template Application. Screenshot showing a ContactsList rendered within the Spezi Template Application.
A ContactsList rendered in the Spezi Template Application.

Setup

Add Spezi Contact as a Dependency

You need to add the Spezi Contact Swift package to your app in Xcode or Swift package.

Example

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(
        image: Image(systemName: "figure.wave.circle"),
        name: PersonNameComponents(givenName: "Leland", familyName: "Stanford"),
        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

The Spezi Template Application provides a great starting point and example using the SpeziContact module.

Contributing

Contributions to this project are welcome. Please make sure to read the contribution guidelines and the contributor covenant code of conduct first.

License

This project is licensed under the MIT License. See Licenses for more information.

Spezi Footer Spezi Footer

GitHub

link
Stars: 3
Last commit: 7 hours ago
Advertisement: IndiePitcher.com - Cold Email Software for Startups

Release Notes

1.0.0
7 weeks ago

Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API | Analytics