swiftproperty-observer

Why property observers can be added to stored properties, but not lazy stored properties


I'm new to Swift and is trying to learn the concept of Property observer. In one of the Youtube tutorials, someone mentioned that "property observers can be added to stored properties, but not lazy stored properties".


Solution

  • lazy stored property is not initialised when you created an instance of a class, therefore you could not observe change to something that has not been initialised