It is possible in Xcode to set empty string as default value of NSString
type attribute? Or [NSDate date]
as default value of NSDate
type attribute?
You will have to do both programmatically. However, you can't let [NSDate date]
be a default value (since at the time you would set that default value you are simply using the date at the specific time that you set the default value, not when the MO gets created).
You should create a subclass of NSManagedObject
and implement the awakeFromInsert
method:
- (void)awakeFromInsert
{
[super awakeFromInsert];
[self setDateAttribute:[NSDate date]];
[self setStringAttribute:@""];
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With