<?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: Objective-C: Alternative Use of Properties?</title>
	<atom:link href="http://MacDeveloperTips.com/objective-c/objective-c-alternative-use-of-properties.html/feed" rel="self" type="application/rss+xml" />
	<link>http://MacDeveloperTips.com/objective-c/objective-c-alternative-use-of-properties.html</link>
	<description>Tips, tools and code for iPhone and Mac developers.</description>
	<lastBuildDate>Tue, 01 May 2012 00:21:44 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
	<item>
		<title>By: john</title>
		<link>http://MacDeveloperTips.com/objective-c/objective-c-alternative-use-of-properties.html/comment-page-1#comment-443</link>
		<dc:creator>john</dc:creator>
		<pubDate>Sun, 17 Aug 2008 01:41:06 +0000</pubDate>
		<guid isPermaLink="false">http://MacDeveloperTips.com/?p=228#comment-443</guid>
		<description>Comments are closed on this post. You can comment on this same post which has been moved to the iPhone Developer Tips blog: http://iphonedevelopertips.com/objective-c/alternative-use-of-properties.html</description>
		<content:encoded><![CDATA[<p>Comments are closed on this post. You can comment on this same post which has been moved to the iPhone Developer Tips blog: <a href="http://iphonedevelopertips.com/objective-c/alternative-use-of-properties.html" rel="nofollow">http://iphonedevelopertips.com/objective-c/alternative-use-of-properties.html</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: stompy</title>
		<link>http://MacDeveloperTips.com/objective-c/objective-c-alternative-use-of-properties.html/comment-page-1#comment-432</link>
		<dc:creator>stompy</dc:creator>
		<pubDate>Thu, 14 Aug 2008 19:05:46 +0000</pubDate>
		<guid isPermaLink="false">http://MacDeveloperTips.com/?p=228#comment-432</guid>
		<description>I think it is because properties do not need to be directly tied to individual ivars.

How about this as an example

@interface SomeClass : NSObject
{
    NSString *firstName
    NSString *lastName
}
@property (copy, readwrite) NSString *firstName;
@property (copy, readwrite) NSString *lastName;
@property (readonly) NSString *fullName;

@end

Now, in the implementation, you explicitly define the getter which operates on the other properties.

- (NSString *)fullName
{
    NSString *retString;
    retString = [NSString stringWithFormat:(@&quot;%@ %@&quot;, firstName, lastName)];
}

You could have used self.firstName and self.lastName above.</description>
		<content:encoded><![CDATA[<p>I think it is because properties do not need to be directly tied to individual ivars.</p>
<p>How about this as an example</p>
<p>@interface SomeClass : NSObject<br />
{<br />
    NSString *firstName<br />
    NSString *lastName<br />
}<br />
@property (copy, readwrite) NSString *firstName;<br />
@property (copy, readwrite) NSString *lastName;<br />
@property (readonly) NSString *fullName;</p>
<p>@end</p>
<p>Now, in the implementation, you explicitly define the getter which operates on the other properties.</p>
<p>- (NSString *)fullName<br />
{<br />
    NSString *retString;<br />
    retString = [NSString stringWithFormat:(@"%@ %@", firstName, lastName)];<br />
}</p>
<p>You could have used self.firstName and self.lastName above.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: john</title>
		<link>http://MacDeveloperTips.com/objective-c/objective-c-alternative-use-of-properties.html/comment-page-1#comment-404</link>
		<dc:creator>john</dc:creator>
		<pubDate>Fri, 25 Jul 2008 17:11:46 +0000</pubDate>
		<guid isPermaLink="false">http://MacDeveloperTips.com/?p=228#comment-404</guid>
		<description>Thanks Paul. What&#039;s kind of intriguing about this approach, and the example that I was looking at, was that the method used in this manner had nothing to do with the instance variables in the class definition. The method returned a reference to a UIImage based on a specific string format (which defined the size of the image to retrieve).

This is cool for a few reasons. First, with the &#039;readonly&#039; value specified in the property definition, there is only a getter required/implied. Second, the method can be accessed using dot syntax.</description>
		<content:encoded><![CDATA[<p>Thanks Paul. What&#8217;s kind of intriguing about this approach, and the example that I was looking at, was that the method used in this manner had nothing to do with the instance variables in the class definition. The method returned a reference to a UIImage based on a specific string format (which defined the size of the image to retrieve).</p>
<p>This is cool for a few reasons. First, with the &#8216;readonly&#8217; value specified in the property definition, there is only a getter required/implied. Second, the method can be accessed using dot syntax.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Paul C</title>
		<link>http://MacDeveloperTips.com/objective-c/objective-c-alternative-use-of-properties.html/comment-page-1#comment-403</link>
		<dc:creator>Paul C</dc:creator>
		<pubDate>Fri, 25 Jul 2008 16:48:46 +0000</pubDate>
		<guid isPermaLink="false">http://MacDeveloperTips.com/?p=228#comment-403</guid>
		<description>Hey John,  I remember from reading about properties the other day that the default value for a property directives is @dynamic.  So, if you declare a property in your interface, but do not specify @synthesize in your implementation it will default to dynamic and expect you to implement a getter/setter corresponding to the @property you&#039;ve defined in the implementation or at runtime.</description>
		<content:encoded><![CDATA[<p>Hey John,  I remember from reading about properties the other day that the default value for a property directives is @dynamic.  So, if you declare a property in your interface, but do not specify @synthesize in your implementation it will default to dynamic and expect you to implement a getter/setter corresponding to the @property you&#8217;ve defined in the implementation or at runtime.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

