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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T16:20:41+00:00 2026-06-06T16:20:41+00:00

In my code, I have about five @property statements; when I go to @synthesize

  • 0

In my code, I have about five @property statements; when I go to @synthesize = ... them, some give me choices (of the property name) in the dropdown menu of objects, and some do not. I also find that if I don’t get all of the properties changed to _property in my methods, it makes no difference in execution; the app still works.

Why does the app still run whether or not the property name has an underscore as a prefix?

  • 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-06T16:20:43+00:00Added an answer on June 6, 2026 at 4:20 pm

    You should use @synthesize iVar = _iVar;, but maybe soon you won’t need to synthesize at all 😉

    I would say that the options given by Xcode are just the code completion being a bit buggy.

    Strictly speaking, the name you use doesn’t matter at all (as long as there aren’t any collisions), @synthesize iVar = i_va_R; is perfectly legal, so is:

    @synthesize foo = bar;
    @synthesize bar = foo;
    // DO NOT DO THIS IN REAL LIFE!!
    

    All you are saying is that you want the property to be backed by an instance variable with the given name. If you never access the instance variable directly (always use self.iVar rather than iVar or _iVar) then it doesn’t really matter at all what you use, it only matters to the rest of the code if you want to access the iVar directly.

    Just to clarify a little more, here is an example of of how the above could be implemented without using properties:

    @interface MyBadClass {
        int foo;
        int bar;
    }
    
    - (int)foo;
    - (void)setFoo:(int)foo;
    
    - (int)bar;
    - (void)setBar:(int)bar;
    
    @end
    
    @implementation MyBadClass
    
    - (it)foo
    {
        return bar;
    }
    
    - (void)setFoo:(int)foo
    {
        bar = foo;
    }
    
    - (int)bar
    {
        return foo;
    }
    
    - (void)setBar:(int)bar
    {
        foo = bar;
    }
    
    @end
    

    (PS: I am using ints to avoid dealing with memory management, the same applies to objects too though)

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

Sidebar

Related Questions

Just a musing about some repetitive code I have: Runnable run = new Runnable()
I'm working on some JQuery code and I have a question about caching selectors.
I have written some SQL code to create five tables with several relations(foreign keys).
I have about 2000 lines of javascript code for my application. A lot of
i executed the following c code on my ubuntu machine...i have read about fcntl()'s
I have a question about the following code in TCL/EXPECT: expect { timeout {
I have a question about the following code : #include <iostream> #include <ctime> int
I have been wondering about the following lines of code [self performSelector:@selector(myMethod) withObject:self afterDelay:1.0];
I have a question about the following C code: void my_function() { int i1;
I have a question about defining Foreign Key in EF Code First Fluent API.

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.