While programming for iOS I encountered the following scenario:
I have a singleton class with a class method + (Store*)sharedStore
. When I want to call an instance method on the singleton object, I can use dot syntax to get that object, i.e. [Store.sharedStore foo]
.
However, Xcode does not autocomplete 'sharedStore' after typing the dot. On the other hand, [[Store sharedStore] foo]
is autocompleted!
Is there such a thing as 'class properties'? If I could turn sharedStore
into a readonly property on the class, the dot syntax would gain autocompletion.
More generally speaking, Xcode simply does not autocomplete after dot syntax on anything that isn't a property, even though this is a valid way of calling a (getter) method.
Any solution, workaround, or information is appreciated.
Currently, as far as class getters go, it appears that we must either:
Store.sharedStore
; or[Store sharedStore]
.I have not tried other editors recently (e.g. AppCode). Another editor might autocorrect the dot syntax on class getters.
Opinions vary as to what is correct, logical or readable.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With