[Mono-osx] MonoMac - KVO and accessor methods

thenextman rmarkiewicz at devolutions.net
Wed Oct 24 18:29:43 UTC 2012


With MonoMac, I am trying to use KVO on a type that has a NSMutableArray
property. I'm able to do this by calling WillChangeValue and DidChangeValue
when mutating the array.

I see in Objective C that we have a couple of other approaches:

1 - using mutableArrayValueForKey to get a proxy to my array that supports
2 - implement the 'collection accessor methods' in my type (e.g.
(void)insertObject:(id)obj in<key>AtIndex:(NSUInteger)index)

Both methods are described quite well here:

Can I use this with MonoMac?

For (1), I can find the mutableArrayValueForKey method. For (2), it just
'doesn't work'. I implemented the collection accessor methods with what I
thought the signature should look like, and calling them mutates the array
but my binding do not update. 

I would like to know if either approach is possible in MonoMac, or should I
just stick with the 'manual' way (WillChangeValue / DidChangeValue)

Thanks in advance!

View this message in context: http://mono.1490590.n4.nabble.com/MonoMac-KVO-and-accessor-methods-tp4657098.html
Sent from the Mono - OSX mailing list archive at Nabble.com.

More information about the Mono-osx mailing list