Skip to content

Commit

Permalink
Update OnboardingView documentation (#42)
Browse files Browse the repository at this point in the history
# *Update OnboardingView documentation

## ♻️ Current situation & Problem
I noticed that the documentation for the initializers and overall
descriptions of this screen were a bit unclear vague when I was trying
to use them.

**All of these changes were copied over from my previous pull request
for signed commits.**


## ⚙️ Release Notes 
N/A


## 📚 Documentation
- I added documentation to provide a coding example of the initializer
of OnboardingView, as well as a more detailed explanation.
- Also added an example fo the custom initializer



## ✅ Testing
*Please ensure that the PR meets the testing requirements set by CodeCov
and that new functionality is appropriately tested.*
*This section describes important information about the tests and why
some elements might not be testable.*


## 📝 Code of Conduct & Contributing Guidelines 

By submitting creating this pull request, you agree to follow our [Code
of
Conduct](https://github.com/StanfordSpezi/.github/blob/main/CODE_OF_CONDUCT.md)
and [Contributing
Guidelines](https://github.com/StanfordSpezi/.github/blob/main/CONTRIBUTING.md):
- [x] I agree to follow the [Code of
Conduct](https://github.com/StanfordSpezi/.github/blob/main/CODE_OF_CONDUCT.md)
and [Contributing
Guidelines](https://github.com/StanfordSpezi/.github/blob/main/CONTRIBUTING.md).
  • Loading branch information
akanshyabhat authored Mar 6, 2024
1 parent 4971a82 commit 6616cb4
Showing 1 changed file with 33 additions and 1 deletion.
34 changes: 33 additions & 1 deletion Sources/SpeziOnboarding/OnboardingView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,12 @@ import SwiftUI
/// - Tip: The ``SequentialOnboardingView`` provides an alternative to provide
/// sequential information that is displayed step by step.
///
/// The following example demonstrates the usage of the `OnboardingView` using its default configuration.
/// ### Usage
///
/// The following example demonstrates the usage of the ``OnboardingView`` using its default configuration. The default configuration divides up
/// each screen into sections and allows you to add a title and subtitle for the overall view itself, as well as create separate information areas. Finally,
/// there is an option for an action that should be performed (which can be used to go to the next screen in the onboarding flow).
///
/// ```swift
/// OnboardingView(
/// title: "Title",
Expand All @@ -39,6 +44,32 @@ import SwiftUI
/// // Action that should be performed on pressing the "Continue" button ...
/// }
/// ```
///
/// In implementation, you can treat the titleView, contentView, and actionView as regular SwiftUI Views. However, to simplify things, you can also use the built-in ``OnboardingTitleView`` and built-in ``OnboardingActionsView``, as demonstrated below.
/// ``` swift
/// OnboardingView(
/// titleView: {
/// OnboardingTitleView(
/// title: "Title",
/// subtitle: "Subtitle"
/// )
/// },
/// contentView: {
/// VStack {
/// Text("This is the onboarding content.")
/// .font(.headline)
/// }
/// },
/// actionView: {
/// OnboardingActionsView (
/// Text: "Action Text",
/// Action: {
/// // Desired Action
/// }
/// )
/// }
/// )
/// ```
public struct OnboardingView<TitleView: View, ContentView: View, ActionView: View>: View {
private let titleView: TitleView
private let contentView: ContentView
Expand Down Expand Up @@ -70,6 +101,7 @@ public struct OnboardingView<TitleView: View, ContentView: View, ActionView: Vie


/// Creates a customized `OnboardingView` allowing a complete customization of the `OnboardingView`.
///
/// - Parameters:
/// - titleView: The title view displayed at the top.
/// - contentView: The content view.
Expand Down

0 comments on commit 6616cb4

Please sign in to comment.