title: Swift: How do I handle a double with two decimal places in a tableView?
body: <p>I've been trying to work this out for some little while now. </p>
  
  <p>I've got a double in my array, but it invariably displays as a rounded integer.</p>
  
  <p><code>var dataArray:   [(colorNo: String, colour: NSColor, spares: Double)] = []</code></p>
  
  <p>Here's the tableView:</p>
  
  <pre><code>    func numberOfRowsInTableView(aTableView: NSTableView) -&gt; Int {
          return dataArray.count
      }
  }
  
  extension ViewController: NSTableViewDelegate {
      func tableView(tableView: NSTableView,
                     viewForTableColumn tableColumn: NSTableColumn?,
                     row: Int) -&gt; NSView? {
          if let column = tableColumn {
              if let cellView = tableView.makeViewWithIdentifier(column.identifier, owner: self) as? NSTableCellView {
                  let thread = dataArray[row]
                  if column.identifier == "colourNo" {
                      cellView.textField?.stringValue = "\(thread.colourNo)"
                      return cellView
                  }
                  if column.identifier == "colour" {
                      cellView.textField?.backgroundColor = thread.colour
                      return cellView
                  }
                  if column.identifier == "spares" {
                      let val = Double(thread.spare)
                      cellView.textField?.doubleValue = val
                      return cellView
                  }
                  return cellView
              }
          }
          return nil
      }
  }
  </code></pre>
  
  <p>and here's the definition of the field in Xcode:</p>
  
  <p><a href="https://i.stack.imgur.com/CAC41.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/CAC41.png" alt="enter image description here"></a></p>
  
  <p>Whenever I enter a decimal value...</p>
  
  <p><a href="https://i.stack.imgur.com/lkRZ3.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/lkRZ3.png" alt="enter image description here"></a></p>
  
  <p>It invariably reverts to integer:</p>
  
  <p><a href="https://i.stack.imgur.com/YLQA0.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/YLQA0.png" alt="enter image description here"></a></p>
  
  <p>I'm sure it must be blindingly obvious to someone out there, but I'm afraid it isn't to me.</p>
  
  <p>Any ideas?</p>