I'm new here. I'm puzzled with an error. This swift code causes an error that I cannot understand. It merely comes from the Apple documentation "Optional Chaining as an Alternative to Forced Unwrapping"
class Person {
var residence: Residence?
}
class Residence {
var numberOfRooms = 1
}
let john = Person()
john.residence = Residence()
john.residence.numberOfRooms = 5
// error here : 'Residence?' does not have a member named 'numberOfRooms'