adspace
What is category and class extension? How these differ?
Answer Posted / Pramd Kumar
A category in Objective-C is a way of extending an existing class by adding new methods, properties, or categories (other categories). Categories are declared using the @category directive, which specifies the name of the category and the name of the original class that it extends. Categories can be used to add functionality to existing classes without modifying their source code.nnClass extensions in Swift are similar to categories in Objective-C, but they are a part of the source file for the class they extend. Class extensions allow you to add additional properties and methods that are not exposed to the public interface of the class. Unlike categories, class extensions do not affect the behavior of existing instances of the class.nnThe main difference between categories and class extensions is that categories can be used with any existing class, while class extensions must be defined within the source file for the class they extend.
| Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
Explain parent-child context setup. How does it work? What are the advantages?
What is latest version of ios?
Why do all model object attributes get marked with @dynamic and not synthesised? What does @dynamic mean?
What is dependency management tools?
In a single model, can I have few entities in one sqlite db file and remaining in another sqlite db file?
What are the different store migration options? How do they work?
Why do all model object attributes get marked with @dynamic and not synthesised?
What is nsmanagedobjectcontext? What are the different concurrency types? Explain them.
What's the latest version of ios?
What is latest ios version?
What is the purpose of reuseidentifier?
How to handle concurrency problems in core data?
What are transient properties?
What is latest xcode version?