If I have a NSIndexPath constant declared for a UITableView, is it valid to compare using the ==
operator?
This is my constant declaration:
let DepartureDatePickerIndexPath = NSIndexPath(forRow: 2, inSection: 0)
And then my function:
override func tableView(tableView: UITableView!, heightForRowAtIndexPath indexPath: NSIndexPath!) -> CGFloat {
var height: CGFloat = 45
if indexPath == DepartureDatePickerIndexPath{
height = departureDatePickerShowing ? 162 : 0
} else if indexPath == ArrivalDatePickerIndexPath {
height = arrivalDatePickerShowing ? 162 : 0
}
return height
}
This certainly works properly, but is it safe to do? I'm assuming that since it works, the ==
operator on the NSIndexPath object is comparing the section and row properties instead of the instance.