I can update property value of class instance using dot notation However It doesn't work for structure.
Here is example:
struct Resolution {
var width = 0
}
class VideoMode {
var interlaced = false
}
let someResolution = Resolution()
let someVideoMode = VideoMode()
For class:
someVideoMode.interlaced // false
someVideoMode.interlaced = true //true
someVideoMode.interlaced // now true
For Struct :
someResolution.width // 0
someResolution.width = 200 // throws an error says : someResolution is constant
Question is :
someResolution and someVideoMode both are constants. I can change the property value of class instance without error not saying someVideoMode is constant.However I can not change the property value of struct.It throws an error says someResolution is constant
Why ?
Thank you !