Question

Good day!=) I have "super" class and category for it) For super class i defined a protocol delegate property but i can't call it in category in method. Is it possible anyway? Thanks everybody for answering=)

Was it helpful?

Solution

Your terms are all confused. A category is not a superclass or a subclass. A category adds methods to an existing class.

A method is not a property, so "defining a delegate method property" does not make sense.

You can't add new instance variables to an object in a category, so you can't add normal properties at all. You can create properties with custom getters/setters that don't use instance variables, or that use existing instance variables (for example if you had a "Person" class that had a "firstName" property and a "lastName" property you could create a new read-only property "fullName" that concatenated the first and last name and returned the result.)

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top