The line of code from your tutorial:
[someObject.someProperty setText:@"This is a text"];
uses two different ways to access two different properties, as such it is a bit confusing.
Declaring a property, say windowHeight
, declares two methods called the getter, which gets the property value, and the setter, which sets it. These methods are named propertyName
and setPropertyName
respectively, in our example windowHeight
and setWindowHeight
. Calling these methods is the original way in which properties where used. Your tutorial line written in this style is:
[[someObject someProperty] setText:@"This is a text"];
This calls the getter someProperty
of someObject
which returns another object, say someOtherObject
, and then calls the setter setText
of someOtherObject
.
Later in the development of Objective-C dot notation was introduced as a shorthand for getters and setters. Using this notation the getter call [someObject someProperty]
can be written as someObject.someProperty
, while the setter call [someObject setSomeProperty:someValue]
can be written as the assignment statement someObject.someProperty = someValue
.
In any of the above dot expressions someObject
is an expression which returns an object reference. It may be a simple variable reference; or it could be a more complex expression, including another dot expression, which returns an object reference.
Using dot notation your tutorial line is written:
someObject.someProperty.text = @"This is a text";
The parallels with the KVC keypath should now be apparent.
Your tutorial choose to mix'n'match original and dot notation styles in the same statement, probably resulting in your confusion and questions.
HTH