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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T23:34:09+00:00 2026-05-15T23:34:09+00:00

It is more of a complain than a question, though maybe someone has some

  • 0

It is more of a complain than a question, though maybe someone has some good points on it. So basically if you want an ivar in your Objective-C class have accessor-methods you have to mention it 3 times

SomeClass* _ivar;
@property (nonatomic,retain/assign/copy) SomeClass* ivar;
@synthesize ivar = _ivar;

and maybe 4th time in dealloc method. So wouldn’t it be more convenient if the approach would be like Java-style annotations – in one place before the actual ivar declaration, just something like:

@property (nonatomic,retain,synthesize = ivar,dealloc) SomeClass* _ivar; 

this also generates accessor methods, and dealloc – telling to dealloc the ivar in dealloc method.

  • 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-15T23:34:10+00:00Added an answer on May 15, 2026 at 11:34 pm

    Actually you don’t have to declare ivar – they can be synthesized if you just declare property for them. This should synthesize name iVar for you: (not supported in legacy run-times though – so one of the reasons of this seemingly redundant syntax is for backward compatibility with legacy platforms)

    @interface MyClass : NSObject 
    {
    }
    
    @property(copy) NSString *name;
    
    @end
    
    ...
    @synthesize name;
    

    In new XCode version (4.0 probably) you won’t need to use @synthesize as well – properties will be synthesized by default.

    So as you see objective-c develops to satisfy your wishes 🙂

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

Sidebar

Related Questions

More of a general MATLAB question than looking for programming advice -- if I
More often than I like when designers edit some of our sites' pages, they
More than one time I have encountered the following problem when building code with
More often than I'd have hoped I seem to come across method/property definitions in
More specifically I want to test whether Oracle ODP.Net is installed on a machine.
More of a design/conceptual question. At work the decision was made to have our
What is the correct way to defend against trying to store more text than
Short Question: Basically I am trying to add a scalar property to my entity
The more I read about frameworks, the more people seem to complain that they're
I have seen someone complain about that Logcat only output the last line. I

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.