Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/stanfordspezi/spezionboarding
Spezi Onboarding module to inform a user or retrieve consent for a study participation
https://github.com/stanfordspezi/spezionboarding
consent ios onboarding spezi stanford swift swiftui welcome xcode
Last synced: 2 months ago
JSON representation
Spezi Onboarding module to inform a user or retrieve consent for a study participation
- Host: GitHub
- URL: https://github.com/stanfordspezi/spezionboarding
- Owner: StanfordSpezi
- License: mit
- Created: 2023-04-05T17:18:31.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2023-11-14T03:47:06.000Z (about 1 year ago)
- Last Synced: 2023-12-19T17:44:22.448Z (about 1 year ago)
- Topics: consent, ios, onboarding, spezi, stanford, swift, swiftui, welcome, xcode
- Language: Swift
- Homepage: https://swiftpackageindex.com/StanfordSpezi/SpeziOnboarding/documentation/
- Size: 1.21 MB
- Stars: 4
- Watchers: 8
- Forks: 1
- Open Issues: 6
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
- Citation: CITATION.cff
Awesome Lists containing this project
README
# Spezi Onboarding
[![Build and Test](https://github.com/StanfordSpezi/SpeziOnboarding/actions/workflows/build-and-test.yml/badge.svg)](https://github.com/StanfordSpezi/SpeziOnboarding/actions/workflows/build-and-test.yml)
[![codecov](https://codecov.io/gh/StanfordSpezi/SpeziOnboarding/branch/main/graph/badge.svg?token=lsRIXi5IXY)](https://codecov.io/gh/StanfordSpezi/SpeziOnboarding)
[![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.7806970.svg)](https://doi.org/10.5281/zenodo.7806970)
[![](https://img.shields.io/endpoint?url=https%3A%2F%2Fswiftpackageindex.com%2Fapi%2Fpackages%2FStanfordSpezi%2FSpeziOnboarding%2Fbadge%3Ftype%3Dswift-versions)](https://swiftpackageindex.com/StanfordSpezi/SpeziOnboarding)
[![](https://img.shields.io/endpoint?url=https%3A%2F%2Fswiftpackageindex.com%2Fapi%2Fpackages%2FStanfordSpezi%2FSpeziOnboarding%2Fbadge%3Ftype%3Dplatforms)](https://swiftpackageindex.com/StanfordSpezi/SpeziOnboarding)Provides UI components for onboarding and consent.
## Overview
The Spezi Onboarding module provides user interface components to onboard a user to an application, including the possibility of retrieving consent for study participation.
|![Screenshot displaying the onboarding view.](Sources/SpeziOnboarding/SpeziOnboarding.docc/Resources/OnboardingView.png#gh-light-mode-only) ![Screenshot displaying the onboarding view.](Sources/SpeziOnboarding/SpeziOnboarding.docc/Resources/OnboardingView~dark.png#gh-dark-mode-only)|![Screenshot displaying the sequential onboarding view.](Sources/SpeziOnboarding/SpeziOnboarding.docc/Resources/SequentialOnboardingView.png#gh-light-mode-only) ![Screenshot displaying the sequential onboarding view.](Sources/SpeziOnboarding/SpeziOnboarding.docc/Resources/SequentialOnboardingView~dark.png#gh-dark-mode-only)|![Screenshot displaying the consent view.](Sources/SpeziOnboarding/SpeziOnboarding.docc/Resources/ConsentView.png#gh-light-mode-only) ![Screenshot displaying the consent view.](Sources/SpeziOnboarding/SpeziOnboarding.docc/Resources/ConsentView~dark.png#gh-dark-mode-only)
|:--:|:--:|:--:|
|[`OnboardingView`](https://swiftpackageindex.com/stanfordspezi/spezionboarding/documentation/spezionboarding/onboardingview)|[`SequentialOnboardingView`](https://swiftpackageindex.com/stanfordspezi/spezionboarding/documentation/spezionboarding/sequentialonboardingview)|[`OnboardingConsentView`](https://swiftpackageindex.com/stanfordspezi/spezionboarding/documentation/spezionboarding/onboardingconsentview)|## Setup
### Add Spezi Onboarding as a Dependency
You need to add the Spezi Onboarding Swift package to
[your app in Xcode](https://developer.apple.com/documentation/xcode/adding-package-dependencies-to-your-app#) or
[Swift package](https://developer.apple.com/documentation/xcode/creating-a-standalone-swift-package-with-xcode#Add-a-dependency-on-another-Swift-package).## Examples
### Onboarding View
The [`OnboardingView`](https://swiftpackageindex.com/stanfordspezi/spezionboarding/documentation/spezionboarding/onboardingview) allows you to separate information into areas on a screen, each with a title, description, and icon.
```swift
import SpeziOnboarding
import SwiftUIstruct OnboardingViewExample: View {
var body: some View {
OnboardingView(
title: "Welcome",
subtitle: "This is an example onboarding view",
areas: [
.init(
icon: Image(systemName: "tortoise.fill"),
title: "Tortoise",
description: "A Tortoise!"
),
.init(
icon: {
Image(systemName: "lizard.fill")
.foregroundColor(.green)
},
title: "Lizard",
description: "A Lizard!"
),
.init(
icon: {
Circle().fill(.orange)
},
title: "Circle",
description: "A Circle!"
)
],
actionText: "Learn More",
action: {
// Action to perform when the user taps the action button.
}
)
}
}
```### Sequential Onboarding View
The [`SequentialOnboardingView`](https://swiftpackageindex.com/stanfordspezi/spezionboarding/documentation/spezionboarding/sequentialonboardingview) allows you to display information step-by-step with each additional area appearing when the user taps the `Continue` button.
```swift
import SpeziOnboarding
import SwiftUIstruct SequentialOnboardingViewExample: View {
var body: some View {
SequentialOnboardingView(
title: "Things to know",
subtitle: "And you should pay close attention ...",
content: [
.init(
title: "A thing to know",
description: "This is a first thing that you should know; read carefully!"
),
.init(
title: "Second thing to know",
description: "This is a second thing that you should know; read carefully!"
),
.init(
title: "Third thing to know",
description: "This is a third thing that you should know; read carefully!"
)
],
actionText: "Continue"
) {
// Action to perform when the user has viewed all the steps
}
}
}
```### Onboarding Consent View
The [`OnboardingConsentView`](https://swiftpackageindex.com/stanfordspezi/spezionboarding/documentation/spezionboarding/onboardingconsentview) can be used to allow your users to read and agree to a document, e.g., a consent document for a research study or a terms and conditions document for an app. The document can be signed using a family and given name and a hand-drawn signature. The signed consent form can then be exported and shared as a PDF file.
The following example demonstrates how the [`OnboardingConsentView`](https://swiftpackageindex.com/stanfordspezi/spezionboarding/documentation/spezionboarding/onboardingconsentview) shown above is constructed by providing markdown content encoded as a [UTF8](https://www.swift.org/blog/utf8-string/) [`Data`](https://developer.apple.com/documentation/foundation/data) instance (which may be provided asynchronously), an action that should be performed once the consent has been given, as well as a configuration defining the properties of the exported consent form.
```swift
import SpeziOnboarding
import SwiftUIstruct ConsentViewExample: View {
var body: some View {
OnboardingConsentView(
markdown: {
Data("This is a *markdown* **example**".utf8)
},
action: {
// Action to perform once the user has given their consent
},
exportConfiguration: .init(paperSize: .usLetter) // Configure the properties of the exported consent form
)
}
}
```For more information, please refer to the [API documentation](https://swiftpackageindex.com/StanfordSpezi/SpeziOnboarding/documentation).
## The Spezi Template Application
The [Spezi Template Application](https://github.com/StanfordSpezi/SpeziTemplateApplication) provides a great starting point and example using the `SpeziOnboarding` module.
## Contributing
Contributions to this project are welcome. Please make sure to read the [contribution guidelines](https://github.com/StanfordSpezi/.github/blob/main/CONTRIBUTING.md) and the [contributor covenant code of conduct](https://github.com/StanfordSpezi/.github/blob/main/CODE_OF_CONDUCT.md) first.
## License
This project is licensed under the MIT License. See [Licenses](https://github.com/StanfordSpezi/SpeziOnboarding/tree/main/LICENSES) for more information.
![Spezi Footer](https://raw.githubusercontent.com/StanfordSpezi/.github/main/assets/FooterLight.png#gh-light-mode-only)
![Spezi Footer](https://raw.githubusercontent.com/StanfordSpezi/.github/main/assets/FooterDark.png#gh-dark-mode-only)