<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: On Cocoa Bindings – &#8220;Let Us Break Their Bonds Asunder&#8221;</title>
	<atom:link href="http://www.timisted.net/blog/archive/on-cocoa-bindings/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.timisted.net/blog/archive/on-cocoa-bindings/</link>
	<description>Cocoa Programming and Other Things</description>
	<lastBuildDate>Mon, 19 Sep 2011 03:07:11 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1.1</generator>
	<item>
		<title>By: craschworks &#187; Blog Archive &#187; links for 2009-07-06</title>
		<link>http://www.timisted.net/blog/archive/on-cocoa-bindings/comment-page-1/#comment-41</link>
		<dc:creator>craschworks &#187; Blog Archive &#187; links for 2009-07-06</dc:creator>
		<pubDate>Mon, 06 Jul 2009 11:04:49 +0000</pubDate>
		<guid isPermaLink="false">http://www.timisted.net/blog/?p=200#comment-41</guid>
		<description>[...] On Cocoa Bindings – “Let Us Break Their Bonds Asunder” &#124; Blog @ Tim Isted Chances are, if you’ve developed any kind of Cocoa application, you’ve probably made use of Cocoa Bindings in one way or another, particularly when it comes to Core Data. The technology is ‘key’ to so many of the underlying frameworks but it is a technology that tends to be often-used but frequently not fully understood. [...]</description>
		<content:encoded><![CDATA[<p>[...] On Cocoa Bindings – “Let Us Break Their Bonds Asunder” | Blog @ Tim Isted Chances are, if you’ve developed any kind of Cocoa application, you’ve probably made use of Cocoa Bindings in one way or another, particularly when it comes to Core Data. The technology is ‘key’ to so many of the underlying frameworks but it is a technology that tends to be often-used but frequently not fully understood. [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: twobyte</title>
		<link>http://www.timisted.net/blog/archive/on-cocoa-bindings/comment-page-1/#comment-40</link>
		<dc:creator>twobyte</dc:creator>
		<pubDate>Thu, 04 Sep 2008 22:47:42 +0000</pubDate>
		<guid isPermaLink="false">http://www.timisted.net/blog/?p=200#comment-40</guid>
		<description>You can check some more bindings examples from Malcolm Crawford who is BTW a Senior Technical Writer at Apple Inc. here http://homepage.mac.com/mmalc/CocoaExamples/controllers.html</description>
		<content:encoded><![CDATA[<p>You can check some more bindings examples from Malcolm Crawford who is BTW a Senior Technical Writer at Apple Inc. here <a href="http://homepage.mac.com/mmalc/CocoaExamples/controllers.html" rel="nofollow">http://homepage.mac.com/mmalc/CocoaExamples/controllers.html</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Tim Isted</title>
		<link>http://www.timisted.net/blog/archive/on-cocoa-bindings/comment-page-1/#comment-39</link>
		<dc:creator>Tim Isted</dc:creator>
		<pubDate>Thu, 28 Aug 2008 11:34:39 +0000</pubDate>
		<guid isPermaLink="false">http://www.timisted.net/blog/?p=200#comment-39</guid>
		<description>This is indeed so -- and thank you for pointing this out; I should have included information on this in the body of the post.

By default, NSObject provides &lt;strong&gt;automatic key-value observing&lt;/strong&gt;. Under this default behaviour, you in fact do not actually need to call either &#039;willChangeValueForKey:&#039; &lt;strong&gt;or&lt;/strong&gt; &#039;didChangeValueForKey:&#039; as these will be called for you if a call is made to a KVC accessor method (e.g. &#039;setTheString:&#039;).

But, you can also disable this automatic notification such that you do need to notify observers manually; this is extremely useful in cases where you need to change large numbers of values and want to control when notifications are sent out. It&#039;s also useful in that you can change the behaviour to send notifications only if the new value is different from its current value:
&lt;pre lang=&quot;objc&quot;&gt;
- (void)setTheString:(NSString *)value
{
	if (  ![_theString isEqualToString:value] )
	{
		[self willChangeValueForKey:@&quot;theString&quot;];
        	_theString = value;
        	[self didChangeValueForKey:@&quot;theString&quot;];
	}
}
&lt;/pre&gt;

You can override the class method +automaticallyNotifiesObserversForKey: to specify that certain keys do not provide the automatic behaviour:
&lt;pre lang=&quot;objc&quot;&gt;
+ (BOOL)automaticallyNotifiesObserversForKey:(NSString *)theKey
{
	BOOL automatic = NO;

	if ( [theKey isEqualToString:@&quot;theString&quot;] )
	{
        	automatic=NO;
    	}
	else
	{
		automatic=[super automaticallyNotifiesObserversForKey:theKey];
	}
	return automatic;
}
&lt;/pre&gt;

Both these methods and further explanation can be found at: &lt;a href=&quot;http://developer.apple.com/documentation/Cocoa/Conceptual/KeyValueObserving/Concepts/AutoVsManual.html&quot; target=&quot;_blank&quot; rel=&quot;nofollow&quot;&gt;Apple Developer Connection : KVO Programming Guide : Automatic Versus Manual Support&lt;/a&gt;.</description>
		<content:encoded><![CDATA[<p>This is indeed so &#8212; and thank you for pointing this out; I should have included information on this in the body of the post.</p>
<p>By default, NSObject provides <strong>automatic key-value observing</strong>. Under this default behaviour, you in fact do not actually need to call either &#8216;willChangeValueForKey:&#8217; <strong>or</strong> &#8216;didChangeValueForKey:&#8217; as these will be called for you if a call is made to a KVC accessor method (e.g. &#8216;setTheString:&#8217;).</p>
<p>But, you can also disable this automatic notification such that you do need to notify observers manually; this is extremely useful in cases where you need to change large numbers of values and want to control when notifications are sent out. It&#8217;s also useful in that you can change the behaviour to send notifications only if the new value is different from its current value:</p>

<div class="wp_syntax"><div class="code"><pre class="objc" style="font-family:monospace;"><span style="color: #002200;">-</span> <span style="color: #002200;">&#40;</span><span style="color: #a61390;">void</span><span style="color: #002200;">&#41;</span>setTheString<span style="color: #002200;">:</span><span style="color: #002200;">&#40;</span><span style="color: #400080;">NSString</span> <span style="color: #002200;">*</span><span style="color: #002200;">&#41;</span>value
<span style="color: #002200;">&#123;</span>
	<span style="color: #a61390;">if</span> <span style="color: #002200;">&#40;</span>  <span style="color: #002200;">!</span><span style="color: #002200;">&#91;</span>_theString isEqualToString<span style="color: #002200;">:</span>value<span style="color: #002200;">&#93;</span> <span style="color: #002200;">&#41;</span>
	<span style="color: #002200;">&#123;</span>
		<span style="color: #002200;">&#91;</span>self willChangeValueForKey<span style="color: #002200;">:</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;theString&quot;</span><span style="color: #002200;">&#93;</span>;
        	_theString <span style="color: #002200;">=</span> value;
        	<span style="color: #002200;">&#91;</span>self didChangeValueForKey<span style="color: #002200;">:</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;theString&quot;</span><span style="color: #002200;">&#93;</span>;
	<span style="color: #002200;">&#125;</span>
<span style="color: #002200;">&#125;</span></pre></div></div>

<p>You can override the class method +automaticallyNotifiesObserversForKey: to specify that certain keys do not provide the automatic behaviour:</p>

<div class="wp_syntax"><div class="code"><pre class="objc" style="font-family:monospace;"><span style="color: #002200;">+</span> <span style="color: #002200;">&#40;</span><span style="color: #a61390;">BOOL</span><span style="color: #002200;">&#41;</span>automaticallyNotifiesObserversForKey<span style="color: #002200;">:</span><span style="color: #002200;">&#40;</span><span style="color: #400080;">NSString</span> <span style="color: #002200;">*</span><span style="color: #002200;">&#41;</span>theKey
<span style="color: #002200;">&#123;</span>
	<span style="color: #a61390;">BOOL</span> automatic <span style="color: #002200;">=</span> <span style="color: #a61390;">NO</span>;
&nbsp;
	<span style="color: #a61390;">if</span> <span style="color: #002200;">&#40;</span> <span style="color: #002200;">&#91;</span>theKey isEqualToString<span style="color: #002200;">:</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;theString&quot;</span><span style="color: #002200;">&#93;</span> <span style="color: #002200;">&#41;</span>
	<span style="color: #002200;">&#123;</span>
        	automatic<span style="color: #002200;">=</span><span style="color: #a61390;">NO</span>;
    	<span style="color: #002200;">&#125;</span>
	<span style="color: #a61390;">else</span>
	<span style="color: #002200;">&#123;</span>
		automatic<span style="color: #002200;">=</span><span style="color: #002200;">&#91;</span>super automaticallyNotifiesObserversForKey<span style="color: #002200;">:</span>theKey<span style="color: #002200;">&#93;</span>;
	<span style="color: #002200;">&#125;</span>
	<span style="color: #a61390;">return</span> automatic;
<span style="color: #002200;">&#125;</span></pre></div></div>

<p>Both these methods and further explanation can be found at: <a href="http://developer.apple.com/documentation/Cocoa/Conceptual/KeyValueObserving/Concepts/AutoVsManual.html" target="_blank" rel="nofollow">Apple Developer Connection : KVO Programming Guide : Automatic Versus Manual Support</a>.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Steve</title>
		<link>http://www.timisted.net/blog/archive/on-cocoa-bindings/comment-page-1/#comment-38</link>
		<dc:creator>Steve</dc:creator>
		<pubDate>Wed, 27 Aug 2008 22:15:55 +0000</pubDate>
		<guid isPermaLink="false">http://www.timisted.net/blog/?p=200#comment-38</guid>
		<description>The code:
[self willChangeValueForKey:@&quot;theString&quot;];

is not needed in the setter for a value. It is automatically generated.</description>
		<content:encoded><![CDATA[<p>The code:<br />
[self willChangeValueForKey:@"theString"];</p>
<p>is not needed in the setter for a value. It is automatically generated.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

