override getter only needs @synthesize

Viewed 1717

I want to ovveride getter for lazy instantiation and leave default setter.

Do I need @synthesize ?

Why ?

@interface Foo()
@property (strong, nonatomic) NSObject *bar;
@end

@implementation Foo
- (NSObject *)bar
{
    if(!_bar) _bar = [[NSObject alloc] init];
    return _bar;
}
@end

Update: I've changed variable and class name, because it was confusing. From Deck and card to Foo and bar.

3 Answers
Related