Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 148771
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T09:01:05+00:00 2026-05-11T09:01:05+00:00

I have trouble understanding Cocoa Bindings. Can someone explain me what this is all

  • 0

I have trouble understanding Cocoa Bindings. Can someone explain me what this is all about, in an way that is humanly perceivable?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-11T09:01:06+00:00Added an answer on May 11, 2026 at 9:01 am

    Bindings is a system for connecting your views to your controllers without writing a lot of glue code to make them explicitly talk to each other. All you have to do is set up properties in both classes* and hook up the binding in IB.

    The traditional approach is that the view has one or more outlets to talk to the controller (the most generic examples being delegate and target) and the controller has outlets to talk to the views. When the controller updates the model, it sends (for example) [view modelChange:newModelObject]. When the view wants to update the model, it sends some delegate message to its delegate (the controller), such as NSText’s textDidChange:.

    With Bindings, all you have to do in code is implement properties on the view and properties on the controller, then expose one or more properties of the view as bindings*. Then you only need to hook up the binding. If it’s a Cocoa class, this is cake: just set it up in IB. If it’s a custom class of your own, you’ll probably write the bind:toObject:withKeyPath:options: message yourself (not much harder).

    Let me restate that: With Bindings, your entire glue code (most of the time) is [view bind:@'viewProperty' toObject:self withKeyPath:@'controllerProperty.modelProperty' options:options]; in the controller. Everything else is handled by the Bindings and KVO systems behind the scenes, and by your properties’ accessors.

    The disadvantage is that you must strictly conform to Cocoa Bindings’ requirements. These are simple, but a lot of older applications are designed in a way that doesn’t fit Cocoa Bindings.

    • You must create real model objects, not just pass primitive objects (e.g., arrays of dictionaries) around. If you’re using Core Data, this is easy: your managed objects are model objects.
    • You must either write your accessors correctly or synthesize the correct accessors. For example, an NSString property should always be @property(copy), never @property(retain) (because otherwise, you will find yourself retaining someone else’s mutable string, which they will then mutate while you’re holding it).
    • You must only change properties of your model objects by their properties (model.foo = bar) or by accessor messages ([model setFoo:bar]), never by direct instance variable access. (Obvious exception for accessor methods themselves, if you’ve written your own, because they must access the instance variable directly.)

    There are two advantages:

    • You can write a brand new view class without having to rip out a lot of glue code. The most you’ll have to delete is some bind:::: messages for the old view’s properties. If, a couple of years down the road, you decide that your current view just can’t scale to your application’s forthcoming capabilities, this gives you the flexibility to rip it out and start afresh with the minimum of pain.
    • More importantly, the less code you have to read, the easier it is to read it.

    *And, according to the documentation, implement a KVO observation method in the view class, but I’ve never actually had to do this. I filed a documentation bug.

    Added 2009-03-07: Ah, found a citation. “NSView subclasses can expose additional key-value-coding/key-value-observing compliant properties as bindings by calling the class method exposeBinding: for each of the properties.” —NSKeyValueBindingCreation So you shouldn’t need to implement a KVO observation method.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 69k
  • Answers 69k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • added an answer Visual Studio Project implementations provide a list of files that… May 11, 2026 at 12:35 pm
  • added an answer It's a bug within 1.3.2. I don't see the behavior… May 11, 2026 at 12:35 pm
  • added an answer $inbound = '{ 1, 3, 1, 2, }, { 2,… May 11, 2026 at 12:35 pm

Related Questions

I have trouble comparing 2 double in Excel VBA suppose that I have the
I have trouble with the following piece of code. When I go through with
I have trouble using Perl grep() with a string that may contain chars that
I have trouble defining a trigger for a MySQL database. I want to change
I have no trouble building 1.35.0, as well as 1.36.0 on the timesys arm-gcc
all I am trying to implement a floating point arithmetic library and I have
I have the following problem, and am having trouble understanding part of the equation:
I am having trouble understanding how the System Registry can help me convert a
I'm having trouble understanding when to use properties in Objective C 2.0. It seems

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.