Skip to content

Instantly share code, notes, and snippets.

@csexton
Last active November 21, 2015 22:28
Show Gist options
  • Save csexton/f958041b48cc48b95b49 to your computer and use it in GitHub Desktop.
Save csexton/f958041b48cc48b95b49 to your computer and use it in GitHub Desktop.
func tableView(tableView: NSTableView, viewForTableColumn tableColumn: NSTableColumn?, row: Int) -> NSView? {
let cellview = tableView.makeViewWithIdentifier("accountCell", owner: self) as! AccountTableCellView
cellview.nameField!.stringValue = self.objects.objectAtIndex(row) as! String
cellview.typeField!.stringValue = self.objects.objectAtIndex(row) as! String
return cellview
}
// ------
func tableView(tableView: NSTableView, viewForTableColumn tableColumn: NSTableColumn?, row: Int) -> NSView? {
if let cellview = tableView.makeViewWithIdentifier("accountCell", owner: self) as? AccountTableCellView {
cellview.nameField!.stringValue = self.objects.objectAtIndex(row) as! String
cellview.typeField!.stringValue = self.objects.objectAtIndex(row) as! String
return cellview
}
return nil
}
// -----
func tableView(tableView: NSTableView, viewForTableColumn tableColumn: NSTableColumn?, row: Int) -> NSView? {
let cellview = tableView.makeViewWithIdentifier("accountCell", owner: self)
if let cell = cellview as? AccountTableCellView {
cell.nameField!.stringValue = self.objects.objectAtIndex(row) as! String
cell.typeField!.stringValue = self.objects.objectAtIndex(row) as! String
}
return cellview
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment