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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T03:24:47+00:00 2026-05-26T03:24:47+00:00

When you declare a @property and @synthesize it, it is considered good practice to

  • 0

When you declare a @property and @synthesize it, it is considered good practice to use:

@synthesize myProperty = _myProperty;

I’ve noticed that Xcode will autocomplete the ivar name _myProperty for you, even though it hasn’t yet been used in the source code.

Is this because the ivar @synthesize creates automatically defaults to the name _myProperty? Or merely because Xcode supports this common convention with an autocompletion for it?

Thanks.

EDIT: I’m not looking for reasons why this is good practice; I’m already aware of those and have used this convention for a while. I want to understand the internals, thus am asking whether this is a hard-coded auto-completion rule to satisfy a convention, or whether it’s standard auto-completion and in fact the Objective-C specification dictates that an ivar generated by @synthesize must have the form _myProperty, thus after behind the scenes generation of the ivar, auto-completion is aware of its existence. Thanks!

  • 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-26T03:24:48+00:00Added an answer on May 26, 2026 at 3:24 am

    I think the autocompletion is an IDE convenience rather than a result of the runtime. My logic for this is that the following appears to be valid:

    @interface SomeClass()
    @property (nonatomic, assign) int unpublishedInstanceVariable;
    @end
    
    @implementation SomeClass
    @synthesize unpublishedInstanceVariable;
    
    - (void)someMethod
    {
        unpublishedInstanceVariable = 3; // not calling the setter
    }
    @end
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In Objective C you can now use @property and @synthesize to auto generate get
In C# 3.0, I'm doing the code below to declare a DateTime property and
I want to declare three properties in my MSBuild file and overwrite one property
Why is not possible to initialize a property to a function when you declare
In C#, if I declare an auto-implemented property, why do I have to declare
I have a property on a domain object that is declared in a many-to-one
Update - Many people are insisting I need to declare an iVar for the
I am using a UIActivity Indicator View named as process. I declare property in
If you declare a property with a retain attribute, do you need to release
I have two properties I declare in my header file and synthesize in my

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.