Created
September 23, 2016 05:26
-
-
Save antonio081014/be743650519f1003cf728adce991cf89 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
//: Playground - noun: a place where people can play | |
import UIKit | |
var str = "Hello, playground" { | |
//"Hello, playground" | |
willSet { | |
print("willSet \(str) : \(newValue)") | |
// "willSet Hello, playground : Hello, Antonio.\n" | |
str = "Hi" | |
// "Hi" | |
print("willSet \(str) : \(newValue)") | |
//"willSet Hi : Hello, Antonio.\n" | |
} | |
didSet { | |
print("didSet \(str) : \(oldValue)") | |
//"didSet Hello, Antonio. : Hello, playground\n" | |
str = "Hi" | |
// "Hi" | |
print("willSet \(str) : \(oldValue)") // | |
//"didSet Hi : Hello, playground\n" | |
} | |
} | |
str = "Hello, Antonio." | |
// "Hello, Antonio." |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment