I want to show NSArraymy user (and I want them to only read it), but in my class I want to use NSMutableArray.
I tried the following code and it does not raise any warnings:
@interface MyClass : NSObject <NSApplicationDelegate>
@property (nonatomic, readonly) NSArray * test ;
@end
and
@interface MyClass ()
@property (nonatomic, strong, readwrite) NSMutableArray * test ;
@end
@implementation MyClass
- (id)init
{
self = [super init];
if (self)
{
self.test = [[NSMutableArray alloc] init] ;
}
return self;
}
@end
But if I try to access @property testfrom my class, I can use the method addObject:. So, I assume that the antecedent is impossible.
Why are there no warnings?
Colas source
share