Why items readonly


#1

@property (nonatomic, readonly, strong) NSMutableArray *items;

  • (void)parser:(NSXMLParser *)parser didStartElement:(NSString *)elementName namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qualifiedName attributes:(NSDictionary *)attributeDict
    {
    NSLog(@"\t%@ found a %@ element", self, elementName);
    if ([elementName isEqual:@“title”]) {
    currentString = [[NSMutableString alloc] init];
    [self setTitle:currentString];
    }
    else if ([elementName isEqual:@“description”]){
    currentString = [[NSMutableString alloc] init];
    [self setInfoString:currentString];
    }
    else if ([elementName isEqual:@“item”]){
    RSSItem *entry = [[RSSItem alloc] init];

      [entry setParentParserDelegate:self];
      
      [parser setDelegate:entry];
    

[color=#FF0000] [items addObject:entry];
[/color] }
}

Why does it work?


#2

Readonly means only that the value of the items property can’t be changed; it does not mean that the (mutable) array object itself can’t be modified.


#3

Readonly means only that the value of the items property can’t be changed; it does not mean that the (mutable) array object itself can’t be modified.[/quote]

Did you mean that i can’t do " items = anything" ,like this?