• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Implementing a KVO/Bindings-Compliant Bridge-Pattern in Cocoa
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Implementing a KVO/Bindings-Compliant Bridge-Pattern in Cocoa


  • Subject: Implementing a KVO/Bindings-Compliant Bridge-Pattern in Cocoa
  • From: "Sebastian Morawietz" <email@hidden>
  • Date: Wed, 15 Oct 2008 11:53:27 +0200

Hi folks,

I'm trying to implement a simple object bridge in cocoa where the
bridge object acts as a kvo/bindings-compliant drop in for some
arbitrary other NSObject-instance.

Here is my problem (more details in the attached code):

A Bridge object acts as a drop in for a Person-Object, with an
NSString* property called name and an Address* property address.
Binding to the keyPath "name" or "address" of the Bridge works nicely.
Trouble starts when binding some object to the keyPath
"address.street" of the bridge and a new Address-Object is set for
Person's address property. That results in KVO-related exceptions that
look like this:

* Cannot remove an observer <NSKeyValueObservance 0x126b00> for the
key path "street"
* from <Address 0x12f1d0> because it is not registered as an observer

This happens even though the bridge notices the change in the
"address"-Property and emits a
willChangeValueForKeyPath/didChangeValueForKeyPath tuple.

The attached code produces the the problem. The file contains a
main-function can be compiled and run with

* gcc -o test BridgeDemo.m -framework AppKit -framework Foundation; ./test

If you know a solution to this problem or can offer me a better
approach solving the same problem you make me a very happy programmer.

Greets
Seb

Attachment: BridgeDemo.m
Description: Binary data

_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: Implementing a KVO/Bindings-Compliant Bridge-Pattern in Cocoa
      • From: Ron Lue-Sang <email@hidden>
    • Re: Implementing a KVO/Bindings-Compliant Bridge-Pattern in Cocoa
      • From: Ken Thomases <email@hidden>
  • Prev by Date: iPhoto thumbnail view
  • Next by Date: Re: executables for OSX 10.4 vs 10.5
  • Previous by thread: Re: iPhoto thumbnail view
  • Next by thread: Re: Implementing a KVO/Bindings-Compliant Bridge-Pattern in Cocoa
  • Index(es):
    • Date
    • Thread