In my application I created a structure with two properties:
struct questionCollection {
var question: String!
var answer: String!
}
I then created an instance of that:
questionCollections = [questionCollection(question: "What is 1+1?", answer: "2")]
Along with this I have a function that allows the user to add a question:
@IBAction func appendQuestion(sender: AnyObject) {
questionCollections += [questionCollection(question: questionInput.text, answer: answerInput.text)]
}
My question is what is the easiest way to save the user submitted data? I have only used NSUserDefaults before and I don't know what to do.
I really couldn't find any solution to my problem so if I could get some help that would be great. Thanks
To clarify: All I want to do is have the data stored so can be shown on a label and check to see if the correct answer is chosen. The data does not need to be seen by the user until it comes up in the label. I am also just creating a simple app so I only need this data to be saved on the device.
With what I am doing now I am not sure if I need to save my data but if someone can still answer this if they want for future reference.