Hello all.
I'm looking for a bit of advice as to the best way to set up an app I'm building (in SwiftUI).
It's an inspection app, with a list of five different inspections, each having eight or so parts, each part having its own form with thirty or so questions relating to the inspection.
The user will pick an inspection type, go through each part, answer the questions on the form then once finished will be able to download the results (Q's and A's) as a PDF.
The questions vary in response from TextField, Toggle or Picker answers.
Sounds simple enough.
I thought a document based app would be the best solution, creating a new document for each inspection, with CoreData pulling question labels from a Plist in the bundle (that bit is simple enough, I've got it working), the answers writing straight to the document.
The problem comes with every answer form for each section having different combinations of Pickers, Toggles and TextFields - makes it harder for a "one size fits all" approach.
I'd have to include around 200-300 individual properties in the document, tailored to each different answer and linked somehow to each question. I'd rather not hard code these answer properties into the default document, if possible.
I thought of having two CoreData persistent stores (one for Q's, one for A's), linked with a fetched property (a UUID), but that defeats the purpose of using the document as an "answer" repository.
Is any of this making sense?
I feel sure I'm missing something obvious here, as I don't think this should be as difficult as it's turning out to be. Am I overthinking things?
I'm looking for a bit of advice as to the best way to set up an app I'm building (in SwiftUI).
It's an inspection app, with a list of five different inspections, each having eight or so parts, each part having its own form with thirty or so questions relating to the inspection.
The user will pick an inspection type, go through each part, answer the questions on the form then once finished will be able to download the results (Q's and A's) as a PDF.
The questions vary in response from TextField, Toggle or Picker answers.
Sounds simple enough.
I thought a document based app would be the best solution, creating a new document for each inspection, with CoreData pulling question labels from a Plist in the bundle (that bit is simple enough, I've got it working), the answers writing straight to the document.
The problem comes with every answer form for each section having different combinations of Pickers, Toggles and TextFields - makes it harder for a "one size fits all" approach.
I'd have to include around 200-300 individual properties in the document, tailored to each different answer and linked somehow to each question. I'd rather not hard code these answer properties into the default document, if possible.
I thought of having two CoreData persistent stores (one for Q's, one for A's), linked with a fetched property (a UUID), but that defeats the purpose of using the document as an "answer" repository.
Is any of this making sense?
I feel sure I'm missing something obvious here, as I don't think this should be as difficult as it's turning out to be. Am I overthinking things?