I have a working app which has a plist as data container. An array of dictionaries is generated from the plist in viewdidload. Three different sub-arrays are generated from the main array depending on segmented control selection and objectforkeys. These arrays then populate a UIickerView.
While using this app user will select different segment each time and the app then has to step through the whole array each time to generate required sub-array.
Should I just go ahead and generate these sub-arrays once in viewdidload, so that they don’t have to be generated repeatedly?
This is not a big file (100 dictionaries). Will it improve overall efficiency of the app?
You could iterate collections numbering in the hundreds on every user action and not notice it, but it’s also very easy to cache the sub-arrays with a property.
Lazy init is a nice pattern here….
If nothing else, this makes your filtering code easy to find, and separate for each array, which might be prettier than burying it all in viewDidLoad.