swift中的只读属性实现,很简单

2016-07-04  本文已影响100人  FindCrt

原文地址readonly properties in Swift

Turns out just like in Obj-C, in Swift it's possible to declare nicely encapsulated readonly properties.

public private(set) var foo: String

Thank you NSHipster reader Stephen Celis

原来这么简单,但好像很少人说

上一篇 下一篇

猜你喜欢

热点阅读