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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T11:38:40+00:00 2026-06-13T11:38:40+00:00

I was wondering what exactly are the differences between using the (get) accessor for

  • 0

I was wondering what exactly are the differences between using the (get) accessor for reading the value of property and directly using the iVar?

Say I have a class which declares a property:

@interface Foo : NSObject

@property (strong) NSString *someString;

@end

And in the implementation I’m using it. Are there any differences between the following two lines:

someLabel.text = self.someString;

someLabel.text = _someString;

For set accessors it’s clear. Afaik for strong properties the accessor takes care of retain and release (an interesting ‘side question’ would be if ARC changes that, i.e. does setting the iVar directly [assuming it’s not an __weak iVar] also retain and release correctly using ARC), also KVO requires the use of accessors to work properly etc. But what about getters?

And if there’s no difference, is there one way considered best practice?

Thx

  • 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-13T11:38:41+00:00Added an answer on June 13, 2026 at 11:38 am

    As you know, calling self.someString is really [self someString]. If you chose to create a property then you should use the property. There may be other semantics added to the property. Perhaps the property is lazy loaded. Perhaps the property doesn’t use an ivar. Perhaps there is some other needed side effect to calling the property’s getter. Maybe there isn’t now but maybe this changes in the future. Calling the property now makes your code a little more future proof.

    If you have an ivar and a property, use the property unless you have explicit reason to use the ivar instead. There may be a case where you don’t want any of the extra semantics or side effect of the property to be performed. So in such a case, using the ivar directly is better.

    But ultimately, it’s your code, your property, your ivar. You know why you added a property. You know any potential benefits of that property, if any.

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

Sidebar

Related Questions

I was wondering what are exactly the differences between CF data structures (CFArray, CFDictionary,
I was reading litb's question about SFINAE here and I was wondering exactly what
I was wondering how exactly does TCP implement in-order delivery. lets say this is
Reading some posts from Jimmy Boggard and wondering - how exactly is it possible
I am wondering , what exactly is stored in the memory when we say
I wondering whats the difference between url and destination using httpservice in flex. I
I am wondering if there is a performance difference between using a cached selector,
So I'm left wondering how exactly asp.net is able to scope a static property,
Using the navigator.geolocation object in JavaScript. Trying to establish accurate ranges, but wondering exactly
I have an Arduino and I am wondering exactly what HIGH and LOW mean,

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.