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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T19:38:33+00:00 2026-06-05T19:38:33+00:00

I have an iOS app that uses a number of enums for valid values,

  • 0

I have an iOS app that uses a number of enums for valid values, mostly as I’m using some integer-driven state transition tables, but also allows lower memory usage and the ability to index-search in SQLite, which I am using for the backend.

I’ve got all the enums in a common .h file, which is included across a number of classes that create variables based on the enum type. I also have several methods which are used across many classes. Some of them are translating the enums back to strings, with the typedef and a (human) language as paramaters.

One of the typedefs is below:

typedef enum {
    Ben,
    Sen,
    O,
    Biz,
    Siz,
    Onlar
} pronoun_typedef;

There are also another set of methods, mostly string manipulation which are fed several parameters and return a NSString* or NSMutableString*.

I’ve already moved these around to different classes a few times, and I am thinking the best approach might be to create a “utility” class and include it in each relevant class, and instantiate as required.

Is this a good approach? The other option I considered would be to create a singleton, and then forward reference it to every class where it would be required. Any suggestions on which approach to use, or any suggestions for other approaches?

I know this is a similar question to this and some others but I didn’t feel it was conclusively answered so I thought I ask again. Singleton and Static Utility classes

  • 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-05T19:38:35+00:00Added an answer on June 5, 2026 at 7:38 pm

    If the utility methods don’t need a reference to self, I would make them C functions defined in the same module as the constants. You need an .h file with the constant definitions and function declarations (prototypes), and a .c file with function bodies defined.

    If it needs to be an object, use a singleton if single instance makes sense, and multiple instances if each one needs a private, independent copy of its internal data/state.

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

Sidebar

Related Questions

I have an app that uses local storage (using sencha 'Ext.data.proxy.LocalStorage') to view some
I have an iOS 5 app that uses NSURLConnection to load some XML via
I have a iOS app that, in a nutshell, uses a UITableView and a
I have an iOS app that uses Core Data for persistent data storage. I
I have an iOS app that uses a SQLite DB to store its data
I have an app for iOS that uses Filesharing to provide the user with
I have an iOS app that uses sqlite3 databases extensively. I need to add
I have developed an iOS app that uses CoreData/SQLite. It works, but now I
I have an app that uses the iPhone's contacts. With iOS 6, the user
I have an iOS App that may store confidential information and also uses iCloud

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.