Reputation: 943
I have the exact opposite of Xcode 4 dot notation code sense problem! The code completion for dot notation shows not only properties but also methods for me (with P or M marked on the left of each completion appropriately indicating whether it is a property or a method respectively). Is this the normal behavior on Xcode 4 or am I doing something wrong?
This does not happen always though. It appears to happen for classes defined by me but not for pre-defined classes. But I haven't tested enough to be sure of this.
Maybe it is possible to customize code sense but there are no answers as yet for where code sense options in Xcode 4 are which has also been asked for Xcode 3.2.2 at "Customizing Xcode: fonts, code sense and more" again with no answers yet.
Upvotes: 2
Views: 490
Reputation: 49044
ObjC dot notation can be used for any method that takes no parameters; it is not limited to formally declared properties. This is mostly because when dot notaion was introduced to the language there was a large amount of existing code that had -foo
and -setFoo:
methods, implicitly defining a property. Thus, they decided to enable dot syntax for any conforming method names, even if they weren't part of an explicit @property
.
Now, we can debate about whether that was a good decision or not, but that's how it is. myArray.count
is perfectly valid code, even though there's no "count" @property
.
Upvotes: 3