Skip to content

Instantly share code, notes, and snippets.

@keicoder
Created January 24, 2014 02:35
Show Gist options
  • Save keicoder/8591100 to your computer and use it in GitHub Desktop.
Save keicoder/8591100 to your computer and use it in GitHub Desktop.
objective-c : make a property read-only to other objects but fully accessible to your own class
//make a property read-only to other objects but fully accessible to your own class
//.h file
//readonly
@property (nonatomic, readonly, strong) NSMutableArray *searchResults;
//.m file
//new class extension inside .m
//readwrite
@property (nonatomic, readwrite, strong) NSMutableArray *searchResults;
//synthesize the properties
@synthesize searchResults = _searchResults;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment