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

  • SEARCH
  • Home
  • 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 6686275
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T05:09:11+00:00 2026-05-26T05:09:11+00:00

In my iOS application I have a set of singleton objects which are created

  • 0

In my iOS application I have a set of singleton objects which are created by my app delegate when the application starts, and they are meant to be reachable from every view controller of the application. These objects are stored as app delegate properties.

I would like to know if it is a better practice to get the reference to these objects everytime I need it ([SharedAppDelegate.singletonName method]) it or is it better to store a private reference for each view controller who will need the object?

Maybe there’s a tradeoff based on how many times I will access that object? Or I’m just overthinking and there’s practically no difference?

Thanks so much in advance.

  • 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-05-26T05:09:12+00:00Added an answer on May 26, 2026 at 5:09 am

    Why store a reference in the app delegate and not in a static var in the singleton object itself – as it is common practice?

    If you are concerned about performance problems because you initialize many objects in the singletons init, just do lazy initialization when the data is needed.

    Storing an object in the app delegate is no real singleton. You can create a singleton for instance like this using GCD.

    @interface MYSingleton
    
    + (id)sharedInstance;
    
    @end
    
    @implementation MYSingleton
    
    + (id)sharedInstance {
      static dispatch_once_t once;
      static MyFoo *sharedInstance;
      dispatch_once(&once, ^{
        sharedInstance = [[self alloc] init];
      });
      return sharedInstance;
    }
    
    @end
    

    Creating many unnecessary accessors in each view controller is just pure overkill and a waste of time.

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

Sidebar

Related Questions

I have an application that is supporting iOS 2.0. The Base SDK is set
I have an ad-hoc deployment of my iOS game, which includes in-app purchase. It
I have an application that was originally created compatible with iOS 2.x. With Xcode
I have made an application which includes movie player in it. Video starts playing
I am developing an iOS application, and trying to zip the file I have
I'm developing a universal iOS application and I set the deployment target to any
So, I may have made a mistake in updating my application to iOS 4.0
My IOS application program have tableview in navigation controller secondview. I want to save
In XCode, for an IOS application target, you can set Version and Build numbers.
I'm trying to support landscape mode in my gl iOS application. I have a

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.