Reputation: 1542
I have the following derived property:
SongWrapper.h
@property (nonatomic, strong) NSString *title;
SongWrapper.m
- (NSString *)title;
{
return self.songDocument.songAttributes.title;
}
I tried to set it like this:
self.songViewController.songWrapper.title = titleTextField.text;
Why doesn't this work and what are the best practices for setting a derived property?
Upvotes: 0
Views: 137
Reputation: 1942
You have to defined getter but not setter. You need to define setter as well.
//Getter
- (NSString *)title;
{
return self.songDocument.songAttributes.title;
}
//Setter
- (void)setTitle:(NSString *)title;
{
self.songDocument.songAttributes.title = title;
}
Upvotes: 1