When should I use @synthesize explicitly?

后端 未结 7 1652

As far as I know, since XCode 4.4 the @synthesize will auto-generate the property accessors. But just now I have read a sample of code about NSUndoManage

7条回答
  •  执念已碎
    2020-11-29 15:26

    Xcode doesn't require an explicit @synthesize declaration.

    If you don't write @synthesize its the same as doing :

    @synthesize manager = _manager;
    

    The sample code might've been old. They'll update it soon.

    You can access your properties like :

    [self.manager function];
    

    This is Apple's recommended convention. I follow it, and I recommend that you do too!

提交回复
热议问题