<?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>Scyanide Chatter &#187; xcode</title>
	<atom:link href="http://scyanide.com/tag/xcode/feed/" rel="self" type="application/rss+xml" />
	<link>http://scyanide.com</link>
	<description>My life, interests, and random babble...</description>
	<lastBuildDate>Tue, 17 Jan 2012 03:43:03 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>XCode: The Starting Curly Brace</title>
		<link>http://scyanide.com/2010/02/xcode-the-starting-curly-brace/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=xcode-the-starting-curly-brace</link>
		<comments>http://scyanide.com/2010/02/xcode-the-starting-curly-brace/#comments</comments>
		<pubDate>Wed, 24 Feb 2010 05:09:32 +0000</pubDate>
		<dc:creator>Scyanide</dc:creator>
				<category><![CDATA[Objective-C]]></category>
		<category><![CDATA[Tips and Tricks]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[newline]]></category>
		<category><![CDATA[obj]]></category>
		<category><![CDATA[objective-c]]></category>
		<category><![CDATA[same line]]></category>
		<category><![CDATA[starting curly brace]]></category>
		<category><![CDATA[xcode]]></category>

		<guid isPermaLink="false">http://scyanide.com/?p=410</guid>
		<description><![CDATA[As I dive deeper into the world of programming for Apple hardware I bring along with me past practices or habits that I must change in order to fit into the Objective-C world. It has been years since I last touched C/C++ and coming from a world of .NET and C#, my first impressions of [...] [...]]]></description>
			<content:encoded><![CDATA[<p>As I dive deeper into the world of programming for Apple hardware I bring along with me past practices or habits that I must change in order to fit into the Objective-C world. It has been years since I last touched C/C++ and coming from a world of .NET and C#, my first impressions of XCode and Objective-C was basically taking a few steps backwards.</p>
<p>I couldn&#8217;t have been more wrong&#8230;</p>
<p><span id="more-410"></span></p>
<p>I see the power of what this new world has to offer and thus as I continue my journey I am finding myself taking new approaches to situations and even finding that some old habits I just flat out prefer to hold on to. Today, I&#8217;m talking about the placement of the starting curly brace.</p>
<p>Now, it seems to be common place in the C/C++ world where the starting curly brace is on the same line as the starting block of code. For example&#8230;</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: #a61390;">void</span> someFunction<span style="color: #002200;">&#40;</span><span style="color: #002200;">&#41;</span> <span style="color: #002200;">&#123;</span>
  <span style="color: #11740a; font-style: italic;">//code...</span>
<span style="color: #002200;">&#125;</span></pre></td></tr></table></div>

<p>In the C# world it seems to be common place to place the curly brace on a new line. For example&#8230;</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
</pre></td><td class="code"><pre class="csharp" style="font-family:monospace;"><span style="color: #0600FF; font-weight: bold;">public</span> <span style="color: #6666cc; font-weight: bold;">void</span> someMethod<span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span>
<span style="color: #008000;">&#123;</span>
  <span style="color: #008080; font-style: italic;">//code...</span>
<span style="color: #008000;">&#125;</span></pre></td></tr></table></div>

<p>There are various arguments on why each one is better. Commonly I hear that the first method is better because it doesn&#8217;t have wasted space which results in less scrolling. While on the flip side, I commonly hear that by placing the curly brace on a newline it makes for easier readability. In the end, it really only comes down to personal preference as the placement has zero effect on the result of the executed code.</p>
<p>Personally, I prefer and have always preferred placing the curly brace on a new line. Why is this? Well, it is what I got used to while using Visual Studio for so long. It has occurred to me that the big named IDE&#8217;s out there seem to have a bit of a role, or rather influence, in how the community adopts the typical way a programming language is written out. With the exception, of course, of those individuals who take the time to rummage through the IDE&#8217;s preferences and change auto features to their liking.</p>
<p>Which is where my recent adventure comes into the story. While working in XCode I noticed the predicting text feature (amazing by the way, really wish Visual Studio had this) would always place the starting curly brace on the same line as my starting block of code. After a short period I stopped relying on the predicting text feature and just wrote everything out so that I would have to interrupt my typing flow to move the curly brace.</p>
<p><a href="http://scyanide.com/wp-content/uploads/2010/02/Screen-shot-2010-02-23-at-12.47.56-PM.png"><img class="aligncenter size-full wp-image-417" title="Screen shot 2010-02-23 at 12.47.56 PM" src="http://scyanide.com/wp-content/uploads/2010/02/Screen-shot-2010-02-23-at-12.47.56-PM.png" alt="" width="328" height="216" /></a></p>
<p>The image above shows XCode&#8217;s auto predicting magic (seriously, I have no clue what it is actually called) on an &#8216;if&#8217; statement. Getting a little tired of having the starting curly brace on the same line I went through XCode&#8217;s preferences to change it but was given a little shock. There are no options to change this from the IDE.</p>
<p>I was a little disappointed but had not given up just yet as I did recall that the Apple world revolves around plist configuration files and held hope that maybe there was still a way.</p>
<p style="text-align: center;"><a href="http://scyanide.com/wp-content/uploads/2010/02/Screen-shot-2010-02-23-at-12.47.02-PM.png"><img class="aligncenter size-medium wp-image-416" title="Screen shot 2010-02-23 at 12.47.02 PM" src="http://scyanide.com/wp-content/uploads/2010/02/Screen-shot-2010-02-23-at-12.47.02-PM-300x203.png" alt="" width="300" height="203" /></a>Home: Library-&gt;Preferences-&gt;com.apple.Xcode.plist</p>
<p style="text-align: left;">I had found the plist file in the above location and as I opened it and looked through I couldn&#8217;t find any settings that would allow me to make the change I wanted. Looking around online I found what I was looking for, I needed the following inside this plist:</p>
<p style="text-align: left;">XCCodeSenseFormattingOptions as a dictionary along with BlockSeparator inside the newly created dictionary with the string value of a newline character.</p>
<p style="text-align: left;">I tried doing this manually through the plist editor that comes with the OS but I couldn&#8217;t get it to work correctly and so looking around online I found out how to manually edit plists from the terminal:</p>
<p style="text-align: left;"><strong>defaults write com.apple.Xcode XCCodeSenseFormattingOptions -dict BlockSeparator &#8220;\\n&#8221;</strong></p>
<p style="text-align: left;">By typing in the above line I had achieved my goal:</p>
<p style="text-align: left;"><a href="http://scyanide.com/wp-content/uploads/2010/02/Screen-shot-2010-02-23-at-12.55.54-PM.png"><img class="aligncenter size-full wp-image-419" title="Screen shot 2010-02-23 at 12.55.54 PM" src="http://scyanide.com/wp-content/uploads/2010/02/Screen-shot-2010-02-23-at-12.55.54-PM.png" alt="" width="329" height="188" /></a></p>
<p style="text-align: left;">Now when I type such statements as &#8216;if&#8217; this is what automatically shows up in XCode.</p>
<p style="text-align: left;">The issues I had doing it manually through a plist editor was that I needed that hidden newline character &#8216;\n&#8217; but typing it out manually only cause actual characters to be printed: For example&#8230;</p>
<p style="text-align: left;">if (condition)\n{</p>
<p style="text-align: left;">statements</p>
<p style="text-align: left;">}</p>
<p style="text-align: left;">So, with that if any of you, like me, prefer to have their curly braces start on a newline in XCode. Just the bolded line above in a terminal and you should be all set. Happy Coding!</p>
<p style="text-align: left;">NOTE: If you copy and paste the bolded line be careful of the quotes. Might just want to type that part in by hand. It has been my past experiences that showed copying lines of code with single and double quotes from a website does not always go over too well everytime.</p>
]]></content:encoded>
			<wfw:commentRss>http://scyanide.com/2010/02/xcode-the-starting-curly-brace/feed/</wfw:commentRss>
		<slash:comments>15</slash:comments>
		</item>
		<item>
		<title>I’m Back!</title>
		<link>http://scyanide.com/2010/02/im-back-2/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=im-back-2</link>
		<comments>http://scyanide.com/2010/02/im-back-2/#comments</comments>
		<pubDate>Mon, 08 Feb 2010 06:18:19 +0000</pubDate>
		<dc:creator>Scyanide</dc:creator>
				<category><![CDATA[Project News]]></category>
		<category><![CDATA[back]]></category>
		<category><![CDATA[iphone sdk]]></category>
		<category><![CDATA[laptop]]></category>
		<category><![CDATA[mac]]></category>
		<category><![CDATA[objective-c]]></category>
		<category><![CDATA[os]]></category>
		<category><![CDATA[x]]></category>
		<category><![CDATA[xcode]]></category>

		<guid isPermaLink="false">http://scyanide.com/?p=400</guid>
		<description><![CDATA[So I&#8217;ve been neglecting this site for awhile now. For those of you who read this blog, I apologize for being so quiet. I ended up taking up 2 jobs which took up a lot more of my time than I had realized and I didn&#8217;t have much time to work on my game much [...] [...]]]></description>
			<content:encoded><![CDATA[<p>So I&#8217;ve been neglecting this site for awhile now. For those of you who read this blog, I apologize for being so quiet. I ended up taking up 2 jobs which took up a lot more of my time than I had realized and I didn&#8217;t have much time to work on my game much less make any new posts here.</p>
<p><span id="more-400"></span></p>
<p>So what have I been up to? Well, since my last post I&#8217;ve broken down and bought a MacBook. For various reasons but most importantly to finally dive in the iPhone SDK. A lot of my attention has been spent playing with Objective-C, XCode, and the iPhone SDK and I have to admit that it is quite enjoyable to mess with. It is taking me some time to get used to as Objective-C is just so strange to me but nothing I can&#8217;t handle.</p>
<p>I do hope that if I become familiar with the language and API that I may have something up on Apple&#8217;s AppStore but we all know how my home projects have been. I do hope this can finally keep my interest. Here are a few screenshots of what I&#8217;ve been doing.<br />

<a href='http://scyanide.com/2010/02/im-back-2/screen-shot-2010-02-06-at-4-54-49-pm/' title='Screen shot 2010-02-06 at 4.54.49 PM'><img width="150" height="150" src="http://scyanide.com/wp-content/uploads/2010/02/Screen-shot-2010-02-06-at-4.54.49-PM-150x150.png" class="attachment-thumbnail" alt="Screen shot 2010-02-06 at 4.54.49 PM" title="Screen shot 2010-02-06 at 4.54.49 PM" /></a>
<a href='http://scyanide.com/2010/02/im-back-2/screen-shot-2010-02-06-at-4-55-24-pm/' title='Screen shot 2010-02-06 at 4.55.24 PM'><img width="150" height="150" src="http://scyanide.com/wp-content/uploads/2010/02/Screen-shot-2010-02-06-at-4.55.24-PM-150x150.png" class="attachment-thumbnail" alt="Screen shot 2010-02-06 at 4.55.24 PM" title="Screen shot 2010-02-06 at 4.55.24 PM" /></a>
<a href='http://scyanide.com/2010/02/im-back-2/screen-shot-2010-02-06-at-4-55-50-pm/' title='Screen shot 2010-02-06 at 4.55.50 PM'><img width="150" height="150" src="http://scyanide.com/wp-content/uploads/2010/02/Screen-shot-2010-02-06-at-4.55.50-PM-150x150.png" class="attachment-thumbnail" alt="Screen shot 2010-02-06 at 4.55.50 PM" title="Screen shot 2010-02-06 at 4.55.50 PM" /></a>
<br />
They are not much but the first shows a simple menu screen which goes into the game screen shown by the other 2 images. The last image shows that the squares are clickable. I really don&#8217;t know where I&#8217;ll be going with this but we&#8217;ll see what comes up as I continue learn the environment.</p>
<p>On a side note, I am loving my new MacBook and the Mac OS X. This is my first time since having an Apple II in my middle school where I&#8217;ve touched a mac. I had no idea just how easy it is to use, everything just works and works really well.</p>
]]></content:encoded>
			<wfw:commentRss>http://scyanide.com/2010/02/im-back-2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

