I am currently also unsure whether or not references should be strong or weak. The previous guys stated that they should be strong, but then I found this on:
https://developer.apple.com/library/prerelease/watchos/documentation/Cocoa/Conceptual/CoreData/CoreDataandStoryboards.html#//apple_ref/doc/uid/TP40001075-CH10-SW1
In the example code, Apple does this:
@interface DetailViewController : UIViewController
@property (weak) AAAEmployeeMO *employee;
@end
What we tend to do is to have a strong reference to the primary key of the object, and then a weak property that does lazy initialization if the object is nil. Like this;
@interface MyVC : UIViewController
@property (nonatomic, strong) NSString *objectId;
@property (nonatomic, weak) SomeObject *myCoolObject;
@end
@implementation MyVC
- (SomeObject *)myCoolObject {
if (_myCoolObject == nil) {
_myCoolObject = [SomeObject MR_findFirstByAttribute:@"primaryKey" withValue:self.objectId];
}
return _myCoolObject;
}
I'm still not sure if this is the correct way of doing it though. Please correct me.