I’m new to iOS development–I’m working on passing data between different views…
Let’s say I have a list of ten questions. Each question will have a different page with a transition between and the UI will contain a prev/next button along with the input collected for each question.
How do I display each question and collect the data in “steps”, then finally save everything as one entry in a Core Data model?
Could you step me through how this is done? Much appreciated! Thanks!
as inafziger mentioned it would be best to use a singleton, but not at the end of each view, on your last view call save data, as this would improve performance. It sounds as though the data is relevant to your entire application.
If that is the case i would put ur:
Inside of your application delegate, this way you can access them from anywhere and if you need to fetch information from a previous question you can perform that action with great ease.
i hope this helps
Edit:
(in regards to your comment)
Assuming you have the same or similar layout for each question, you could push a new instance of the same
ViewControllerwith the a different param ieOr something similar to the above, also note, UITableViewController is always a UIViewController but a UIViewController isn’t always a UITableViewController.
This way you can display a new question each time and reuse the exact same
ViewControllerfor each question