Beginner Swift
Q30 / 100

What is a property observer in Swift?

Correct! Well done.

Incorrect.

The correct answer is B) willSet and didSet blocks that run before and after a property value changes

B

Correct Answer

willSet and didSet blocks that run before and after a property value changes

Explanation

var score: Int = 0 { willSet { print("About to set \(newValue)") } didSet { print("Set from \(oldValue)") } }

Progress
30/100