<?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>Project Cocoa &#187; Development</title>
	<atom:link href="http://projectcocoa.com/category/development/feed/" rel="self" type="application/rss+xml" />
	<link>http://projectcocoa.com</link>
	<description>powered by i-NOVATiON.de</description>
	<lastBuildDate>Thu, 29 Apr 2010 18:02:46 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.1</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Objective-C Singleton Class template</title>
		<link>http://projectcocoa.com/2009/10/26/objective-c-singleton-class-template/</link>
		<comments>http://projectcocoa.com/2009/10/26/objective-c-singleton-class-template/#comments</comments>
		<pubDate>Mon, 26 Oct 2009 20:44:49 +0000</pubDate>
		<dc:creator>Project Cocoa</dc:creator>
				<category><![CDATA[Development]]></category>

		<guid isPermaLink="false">http://projectcocoa.com/?p=94</guid>
		<description><![CDATA[The Singleton design pattern is widely spread when developing software with the Cocoa (touch) framgework. A Singleton makes sure, that only one object of your class is allocated.
When using the template a cocoa class file with 2 additions will be generated:
-a static pointer to the singleton object
-a static method to access the singleton object: shared&#60;&#60;CLASSNAME&#62;&#62;
Template ]]></description>
			<content:encoded><![CDATA[<div id="_mcePaste" style="overflow: hidden; position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px;">The Singleton design pattern is widely spread when developing software with the Cocoa (touch) framgework. A Singleton makes sure, that only one object of your class is allocated.</div>
<div id="_mcePaste" style="overflow: hidden; position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px;">When using the template a cocoa class file with 2 additions will be generated:</div>
<div id="_mcePaste" style="overflow: hidden; position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px;">-a static pointer to the singleton object</div>
<div id="_mcePaste" style="overflow: hidden; position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px;">-a static method to access the singleton object: shared&lt;&lt;CLASSNAME&gt;&gt;</div>
<div id="_mcePaste" style="overflow: hidden; position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px;">Template Installation</div>
<div id="_mcePaste" style="overflow: hidden; position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px;">Download the attached archive and extract the included files to the following locations:</div>
<div id="_mcePaste" style="overflow: hidden; position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px;">Cocoa Template:</div>
<div id="_mcePaste" style="overflow: hidden; position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px;">&#8220;/Developer/Library/Xcode/File Templates/Cocoa Class/Objective-C Singleton class.pbfiletemplate&#8221;</div>
<div id="_mcePaste" style="overflow: hidden; position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px;">Cocoa Touch Template:</div>
<div id="_mcePaste" style="overflow: hidden; position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px;">&#8220;/Developer/Platforms/iPhoneOS.platform/Developer/Library/Xcode/File Templates/Objective-C Singleton class (iPhone).pbfiletemplate&#8221;</div>
<div id="_mcePaste" style="overflow: hidden; position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px;">Usage:</div>
<div id="_mcePaste" style="overflow: hidden; position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px;">Just choose the template &#8220;Objective-C Singleton class&#8221; when adding a new file to your project.</div>
<p><strong>Update</strong>: template was optimized by ensuring thread safety when allocating the object.</p>
<p>The Singleton design pattern is widely spread when developing software with the Cocoa (touch) framework. A Singleton makes sure, that only one object of your class is allocated.</p>
<p>When using the template, a cocoa class file with 2 additions will be generated:</p>
<ul>
<li>a static pointer to the singleton object</li>
<li>a static method to access the singleton object: shared&lt;&lt;CLASSNAME&gt;&gt;</li>
</ul>
<p><strong>Template Installation</strong></p>
<p>Download the attached archive and extract the included files to the following locations:</p>
<ul>
<li>&#8220;/Developer/Library/Xcode/File Templates/Cocoa Class/Objective-C Singleton class.pbfiletemplate&#8221;</li>
<li>&#8220;/Developer/Platforms/iPhoneOS.platform/Developer/Library/Xcode/File Templates/Cocoa Touch Class/Objective-C Singleton class (iPhone).pbfiletemplate&#8221;</li>
</ul>
<p><strong>Files</strong>:</p>
<ul>
<li><a href="http://projectcocoa.com/wp-content/uploads/2009/10/Objective-C-Singleton-class.pbfiletemplate.zip">Objective-C Singleton class.pbfiletemplate</a></li>
<li><a href="http://projectcocoa.com/wp-content/uploads/2009/10/Objective-C-Singleton-class-iPhone.pbfiletemplate.zip">Objective-C Singleton class (iPhone).pbfiletemplate</a></li>
</ul>
<p><strong>Usage</strong>:</p>
<p>Just choose the template &#8220;Objective-C Singleton class&#8221; when adding a new file to your project. To access the singleton object don&#8217;t allocate the object yourself. Use the static method &#8220;shared&#8230;&#8221; (e.g: sharedTestManager):</p>
<blockquote><p>TestManager *myTestManager = [TestManager sharedTestManager];</p></blockquote>
<p style="text-align: left;"><strong>Images</strong>:</p>
<p style="text-align: left;"><a href="http://projectcocoa.com/wp-content/uploads/2009/10/Add-Singleton.png"><img class="alignleft size-medium wp-image-130" title="Add Singleton" src="http://projectcocoa.com/wp-content/uploads/2009/10/Add-Singleton-300x247.png" alt="Add Singleton" width="300" height="247" /></a><a href="http://projectcocoa.com/wp-content/uploads/2009/10/Added-Singleton.png"><img class="alignleft size-medium wp-image-131" title="Added Singleton" src="http://projectcocoa.com/wp-content/uploads/2009/10/Added-Singleton-300x220.png" alt="Added Singleton" width="300" height="220" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://projectcocoa.com/2009/10/26/objective-c-singleton-class-template/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
