Reputation: 15672
My understanding of properties is that they just construct getter and setter methods. Is there a way to create a property that just has a setter method? My question is similar to this Write only property in Objective-C but it looks like the only solutions given are explicitly declaring and defining a setter method. Is that the only way or can it be done with properties?
Upvotes: 1
Views: 895
Reputation: 3084
If you are asking if you can have IOS automatically synthesize a "write only" property, than no. However, you can explicitly set a getter method that returns nil.
Example:
@property(strong, nonatomic) NSString *myString;
-(NSString *)myString
{
return nil;
}
Upvotes: 1