Is there any benefit to adding a self. to the key path?

I see that many key paths are indicated as self.someProperty, and not just someProperty. Is there any use for this? Are these two key paths equivalent?

Edit: I'm talking about keypath strings, for example, used in bindings, sent to observeValueForKeyPath:or returned fromkeyPathsForValuesAffectingValueForKey:

+4
source share
1 answer

You mean valueForKey:/ setValue:forKey:or just directly depending on the difference between:

var = 8;
self.var = 8;

Assuming the latter, the difference is that the former stores the value directly, style C, while the latter calls setter (or getter, depending on context).

, , :

  • ;
  • , . : , .

EDIT: , , , , , , ?

+2

Source: https://habr.com/ru/post/1532142/


All Articles