美文网首页
Swift属性的Set,Get

Swift属性的Set,Get

作者: chenhh6701 | 来源:发表于2018-04-11 18:06 被阅读0次

1.setter/getter一起出现,该属性已经变为方法(同OC)
2.willSet,didSet 不能同1

3.init方法中调用属性不会调用willSet,didSet方法

When you assign a default value to a stored property, or set its initial value within an initializer, the value of that property is set directly, without calling any property observers.

相关文章

网友评论

      本文标题:Swift属性的Set,Get

      本文链接:https://www.haomeiwen.com/subject/aiuzhftx.html