Skip to content

Commit

Permalink
Make survey view initializer public
Browse files Browse the repository at this point in the history
  • Loading branch information
Victor Prüfer committed May 8, 2021
1 parent 6663167 commit 774d877
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
Binary file not shown.
8 changes: 6 additions & 2 deletions Sources/COFFEE/Views/SurveyView/SurveyView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,11 @@ import SwiftUI
public struct SurveyView: View {

// View model for this survey session, also provided to the subviews as environment object
@StateObject public var viewModel: ViewModel
@StateObject var viewModel: ViewModel

public init(viewModel: SurveyView.ViewModel) {
self.viewModel = viewModel
}

public var body: some View {
VStack(alignment: .leading, spacing: 6) {
Expand Down Expand Up @@ -101,7 +105,7 @@ extension SurveyView {
/// - survey: The survey to display
/// - completionHandler: A function that is called when the survey is completed
/// - showSurvey: A binding to a boolean value that defines whether the survey view is shown or not
init(survey: Survey, completionHandler: ((Submission) -> ())?, showSurvey: Binding<Bool>) {
public init(survey: Survey, completionHandler: ((Submission) -> ())?, showSurvey: Binding<Bool>) {
// Make sure survey is not empty
// Ensure the survey is not empty
assert(!survey.items.isEmpty, "Survey is empty. The survey should have at least one item.")
Expand Down

0 comments on commit 774d877

Please sign in to comment.