So I have a sheet like this
.sheet(item: $logMyPractice, content: { item in
AssesmentRecorderView(
assessment: DrillModel(
questions: [
.init(prompt: "Question 1", resultValue: .integer),
]
),
completion: { date, answers in
print("response", date, answers)
// custom logic, save in the db
})
.presentationDetents([.fraction(0.85), .large ])
}
What is happening is that I need to open that sheet from a different views.
I could copy/paste it to the separate views but it's not following a DRY
concept.
I could create an ObservableObject
in the main view that holds information about the sheet and attach it as a environmentObject
, but I wonder if there's a better approach?