Maybe what you want is
struct S1 {
private var _v = 1
var v:Int {
get {
return self._v
}
}
}
Zhaoxin
On Thu, Jan 19, 2017 at 2:08 AM, Jordan Rose via swift-users <
swift-users@swift.org> wrote:
> It is a terrible error message, though. I've filed
Computed properties do not have any default values. That said, you can only use
didSet or willSet on properties like yours to observe them or remove the
default value from the computed property completely to use get and set.
--
Adrian Zubarev
Sent with Airmail
Am 18. Januar 2017 um
In latest Xcode(8.2.1), playground
struct S1 {
var v = 1 {
get { // report Error: Use of unresolved identifier ‘get'
return self.v.// report Error: Use of unresolved identifier ‘self'
}
}
I can’t found the reason about the error.