I added a UITextView to storyboard that I created a property for and connected in a subview of UIView (called FieldView) in this case. The property was like this
@property (strong, nonatomic) UITextView * instructions;
That FieldView is a property of the viewController
@property (strong, nonatomic) IBOutlet FieldView *fieldView;
When I wanted to hide the UITextView *instructions with code in the viewController, I declared the property in the .h file so that I could eventually do this when a button was pressed
self.fieldView.instructions.hidden = YES;
However, xCode's giving me an error
illegal redeclaration of property in class extension FieldView, attribute must be readwrite while its primary must be readonly
When I added readwrite in both the .h and .m files
@property (weak, nonatomic, readwrite) IBOutlet UITextView *instructions;
it said `perhaps you intended this to be a readwrite redeclaration of a readonly public property
What is the correct way to do what I am trying to do?
To resolve your issue you need declare
readonly
property in.h
file andreadwrite
property in.m
file:I Also got same issue,
If same name property is declared in .h file and you are again declaring it in extension then you will get this error.
So renaming property name will resolve the issue.