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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T05:25:55+00:00 2026-06-03T05:25:55+00:00

When using Objective-C properties can you stop creating instance variables altogether or do explicit

  • 0

When using Objective-C properties can you stop creating instance variables altogether or do explicit instance variables (not the ones synthesized by the properties) still serve a purpose where properties would be inappropriate?

  • 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-03T05:25:56+00:00Added an answer on June 3, 2026 at 5:25 am

    can you stop creating instance variables altogether

    No, you can’t (in a sense). What you can do is stop declaring them if you have properties. If you synthesize a property and you haven’t declared the instvar, it will get declared for you, so you are creating an instance variable, just not explicitly.

    do they still serve a purpose where properties would be inappropriate?

    It used to be the advice to create properties for everything because having synthesized properties does almost all of the retains and releases for you. However, with ARC that reason for using properties to wrap the memory management has gone away. The advice now (for ARC) is, I believe, use properties to declare your external interface, but use direct instance variables where the variable is part of the object’s internal state.

    That’s a good reason to adopt ARC: properties revert to their true purpose only of being part of the class’s API and it’s no longer necessary to use them as a hacky way to hide memory management work.

    Edit

    One more thing: you can now declare instance variables in the @implementation so there is now no need to leak any implementation details in the @interface. i.e.

    @implementation MyClass
    {
        NSString* myString;
    }
    // method definitions
    @end
    

    And I’m pretty sure it works in categories too. – see comment below

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

Sidebar

Related Questions

I'm using Objective-C properties to handle retaining/releasing instance variables for me. In my class,
Possible Duplicate: Properties and Instance Variables in Objective-C 2.0 I'm using properties only for
With Objective-C, you can add iVars/properties to a class using the associated object support
I'm rather confused about properties and instance variables in Objective-C. I'm about half-way through
I'm using garbage collection in Objective-C 2.0. Do I need to retain properties? Eg.
I had some discussion related to the use of properties and instance variables at
I am using objective c, and I got some variables like this: 1100 920
I have been using objective-C to develop in iOS. Now we want to develop
I am using Objective-C in my app and I have a question about multiple
How to create a TCP socket using Objective-C, check if some TCP ports are

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.