Just select Objective-C 2.0 and want to know if there is an advantage to using the point operator to access properties instead of the "old" way. A short example of what I mean.
"old" way:
[myFraction setNumerator: 1]; [myFraction setDenominator: 3];
"new" way:
myFraction.numerator = 1; myFraction.denominator = 3;
Thanks!
Rodrigo
The only difference is the ease of typing and reading. The opinion of which is more readably different from person to person :)
I use dot syntax when I omit an object and use a bracket to actually set the property.
Same:
[self.view setFrame:CGRectMake(0, 0, 320, 480)];
Instead:
[[self view] setFrame:CGRectMake(0, 0, 320, 480)];
, , , , Python.
dot-property KVC/KVO. , ( , !) , , , - .
, ( ) , , .
:
, Objective-C, , C struct ( ).
, / .
C ++ and C # programmers are likely to more naturally adapt to the dot operator when accessing member variables, since it has a similar use in these languages.
Source: https://habr.com/ru/post/1704242/More articles:Data Access Layer (DAL) - design"Unable to start program" (Debug build) - c ++Json post request size limit (now checked php-mysqli error) - jsonHow to use a parameter in an external Excel data query? - sqlSilverlight ReaderWriterLock Implementation Good / Bad? - multithreadingOracle performance schema changes compared to MySQL ALTER TABLE? - oracleASP.net website. The assembly includes pdb files. How can I get rid of them? - asp.netКак вы определяете блок кода один раз для многократного использования? - rubyCosts associated with C # destructors (aka: finalizers)? - c #Directory structure for file host - linuxAll Articles