-1

I am having difficulty in understanding the difference between the willSet and didSet. Can someone throw some light on their usage?

Keshav
  • 1,123
  • 1
  • 18
  • 36

1 Answers1

9

willSet is executed before property is set.

didSet is executed after property is set.

David Xu
  • 5,555
  • 3
  • 28
  • 50