Does an Objective-C readonly property need to specify strong or copy?

前端 未结 1 2009
温柔的废话
温柔的废话 2021-01-11 23:12

If I have a read-only string property, is it necessary to specify strong (or retain) or copy in the declaration? If I don\'t specify,

相关标签:
1条回答
  • 2021-01-11 23:27

    That is mostly correct. For a readonly property, strong, retain, weak, and assign have no effect. But if you also declare the property elsewhere as readwrite (most frequently in an anonymous category in the .m), then the other modifiers need to match.

    0 讨论(0)
提交回复
热议问题