Answer the question
In order to leave comments, you need to log in
How to implement data storage in an ios mobile application with questions and answers to them?
Good afternoon!
I'm new to mobile development and would like to know how best to store data in an application.
Mobile application based on ios, using the swift 5 programming language.
The application will consist of registration (which will be implemented using firebase) and questions with answers to them.
For example, suppose the question is "What shape is the earth?" and below the answers will be presented in the form of buttons "Round", "Square", "Flat", "Diamond-shaped".
There will also be other types of questions, for example, the question about the shape of the earth is the same, but instead of the correct answers, there will be a text label where you will need to enter the answer.
The question is what is the best way to implement storing these questions with answers on the device, I have found several options so far, but I do not know which one is better:
{
"id": "1",
"title": "Какой формы земля?",
"type": "buttons",
"right-answer": "Плоская",
"wrong-answers": "Круглая, Квадратная, Ромбовидная"
}
Answer the question
In order to leave comments, you need to log in
Of course JSON , don't even hesitate.
The architecture is correct, a little grind:
{
"id": "1", // всё отлично
"title": "Какой формы земля?", // можно question
"type": "buttons", // Если это стиль отображения, тогда сделай массив. Если тип вопроса - всё ок
"answers" {
"correct": "Плоская"
"incorrect": ["Круглая", "Квадратная", "Ромбовидная"]
}
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question