Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8737741
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T10:35:32+00:00 2026-06-13T10:35:32+00:00

I have a working app which has a plist as data container. An array

  • 0

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?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T10:35:33+00:00Added an answer on June 13, 2026 at 10:35 am

    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….

    @property (nonatomic, strong) NSArray *myFilteredArray;
    //...
    @synthesize myFilteredArray=_myFilteredArray;
    
    - (NSArray *)myFilteredArray {
    
        if (!_myFilteredArray) {
            NSMutableArray *array = [NSMutableArray array];
            // add to array using the filter logic you have already
            _myFilteredArray = [NSArray arrayWithArray:array];
        }
        return _myFilteredArray;
    }
    

    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.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have recently started working on an app which has both Java and native
I have been working on an app all day which has been working fine
I'm working on a iPhone app which has a pretty large UITableView with data
I'm working on an android app which has different layouts for phone vs tablet.
I am working on a rails 3 app which has different languages in my
I am working on a app which has push notification in it.I have implemented
I am working on app which have data entry form which have Some fields
I have made an android app which working fine. I implemented the Login functionality
I have rails app which are working perfectly in the local computer. But when
I have an app which was tested thoroughly and working fine on Android Gingerbread

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.