• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: iOS: Using AppDelegate as an app-wide singleton
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: iOS: Using AppDelegate as an app-wide singleton


  • Subject: Re: iOS: Using AppDelegate as an app-wide singleton
  • From: Rick Mann <email@hidden>
  • Date: Tue, 01 Dec 2015 16:31:13 -0800

>
>
>> On Dec 1, 2015, at 4:55 PM, Quincey Morris <email@hidden> wrote:
>>
>> On Dec 1, 2015, at 12:58 , Carl Hoefs <email@hidden <mailto:email@hidden>> wrote:
>>
>>> available to all classes via [[UIApplication sharedApplication] delegate].
>>
>>> Are there any drawbacks to this?

I've found it's best to remove as much of your app-specific singleton behavior out of the app delegate as possible, with an eye toward porting the iOS app to OS X or vice-versa.

This is not to say you should actually port it. But by moving those things out of the app delegate, it makes that sort of thing much easier should you choose to.

You may also want to break up that singleton into more than one, depending on the functional areas it serves. For example, I no longer put my Core Data stack in app delegate, instead putting it in a CDManager of some sort. This, along with my model classes, ends up being a fairly portable chunk of code I can share among apps. But I may have a different singleton for collecting other app-wide functionality that's specific to my app, again, trying to keep it out of the AppDelegate.


--
Rick Mann
email@hidden



_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden


References: 
 >iOS: Using AppDelegate as an app-wide singleton (From: Carl Hoefs <email@hidden>)
 >Re: iOS: Using AppDelegate as an app-wide singleton (From: Quincey Morris <email@hidden>)
 >Re: iOS: Using AppDelegate as an app-wide singleton (From: Carl Hoefs <email@hidden>)

  • Prev by Date: Re: iOS: Using AppDelegate as an app-wide singleton
  • Next by Date: Re: iOS: Using AppDelegate as an app-wide singleton
  • Previous by thread: Re: iOS: Using AppDelegate as an app-wide singleton
  • Next by thread: Re: iOS: Using AppDelegate as an app-wide singleton
  • Index(es):
    • Date
    • Thread