If I try the example from the Swift guide as shown below. I am getting errors, such as (not relevant to the below code but it’s the same error):
/Users/x/Documents/FireExperiment/RippleApp/CardStackViewLayout.swift(11,19): error E525: Cannot invoke data value
/Users/x/Documents/FireExperiment/RippleApp/CardStackViewLayout.swift(11,19): error E62: Type mismatch, cannot assign "method that returns no value" to "Int"
/Users/x/Documents/FireExperiment/RippleApp/CardStackViewLayout.swift(11,19): error E525: Cannot invoke data value
The example comes from this page:
https://developer.apple.com/library/ios/documentation/Swift/Conceptual/Swift_Programming_Language/Properties.html
Code snippet:
class StepCounter {
var totalSteps: Int = 0 {
willSet(newTotalSteps) {
print("About to set totalSteps to \(newTotalSteps)")
}
didSet {
if totalSteps > oldValue {
print("Added \(totalSteps - oldValue) steps")
}
}
}
}