<?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>Perspx &#187; Tools</title>
	<atom:link href="http://perspx.com/blog/archives/category/tools/feed/" rel="self" type="application/rss+xml" />
	<link>http://perspx.com</link>
	<description>Musings of a teenage programmer</description>
	<lastBuildDate>Thu, 20 May 2010 06:56:17 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Useful Interface Builder Features</title>
		<link>http://perspx.com/blog/archives/1003/useful-interface-builder-features/</link>
		<comments>http://perspx.com/blog/archives/1003/useful-interface-builder-features/#comments</comments>
		<pubDate>Tue, 12 Jan 2010 20:26:05 +0000</pubDate>
		<dc:creator>Perspx</dc:creator>
				<category><![CDATA[Cocoa]]></category>
		<category><![CDATA[Development]]></category>
		<category><![CDATA[Tools]]></category>
		<category><![CDATA[cocoa-touch]]></category>
		<category><![CDATA[design]]></category>
		<category><![CDATA[interface builder]]></category>
		<category><![CDATA[user interface]]></category>

		<guid isPermaLink="false">http://perspx.com/?p=1003</guid>
		<description><![CDATA[Interface Builder is one of Apple&#8217;s developer tools, used to design interfaces for both Mac OS X and iPhone applications, and in most instances saves developers huge amounts of time from having to write the equivalent code, whilst also providing a useful visual representation of the interfaces they are working on.
Some developers try and fight Interface Builder, and would rather  ... ]]></description>
			<content:encoded><![CDATA[<p>Interface Builder is one of Apple&#8217;s developer tools, used to design interfaces for both Mac OS X and iPhone applications, and in most instances saves developers huge amounts of time from having to write the equivalent code, whilst also providing a useful visual representation of the interfaces they are working on.</p>
<p>Some developers <a href="http://stackoverflow.com/questions/717442/how-do-i-create-cocoa-interfaces-without-interface-builder" target="_blank">try and fight</a> Interface Builder, and would rather code up the interfaces rather than let Interface Builder do most of the work for them. Of course, there are instances where this may be useful, but in the grand scheme of things IB is a tool which has lots of useful features that makes interface design a much easier process.</p>
<h2>Layout and alignment</h2>
<p>Interface Builder provides blue guides to aid positioning of objects, in accordance with the <a href="http://perspx.com/blog/archives/454/apple-human-interface-guidelines/" target="_blank">Apple Human Interface Guidelines</a>. However, if you want a tighter grain of control over the layout, there are other guides which help you with this.</p>
<p>Pressing <strong>option</strong> with an interface object selected causes red arrows to be displayed on the four sides of the object, with labels displaying the number of pixels from the frame of the object to the edges of the container.</p>
<p style="text-align: center;"><a href="http://perspx.com/wp-content/uploads/2010/01/option-spacing-guides.jpg"><img class="aligncenter size-full wp-image-1017" title="IB Layout: Spacing guides" src="http://perspx.com/wp-content/uploads/2010/01/option-spacing-guides.jpg" alt="" width="337" height="262" /></a></p>
<p>With the option key still held down, placing the cursor over another interface object will show you the spacing between the frame of the selected object and the frame of the object you have the cursor over. This can be useful in times when making sure objects have equal alignments with neighbouring objects, or within the window itself.</p>
<p style="text-align: center;"><a href="http://perspx.com/wp-content/uploads/2010/01/option-spacing-guides2.jpg"><img class="aligncenter size-full wp-image-1018" title="IB Layout: Spacing guides" src="http://perspx.com/wp-content/uploads/2010/01/option-spacing-guides2.jpg" alt="" width="332" height="255" /></a></p>
<p>There are also the <em>Align Vertical Center in Container</em> and <em>Align Horizontal Center in Container</em> options from the <em>Layout &gt; Alignment</em> menu which are useful in centering objects within their container (and which I personally think should also have keyboard shortcuts associated with them).</p>
<p style="text-align: center;"><a href="http://perspx.com/wp-content/uploads/2010/01/alignment.jpg"><img class="aligncenter size-full wp-image-1019" title="IB Layout: Alignment menu" src="http://perspx.com/wp-content/uploads/2010/01/alignment.jpg" alt="" width="410" height="309" /></a></p>
<h2>Option-drag to duplicate objects</h2>
<p>It really does what it says on the tin. To duplicate objects just hold down the option key then drag an object. A clone of the object will be created which you can then move to the desired location.</p>
<p style="text-align: center;"><a href="http://perspx.com/wp-content/uploads/2010/01/option-drag.jpg"><img class="aligncenter size-full wp-image-1021" title="IB: Option-drag to duplicate objects" src="http://perspx.com/wp-content/uploads/2010/01/option-drag.jpg" alt="" width="377" height="247" /></a></p>
<h2>Decompose and Simulate Interface</h2>
<p>These are two useful options that are accessible from the <em>File</em> menu.</p>
<p style="text-align: center;"><a href="http://perspx.com/wp-content/uploads/2010/01/decompose_simulate_interface.jpg"><img class="aligncenter size-full wp-image-1022" title="IB File Menu" src="http://perspx.com/wp-content/uploads/2010/01/decompose_simulate_interface.jpg" alt="" width="341" height="309" /></a></p>
<p>The first is <em>Decompose Interface</em>. An advantage of using NIBs is that they can be loaded lazily – that is, only when the contained objects are actually needed by the application. This can reduce the memory footprint and loading times, which is particularly useful when developing iPhone applications due to the somewhat limited system resources available.</p>
<p>Therefore a common design pattern for Cocoa/Cocoa-Touch applications is to share different objects – be that menus, windows, view controllers and such – across multiple nibs – not necessarily one per nib, but perhaps two or three that are needed for a particular part of the application and have to be loaded together. What the <em>Decompose Interface</em> action does is split objects in the current nib into separate nibs, which can then be saved and then loaded lazily by the application in this way.</p>
<p>The other action, <em>Simulate Interface</em>, is a convenience when designing an interface; instead of having to go back to Xcode and Build and Run to see what the interface looks like, you can do it straight from Interface Builder, which will simulate the current window and its contents.</p>
<p>However, note that if you use any custom views, any custom visual or behavioural attributes will not be implemented by the simulator – it does not build your application, just simulates the available objects used by your interfaces from the Library.</p>
<h2>Size to Fit</h2>
<p><em>Size to Fit</em> is an option available from the <em>Layout</em> menu (or ⌘=) which resizes a view to a size just large enough to fit its contents.</p>
<p><a href="http://perspx.com/wp-content/uploads/2010/01/sizetofit.jpg"><img class="aligncenter size-medium wp-image-1023" title="IB: Size To Fit menu option" src="http://perspx.com/wp-content/uploads/2010/01/sizetofit-300x155.jpg" alt="" width="300" height="155" /></a></p>
<p>This is useful after changing the contents of an element to then resize it to just the right size to fit its contents.</p>
<h2>Precise selection of Views in the view hierarchy</h2>
<p>This is another really useful feature of Interface Builder; when making a selection, hold down <strong>shift</strong> and then <strong>right-click</strong> on an element. A menu will pop up, which lists the views in the view hierarchy for that element, from the enclosing Window (or other appropriate top-level container) to the interface object that you have clicked on. For example, when clicking on an <code>NSButton</code>, the menu lists <em>Window, Content View, Push Button</em> and<em> Button Cell</em>.</p>
<p style="text-align: center;"><a href="http://perspx.com/wp-content/uploads/2010/01/rightclickselection.png"><img class="aligncenter size-full wp-image-1024" title="rightclickselection_thumb" src="http://perspx.com/wp-content/uploads/2010/01/rightclickselection_thumb.png" alt="" width="290" height="315" /></a></p>
<p>Where I&#8217;ve found this to be particularly useful is with Table Views; the particular part of the table that you want to select very much depends on what you want to do; if you are binding to a column for instance, you will want to select the table column; if you are resizing the headers, you will want to select the header view; if you want to change the row height, you want to select the Table View itself, and so forth.</p>
<p>Selection of these individual components is rather difficult and annoying, and you often have to time your clicks appropriately to select the part of the Table View that you want. However, shift-right-clicking on the Table View means that you can select the appropriate item – be that the table column, the cell for a column or the Table View itself – by selecting the appropriate item from the popup menu.</p>
<h2>Smart Groups</h2>
<p>Smart Groups can be created in Interface Builder much like smart groups in applications such as the Finder or iTunes. These are listed in the Library window, along with the other object groupings.</p>
<p style="text-align: center;"><a href="http://perspx.com/wp-content/uploads/2010/01/smart-groups.png"><img class="aligncenter size-full wp-image-1027" title="smart groups_thumb" src="http://perspx.com/wp-content/uploads/2010/01/smart-groups_thumb.png" alt="" width="464" height="264" /></a></p>
<p>Smart Groups provide a means of filtering objects based on a predicate (or filter) based on such properties as object label, the most recently used objects, or the kind of class an object is. This last property can be especially useful. For example, if you want a Smart Group that lists all <code>NSView</code> objects or subclasses, you can set the predicate to:</p>
<pre>&lt;Is A Kind Of&gt; NSView</pre>
<p>And the group will contain all <code>NSView</code> classes or subclasses.</p>
<p>Smart Groups can be created by clicking on the actions button at the bottom of the Library window and selecting <em>New Smart Group</em>.</p>
<p style="text-align: center;"><a href="http://perspx.com/wp-content/uploads/2010/01/new_smart_group.jpg"><img class="aligncenter size-full wp-image-1038" title="IB: New Smart Group" src="http://perspx.com/wp-content/uploads/2010/01/new_smart_group.jpg" alt="" width="290" height="259" /></a></p>
<h2>Font Menu</h2>
<p>Another useful menu is the <em>Font</em> menu, which allows you to set the font and font attributes of items in your interface. This can be useful when setting fonts of controls or cells, such as changing the font size, weight or colour of a cell in an <code>NSTableView</code>, for example, which saves you having to do it with code.</p>
<p><a href="http://perspx.com/wp-content/uploads/2010/01/fontsmenu.jpg"><img class="aligncenter size-full wp-image-1030" title="IB Font Menu" src="http://perspx.com/wp-content/uploads/2010/01/fontsmenu.jpg" alt="" width="241" height="342" /></a></p>
<h2>Info Panel</h2>
<p>The Info panel provides useful information about the nib that you are currently editing and its contained objects. It allows you to specify a deployment and development target, and shows any errors that your interface may have when deploying to that target.</p>
<p style="text-align: center;"><a href="http://perspx.com/wp-content/uploads/2010/01/Info-panel.jpg"><img class="aligncenter size-full wp-image-1029" title="IB Info Panel" src="http://perspx.com/wp-content/uploads/2010/01/Info-panel.jpg" alt="" width="462" height="265" /></a></p>
<p>For example, placing an <code>NSCollectionView</code> instance in a window and selecting a deployment target of Mac OS X 10.4 will show an error that the <code>NSCollectionView</code> class is not supported on versions of OS X prior to 10.5.</p>
<p>The Info panel can also show useful information about layout, for example if a window lies partially hidden off the screen which means that it will be partially hidden from view when unarchived and displayed.</p>
]]></content:encoded>
			<wfw:commentRss>http://perspx.com/blog/archives/1003/useful-interface-builder-features/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Xcoding made easier</title>
		<link>http://perspx.com/blog/archives/206/xcoding-made-easier/</link>
		<comments>http://perspx.com/blog/archives/206/xcoding-made-easier/#comments</comments>
		<pubDate>Thu, 20 Aug 2009 11:56:31 +0000</pubDate>
		<dc:creator>Perspx</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Tools]]></category>
		<category><![CDATA[Cocoa]]></category>
		<category><![CDATA[objective-C]]></category>
		<category><![CDATA[Xcode]]></category>

		<guid isPermaLink="false">http://oneinfinitemonkey.wordpress.com/?p=206</guid>
		<description><![CDATA[After the popularity of my post on the useful features of Xcode, titled Xcoding Made Easy, I decided to write a followup post detailing more features about the IDE which help make developing applications a much easier process.
Project Breakpoints

Breakpoints are a great convenience method for debugging your code. However, if you have lots of breakpoints, how do you manage them  ... ]]></description>
			<content:encoded><![CDATA[<p>After the popularity of <a href="http://perspx.com/blog/archives/44/xcoding-made-easy/">my post on the useful features of Xcode</a>, titled <em>Xcoding Made Easy</em>, I decided to write a followup post detailing more features about the IDE which help make developing applications a much easier process.</p>
<h2>Project Breakpoints</h2>
<p><a href="http://perspx.com/wp-content/uploads/2009/08/breakpoints_groupsandfiles.jpg"><img class="alignleft size-full wp-image-811" title="Project breakpoints" src="http://perspx.com/wp-content/uploads/2009/08/breakpoints_groupsandfiles.jpg" alt="" width="204" height="204" /></a><br />
Breakpoints are a great convenience method for debugging your code. However, if you have lots of breakpoints, how do you manage them all easily?</p>
<p>When you add a breakpoint it appears in the <em>Breakpoints</em> folder in the <em>Groups &amp; Files</em> list under <em>Project Breakpoints</em>. From here, you can turn breakpoints on and off and remove them, and change the conditions or add/remove breakpoint actions easily (from the accompanying detail view shown above the Editor pane) without having to navigate to each breakpoint directly. This is a great convenience for batch methods, such as removing all breakpoints.</p>
<p>Groups of breakpoints can also be created, by right-clicking on any number of breakpoints and selecting <em>Group</em> from the context menu.</p>
<p><a href="http://perspx.com/wp-content/uploads/2009/08/breakpoints_list1.jpg"><img class="alignright size-full wp-image-812" title="Breakpoints list" src="http://perspx.com/wp-content/uploads/2009/08/breakpoints_list1.jpg" alt="" width="290" height="139" /></a></p>
<p>Breakpoints for a specific source file can also be easily shown using the breakpoints popup list button in the Editor window, which lists the breakpoints detailing the method they are set in, and the line number that they apply to. Clicking on a breakpoint in the list will navigate to the source file and highlight the row that that breakpoint is applied to.</p>
<h2>Class Navigation</h2>
<p><a href="http://perspx.com/wp-content/uploads/2009/08/class_navigation_location1.jpg"><img class="size-full wp-image-813 alignleft" title="Class Navigation" src="http://perspx.com/wp-content/uploads/2009/08/class_navigation_location1.jpg" alt="" width="204" height="138" /></a><br />
Class navigation is a convenience for exploring the class hierarchy for a given class. It presents itself as a popup menu in the Editor window, which lists the superclasses, the class itself and any categories present on the class. The class that the menu displays information about is flexible: if the text caret in the editor window is within a class interface (between <code>@interface</code> and <code>@end</code>) or a class implementation (between <code>@implementation</code> and <code>@end</code>), the class navigation popup menu will provide information about that class.</p>
<p><a href="http://perspx.com/wp-content/uploads/2009/08/class_navigation_popup.jpg"><img class="alignright size-full wp-image-814" title="Class navigation popup" src="http://perspx.com/wp-content/uploads/2009/08/class_navigation_popup.jpg" alt="" width="220" height="178" /></a></p>
<p>This is a useful tool, especially when subclassing an existing class. Since subclassing builds on the existing functionality and implementation of a class (or classes), it may often be necessary to access inherited instance variables or provide custom implementations for inherited methods. By simply clicking on the class name of a superclass in the class navigation menu, you are taken to the superclass interface, which details the instance variables and methods which you can extend in your subclass.</p>
<h2>Code Folding and Focus Follows Selection</h2>
<p>As any Objective-C programmer knows, it is not the most<em> </em>concise language in the world – it is far from it, and it is so with some reason. However, this can make the readability of your source files difficult, especially if you are working with a class that has lots of methods implemented.</p>
<p><a href="http://perspx.com/wp-content/uploads/2009/08/code_folding1.jpg"><img class="alignleft size-medium wp-image-815" title="Code folding" src="http://perspx.com/wp-content/uploads/2009/08/code_folding1-300x124.jpg" alt="" width="300" height="124" /></a></p>
<p><em>Code Folding</em> and <em>Focus Follows Selection</em> are two options from the <em>View</em> menu which help to increase the readability of code. Code Folding is a way of folding functions and other braced parts of code into stubs, which makes the code dramatically more easy to read, whilst still providing the first line of a function or code block to show what the folded code is a part of. It can be applied from the <em>View &gt; Code Folding</em> menu, with menu items to fold the code block that the text caret is currently placed in, unfold all items in the current source file, fold/unfold all methods and functions, and fold/unfold all comment blocks.</p>
<p><a href="http://perspx.com/wp-content/uploads/2009/08/focus_follows_selection1.jpg"><img class="alignright size-medium wp-image-816" title="Focus follows selection" src="http://perspx.com/wp-content/uploads/2009/08/focus_follows_selection1-300x161.jpg" alt="" width="300" height="161" /></a></p>
<p><em>Focus Follows Selection</em> is another feature used to help readability. When this is turned on, Xcode will highlight the block of code that the text caret is placed in (be it a method/function or other parenthesised block such as an <code>if</code> statement) and dim the rest of the editing area, making it easier to see in which block you are working. This can be very useful for nested loops or where there is nesting of braced pieces of code. It is presented as a checkable menu item in the <em>View &gt; Code Folding</em> menu</p>
<h2>Smart Groups</h2>
<p><a href="http://perspx.com/wp-content/uploads/2009/08/smart_groups1.jpg"><img class="alignleft size-medium wp-image-817" title="Smart groups" src="http://perspx.com/wp-content/uploads/2009/08/smart_groups1-266x300.jpg" alt="" width="266" height="300" /></a></p>
<p>Smart Groups are a way of organising your project files based on a filter. Selecting <em>Project &gt; New Smart Group</em> from the menu and then either <em>Simple Filter Smart Group</em> or <em>Simple Regular Expression Smart Group</em> allows you to create a Smart Group based on a wildcard expression (for example, <code>*.nib</code> would match all files ending in <code>.nib</code>) or a regular expression. You can also select where Xcode starts looking for files in the project folder hierarchy by changing the value in the &#8220;Start From:&#8221; dropdown box. You can then also select whether the group applies to all projects created in Xcode, or just the project that you are currently working on.</p>
<p>This is an easy way to keep your project(s) organised for you, which can reduce clutter across the <em>Groups &amp; Files</em> list. As with all folders in the hierarchy in the <em>Groups &amp; Files</em> list, it is purely virtual – that is, any items placed in Smart Groups will have no effect on their physical location on disk.</p>
<p>There are two Smart Groups that are present with Xcode by default &#8211; &#8220;Implementation Files&#8221; and &#8220;NIB Files&#8221;, which contain the project&#8217;s implementation and NIB files respectively.</p>
<h2>Splitting the Editor View</h2>
<p style="text-align: center;"><a href="http://perspx.com/wp-content/uploads/2009/08/editor_splitviews1.jpg"><img class="aligncenter size-large wp-image-818" title="Multiple editor views" src="http://perspx.com/wp-content/uploads/2009/08/editor_splitviews1-1024x650.jpg" alt="" width="393" height="250" /></a></p>
<p><a href="http://perspx.com/wp-content/uploads/2009/08/editor_splitview1.jpg"><img class="alignleft size-full wp-image-819" title="Add another editor view" src="http://perspx.com/wp-content/uploads/2009/08/editor_splitview1.jpg" alt="" width="241" height="146" /></a>Often it is useful to edit more than one source file at the same time, in the same editor window. This can be achieved easily by clicking on the Split Editor View button. This will add an extra editor view to the current window, resizing the other editor view(s) to fit. Then, when files are selected from the source list they will be loaded into the currently active editor view. There is an editor bar for each editor view (containing the history list, and method list etc) which is applicable to that view. There is also a resizing separator between the editing views to allow you to resize them.</p>
<p style="clear: both;"><a href="http://perspx.com/wp-content/uploads/2009/08/editor_closeview1.jpg"><img class="alignright size-full wp-image-820" title="Close editor view" src="http://perspx.com/wp-content/uploads/2009/08/editor_closeview1.jpg" alt="" width="196" height="152" /></a><br />
Editor views can then also be easily removed by clicking on the Close Editor view button on that pane, located under the split editor view button for that editor view. This will resize the other editor views accordingly.</p>
]]></content:encoded>
			<wfw:commentRss>http://perspx.com/blog/archives/206/xcoding-made-easier/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Xcoding made easy</title>
		<link>http://perspx.com/blog/archives/44/xcoding-made-easy/</link>
		<comments>http://perspx.com/blog/archives/44/xcoding-made-easy/#comments</comments>
		<pubDate>Thu, 25 Jun 2009 20:10:54 +0000</pubDate>
		<dc:creator>Perspx</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Tools]]></category>
		<category><![CDATA[Cocoa]]></category>
		<category><![CDATA[objective-C]]></category>
		<category><![CDATA[Xcode]]></category>

		<guid isPermaLink="false">http://oneinfinitemonkey.wordpress.com/?p=44</guid>
		<description><![CDATA[Xcode is Apple&#8217;s Integrated Development Environment for applications written for OS X or iPhone OS. With the increasing popularity for software written for both platforms, here are some useful features of Xcode that make coding using it a much smoother and easier process.
Keyboard Shortcuts
There are a plethora of keyboard shortcuts in Xcode to perform common tasks associated with various aspects  ... ]]></description>
			<content:encoded><![CDATA[<p>Xcode is Apple&#8217;s Integrated Development Environment for applications written for OS X or iPhone OS. With the increasing popularity for software written for both platforms, here are some useful features of Xcode that make coding using it a much smoother and easier process.</p>
<h2>Keyboard Shortcuts</h2>
<p>There are a plethora of keyboard shortcuts in Xcode to perform common tasks associated with various aspects of the development tool. Here is a handy chart of all the Xcode keyboard shortcuts available (note that <a href="http://www.1729.us/"></a>this chart was created by <a href="http://www.1729.us/" target="_blank">Colin Wheeler</a>):</p>
<p><a href="http://www.1729.us/xcode/Xcode%20Shortcuts.png"><img class="aligncenter size-full wp-image-779" title="Xcode Keyboard Shortcuts" src="http://perspx.com/wp-content/uploads/2009/06/xcode_keyboard_shortcuts1.jpg" alt="" width="200" height="207" /></a></p>
<h2>All-In-One View</h2>
<p><a href="http://perspx.com/wp-content/uploads/2009/06/xcode_allinone_view.png"><img class="size-medium wp-image-781 alignleft" title="All in one View" src="http://perspx.com/wp-content/uploads/2009/06/xcode_allinone_view-300x204.png" alt="" width="300" height="204" /></a></p>
<p>In the Xcode preferences, the default layout is, oddly enough, the <em>Default</em> layout. This is better set to <em>All-In-One</em>, since it adds extra panes to the main window, such as the <em>Page</em> toolbar item, which allows you to switch between the Project and Debug modes with one click, in the same main window. Also, a tabbed menu is added above the editor window, with tabs for <em>Detail</em>, <em>Project Find</em>, <em>SCM Results</em> and <em>Build</em>, which make it easier to access different windows within your project, keeping them within the same workspace. To change the layout to <em>All-In-One</em>, open up the Xcode preferences (⌘+,) and in the <em>General</em> preferences, change the <em>Layout</em> preference to <em>All-In-One</em>.</p>
<h2>The #pragma mark directive</h2>
<p>The <code>#pragma mark</code> directive is very useful in organising implementation files, especially those with a large number of methods. It can be placed anywhere in the source files, and is used as a way of grouping common methods. It takes the form:</p>
<p><code>#pragma mark &lt;Label&gt;</code></p>
<p>Where &lt;<code>Label&gt;</code> is the name you want to associate. For example:</p>
<p><code><br />
#pragma mark Drawing- (void)drawRect:(NSRect)rect {<br />
// Drawing code here.<br />
}//... other methods here, if necessary</p>
<p></code></p>
<p>and it allows you to group together methods in the Project Symbols list; with any method signature following the group name being listed underneath the group title you have assigned.</p>
<p><img class="aligncenter size-medium wp-image-782" title="Xcode function list" src="http://perspx.com/wp-content/uploads/2009/06/function_list-300x241.png" alt="" width="300" height="241" /></p>
<p>Clicking on any of the method names selects the method declaration in the file and scrolls down to that point; in this way it is easy to navigate around the implementation files, even if they contain a lot of code or methods.</p>
<h2>Finding APIs in the documentation</h2>
<p>When writing code in Xcode, it is not uncommon for you to need to take a look at the documentation for a particular symbol, be that method, class, or even data types, for example. You could do this by going to <em>Help &gt; Documentation</em> and then typing in the name of the symbol into the search field, and then hitting return.</p>
<p>However, there is an easier way. In your source file, double-click on the word that you want to look up in the docs, whilst holding down the <strong>⌥ (option)</strong><strong> key</strong>. This will then open up the documentation window, filling the search field in with the word that you want to look up.</p>
<h2>Finding declarations</h2>
<p>It may also be the case that you want to look up the declarations for symbols, as defined in the headers. For example, you may wish to find the interface for <code>NSObject</code> or the typedef for <code>NSUInteger</code>. Again, this is easily accomplished. In your source file, double-click on the symbol that you want to find the declaration for, whilst holding down the <strong>⌘ (command) key</strong>.</p>
<h2>Bookmarking Code</h2>
<p><a href="http://perspx.com/wp-content/uploads/2009/06/xcode_add_bookmark1.png" target="_blank"><img class="size-medium wp-image-783 alignleft" title="xcode_add_bookmark" src="http://perspx.com/wp-content/uploads/2009/06/xcode_add_bookmark1-300x164.png" alt="" width="300" height="164" /></a></p>
<p>Xcode allows you to add bookmarks to your project, not just of source files themselves, but even lines <em>within</em> the files. These bookmarks get added to the <em>Bookmarks</em> section in the <em>Groups &amp; Files</em> pane. To add a bookmark, place the text caret on the line which you want to bookmark, and select <em><strong>Edit &gt; Add to Bookmarks</strong></em> or (<strong>⌘+D</strong>); the name of the file the line originates from, and the line number will be displayed as the bookmark name, although this can be renamed by clicking on the bookmark name.</p>
<h2>Go to Counterpart</h2>
<p><a href="http://perspx.com/wp-content/uploads/2009/06/go_to_counterpart1.png"><img class="size-medium wp-image-784 alignleft" title="Go to counterpart" src="http://perspx.com/wp-content/uploads/2009/06/go_to_counterpart1-300x191.png" alt="" width="300" height="191" /></a></p>
<p>Classes are one of the major additions to the Objective-C superset of C, and are used frequently in. There exists class interface and implementation files for any class, and it is frequent to switch between both, such as when declaring a method in the interface, then implementing it in the implementation. There is a button which makes switching between the two easier, titled <strong>Go to Counterpart</strong>; clicking on it will change the editor window to the implementation for that class, if working within the class interface file, or the interface if working within the implementation file.</p>
<p>Whether the counterpart is opened in the same editor window or another editor window is determined in the Xcode <em>General</em> preferences, with the &#8220;Open counterparts in same editor&#8221; checkbox.</p>
<h2>Simple Housekeeping</h2>
<p><a href="http://perspx.com/wp-content/uploads/2009/06/organising_files1.png"><img class="alignright size-medium wp-image-785" title="Organising files" src="http://perspx.com/wp-content/uploads/2009/06/organising_files1-178x299.png" alt="" width="178" height="299" /></a>When dealing with Xcode projects, the number of files present can quickly mount up, whether that be source code, resources, NIBs or any other files that your project uses. When adding files to the project, Xcode doesn&#8217;t add them to any particular directory in the Groups &amp; Files list, so it is up to you to do this. Note that the directory structure in the <em>Groups &amp; Files</em> list is purely virtual &#8211; any movement of files within the hierarchy has no physical effect on disk. To add groups to the list, simply right click in the window and select <em><strong>Add &gt; New Group</strong></em>, and once added, groups can be dragged around like you would in a Finder window.<em> </em>Here is a summary of the various groups and files within the project subdirectory:</p>
<ol>
<li><strong>Classes:</strong> as it says on the tin, place class interface (.h) and implementation (.m) files in here. It may be useful to group class files based on their purpose, for example naming groups <em>Controllers</em> or <em>Models</em>, etc to make it easier to find the source files when you need them.</li>
<li><strong>Other sources</strong>: this group is for source files that do not declare classes; main.m is here by default. Since most source files deal with classes, there are usually not so many files in here, unless you are creating a non-AppKit based application, such as a Foundation Tool.</li>
<li><strong>Resources</strong>: where all the project resources are placed, be that NIBs, or images, for example, this is the place to keep it. It may be useful to group resources based on their function, especially NIBs since in larger projects the number of these can quickly mount up.</li>
<li><strong>Frameworks:</strong> this is where the frameworks that your project uses are. Xcode adds the <em>Cocoa</em>, <em>AppKit</em> and <em>Foundation</em> frameworks for you when a project is created, but if you need to link against others, this is the place to put them. If a lot of frameworks are being linked to, it would be best to create extra subdirectories to organise the linked frameworks. Frameworks can be added by right clicking in the <em>Groups &amp; Files</em> window and selecting <em>Add &gt; Existing Frameworks..</em></li>
<li><strong>Products:</strong> these are the products of building the target(s). Normally there is only one product, your .app application file, so extra organisation of this subdirectory is not usually particularly necessary.</li>
</ol>
<h2>Debugging</h2>
<p><a href="http://perspx.com/wp-content/uploads/2009/06/debug_preferences1.png"><img class="size-medium wp-image-786 alignright" title="Debug preferences" src="http://perspx.com/wp-content/uploads/2009/06/debug_preferences1-300x203.png" alt="" width="300" height="203" /></a></p>
<p>A lot of time is often spent debugging your application. The interface can be made more straightforward in the <em>Debugging</em> pane of the Xcode preferences. There is a popup menu labelled <em>On Start:</em> this is how the workspace will change when debugging of your application begins. Its default is <em>Do Nothing</em>, however selecting <em>Show Console</em>,<em> Show Debugger </em>or <em>Show Console and Debugger</em> are useful so that when you begin to debug your application the workspace can update itself accordingly to make debugging a more straightforward process.</p>
<h2>Start with Performance Tool..</h2>
<p><a href="http://perspx.com/wp-content/uploads/2009/06/start_performance_tool1.png"><img class="size-medium wp-image-787 alignleft" title="Start with performance tool" src="http://perspx.com/wp-content/uploads/2009/06/start_performance_tool1-300x224.png" alt="" width="300" height="224" /></a></p>
<p>The Xcode Tools do not encompass simply Xcode and Interface Builder; there are a few other other tools bundled with the package that are useful when testing projects, such as Instruments and Shark. Instead of having to build your application every time then manually loading it into the designated tool, it can be done from the <em>Run</em> menu. From <em>Run &gt; Start With Performance Tool</em>, you can load your application into Shark, MallocDebug or one of the Instruments templates, such as <em>Leaks</em>.</p>
]]></content:encoded>
			<wfw:commentRss>http://perspx.com/blog/archives/44/xcoding-made-easy/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>
