0

I am familiar in iOS/Objective C. Now I see people using self->property in some cases. How does it differ from self.property? What is the actual need? I googled, no answer. Curious in it.

iOS
  • 3,526
  • 3
  • 37
  • 82
  • It calls for instance variable. Check: http://stackoverflow.com/questions/7057934/property-vs-instance-variable for more. – b.zdybowicz Feb 12 '15 at 09:27
  • Also http://stackoverflow.com/questions/22398609/what-does-property-actually-do-behind-the-scene-with-usage-of-self-and-self?rq=1 – Thilo Feb 12 '15 at 09:28

1 Answers1

5

self->property is the same as _property, meaning it accesses the ivar directly.

self.property on the other hand calls the setter/getter.

Lord Zsolt
  • 6,492
  • 9
  • 46
  • 76