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

1,942 阅读1分钟

原文地址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

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