title: NSTableView rowForView is always -1
body: <p>I have a NSTableView with view based cells, TaskCell and NonTaskCell, and i create them like this:</p>
  
  <pre><code>func tableView (tableView: NSTableView,
      viewForTableColumn tableColumn: NSTableColumn?, row: Int) -&gt; NSView? {
  
      let cellRow = row
      var theData = data[row]
      var cell: TaskCellProtocol? = nil
      switch Int(theData.taskType!.intValue) {
          case TaskType.Issue.rawValue:
              cell = self.tableView?.makeViewWithIdentifier(kTaskCellIdentifier, owner: self) as? TaskCell
          default:
              cell = self.tableView?.makeViewWithIdentifier(kNonTaskCellIdentifier, owner: self) as? NonTaskCell
      }
      assert(cell != nil, "Cell can't be nil, check the identifier")
  
      // Add data to the cell
      TaskCellPresenter(cell: cell!).presentData(theData, andPreviousData: row &lt; data.count-1 ? data[row+1] : nil)
  
      cell?.didAddCell = { (cell: NSTableRowView) in
          RCLog(cell)
          let row = tableView.rowForView(cell as! NSTableRowView)
          tableView.enumerateAvailableRowViewsUsingBlock({ (rowView, rowIndex) -&gt; Void in
              RCLog(rowView)
              if rowView == cell as! NSTableRowView {
                  RCLog("found it")
                  self.didAddRow?(row: cellRow)
              }
          })
      }
      RCLog(cell)
      return cell as? NSView
  }
  </code></pre>
  
  <p>When i create the cells they have the row -1 as this logs show:</p>
  
  <pre><code>TasksScrollView.swift:114: Optional(&lt;Jirassic.TaskCell: 0x100e1eb60&gt; - row: -1)
  TasksScrollView.swift:114: Optional(&lt;Jirassic.TaskCell: 0x100e269f0&gt; - row: -1)
  TasksScrollView.swift:114: Optional(&lt;Jirassic.TaskCell: 0x100b120e0&gt; - row: -1)
  TasksScrollView.swift:114: Optional(&lt;Jirassic.NonTaskCell: 0x100b181d0&gt; - row: -1)
  </code></pre>
  
  <p>When i click a button inside the cell i call didAddCell with the cell itself as a parameter. RCLogCell(cell) is</p>
  
  <pre><code>TasksScrollView.swift:101: &lt;Jirassic.TaskCell: 0x100e269f0&gt; - row: -1
  </code></pre>
  
  <p>The logs in the enumerator are:</p>
  
  <pre><code>TasksScrollView.swift:107: &lt;NSTableRowView: 0x6000001a24c0&gt; - row: 0
  TasksScrollView.swift:107: &lt;NSTableRowView: 0x6000001a1b20&gt; - row: 1
  TasksScrollView.swift:107: &lt;NSTableRowView: 0x6180001a0540&gt; - row: 2
  TasksScrollView.swift:107: &lt;NSTableRowView: 0x6180001a07e0&gt; - row: 3
  </code></pre>
  
  <p>From the apple documentation i read that if the cell is not NSTableRowView or a subclass, rowForView will report -1. However my TaskCell it is a NSTableRowView and i don't get what's happening. It seems that created another rows internally. Any ideas?
  You can also follow the code on git <a href="https://github.com/ralcr/Jirassic/blob/master/Jirassic/TasksScrollView.swift" rel="nofollow">https://github.com/ralcr/Jirassic/blob/master/Jirassic/TasksScrollView.swift</a></p>