Questions tagged [cocoa-bindings]

Cocoa bindings is Apple’s implementation of the Model-View-Controller design pattern for Mac OS X applications. It provides technologies that automate the synchronisation of domain data and the user interface elements that present them.

975 questions
7
votes
1 answer

Using INotifyPropertyChanged view models with Cocoa/AppKit bindings

I know this is pretty esoteric but hoping someone has a solution for me. I have an application that started life as WPF, moved to UWP and now lives primarily as XF/MAUI and WinUI. I'm wanting to port this to macOS and essentially just replace the UI…
Sam
  • 4,219
  • 7
  • 52
  • 80
7
votes
4 answers

Storing an NSImage in a Core Data Model

What is the correct way to store an NSImage in a Core Data Model? I have assumed adding an Attribute to an Entity and giving it the Type "Binary" should work, but it is not working. I have a table with a column of NSImageCells and it is not…
Jeffrey Peck
7
votes
4 answers

What does "Controller Key" mean in Interface Builder > Inspector > Bindings?

I can't find in the Docs where they explain all those fields and what they mean. Especially "Controller Key" is not clear to me.
7
votes
1 answer

Starting a Cocoa document-based application shows selection window first

This seems like it should be easy yet I must be missing something. I have a document-based application. I have also built a new XIB that has a NSTableView and three buttons on it that I intend to display a list of previous files. I wish this XIB…
Rob
  • 4,149
  • 5
  • 34
  • 48
7
votes
1 answer

Implementing NSOutlineView/NSTableView with different cells (and data types) per row

I'm wondering how one would implement an outline view like the one Xcode 3 is using for the build configuration: When using an NSOutlineView/NSTableView with bindings and an NSTreeController/NSArrayController, the view's columns get bindings…
Regexident
  • 29,441
  • 10
  • 93
  • 100
7
votes
1 answer

How to use Cocoa bindings against Swift structs

I'm learning Swift. I mostly work in iOS these days, but I'm currently working on a small project for OS X. On OSX I like using Cocoa bindings to link values from my model to UI elements. It saves writing tons of glue code. I am writing a program…
Duncan C
  • 128,072
  • 22
  • 173
  • 272
7
votes
1 answer

Binding image to NSPopupbutton from NSArrayController

This question is an extension to link (The question in the link mainly targets, binding NSPopupbutton to a NSArrayController) I have a Person class having properties NSString *name and NSImage *avatar I have to show all the names of persons in Popup…
Kaunteya
  • 3,107
  • 1
  • 35
  • 66
7
votes
3 answers

Cocoa bindings and KVO, unregister the observer, when the observing object gets `dealloced`

How can i unregister the observer, when the observing object gets dealloced? How can cocoa bindings handle a situation when the observed objects gets deallocated? By using manual KVO, i have to remove the observing (removeObserver) before dealloc…
Peter Lapisu
  • 19,915
  • 16
  • 123
  • 179
7
votes
2 answers

How would an iTunes-style Source-List be implemented with Bindings+CoreData in Cocoa?

Let's say, for illustration, I was writing an iTunes clone app in Cocoa, that was backed by CoreData. For simplification's sake, let's say there are two "sections", "Library" with things like Music, Movies, Radio, etc. And a second section called…
jbrennan
  • 11,943
  • 14
  • 73
  • 115
7
votes
1 answer

Make NSTableView row editable when adding object with NSArrayController

I have a table column of NSTableView bound to to an NSArrayController in Interface Builder. The array controller is bound to Shared User Defaults Controller for the Content Array. I had to select Handles Content As Compound Value to make adding…
7
votes
1 answer

How to setup bindings for NSPopUpButton

I want to bind selection of NSPopUpButton to one of the predefined values. To make it simpler, imagine a blog app: I'd have BlogPost and Category entities (Core Data, although it doesn't matter) and each BlogPost object has a link to one of the…
Tom
  • 1,522
  • 9
  • 10
6
votes
3 answers

How to bind objects in NSDictionary in NSUserDefaults?

How do I bind NSDictionary objects to several text fields in Interface Builder? I would like to bind each object to a specific item in the dictionary. For example, the first text field should be bound to Actor:
aneuryzm
  • 63,052
  • 100
  • 273
  • 488
6
votes
1 answer

SelectionIndexes on NSArrayController return just a value

I have a NSCollectionView wich content is handled by a NSArrayController. The NSCollectionView is selectable and I need to retrieve a list of selected elements. I'm trying to observe key property of NSArrayController "selectionIndexes" but it just…
Giuseppe
  • 6,666
  • 2
  • 20
  • 32
6
votes
1 answer

What does Cocoa binding's NSHandlesContentAsCompoundValueBindingOption do exactly?

When binding an NSArrayController's contentArray to an NSUserDefaultsController, you have to check the "Handles Content As Compound Value" checkbox on the binding. This has become conventional wisdom, but what does the option actually do? I wrote a…
Alexander Ljungberg
  • 6,302
  • 4
  • 31
  • 37
6
votes
1 answer

NSManagedObject Not Reflecting Changes After Background Thread NSManagedObjectContextDidSaveNotification

I am having trouble with an NSManagedObject not reflecting the changes made to a persistent store after a background thread has saved it's context. The Setup In a simple test application I have a single window that lists all of the objects in my…