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 7709601
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T00:54:11+00:00 2026-06-01T00:54:11+00:00

Fairly early on in my app, when I was a lot less experienced than

  • 0

Fairly early on in my app, when I was a lot less experienced than I am now, I wanted to spice up some transitions between view controllers with my own custom animations. Having no idea where to start, I looked around SO for a pattern like MVC that could be accessed from nearly any controller at any time, and as it turns out, a singleton was the way to go.

What I didn’t realize is that there seems to be a strong and well-defended hatred of the singleton pattern, and I myself am starting to see why, but that is beside the point.

So, a while later, I decided to move my very same implementation into a category on UINavigationController (after all, it handles transitions!), kept the original classes around for comparison, and am wondering which method would work best. Having thoroughly tested both implementations, I can say without a doubt that they are equal in every way, including speed, accuracy, smoothness, frame-rate, memory usage, etc. so which one is ‘better’ in the sense of overall maintainability?

EDIT: after reading the well-written arguments you all have made, I have decided to use a singleton. @JustinXXVII has made the most convincing argument (IMHO), although I consider every answer here equally worthy of merit. Thank you all for your opinions, I have upvoted all answers in the question.

  • 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-01T00:54:13+00:00Added an answer on June 1, 2026 at 12:54 am

    I’ll make the case for a singleton object. Singletons are used all over UIKit and iOS. One thing you can’t do with categories is add instance variables. There are two things about this:

    1. MVC workflows don’t tolerate objects with intimate knowledge of other objects
    2. Sometimes you just need a place to reference an object that doesn’t really belong anywhere else

    These things go against each other, but the added ability to be able to keep an instance variable that doesn’t really have an “owner” is why I favor the singleton.

    I usually have one singleton class in all of my XCode projects, which is used to store “global” objects and do mundane things that I don’t want to burden my AppDelegate with.

    An example would be serializing/archiving objects and unarchiving/restoring. I have to use the same method throughout several classes, I don’t want to extend UIViewController with some serializing method to write and read arbitrary files. Maybe it’s just my personal preference.

    I also might need a quick way to lookup information in NSUserDefaults but not want to always be writing [[NSUserDefaults standardUserDefaults]stringForKey:@"blah"], so I will just declare a method in my singleton that takes a string argument.

    Until now i’ve not really thought too much about using a category for these things. One thing is sure though, I’d rather not be instantiating a new object a hundred times to do the same task when I can have just one living object that sticks around and will take care of stuff for me. (Without burdening the AppDelegate)

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

Sidebar

Related Questions

fairly new iPhone developer here. Building an app to send RS232 commands to a
It seems the Khronos group is fairly closed when it comes to releasing early
I'm currently working on a project with some fairly significant business rules where the
Fairly new to Spring, so I'm having some trouble with this. I'm trying to
I'm playing around with corecursive data structures, and fairly early on in my code,
On a fairly complex page, we're getting some unusual behavior with dropdownlists in IE6
Fairly simple HTML (the ellipses indicate that there's more code): ...Profile> Some text </a>...
Fairly new to programming. I just can't wrap my head around how to get
Fairly straight forward question but Googling hasn't turned up anything as yet. How do
Fairly straightforward question here, but I can't seem to find someone who has asked

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.