Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import UIKit
- class PropertyObserver {
- var totalScore: Int = 0 {
- willSet {
- print("willSet: \(totalScore)")
- }
- didSet {
- print("didSet: \(totalScore)")
- }
- }
- }
- let propertyObserver = PropertyObserver()
- propertyObserver.totalScore = 100
- ผลลัพท์
- //willSet: 0
- //didSet: 100
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement