<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	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/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Mac Developer Tips &#187; Cocoa</title>
	<atom:link href="http://MacDeveloperTips.com/category/cocoa/feed" rel="self" type="application/rss+xml" />
	<link>http://MacDeveloperTips.com</link>
	<description>Tips, tools and code for iPhone and Mac developers.</description>
	<lastBuildDate>Tue, 29 Jun 2010 19:58:49 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Introduction to Protocols</title>
		<link>http://MacDeveloperTips.com/cocoa/introduction-to-protocols.html</link>
		<comments>http://MacDeveloperTips.com/cocoa/introduction-to-protocols.html#comments</comments>
		<pubDate>Sun, 26 Apr 2009 14:02:02 +0000</pubDate>
		<dc:creator>john</dc:creator>
				<category><![CDATA[Cocoa]]></category>

		<guid isPermaLink="false">http://MacDeveloperTips.com/?p=270</guid>
		<description><![CDATA[What follows is a quick introduction to working with protocols. This is good background information to understand as protocols are common in various Cocoa frameworks. A protocol is means to define a list of required and/or optional methods that a class implements. If a class adopts a protocol, it must implement all required methods in [...]]]></description>
			<content:encoded><![CDATA[<p>What follows is a quick introduction to working with protocols. This is good background information to understand as protocols are common in various Cocoa frameworks. A protocol is means to define a list of required and/or optional methods that a class implements. If a class adopts a protocol, it must implement all required methods in the protocols it adopts. </p>
<p>Cocoa uses protocols to support interprocess communication through Objective-C messages. In addition, since Objective-C does not support multiple inheritance, you can achieve similar functionality with protocols, as a class can adopt more than one protocol.<br />
<span id="more-270"></span></p>
<p>A good example of a protocol is <em>NSCoding</em>, which has two required methods that a class must implement. This protocol is used to enable classes to be encoded and decoded, that is, archiving of objects by writing to permanent storage.</p>

<div class="wp_syntax"><div class="code"><pre class="objc" style="font-family:monospace;"><span style="color: #a61390;">@protocol</span> <span style="color: #2a6f76;">NSCoding</span>
<span style="color: #002200;">-</span> <span style="color: #002200;">&#40;</span><span style="color: #a61390;">void</span><span style="color: #002200;">&#41;</span>encodeWithCoder<span style="color: #002200;">:</span><span style="color: #002200;">&#40;</span><span style="color: #400080;">NSCoder</span> <span style="color: #002200;">*</span><span style="color: #002200;">&#41;</span>aCoder;
<span style="color: #002200;">-</span> <span style="color: #002200;">&#40;</span><span style="color: #a61390;">id</span><span style="color: #002200;">&#41;</span>initWithCoder<span style="color: #002200;">:</span><span style="color: #002200;">&#40;</span><span style="color: #400080;">NSCoder</span> <span style="color: #002200;">*</span><span style="color: #002200;">&#41;</span>aDecoder;
<span style="color: #a61390;">@end</span></pre></div></div>

<p>To adopt a protocol, enclose the name of the protocol in <> as below:</p>

<div class="wp_syntax"><div class="code"><pre class="objc" style="font-family:monospace;"><span style="color: #11740a; font-style: italic;">// Interface</span>
<span style="color: #a61390;">@interface</span> SomeClass <span style="color: #002200;">:</span> <span style="color: #400080;">NSObject</span> &lt;NSCoding&gt; 
<span style="color: #002200;">&#123;</span>
  ...
<span style="color: #002200;">&#125;</span>
&nbsp;
<span style="color: #11740a; font-style: italic;">// Implementation</span>
<span style="color: #a61390;">@implementation</span> SomeClass
&nbsp;
<span style="color: #002200;">-</span><span style="color: #002200;">&#40;</span><span style="color: #a61390;">void</span><span style="color: #002200;">&#41;</span>encodeWithCoder<span style="color: #002200;">:</span><span style="color: #002200;">&#40;</span><span style="color: #400080;">NSCoder</span> <span style="color: #002200;">*</span><span style="color: #002200;">&#41;</span>aCoder
<span style="color: #002200;">&#123;</span>
  ...
<span style="color: #002200;">&#125;</span>
&nbsp;
<span style="color: #002200;">-</span><span style="color: #002200;">&#40;</span><span style="color: #a61390;">id</span><span style="color: #002200;">&#41;</span>initWithCoder<span style="color: #002200;">:</span><span style="color: #002200;">&#40;</span><span style="color: #400080;">NSCoder</span> <span style="color: #002200;">*</span><span style="color: #002200;">&#41;</span>aDecoder
<span style="color: #002200;">&#123;</span>
  ...
<span style="color: #002200;">&#125;</span></pre></div></div>

<p><strong>Defining a Protocol</strong></p>
<p>You can create both required an optional methods within a protocol. What follows is a definion of a protocol named &#8216;Fubar&#8217;:</p>

<div class="wp_syntax"><div class="code"><pre class="objc" style="font-family:monospace;"><span style="color: #a61390;">@protocol</span> Fubar
<span style="color: #002200;">-</span> <span style="color: #002200;">&#40;</span><span style="color: #a61390;">BOOL</span><span style="color: #002200;">&#41;</span>send<span style="color: #002200;">:</span><span style="color: #002200;">&#40;</span><span style="color: #a61390;">id</span><span style="color: #002200;">&#41;</span>data;
<span style="color: #002200;">-</span> <span style="color: #002200;">&#40;</span><span style="color: #a61390;">id</span><span style="color: #002200;">&#41;</span>receive;
@optional
<span style="color: #002200;">-</span> <span style="color: #002200;">&#40;</span><span style="color: #a61390;">int</span><span style="color: #002200;">&#41;</span>status;
<span style="color: #a61390;">@end</span></pre></div></div>

<p>To use the protocol, as with the example above, specify the protocol in the interface and write the required methods in the class implementation:</p>

<div class="wp_syntax"><div class="code"><pre class="objc" style="font-family:monospace;"><span style="color: #11740a; font-style: italic;">// Interface</span>
<span style="color: #a61390;">@interface</span> AnotherClass <span style="color: #002200;">:</span> <span style="color: #400080;">NSObject</span> &lt;Fubar&gt; 
<span style="color: #002200;">&#123;</span>
  ...
<span style="color: #002200;">&#125;</span>
&nbsp;
<span style="color: #11740a; font-style: italic;">// Implementation</span>
<span style="color: #a61390;">@implementation</span> AnotherClass
&nbsp;
<span style="color: #002200;">-</span> <span style="color: #002200;">&#40;</span><span style="color: #a61390;">BOOL</span><span style="color: #002200;">&#41;</span>send<span style="color: #002200;">:</span><span style="color: #002200;">&#40;</span><span style="color: #a61390;">id</span><span style="color: #002200;">&#41;</span>data
<span style="color: #002200;">&#123;</span>
  ...
<span style="color: #002200;">&#125;</span>
&nbsp;
<span style="color: #002200;">-</span> <span style="color: #002200;">&#40;</span><span style="color: #a61390;">id</span><span style="color: #002200;">&#41;</span>receive
<span style="color: #002200;">&#123;</span>
  ...
<span style="color: #002200;">&#125;</span>
&nbsp;
<span style="color: #11740a; font-style: italic;">// Optional methods</span>
<span style="color: #002200;">-</span> <span style="color: #002200;">&#40;</span><span style="color: #a61390;">int</span><span style="color: #002200;">&#41;</span>status
<span style="color: #002200;">&#123;</span>
  ...
<span style="color: #002200;">&#125;</span>
&nbsp;
<span style="color: #a61390;">@end</span></pre></div></div>

<p>If you are from a Java background, protocols should look familiar as they are analogous to an interface.</p>
]]></content:encoded>
			<wfw:commentRss>http://MacDeveloperTips.com/cocoa/introduction-to-protocols.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Basics of Notifications</title>
		<link>http://MacDeveloperTips.com/cocoa/basics-of-notifications.html</link>
		<comments>http://MacDeveloperTips.com/cocoa/basics-of-notifications.html#comments</comments>
		<pubDate>Wed, 15 Apr 2009 03:40:38 +0000</pubDate>
		<dc:creator>john</dc:creator>
				<category><![CDATA[Cocoa]]></category>

		<guid isPermaLink="false">http://MacDeveloperTips.com/?p=269</guid>
		<description><![CDATA[What follows is a brief guide to working with Notifications in Cocoa. I&#8217;ll cover the basics, including registering an observer and posting notifications, just enough to start using notifications in your apps. There is an instance of NSNotificationCenter available to every running application. This class acts as an intermediary to facilitate communication between objects that [...]]]></description>
			<content:encoded><![CDATA[<p>What follows is a brief guide to working with Notifications in Cocoa. I&#8217;ll cover the basics, including registering an observer and posting notifications,  just enough to start using notifications in your apps.</p>
<p>There is an instance of <em>NSNotificationCenter</em> available to every running application. This class acts as an intermediary to facilitate communication between objects that are interested in being notified at some point in the future (these objects are known as the  <em>observers</em>) and a <em>poster</em> that posts to the notification center, resulting in all observers (registered for a specific notification) being called.<br />
<span id="more-269"></span></p>
<p>To give you an idea of where you might use notifications, consider how you might handle downloading of data in a background thread. I recently used notifications in this scenario as I wanted to be notified when a web-service call completed. Upon receiving a notification, I then proceeded to populate a view with the data retrieved, or with an error message if the data access failed. </p>
<p>The 30,000 foot view consists of two steps:</p>
<p><strong>Step #1</strong><br />
Register an observer, which requests that a selector to be called when a specific notification is posted.</p>
<p><strong>Step #2</strong><br />
Post a notification, which will result in all registered observers being called.</p>
<p>For example:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
</pre></td><td class="code"><pre class="objc" style="font-family:monospace;"><span style="color: #11740a; font-style: italic;">// Register observer to be notified when download of data is complete</span>
<span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span><span style="color: #400080;">NSNotificationCenter</span> defaultCenter<span style="color: #002200;">&#93;</span> addObserver<span style="color: #002200;">:</span>self 
                                   selector<span style="color: #002200;">:</span><span style="color: #a61390;">@selector</span><span style="color: #002200;">&#40;</span>downloadDataComplete<span style="color: #002200;">:</span><span style="color: #002200;">&#41;</span> 
                                   name<span style="color: #002200;">:</span>NOTIF_DataComplete object<span style="color: #002200;">:</span><span style="color: #a61390;">nil</span><span style="color: #002200;">&#93;</span>;</pre></td></tr></table></div>

<p>This code registers an observer for a notification with the name <em>NOTIF_DataComplete</em> (more on that below). When a notification is posted with the same name, the method <em>downloadDataComplete</em> will be called. </p>
<p>Posting a notification with the name <em>NOTIF_DataComplete</em> would look as follows:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
</pre></td><td class="code"><pre class="objc" style="font-family:monospace;"><span style="color: #11740a; font-style: italic;">// Post notification that the download is complete  </span>
<span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span><span style="color: #400080;">NSNotificationCenter</span> defaultCenter<span style="color: #002200;">&#93;</span> 
                    postNotificationName<span style="color: #002200;">:</span>NOTIF_DataComplete object<span style="color: #002200;">:</span><span style="color: #a61390;">nil</span><span style="color: #002200;">&#93;</span>;</pre></td></tr></table></div>

<p>Let&#8217;s show how this might like in a working example.</p>
<p><strong>Class Registering as Observer</strong></p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
</pre></td><td class="code"><pre class="objc" style="font-family:monospace;"><span style="color: #11740a; font-style: italic;">//  SomeClass.h</span>
&nbsp;
<span style="color: #6e371a;">#import &lt;Foundation/Foundation.h&gt;</span>
&nbsp;
<span style="color: #a61390;">@interface</span> SomeClass <span style="color: #002200;">:</span> <span style="color: #400080;">NSObject</span> 
<span style="color: #002200;">&#123;</span>
&nbsp;
<span style="color: #002200;">&#125;</span>
&nbsp;
<span style="color: #11740a; font-style: italic;">// For name of notification</span>
<span style="color: #a61390;">extern</span> <span style="color: #400080;">NSString</span> <span style="color: #002200;">*</span> <span style="color: #a61390;">const</span> NOTIF_DataComplete;
&nbsp;
<span style="color: #a61390;">@end</span></pre></td></tr></table></div>

<p>Below is the code for the implementation of <em>SomeClass</em>. Notice on line 6 the name of the notification is defined. On line 40 we register as an observer for the named notification, specifying the selector <em>@selector(downloadDataComplete:)</em>. Once the notification is posted, the method on line 26 is called.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
</pre></td><td class="code"><pre class="objc" style="font-family:monospace;"><span style="color: #11740a; font-style: italic;">//  SomeClass.m</span>
&nbsp;
<span style="color: #6e371a;">#import &quot;SomeClass.h&quot;</span>
&nbsp;
<span style="color: #11740a; font-style: italic;">// Name of notification</span>
<span style="color: #400080;">NSString</span> <span style="color: #002200;">*</span> <span style="color: #a61390;">const</span> NOTIF_DataComplete <span style="color: #002200;">=</span> <span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;DataComplete&quot;</span>;
&nbsp;
<span style="color: #6e371a;">#pragma mark -</span>
<span style="color: #6e371a;">#pragma mark Private Interface</span>
&nbsp;
<span style="color: #11740a; font-style: italic;">/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
* Private interface definitions
*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/</span>
<span style="color: #a61390;">@interface</span> SomeClass <span style="color: #002200;">&#40;</span>private<span style="color: #002200;">&#41;</span>
<span style="color: #002200;">-</span> <span style="color: #002200;">&#40;</span><span style="color: #a61390;">void</span><span style="color: #002200;">&#41;</span> dataDownloadComplete<span style="color: #002200;">:</span><span style="color: #002200;">&#40;</span><span style="color: #400080;">NSNotification</span> <span style="color: #002200;">*</span><span style="color: #002200;">&#41;</span>notif;
<span style="color: #a61390;">@end</span>
&nbsp;
<span style="color: #a61390;">@implementation</span> SomeClass
&nbsp;
<span style="color: #6e371a;">#pragma mark -</span>
<span style="color: #6e371a;">#pragma mark Private Methods</span>
&nbsp;
<span style="color: #11740a; font-style: italic;">/*---------------------------------------------------------------------------
* Notifications of data downloads 
*--------------------------------------------------------------------------*/</span>
<span style="color: #002200;">-</span> <span style="color: #002200;">&#40;</span><span style="color: #a61390;">void</span><span style="color: #002200;">&#41;</span>downloadDataComplete<span style="color: #002200;">:</span><span style="color: #002200;">&#40;</span><span style="color: #400080;">NSNotification</span> <span style="color: #002200;">*</span><span style="color: #002200;">&#41;</span>notif 
<span style="color: #002200;">&#123;</span>
  NSLog<span style="color: #002200;">&#40;</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;Received Notification - Data has been downloaded&quot;</span><span style="color: #002200;">&#41;</span>;
<span style="color: #002200;">&#125;</span>
&nbsp;
<span style="color: #6e371a;">#pragma mark -</span>
<span style="color: #6e371a;">#pragma mark Initialization</span>
&nbsp;
<span style="color: #11740a; font-style: italic;">/*---------------------------------------------------------------------------
* Initialization
*--------------------------------------------------------------------------*/</span>
<span style="color: #002200;">-</span> <span style="color: #002200;">&#40;</span><span style="color: #a61390;">void</span><span style="color: #002200;">&#41;</span> init
<span style="color: #002200;">&#123;</span>
  <span style="color: #11740a; font-style: italic;">// Other initialization code here...</span>
&nbsp;
  <span style="color: #11740a; font-style: italic;">// Register observer to be called when download of data is complete</span>
  <span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span><span style="color: #400080;">NSNotificationCenter</span> defaultCenter<span style="color: #002200;">&#93;</span> addObserver<span style="color: #002200;">:</span>self 
                         selector<span style="color: #002200;">:</span><span style="color: #a61390;">@selector</span><span style="color: #002200;">&#40;</span>downloadDataComplete<span style="color: #002200;">:</span><span style="color: #002200;">&#41;</span> 
                         name<span style="color: #002200;">:</span>NOTIF_DataComplete object<span style="color: #002200;">:</span><span style="color: #a61390;">nil</span><span style="color: #002200;">&#93;</span>; 
&nbsp;
<span style="color: #002200;">&#125;</span>
&nbsp;
<span style="color: #6e371a;">#pragma mark -</span>
<span style="color: #6e371a;">#pragma mark Cleanup</span>
&nbsp;
<span style="color: #11740a; font-style: italic;">/*---------------------------------------------------------------------------
* Cleanup 
*--------------------------------------------------------------------------*/</span> 
<span style="color: #002200;">-</span> <span style="color: #002200;">&#40;</span><span style="color: #a61390;">void</span><span style="color: #002200;">&#41;</span>dealloc 
<span style="color: #002200;">&#123;</span>
  <span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span><span style="color: #400080;">NSNotificationCenter</span> defaultCenter<span style="color: #002200;">&#93;</span> removeObserver<span style="color: #002200;">:</span>self<span style="color: #002200;">&#93;</span>;
  <span style="color: #002200;">&#91;</span>super dealloc<span style="color: #002200;">&#93;</span>;
<span style="color: #002200;">&#125;</span>
&nbsp;
<span style="color: #a61390;">@end</span></pre></td></tr></table></div>

<p><strong>Class That Posts Notification</strong></p>
<p>To keep things simple, I&#8217;ll add a few lines to the <em>applicationDidFinishLaunching</em> method to show you how posting a notification might look:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
</pre></td><td 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>applicationDidFinishLaunching<span style="color: #002200;">:</span><span style="color: #002200;">&#40;</span>UIApplication <span style="color: #002200;">*</span><span style="color: #002200;">&#41;</span>application 
<span style="color: #002200;">&#123;</span>
  <span style="color: #002200;">&#91;</span>window makeKeyAndVisible<span style="color: #002200;">&#93;</span>;
&nbsp;
  SomeClass <span style="color: #002200;">*</span>someclass <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span>SomeClass alloc<span style="color: #002200;">&#93;</span> init<span style="color: #002200;">&#93;</span>;
&nbsp;
  <span style="color: #11740a; font-style: italic;">// ...</span>
&nbsp;
  <span style="color: #11740a; font-style: italic;">// Post a notification that the data has been downloaded  </span>
  <span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span><span style="color: #400080;">NSNotificationCenter</span> defaultCenter<span style="color: #002200;">&#93;</span> 
            postNotificationName<span style="color: #002200;">:</span>NOTIF_DataComplete object<span style="color: #002200;">:</span><span style="color: #a61390;">nil</span><span style="color: #002200;">&#93;</span>;
&nbsp;
<span style="color: #002200;">&#125;</span></pre></td></tr></table></div>

<p>I create an instance of SomeClass and follow this by posting of a notification of the name <em>NOTIF_DataComplete</em>. This example is a little contrived, however, I&#8217;m sure you get the idea. Although a short example, it shows just how easy it is to register an observer and post notifications.</p>
<p>There are various other nuances to working with notifications that can be quite helpful when the time comes that you need more robust support for communication among objects. For example, you could specify that you are interested in receiving a notification by name (as above), however, only if that notification has a specific object affiliated with it. This would allow you to use the same notification name, however, only notify certain objects. One use of this could be if you have multiple downloads and want to use notifications to be notify a specific object that it&#8217;s download is complete.</p>
<p>If you are working with multiple threads, which would be the case if you need to fire off multiple downloads in the background, you can look into distributed notifications, which allow notifications to be delivered to a particular thread.</p>
]]></content:encoded>
			<wfw:commentRss>http://MacDeveloperTips.com/cocoa/basics-of-notifications.html/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Date Formatters &#8211; Part 3</title>
		<link>http://MacDeveloperTips.com/cocoa/date-formatters-part-3.html</link>
		<comments>http://MacDeveloperTips.com/cocoa/date-formatters-part-3.html#comments</comments>
		<pubDate>Fri, 16 Jan 2009 14:32:11 +0000</pubDate>
		<dc:creator>john</dc:creator>
				<category><![CDATA[Cocoa]]></category>

		<guid isPermaLink="false">http://MacDeveloperTips.com/?p=259</guid>
		<description><![CDATA[While working on an iPhone application recently, I needed to convert a date read from an XML stream that was in the following format: 20081122 to a nicely formatted string for display on the device: Saturday November 22, 2008. How to get there from here is now obvious, however, when I first encountered this dilemma [...]]]></description>
			<content:encoded><![CDATA[<p>While working on an iPhone application recently, I needed to convert a date read from an XML stream that was in the following format: 20081122 to a nicely formatted string for display on the device: Saturday November 22, 2008.<br />
<span id="more-259"></span></p>
<p>How to get there from here is now obvious, however, when I first encountered this dilemma the solution wasn&#8217;t apparent. The reason being, there is significant depth in the Cocoa frameworks and half the battle in becoming proficient as an iPhone developer is to have an opportunity to explore the range of APIs. Albeit the solution was right under my nose the whole time, my first pass was to take a more traditional route of trying to parse the string and rebuild a more &#8220;traditional&#8221; date format which I could use to create a date object. So, skipping all that, here&#8217;s the proper solution&#8230;</p>
<p>If you&#8217;ve ever worked with dates in Cocoa, chances are you are familiar with the <em>stringFromDate</em> method of the <em>NSDateFormatter</em>. For example, the code below will convert the current date to a string that looks like this: Wednesday November 26, 2008<br />
<!--more--></p>

<div class="wp_syntax"><div class="code"><pre class="objc" style="font-family:monospace;"><span style="color: #400080;">NSDate</span> <span style="color: #002200;">*</span>date <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span><span style="color: #400080;">NSDate</span> date<span style="color: #002200;">&#93;</span>;
<span style="color: #400080;">NSDateFormatter</span> <span style="color: #002200;">*</span>dateFormat <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span><span style="color: #400080;">NSDateFormatter</span> alloc<span style="color: #002200;">&#93;</span> init<span style="color: #002200;">&#93;</span>;
<span style="color: #002200;">&#91;</span>dateFormat setDateFormat<span style="color: #002200;">:</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;EEEE MMMM d, YYYY&quot;</span><span style="color: #002200;">&#93;</span>;
<span style="color: #400080;">NSString</span> <span style="color: #002200;">*</span>dateString <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span>dateFormat stringFromDate<span style="color: #002200;">:</span>date<span style="color: #002200;">&#93;</span>;  
<span style="color: #002200;">&#91;</span>dateFormat release<span style="color: #002200;">&#93;</span>;</pre></div></div>

<p>The trick is two-fold, the date format string to specify desired output, and the method <em>stringFromDate</em> to convert the date object to an NSString.</p>
<p>I&#8217;m sure you can see where I&#8217;m going with this&#8230;the solution I was looking for to convert a date (stored as a string) that was in a pre-defined format (i.e. 20081122) to a date object is as simple as using the method <em>dateFromString</em>. The primary difference is that the format string needs to represent the current format of the date that is to be read (versus the desired output format).</p>
<p>The code below converts a string that represents a date to an NSString object, with the output as follows: Saturday November 22, 2008:</p>

<div class="wp_syntax"><div class="code"><pre class="objc" style="font-family:monospace;"><span style="color: #400080;">NSString</span> <span style="color: #002200;">*</span>dateStr <span style="color: #002200;">=</span> <span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;20081122&quot;</span>;
&nbsp;
<span style="color: #11740a; font-style: italic;">// Convert string to date object</span>
<span style="color: #400080;">NSDateFormatter</span> <span style="color: #002200;">*</span>dateFormat <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span><span style="color: #400080;">NSDateFormatter</span> alloc<span style="color: #002200;">&#93;</span> init<span style="color: #002200;">&#93;</span>;
<span style="color: #002200;">&#91;</span>dateFormat setDateFormat<span style="color: #002200;">:</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;yyyyMMdd&quot;</span><span style="color: #002200;">&#93;</span>;
<span style="color: #400080;">NSDate</span> <span style="color: #002200;">*</span>date <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span>dateFormat dateFromString<span style="color: #002200;">:</span>dateStr<span style="color: #002200;">&#93;</span>;  
&nbsp;
<span style="color: #11740a; font-style: italic;">// Convert date object to desired output format</span>
<span style="color: #002200;">&#91;</span>dateFormat setDateFormat<span style="color: #002200;">:</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;EEEE MMMM d, YYYY&quot;</span><span style="color: #002200;">&#93;</span>;
dateStr <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span>dateFormat stringFromDate<span style="color: #002200;">:</span>date<span style="color: #002200;">&#93;</span>;  
<span style="color: #002200;">&#91;</span>dateFormat release<span style="color: #002200;">&#93;</span>;</pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://MacDeveloperTips.com/cocoa/date-formatters-part-3.html/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Date Formatters &#8211; Part 2</title>
		<link>http://MacDeveloperTips.com/cocoa/date-formatters-part-2.html</link>
		<comments>http://MacDeveloperTips.com/cocoa/date-formatters-part-2.html#comments</comments>
		<pubDate>Fri, 09 Jan 2009 18:50:52 +0000</pubDate>
		<dc:creator>john</dc:creator>
				<category><![CDATA[Cocoa]]></category>

		<guid isPermaLink="false">http://MacDeveloperTips.com/?p=258</guid>
		<description><![CDATA[In the first post on working with dates several of the examples use the &#8220;old style&#8221; date format syntax. The examples work, however, I want to show an additional example that uses the ICU (International Components for Unicode) library for format strings. Here is a short list of sample formats using ICU: The format specifiers [...]]]></description>
			<content:encoded><![CDATA[<p>In the first post on <a href="http://macdevelopertips.com/cocoa/date-formatters-part-1.html" target="_blank">working with dates</a> several of the examples use the &#8220;old style&#8221; date format syntax. The examples work, however, I want to show an additional example that uses the <a href="http://unicode.org/reports/tr35/tr35-6.html#Date_Format_Patterns" target="_blank">ICU</a> (International Components for Unicode) library for format strings.<br />
<span id="more-258"></span></p>
<p>Here is a short list of sample formats using ICU:</p>
<p><img width="450" src="http://iPhoneDeveloperTips.com/wp-content/uploads/2008/11/dateformatter.png"/></p>
<p>The format specifiers are quite straightforward, Y = year, M = month, etc. Changing the number of specifiers for a field, changes the output. For example, MMMM generates the full month name &#8220;November&#8221;, MMM results in &#8220;Nov&#8221; and MM outputs &#8220;11&#8243;.</p>
<p>What follows is an example to create the following date string:</p>
<p><em><strong>Saturday November 8, 2008</strong></em>:</p>

<div class="wp_syntax"><div class="code"><pre class="objc" style="font-family:monospace;"><span style="color: #400080;">NSDate</span> <span style="color: #002200;">*</span>today <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span><span style="color: #400080;">NSDate</span> date<span style="color: #002200;">&#93;</span>;
<span style="color: #400080;">NSDateFormatter</span> <span style="color: #002200;">*</span>dateFormat <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span><span style="color: #400080;">NSDateFormatter</span> alloc<span style="color: #002200;">&#93;</span> init<span style="color: #002200;">&#93;</span>;
<span style="color: #002200;">&#91;</span>dateFormat setDateFormat<span style="color: #002200;">:</span>@<span style="color: #002200;">&amp;</span>quot;EEEE MMMM d, YYYY<span style="color: #002200;">&amp;</span>quot;<span style="color: #002200;">&#93;</span>;
<span style="color: #400080;">NSString</span> <span style="color: #002200;">*</span>dateString <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span>dateFormat stringFromDate<span style="color: #002200;">:</span>today<span style="color: #002200;">&#93;</span>;
<span style="color: #002200;">&#91;</span>dateFormat release<span style="color: #002200;">&#93;</span>;</pre></div></div>

<p>Here&#8217;s another example showing the current time:</p>
<p><em><strong>9:20 AM, PST</strong></em>:</p>

<div class="wp_syntax"><div class="code"><pre class="objc" style="font-family:monospace;"><span style="color: #400080;">NSDate</span> <span style="color: #002200;">*</span>today <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span><span style="color: #400080;">NSDate</span> date<span style="color: #002200;">&#93;</span>; 
<span style="color: #400080;">NSDateFormatter</span> <span style="color: #002200;">*</span>dateFormat <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span><span style="color: #400080;">NSDateFormatter</span> alloc<span style="color: #002200;">&#93;</span> init<span style="color: #002200;">&#93;</span>;
<span style="color: #002200;">&#91;</span>dateFormat setDateFormat<span style="color: #002200;">:</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;h:mm a, zzz&quot;</span><span style="color: #002200;">&#93;</span>;
<span style="color: #400080;">NSString</span> <span style="color: #002200;">*</span>dateString <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span>dateFormat stringFromDate<span style="color: #002200;">:</span>today<span style="color: #002200;">&#93;</span>;  
<span style="color: #002200;">&#91;</span>dateFormat release<span style="color: #002200;">&#93;</span>;</pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://MacDeveloperTips.com/cocoa/date-formatters-part-2.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Date Formatters &#8211; Part 1</title>
		<link>http://MacDeveloperTips.com/cocoa/date-formatters-part-1.html</link>
		<comments>http://MacDeveloperTips.com/cocoa/date-formatters-part-1.html#comments</comments>
		<pubDate>Tue, 30 Dec 2008 14:17:00 +0000</pubDate>
		<dc:creator>john</dc:creator>
				<category><![CDATA[Cocoa]]></category>

		<guid isPermaLink="false">http://MacDeveloperTips.com/?p=257</guid>
		<description><![CDATA[Sometimes all you&#8217;re really looking for is a basic chunk of code to get something done. For example, I was working on an application yesterday and needed to display the current date in text format: October 29, 2008. A simple concept for sure, however, with the many nuances of date formatters, it takes some time [...]]]></description>
			<content:encoded><![CDATA[<p>Sometimes all you&#8217;re really looking for is a basic chunk of code to get something done. For example, I was working on an application yesterday and needed to display the current date in text format: October 29, 2008. A simple concept for sure, however, with the many nuances of date formatters, it takes some time to pull together the &#8220;right&#8221; code.<br />
<span id="more-257"></span></p>
<p>So, to save you some time, here are several simple examples for displaying date information:</p>

<div class="wp_syntax"><div class="code"><pre class="objc" style="font-family:monospace;"> <span style="color: #11740a; font-style: italic;">// &lt;strong&gt;Output -&gt;  Date: 10/29/08&lt;/strong&gt;</span>
 <span style="color: #400080;">NSDate</span> <span style="color: #002200;">*</span>today <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span><span style="color: #400080;">NSDate</span> dateWithTimeIntervalSinceNow<span style="color: #002200;">:</span><span style="color: #2400d9;">0</span><span style="color: #002200;">&#93;</span>;
 <span style="color: #400080;">NSDateFormatter</span> <span style="color: #002200;">*</span>dateFormat <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span><span style="color: #400080;">NSDateFormatter</span> alloc<span style="color: #002200;">&#93;</span> init<span style="color: #002200;">&#93;</span> autorelease<span style="color: #002200;">&#93;</span>;
 <span style="color: #002200;">&#91;</span>dateFormat setDateStyle<span style="color: #002200;">:</span>NSDateFormatterShortStyle<span style="color: #002200;">&#93;</span>;
 <span style="color: #400080;">NSString</span> <span style="color: #002200;">*</span>dateString <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span>dateFormat stringFromDate<span style="color: #002200;">:</span>today<span style="color: #002200;">&#93;</span>;
 NSLog<span style="color: #002200;">&#40;</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;Date: %@&quot;</span>, dateString<span style="color: #002200;">&#41;</span>;</pre></div></div>

<p>Notice above how the style of the output is set using <em>NSDateFormatterShortStyle</em>. There are additional canned formats as well such as <em>NSDateFormatterFullStyle</em> and <em>NSDateFormatterNoStyle</em>.</p>

<div class="wp_syntax"><div class="code"><pre class="objc" style="font-family:monospace;"> <span style="color: #11740a; font-style: italic;">// &lt;strong&gt;Output -&gt;  Date: 10/29/2008 08:28pm&lt;/strong&gt;  </span>
 <span style="color: #400080;">NSDate</span> <span style="color: #002200;">*</span>today <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span><span style="color: #400080;">NSDate</span> date<span style="color: #002200;">&#93;</span>;
 <span style="color: #400080;">NSDateFormatter</span> <span style="color: #002200;">*</span>dateFormat <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span><span style="color: #400080;">NSDateFormatter</span> alloc<span style="color: #002200;">&#93;</span> 
   initWithDateFormat<span style="color: #002200;">:</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;%m/%d/%Y %I:%M%p&quot;</span> allowNaturalLanguage<span style="color: #002200;">:</span><span style="color: #a61390;">NO</span><span style="color: #002200;">&#93;</span> autorelease<span style="color: #002200;">&#93;</span>;
 <span style="color: #400080;">NSString</span> <span style="color: #002200;">*</span>dateString <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span>dateFormat stringFromDate<span style="color: #002200;">:</span>today<span style="color: #002200;">&#93;</span>;
 NSLog<span style="color: #002200;">&#40;</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;Date: %@&quot;</span>, <span style="color: #002200;">&#91;</span>dateString lowercaseString<span style="color: #002200;">&#93;</span><span style="color: #002200;">&#41;</span>;</pre></div></div>

<p>Notice in the above example how I convert the string to lowercase to get &#8220;pm&#8221; rather than the default &#8220;PM&#8221;. Obviously, if the date contains text (e.g. October) this wouldn&#8217;t be a good approach.</p>

<div class="wp_syntax"><div class="code"><pre class="objc" style="font-family:monospace;"> <span style="color: #11740a; font-style: italic;">//&lt;strong&gt;Output -&gt; Date: Thursday, October 30, 2008&lt;/strong&gt;</span>
 <span style="color: #400080;">NSDate</span> <span style="color: #002200;">*</span>today <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span><span style="color: #400080;">NSDate</span> date<span style="color: #002200;">&#93;</span>;
 <span style="color: #400080;">NSDateFormatter</span> <span style="color: #002200;">*</span>dateFormat <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span><span style="color: #400080;">NSDateFormatter</span> alloc<span style="color: #002200;">&#93;</span> 
   initWithDateFormat<span style="color: #002200;">:</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;%A, %B %d, %Y&quot;</span> allowNaturalLanguage<span style="color: #002200;">:</span><span style="color: #a61390;">NO</span><span style="color: #002200;">&#93;</span> autorelease<span style="color: #002200;">&#93;</span>;
 <span style="color: #400080;">NSString</span> <span style="color: #002200;">*</span>dateString <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span>dateFormat stringFromDate<span style="color: #002200;">:</span>today<span style="color: #002200;">&#93;</span>;
 NSLog<span style="color: #002200;">&#40;</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;Date: %@&quot;</span>, dateString<span style="color: #002200;">&#41;</span>;</pre></div></div>

<p>The above example is similar to the previous, simply using different specifiers to write out the date with full weekday and month.</p>

<div class="wp_syntax"><div class="code"><pre class="objc" style="font-family:monospace;"> <span style="color: #11740a; font-style: italic;">// &lt;strong&gt;Output -&gt;  Date: 10/29/2008 08:29PM&lt;/strong&gt;    </span>
 <span style="color: #400080;">NSDate</span> <span style="color: #002200;">*</span>today <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span><span style="color: #400080;">NSDate</span> date<span style="color: #002200;">&#93;</span>;
 <span style="color: #400080;">NSDateFormatter</span> <span style="color: #002200;">*</span>dateFormat <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span><span style="color: #400080;">NSDateFormatter</span> alloc<span style="color: #002200;">&#93;</span> init<span style="color: #002200;">&#93;</span>;
 <span style="color: #002200;">&#91;</span>dateFormat setDateFormat<span style="color: #002200;">:</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;MM/dd/yyyy hh:mma&quot;</span><span style="color: #002200;">&#93;</span>;
 <span style="color: #400080;">NSString</span> <span style="color: #002200;">*</span>dateString <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span>dateFormat stringFromDate<span style="color: #002200;">:</span>today<span style="color: #002200;">&#93;</span>;
 NSLog<span style="color: #002200;">&#40;</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;date: %@&quot;</span>, dateString<span style="color: #002200;">&#41;</span>;
 <span style="color: #002200;">&#91;</span>dateFormat release<span style="color: #002200;">&#93;</span>;</pre></div></div>

<p>The example above shows how you can manage memory without using autorelease.</p>
<p>These examples merely skim the surface of what you can do when working with dates. Look at the documentation for specifics on how to tweak the specifier strings to create variations of the date output.</p>
]]></content:encoded>
			<wfw:commentRss>http://MacDeveloperTips.com/cocoa/date-formatters-part-1.html/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Minnesota CocoaHeads Recap</title>
		<link>http://MacDeveloperTips.com/cocoa/minnesota-cocoaheads-recap.html</link>
		<comments>http://MacDeveloperTips.com/cocoa/minnesota-cocoaheads-recap.html#comments</comments>
		<pubDate>Fri, 12 Sep 2008 07:21:23 +0000</pubDate>
		<dc:creator>john</dc:creator>
				<category><![CDATA[Cocoa]]></category>
		<category><![CDATA[Lua]]></category>

		<guid isPermaLink="false">http://MacDeveloperTips.com/?p=246</guid>
		<description><![CDATA[The Minnesota CocoaHeads met tonight and it was an interesting spin on development for the Mac. Troy Gaul did a presentation on Adobe Lightroom, from the perspective of the development tools and approach used to create Lightroom. Although I have heard of Lua , I had no idea of the depth of its usefulness. It [...]]]></description>
			<content:encoded><![CDATA[<p>The <a href="http://www.cocoaheadsmn.org/" target="_blank">Minnesota CocoaHeads</a> met tonight and it was an interesting spin on development for the Mac. Troy Gaul did a presentation on Adobe Lightroom, from the perspective of the development tools and approach used to create Lightroom.</p>
<p>Although I have heard of <a href="http://www.lua.org/home.html" target="_blank">Lua</a> , I had no idea of the depth of its usefulness. It was impressive to see the extent it&#8217;s used in Lightroom, somewhere in the neighborhood of 60% of the code base.<span id="more-246"></span></p>
<p><a href="http://www.lua.org/home.html" target="_blank"><img class="alignleft" style="float: left;" src="http://www.lua.org/images/logo.gif" alt="" /> </a></p>
<p>Tim Gogolin was the guy behind designing and developing a nice editor that Adobe uses internally for working with Lua to develop Lightroom. I can&#8217;t do it justice to describe it hear, suffice it to say, it was  pretty cool, written specifically to meet the needs of the engineering team, from the way it compiles code on the fly to its debugging capabilities.</p>
<p>There was a nice demo showing how Lua (and the editor) are used to create Lightroom, and it was very intriguing to see how deeply ingrained Lua was in the development process. No question, Lua deserves a close look for those needing an embedded scripting language. And if you are into World of Warcraft, you should definitely give Lua a look, as the interface is written using Lua scripting.</p>
]]></content:encoded>
			<wfw:commentRss>http://MacDeveloperTips.com/cocoa/minnesota-cocoaheads-recap.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Filename and Line Number with NSLog: Part II</title>
		<link>http://MacDeveloperTips.com/cocoa/filename-and-line-number-with-nslog-part-ii.html</link>
		<comments>http://MacDeveloperTips.com/cocoa/filename-and-line-number-with-nslog-part-ii.html#comments</comments>
		<pubDate>Wed, 20 Aug 2008 12:03:30 +0000</pubDate>
		<dc:creator>john</dc:creator>
				<category><![CDATA[Cocoa]]></category>

		<guid isPermaLink="false">http://MacDeveloperTips.com/?p=241</guid>
		<description><![CDATA[In the previous post (on the iPhone Developer Tips blog) I demonstrated a simple debug class that I wrote to wrap some additional code around NSLog. The code allows for displaying additional information beyond the date/time stamp and process ID that NSLog outputs, specifically, the filename which calls the debug routine, and the line number [...]]]></description>
			<content:encoded><![CDATA[<p>In the <a href="http://iphonedevelopertips.com/cocoa/filename-and-line-number-with-nslog-part-i.html" target="_blank">previous post</a> (on the iPhone Developer Tips blog) I demonstrated a simple debug class that I wrote to wrap some additional code around NSLog. The code allows for displaying additional information beyond the date/time stamp and process ID that NSLog outputs, specifically, the filename which calls the debug routine, and the line number where the call was invoked. I also added a few additional configuration options including an option to disable all debug messages.</p>
<p>You can read the rest of the tip on the <a href="http://iphonedevelopertips.com/cocoa/filename-and-line-number-with-nslog-part-ii.html" target="_blank">iPhone Developer Tips</a> blog.</p>
]]></content:encoded>
			<wfw:commentRss>http://MacDeveloperTips.com/cocoa/filename-and-line-number-with-nslog-part-ii.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Filename and Line Number with NSLog: Part I</title>
		<link>http://MacDeveloperTips.com/cocoa/filename-and-line-number-with-nslog-part-i.html</link>
		<comments>http://MacDeveloperTips.com/cocoa/filename-and-line-number-with-nslog-part-i.html#comments</comments>
		<pubDate>Tue, 19 Aug 2008 12:26:17 +0000</pubDate>
		<dc:creator>john</dc:creator>
				<category><![CDATA[Cocoa]]></category>
		<category><![CDATA[Xcode]]></category>

		<guid isPermaLink="false">http://MacDeveloperTips.com/?p=240</guid>
		<description><![CDATA[Coming from a C development background, long before the days of integrated debuggers, printf() was the primary tool for tracking down bugs. Building on that, NSLog is no doubt helpful. However, as the amount of code in a project grows, I often find that another reference point in the output would be helpful, namely, the [...]]]></description>
			<content:encoded><![CDATA[<p>Coming from a C development background, long before the days of integrated debuggers, printf() was the primary tool for tracking down bugs. Building on that, NSLog is no doubt helpful. However, as the amount of code in a project grows, I often find that another reference point in the output would be helpful, namely, the filename and line number where the NSLog calls originate.</p>
<p>This is a two part series on creating a new class that wraps NSLog to add several additional debugging features including output of the filename/path, line number information and the option to turn debug messages off/on.</p>
<p>You can read the rest of the tip on the <a href="http://iphonedevelopertips.com/cocoa/filename-and-line-number-with-nslog-part-i.html" target="_blank">iPhone Developer Tips</a> blog.</p>
]]></content:encoded>
			<wfw:commentRss>http://MacDeveloperTips.com/cocoa/filename-and-line-number-with-nslog-part-i.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>CocoaHeads MN: Objective-C</title>
		<link>http://MacDeveloperTips.com/cocoa/cocoaheads-mn-objective-c.html</link>
		<comments>http://MacDeveloperTips.com/cocoa/cocoaheads-mn-objective-c.html#comments</comments>
		<pubDate>Fri, 11 Jul 2008 12:21:54 +0000</pubDate>
		<dc:creator>john</dc:creator>
				<category><![CDATA[Cocoa]]></category>

		<guid isPermaLink="false">http://MacDeveloperTips.com/?p=224</guid>
		<description><![CDATA[Lastnight was the second meeting for CocoaHeads in Minnesota . The meeting was all about Objective-C. Bob McCune , the organizer of the event, gave a talk that covered Objective-C from beginning to end. One of the most intriguing aspects (at least from my perspective) was how the group would segue into a discussion on [...]]]></description>
			<content:encoded><![CDATA[<p>Lastnight was the second meeting for <a href="http://cocoaheadsmn.org" target="_blank">CocoaHeads in Minnesota</a> .</p>
<p>The meeting was all about Objective-C. <a href="http://www.bobmccune.com/" target="_blank">Bob McCune</a> , the organizer of the event, gave a talk that covered Objective-C from beginning to end. One of the most intriguing aspects (at least from my perspective) was how the group would segue into a discussion on a topic. What was quite helpful was insight from those in the group who had significant experience working with Cocoa and Objective-C.</p>
<p>Bob did an excellent job, covering a great deal of ground, and wrapped up with an demo of a calculator application that tied together many of the concepts. If you are new to working with protocols, I highly recommend you download and give the application a look. The example shows how you can define and implement a protocol &#8211; no better way to learn a concept than to see it in code (I&#8217;ll add a link to the code once it is posted on the MN CocoaHeads site).</p>
<p>Many thanks to Bob McCune for starting <a href="http://cocoaheadsmn.org" target="_blank">MN CocoaHeads</a> , <a href="http://www.synfoserv.com/" target="_blank">Synergy Information Systems</a> for making the space available, and Vladan Pulec (Synergy) for adding a link to this blog from the CocoaHeads MN website.</p>
<p>If you live in Minnesota, are within reasonable driving distance to Bloomington (or even if not) and are interested in developing applications for the Mac/iPhone, join us on August 14th (the second Thursday of every month) for our next meeting.</p>
]]></content:encoded>
			<wfw:commentRss>http://MacDeveloperTips.com/cocoa/cocoaheads-mn-objective-c.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
