I'm very new at programming and I'm having trouble understanding these two property observers.
I'm currently building an app with a table view where date pickers are contained in the rows of it. In this case I have two date pickers. As you all know, date pickers take a big amount of height in cells, therefore you need to hide them. The following code takes care of it:
var isCheckInDatePickerShown: Bool = false {
didSet{
checkInDatePicker.isHidden = !isCheckInDatePickerShown
}
}
var isCheckOutDatePickerShown: Bool = false {
didSet{
checkOutDatePicker.isHidden = !isCheckOutDatePickerShown
}
}
I have a very basic knowledge of programming so I'm confused by the functionality of didSet
. What would happen with a willSet
?