[Office Hours] Onboarding Questionnaire #125
Answered
by
PSchmiedmayer
MiguelAFH
asked this question in
Office Hours
-
Beta Was this translation helpful? Give feedback.
Answered by
PSchmiedmayer
Feb 11, 2025
Replies: 1 comment 2 replies
-
@MiguelAFH I think you are on the right track here! Spezi Questionnaire is the right module to use, and it works great in combination with Spezi Onboarding. You can use the results closure to trigger the next step on the onboarding step. You can use the This might be a small example that you can put in your onboarding stack: import SpeziOnboarding
import SpeziQuestionnaire
import SwiftUI
struct QuestionnaireDuringOnboardingExample: View {
@Environment(OnboardingNavigationPath.self) private var onboardingNavigationPath
// ...
var body: some View {
QuestionnaireView(
questionnaire: Bundle.main.questionnaire(withName: "SocialSupportQuestionnaire")
) { result in
// Handle the result, e.g., forward to the standard or upload somehwere ...
onboardingNavigationPath.nextStep()
}
.navigationBarBackButtonHidden()
.toolbarVisibility(.hidden, for: .navigationBar)
}
}
#Preview {
OnboardingStack {
QuestionnaireDuringOnboardingExample()
}
} |
Beta Was this translation helpful? Give feedback.
2 replies
Answer selected by
PSchmiedmayer
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@MiguelAFH I think you are on the right track here! Spezi Questionnaire is the right module to use, and it works great in combination with Spezi Onboarding. You can use the results closure to trigger the next step on the onboarding step. You can use the
toolbarVisibility
modifier to hide the navigation bar presented by theOnboardingStack
as theQuestionnaireView
renders its own navigation stack.This might be a small example that you can put in your onboarding stack: