struct S1 {
var v = 1 {
get { // report Error: Use of unresolved identifier ‘get'
return self.v. // report Error: Use of unresolved identifier ‘self'
}
}
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 15:06:16, Wang LiMing via swift-users (swift-users@swift.org) schrieb:
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'
}
}
On Jan 18, 2017, at 07:29, Adrian Zubarev via swift-users <swift-users@swift.org> wrote:
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 15:06:16, Wang LiMing via swift-users (swift-users@swift.org <mailto:swift-users@swift.org>) schrieb:
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'
}
}
On Jan 18, 2017, at 07:29, Adrian Zubarev via swift-users < > swift-users@swift.org> wrote:
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 15:06:16, Wang LiMing via swift-users (
swift-users@swift.org) schrieb:
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'
}
}