Skip to content

Instantly share code, notes, and snippets.

@nicklockwood
Last active November 3, 2018 13:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nicklockwood/35bc1734f2f8c97177010b1188345921 to your computer and use it in GitHub Desktop.
Save nicklockwood/35bc1734f2f8c97177010b1188345921 to your computer and use it in GitHub Desktop.
Simplified.swift
func tableView(_ tableView: NSTableView, objectValueFor tableColumn: NSTableColumn?, row: Int) ->
guard let obj = (self.representedObject as? ModelType)?.collection(at:row) else {
return nil
}
switch tableColumn?.identifier.rawValue ?? "" {
case "column1":
return obj.field1
case "column2":
return objc.field2
//...
default:
return nil
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment