func tableView()

in SasquatchMac/SasquatchMac/ViewControllers/CrashesViewController.swift [117:140]


  func tableView(_ tableView: NSTableView, viewFor tableColumn: NSTableColumn?, row: Int) -> NSView? {
    if isHeader(row: row) {
      let categoryView = tableView.makeView(withIdentifier: NSUserInterfaceItemIdentifier(rawValue: "crashName"), owner: nil) as! NSTextField
      categoryView.stringValue = crashes[row] as! String
      categoryView.alignment = NSTextAlignment.center
      categoryView.font = NSFontManager.shared.convert(categoryView.font!, toHaveTrait: NSFontTraitMask(rawValue: UInt(NSFontBoldTrait)))
      return categoryView
    } else {
      switch tableColumn {
      case tableView.tableColumns[0]?:
        let nameView = tableView.makeView(withIdentifier: NSUserInterfaceItemIdentifier(rawValue: "crashName"), owner: nil) as! NSTextField
        nameView.stringValue = (crashes[row] as! MSCrash).title
        return nameView
      case tableView.tableColumns[1]?:
        let crashButton = tableView.makeView(withIdentifier: NSUserInterfaceItemIdentifier(rawValue: "crashButton"), owner: nil) as! NSButton
        crashButton.tag = row
        crashButton.target = self
        crashButton.action = #selector(CrashesViewController.crashButtonPressed)
        return crashButton
      default: break
      }
    }
    return nil
  }