Can't make table view cells editable


Hey all,

I’m a professional iOS developer but am totally new to Mac OS development. I’m trying to work my way through this book while translating into Swift, and running Xcode 6. It’s gone mostly OK, so far. One thing has me stumped, though: I cannot for the life of me make my cells editable. I can add, remove, and select them, but cannot change their contents. I’ve tried every combination I can think of…setting the columns to editable, setting the cells to editable, enabled, etc. and I cannot make it work. I also tried making the Document class the delegate and datasource and implementing the shouldEditTableColumn method, to no effect–the method is never called (maybe if you define bindings, the datasource and delegate are ignored? I really don’t know, as bindings are not available in iOS).

The hierarchy of NSTableView seems unnecessarily complex and confusing, coming from iOS, and I’m trying to find clarification. Within each Table Column I have a Table Cell View, which embeds a Table View Cell, which embeds a Table View Cell (of a different class). Additionally, there is a Text Cell which is a sibling of the top-level Table Cell View. This makes my head hurt. Why so many objects for a simple cell, and how do they all relate to each other?

Appreciate any help. Thanks.

  1. Make sure that the TableViewDelegate object is connected to the TableView object;
  2. Make sure that the TableView is cell based, not view based.


“Make sure that the TableView is cell based, not view based.”

Oh my god this took me away my last 1.5 hours until found your post. Thank you so much. My tableview was view based… The result was that instead of Person instance fields appearing on “add” button, I got “TableView Cell” “TableView Cell” displayed.