I’d like to declare a public immutable property:
@interface Foo
@property(strong, readonly) NSSet *items;
@end
…backed with a mutable type
You have to declare the property in the public interface as readonly in order the compiler not to complain. Like this:
Word.h
#import
@interface Word : NSObject
@property (nonatomic, strong, readonly) NSArray *tags;
@end
Word.m
#import "Word.h"
@interface Word()
@property (nonatomic, strong) NSMutableArray *tags;
@end
@implementation Word
@end