I am new at iOS development. I am trying to do the following: Store a title, that allows any number of subcategories to be added below it. Each subcategory needs to have 2 integers attached to it. I need to be able to use, edit, remove, and add new titles, subcategories, and integers.
"Title":
"Subcategory": int, int
"Subcategory": int, int
"Title":
"Subcategory": int, int
"Subcategory": int, int
"Subcategory": int, int
"Subcategory": int, int
I have tried several times with structs and arrays. For example:
struct everyThing {
var titles = ["Title 1", "Title 2", "Title 3"]
var subcategories = ["subcat1", "subcat2", "subcat3", "subcat4", "subcat5"]
var integers: [Double] = [5.0,10.0,7.0,15,3,6,7,8,12,14,13,15]
}
struct grouping1{
var title = everyThing().titles[0]
var subcategories = everyThing().subcategories[0..<2]
var integers = everyThing().workRest[0..<2]
}
struct grouping2{
var title = everyThing().titles[1]
var subcategories = everyThing().integers[2..<4]
var integers = everyThing().integers[2..<4]
}
It becomes impossible to keep track of and scale, as any number of subcategories can be added under a particular title.
Any ideas of the best way to organize this data? Let me know if this is too vague.