Reputation: 4551
My question is: is UItextInputTraits a protocol ?? if yes why does it have instances variables ?
Thanks
Upvotes: 0
Views: 145
Reputation: 20236
Yes it is a protocol, and no it does not have instance variables. It has properties, which are just syntactic sugar for methods.
A property does not need to be backed by an instance variable at all; not in a class definition or a protocol (in the latter it can't just by the nature of how protocols work). All it cares about is that, for instance, in the case of a protocol named foo
two methods exist if it's readwrite
:
- foo
- setFoo:
Obviously, returning and taking the appropriate data type.
Upvotes: 3