In this episode I will show you how to bind a Table View to an Array Controller in Cocoa, using Xcode 5.1 and OS X Mavericks.
We’re using Core Data to save our entries and – check it out – we’re not writing a single line of code!
Cocoa Bindings is one of the most exciting features in OS X development for me, and I hope that one day it’ll find its way into iOS too.
The project is also available on GitHub:
I’ve written more about how to do this here:
Podcast: Download (Duration: 17:07 — 15.7MB)
Watch the full course in one convenient playlist:


Hey Jay,
Thanks for this wonderful tutorial. Im a beginner in Cocoa Development and I found your tutorial very helpful.
You’re very welcome Sridhar, I’m glad to hear you liked it!
Really helpful video. One of the best I’ve seen when it comes to dealing with Interface Builder.
I’m using XCode 6.0 and I’m pretty sure April was still and XCode 5 time frame. I don’t know if I missed something or not, but if someone watches this video and can seem to get the cell to edit as shown, I had to go into Attribute Editor for the Table View Cell and change the behavior to “Editable.”
I’m still having issues get the save to work and will post if I find out why it isn’t saving.
You definitely got a “bookmark” from me. Thanks again.
Thanks Scot! I did this with Xcode 5 indeed and must admit that I haven’t tried the procedure in Xcode 6.1 yet. Thanks for the tip about the editable cell!
As for the save issue: try saving the context when the app quits. The Xcode 6.1 template adds a new method stub towards the top of your AppDelegate.m file. You can call the included save action in there like so:
Let me know if this helps.
Hi Jay, thank you so much for sharing this. Most concise, perfectly short!
Is there a chance that you could try this demo on Xcode 6.1.1 (Yosemite) and Swift?
I repeated your steps in Objective-C and all is ok, but as soon as I switch to Swift, I get the following on pressing the add button, maybe you could explain whats wrong?
Regards and thanks for supporting a beginner !!
2015-01-21 23:52:39.378 Bindings-Swift[18743:3638820] Failed to create new object
2015-01-21 23:52:39.379 Bindings-Swift[18743:3638820] (
0 CoreFoundation 0x00007fff95e8464c __exceptionPreprocess + 172
1 libobjc.A.dylib 0x00007fff8ba296de objc_exception_throw + 43
2 CoreFoundation 0x00007fff95e8442a +[NSException raise:format:arguments:] + 106
3 AppKit 0x00007fff96d3e507 _NSSendCommitEditingSelector + 267
4 AppKit 0x00007fff969e22bf -[NSController _controllerEditor:didCommit:contextInfo:] + 185
5 CoreFoundation 0x00007fff95d5d33c __invoking___ + 140
6 CoreFoundation 0x00007fff95d5d192 -[NSInvocation invoke] + 290
7 CoreFoundation 0x00007fff95dfbe56 -[NSInvocation invokeWithTarget:] + 54
8 Foundation 0x00007fff8ca29abb __NSFireDelayedPerform + 364
9 CoreFoundation 0x00007fff95dd7b44 __CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION__ + 20
10 CoreFoundation 0x00007fff95dd77d3 __CFRunLoopDoTimer + 1059
11 CoreFoundation 0x00007fff95e4ad9d __CFRunLoopDoTimers + 301
12 CoreFoundation 0x00007fff95d94268 __CFRunLoopRun + 2024
13 CoreFoundation 0x00007fff95d93838 CFRunLoopRunSpecific + 296
14 HIToolbox 0x00007fff8ec9a43f RunCurrentEventLoopInMode + 235
15 HIToolbox 0x00007fff8ec9a1ba ReceiveNextEventCommon + 431
16 HIToolbox 0x00007fff8ec99ffb _BlockUntilNextEventMatchingListInModeWithFilter + 71
17 AppKit 0x00007fff965ed6d1 _DPSNextEvent + 964
18 AppKit 0x00007fff965ece80 -[NSApplication nextEventMatchingMask:untilDate:inMode:dequeue:] + 194
19 AppKit 0x00007fff965e0e23 -[NSApplication run] + 594
20 AppKit 0x00007fff965cc2d4 NSApplicationMain + 1832
21 Bindings-Swift 0x0000000100005762 top_level_code + 34
22 Bindings-Swift 0x000000010000579a main + 42
23 libdyld.dylib 0x00007fff888155c9 start + 1
)
If somebody have the same problem: Enter this at http://www.stackoverflow.com and you get a solution.
“Failed to Create Object – Simple Core Data App”
There you get the hint of prefixing the class name in the data model file with the current module – this works for me.
Hi Klaus, thank you for the kind words, and I’m glad you found a workaround. I’ve not tired this in Swift, but if I do I’ll keep an eye out for the warning.
Hey mate,
you’re a rockstar! I’m usually not a euphoric commentator, but your tutorial is nothing short of fantastic!
Got me up and running on Core Data and array controllers in record time.
Thank you very much!
Great video & lesson.
It might help some frustrated learners to emphasize this tutorial is using a ‘Cell-based’ table view. Should you choose to use a ‘View-based’ table view, it becomes necessary to bind the ‘Table View Cell’ (6th layer down) instead of the Column (4th layer).
Lots of trial and error to discover the only way to display values in this type of table view is for the column’s cell to be bound to: Table View Cell with Model Key Path: objectValue. or, using this tutorial’s example, objectValue.title.
Boy would I love to have this screencast for using NSArrayController in NON-Entity CoreData mode!!! I’ve never seen such a glaring hole even in web documentation that actually yields a working result! This is great though for CoreData folks. Very useful.
Thanks Dex! Hey I didn’t know you could do Core Data without an entity – how interesting, I’ll have to look into that.