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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T15:59:21+00:00 2026-06-05T15:59:21+00:00

I’m still pretty new to ObjC. I noticed that it’s pretty standard everywhere to

  • 0

I’m still pretty new to ObjC. I noticed that it’s pretty standard everywhere to create your

@interface myObj : NSObject {
    id delegate;
    NSDictionary *dict;
}

and then

@property (nonatomic,retain) NSDictionary *dict;
@property (retain) id delegate;

–for example. I know how useful the auto code generation + clearer definition of @property is thanks to the Declared Properties page over at Apple. What I do not understand, however, is why it’s standard for people to do both — declare their properties and then have them again in the {curly brackets}.

I mean, if I had a class where I wanted some of the variables to have auto getters/setters and some not to, then I would understand having the {} block for my regular vars and then only creating @property/@synthesize statements for just those specific variables I wanted to have the added functionality; but why is it standard to always have both in cases where you know that you want all of your instance vars to have the getters and setters? I guess I’m tripping out because I’m basically seeing it used like this 100% of the time when I feel like it really isn’t necessary… just declare the @properties and leave it at that.

Thoughts? Best coding practice suggestions? Or is there some information I’m missing here?

  • 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-05T15:59:21+00:00Added an answer on June 5, 2026 at 3:59 pm

    What you’re seeing was required in earlier versions of Objective-C, but isn’t any more.

    In the first versions of Objective-C used by NeXT up until the new runtime was introduced (with Objective-C 2.0 on Mac OS X), all instance variables had to be declared as part of the class’s structure in its @interface. The reason was that if you subclassed a class, the compiler needed to know the instance variable layout of the class so it could see at what offset to put the subclass’s instance variables.

    When properties were introduced, synthesized properties had to be “backed” by an instance variable in the class’s structure. Therefore you had to declare both an instance variable and the property.

    All of the above is no longer true. Newer Objective-C is less fragile in the way it looks up instance variable offsets, which has meant a few changes:

    • not all instance variables need to be in the @interface. They can now be defined in the @implementation: though not in categories due to the possibilities of clashing and other issues.
    • instance variables for synthesized properties can be inferred and created based on the property definition.
    • you can programmatically add instance variables to classes you’re creating at runtime (only before you’ve registered the class as available to the system).

    So, to reiterate, you only needed to declare both the instance variable and a synthesized property in older versions of the Objective-C language. What you’re seeing is redundant and should not be considered a “best practice”.

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

Sidebar

Related Questions

That's pretty much it. I'm using Nokogiri to scrape a web page what has
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I'm trying to create an if statement in PHP that prevents a single post
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I've got a string that has curly quotes in it. I'd like to replace
I have a small JavaScript validation script that validates inputs based on Regex. I
I have a French site that I want to parse, but am running into
I want use html5's new tag to play a wav file (currently only supported

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.