Last active
May 19, 2020 14:24
-
-
Save bestiosdeveloper/1a47bed8af15d5dd87f811dc72a1d995 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class User { | |
var age: Int = 0 { | |
didSet { print("didSet for age") } | |
} | |
var name: String = "" { | |
didSet { print(oldValue) } | |
} | |
} | |
let user = User() | |
// This will not call the getter to fetch the oldValue | |
user.age = 15 | |
// This will call the getter to fetch the oldValue | |
user.name = "name" | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment