I have a User class which has various properties:
@property (strong, nonatomic) NSString *CandID;
@property (assign, nonatomic) BOOL IsCandidate;
@property (assign, nonatomic) NSInteger ResponseCode;
@property (strong, nonatomic) NSMutableArray *locations;
etc
One of my ViewControllers may have a user property i.e.
@property (strong, nonatomic) User *user;
And this user may be passed to subsequent ViewControllers which are launched modally.
When the user object is first initialized I am going to send some method off in grand central dispatch that will fill the locations array via REST. The idea is that by the time someone using my app gets to the screen to pick a location, the list will already be downloaded.
What I want to do is lock the locations area when the gcd is using it, I have used something like
[someLock lock] ... [someLock unlock]
in the past but what I want is the locations array to be locked but the rest of the user object's methods and properties to be accessible from the main thread. What is the best way to achieve this?