En Comparant NSIndexPath Swift

Si j'ai un NSIndexPath constant a déclaré pour une UITableView, est-il valable pour les comparer à l'aide de la == opérateur?

C'est ma déclaration de constante:

let DepartureDatePickerIndexPath = NSIndexPath(forRow: 2, inSection: 0)

Et puis ma fonction:

 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
}

Certes cela fonctionne correctement, mais est-il sécuritaire de le faire? Je suppose que depuis qu'il travaille, le == opérateur sur le NSIndexPath objet est de comparer la section de ligne et de propriétés, au lieu de l'instance.

InformationsquelleAutor Shan | 2014-08-07