why can I do this without any error:
var testDto = ModelDto(modelId: 1)
testDto.objectId = 2
while I define this:
protocol
In your class, you create a stored property named objectId. In your protocol, you specify that the property needs a getter – that is its only requirement.
If you wanted it to be a computer property, like you expect it to, you need to declare objectId with the following:
var objectId: Int{ return (someNumber) }
Without the closure to compute the value, it is, by default, a stored property.