Synthesizing a property without instance variables

前端 未结 3 618
别跟我提以往
别跟我提以往 2020-12-08 00:48

I thought I understood @property and @synthesize, but I did some experimenting and I can\'t figure out why the below (what I thought was broken) code works.

As you c

3条回答
  •  星月不相逢
    2020-12-08 01:24

    I want to add that although the instance variable is automatically created, it's named the same as the property. By doing this, you may get bugs in your code later. So, besides preventing the case of not automatically generating on some architectures, you should always create the instance variable so that you don't get anything unexpected later on down the road.

提交回复
热议问题