Avatar ·

Can didSet be forced to be called during initialization in Swift?

Hello! I'm new to Swift and encountered unexpected behavior with property observers. I have a class with a stored property for which I set didSet to perform validation or update the UI every time the value changes. But I noticed that didSet is not called when I set the property value in the initializer. Here's an example: ```swift class Temperature { var celsius: Double = 0 { didSet { print("Temperature changed to \(celsius)°C") // Here I want to update the UI or do validation } } init(celsius: Double) { self.celsius = celsius // didSet is NOT called! } } ``` When creating an object `let temp = Temperature(celsius: 25)`, I expect to see "Temperature changed to 25.0°C" in the console, but n