Skip to content

Instantly share code, notes, and snippets.

@RyanCopley
Created June 4, 2014 21:39
Show Gist options
  • Save RyanCopley/b09b2288b8be26357c96 to your computer and use it in GitHub Desktop.
Save RyanCopley/b09b2288b8be26357c96 to your computer and use it in GitHub Desktop.
“class StepCounter {
var totalSteps: Int = 0 {
willSet(newTotalSteps) {
println("About to set totalSteps to \(newTotalSteps)")
}
didSet {
if totalSteps > oldValue {
println("Added \(totalSteps - oldValue) steps")
}
}
}
}”
Excerpt From: Apple Inc. “The Swift Programming Language.” iBooks. https://itun.es/us/jEUH0.l
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment