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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T12:02:53+00:00 2026-05-12T12:02:53+00:00

I find myself declaring bunch of class variables and it is really tiring to

  • 0

I find myself declaring bunch of class variables and it is really tiring to write simple get/set methods for each variable. So, the question is how to synthesize setters/getter for class variables in objective-c?

  • 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-12T12:02:53+00:00Added an answer on May 12, 2026 at 12:02 pm

    Usually when you are grouping a set of related variables that are meant to be accessed globally, you create what is called a Singleton:

    What should my Objective-C singleton look like?

    This means you have one class level method that gives you back a shared instance – so you’d have a call like:

    [MyClass sharedInstance].myProperty
    

    Since the values are you are storing are true class instance variables, you can use normal properties, but all classes will be working with the same shared data.

    Note that some people dislike the use of singletons, you may want to read some caveats about the practice:

    Singleton: How should it be used

    But since you already start with one inherent singleton in iPhone development (the application delegate, which anyone can access at any time) making light use of the technique does not hurt if you are careful. Note that instead of creating a Singleton class, one alternative is to have the application delegate create a single instance of a variable storage class, and have everyone access that through the delegate…

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

Sidebar

Related Questions

I find myself often wanting to do simple commands like: cp /really/long/path/from/file.txt /really/long/path/to/file.txt Although
I frequently find myself declaring a simple procedure type TMessageProc = procedure(const AMsg: String);
I find myself writing delegates occasionally for really simple functions (take no arguments and
I find myself constantly running into a situation where I have a set of
I find myself having this sort of pattern over and over: variable = try:
I find myself writing this class often in my python code when I need
I find myself wanting to write a routine that will operate on both volatile
I find myself having to get around waiting for AJAX in jQuery often these
I find myself stuck in something I think would be really easy to solve.
I find myself writing code that looks like this a lot: set<int> affected_items; while

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.